📄 2.asm
字号:
mov dl,[si] ;光标列号
mov bh,00h ;页号
mov ah,02h ;置光标位置功能号
int 10h
inc si
mov ah,09h ;功能号
mov al,[si];显示的字符
mov bh,0 ;显示页
inc si
mov bl,[si]
mov cx,01h;字符重复的字数
int 10h
inc si
jmp lpdf
exitdf:
ret
disflag endp
;.........................
inputdata proc
chushida qibujias,qibujia
chushida danjias,danjia
chushida chesus,chesu
daconver qibujia,qibujia2
daconver danjia,danjia2
ret
inputdata endp
;................................
jishi1 proc
mov ah,2ch
int 21h
mov time1,cx
mov time2,dx
ret
jishi1 endp
jishi2 proc
mov ah,2ch
int 21h
mov time3,cx
mov time4,dx
ret
jishi2 endp
;*****动画显示路中线****
diszhongxian1 proc
lea si,bufferzx1
call zhongxian;显示路中线1
ret
diszhongxian1 endp
diszhongxian2 proc
lea si,bufferzx2
call zhongxian;显示路中线2
ret
diszhongxian2 endp
;*****显示路中线****
zhongxian proc
push ds
lpzx:
mov dh,[si] ;光标行号
cmp dh,0ffh
jz exitzx ;为offh时退出
inc si
mov dl,[si] ;光标列号
mov bh,00h ;页号
mov ah,02h ;置光标位置功能号
int 10h ;置光标位置
inc si
mov ah,09h ;功能号
mov al,[si];显示的字符
mov bh,0 ;显示页
mov bl,colortxt
mov cx,01h;字符重复的字数
int 10h
inc si
jmp lpzx
exitzx:
pop ds
ret
zhongxian endp
;..............................
;******延时******
;以车速为依据,分段计算出延时时间
delay0 proc
mov ax,chesu3
cmp ax,1000
jbe nextde1
mov bx,4000
jmp nextde2
nextde1:
cmp ax,500
jbe nextde3
mov bx,12000
mov cx,8
mul cx
jmp nextde2
nextde3:
cmp ax,100
jbe nextde4
mov bx,9500
mov cx,3
mul cx
jmp nextde2
nextde4:
mov bx,60000
mov cx,40
mul cx
nextde2:
sub bx,ax
wait1:mov cx,3000h
delay1:loop delay1
dec bx
jnz wait1
ret
delay0 endp
;******即时显示起步价,单价,车速,总价,里程信息******
;向屏幕输出即刻的起步价,单价,车速,总价,里程信息
;di指向显示变量属性表
;
disdatas proc
push ds
lea di,disdataptr;di指向显示变量属性表
lea si,qibujia
call disdata
add di,3
lea si,danjia
call disdata
add di,3
lea si,chesu
call disdata
add di,3
lea si,zongjia
call disdata
add di,3
lea si,licheng
call disdata
add di,3
pop ds
ret
disdatas endp
;...................................
;*****显示单个数据变量信息****
disdata proc
mov dh,[di] ;光标行号
mov dl,[di+1] ;光标列号
;*****置光标位置****
lpdd:
inc dl ;光标后移一列
mov bh,00h ;页号
mov ah,02h ;置光标位置功能号
int 10h
;*****显示数据****
mov ah,09h ;功能号
mov al,[si] ;显示的字符
cmp al,'$'
jz exitdd
mov bh,0 ;显示页
mov bl,[di+2]
mov cx,01h ;字符重复的字数
int 10h
inc si
jmp lpdd
exitdd:
ret
disdata endp
;******显示字模串******
;di指向charptr字模起始横纵坐标,颜色数组
;si指向buffer?字模数据数组
;
dischars proc
push ds
lea di,charptr
lea si,buffer2 ;si,di初始化
call dischar ;显示字模
lea si,buffer3
lea di,charptr+6
call dischar
lea si,buffer4
lea di,charptr+12
call dischar
lea si,buffer5
lea di,charptr+18
call dischar
lea si,buffer4
lea di,charptr+24
call dischar
lea si,buffer6
lea di,charptr+30
call dischar
lea si,buffer7
lea di,charptr+36
call dischar
lea si,buffer8
lea di,charptr+42
call dischar
lea si,buffer4
lea di,charptr+48
call dischar
lea si,buffer9
lea di,charptr+54
call dischar
lea si,buffer10
lea di,charptr+60
call dischar
lea si,buffer1
lea di,charptr+66
call dischar
pop ds
ret
dischars endp
;******显示字模******
;si指向待显示字模起始位置
;x0,y0为该字模显示的起始横纵坐标,color为显示颜色
;x0,y0,color的信息放在di指向的单元中
;************
dischar proc
lpd:
mov ax,[di]
cmp ax,0ffffh
jz exitd
mov x0,ax ;起始横坐标
mov ax,[di+2]
mov y0,ax ;起始纵坐标
mov ax,[di+4]
mov color,al ;显示颜色
lpdc:
mov ax,[si]
cmp ax,0ffh
je exitdc
mov cx,ax
add cx,x0
inc si
inc si
mov dx,[si]
add dx,y0
mov bh,0
mov al,color
mov ah,0ch
int 10h
inc si
inc si
jmp lpdc
exitdc:
;add di,6
;jmp lpd
exitd:
ret
dischar endp
;******小车左移******
movecar proc
lea di,charptr2
lea si,buffer1;si,di初始化
mov ax,[di]
mov x0,ax ;起始横坐标
mov ax,[di+2]
mov y0,ax ;起始纵坐标
mov ax,[di+4]
mov color,al ;显示颜色
lpmc2:
lea si,buffer1;si,di初始化
lpmc:
mov ax,[si]
cmp ax,0ffh
je exitmc
mov cx,ax
add cx,x0
inc si
inc si
mov dx,[si]
add dx,y0
mov bh,0
mov al,3
mov ah,0ch
int 10h
inc si
inc si
jmp lpmc
exitmc:
;...................
call delay
lea si,buffer1 ;si,di初始化
lpmc3:
mov ax,[si]
cmp ax,0ffh
je exitmc2
mov cx,ax
add cx,x0
inc si
inc si
mov dx,[si]
add dx,y0
mov bh,0
mov al,0
mov ah,0ch
int 10h
inc si
inc si
jmp lpmc3
exitmc2:
;.......................
dec x0
jnz lpmc2
ret
movecar endp
;******画文本字符纵线******
txtlinel proc
push ds
lea si,linel
lptll:
mov dh,[si+1]
cmp dh,0ffh
jz exittll
mov colortxt,dh;颜色
mov dl,[si+2] ;光标列号,为不变值
mov dh,[si+3] ;光标起始行号
lptll0:
cmp dh,[si+4] ;光标终止行号
jae exittll0 ;一纵列显示完毕,转入下一列
mov bh,00h ;页号
mov ah,02h ;置光标位置功能号
int 10h
call distext
inc dh ;行值加1
jmp lptll0
exittll0:
add si,5
jmp lptll
exittll:
pop ds
ret
txtlinel endp
;******画文本字符横线******
txtliner proc
push ds
lea si,liner
lptlr:
mov dl,[si+1]
cmp dl,0ffh
jz exittlr
mov colortxt,dl;颜色
mov dh,[si+2] ;光标行号,为不变值
mov dl,[si+3];光标起始列号
lptl:cmp dl,[si+4];光标终止列号
jae exittl ;一行显示完毕,转入下一行
mov bh,00h ;页号
mov ah,02h ;置光标位置功能号
int 10h
call distext
inc dl ;列值加1
jmp lptl
exittl:
add si,5
jmp lptlr
exittlr:
pop ds
ret
txtliner endp
;******显示文本字符串******
;dh光标行号
;dl光标列号
;buffertxt1文本字符串相关内容
distexts proc
push ds
lea si,buffertxt1
lpdt:
mov dh,[si] ;光标行号
cmp dh,0ffh
jz exitdt ;为offh时退出
inc si
mov dl,[si] ;光标列号
mov bh,00h ;页号
mov ah,02h ;置光标位置功能号
int 10h ;置光标位置
inc si
call distext
inc si
jmp lpdt
exitdt:
pop ds
ret
distexts endp
;******显示文本字符******
;si指向显示的字符(ASCII码或单个字符)
;colortxt(db)为字符颜色
;........................
distext proc
mov ah,09h ;功能号
mov al,[si];显示的字符
mov bh,0 ;显示页
mov bl,colortxt
mov cx,01h;字符重复的字数
int 10h
ret
distext endp
;....................................
chushisc proc
call readdistype;读当前显示方式
call clearscreen;清屏
setdistype 04h ;设置显示方式分辨率为320*200
ret
chushisc endp
;*****清屏****
clearscreen proc
mov ax,0600h ;al=0初始化窗口
mov bh,07h ;卷入行属性
mov cx,00h ;左上角行/列号
mov dx,284fh;右上角行/列号
int 10h
ret
clearscreen endp
;*****读当前显示方式****
readdistype proc
mov ah,0fh
int 10h
mov distype,al
ret
readdistype endp
;....................................
CODES ENDS
END START
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -