main proc far
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ah,0
mov al,4
int 10h
mov ah,0bh
mov bh,0
mov bl,2
int 10h
mov ah,0bh
mov bh,01
mov bl,00
int 10h
call clear_screen ;调用清屏子程序
lea di,car
mov dh,10
mov dl,2
call move_shape
mov ah,8
int 21h
cmp al,'q'
jz exit
main endp
clear_screen proc near
push ax
push bx
push cx
push dx
mov ah,6
mov al,0
mov ch,0
mov cl,0
mov dh,120
mov dl,200
mov bh,7
int 10h
pop dx
pop cx
pop bx
pop ax
ret
clear_screen endp
move_shape proc near
push ax
push bx
push cx
push dx
push di
mov ah,0fh
int 10h
sub ch,ch
mov cl,[di]
inc di
mov char_cnt,cx
mov pointer,di
mov line_on,dh
mov col_on,dl
mov_crsr:
add dh,[di+2]
add dl,[di+3]
mov ah ,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov cx,1
mov ah,09
int 10h
pop cx
add di,4
loop mov_crsr
call dly_qrtr ;调用延时子程序
pop di
pop dx
pop cx
pop bx
pop ax
ret
move_shape endp
dly_qrtr proc near
push cx
push dx
mov dx,5000
d11:mov cx,25000
d12:loop d12
dec dx
jnz d11
pop dx
pop cx
ret
dly_qrtr endp
exit:mov ah,4ch
int 21h
code ends
end main