主题:[讨论]请大家帮忙看看这个小车的动画程序
[size=4]请问大家这个程序里,那一段程序是控制这个小车如何运动的?
怎么样子把它改成斜着跑啊?
我实在是看不懂这个程序到底在说什么
请大家帮帮忙啊
谢谢[/size]
[size=4]
data segment
car db 7
db 52h,7,0,0
db 0b1h,7,0,1
db 0dbh,7,0,1
db 0dbh,7,0,1
db 4fh,7,0,1
db 4fh,7,0,-3
db 2,8,-2,1
char_cnt dw ?
pointer dw ?
line_on db ?
col_on db ?
data ends
code segment
assume cs:code,ds:data
main proc far
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ah,0
mov al,4
call clear_screen
lea di,car
mov dh,5
mov dl,5
mov cx,9
x1:call move_shape
add dh,5
loop x1
ret
main endp
clear_screen proc near
push ax
push bx
push cx
push dx
mov ah,9
mov al,0
mov ch,0
mov cl,0
mov dh,24
mov dl,79
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
plot_next:
add dh,[di+2]
add dl,[di+3]
cmp dl,80
jb mov_crsr
call erase
pop di
pop dx
pop cx
pop bx
pop ax
ret
mov_crsr:
mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov cx,1
mov ah,9
int 10h
pop cx
add di,4
loop plot_next
call dly_qrtr
call erase
jmp short plot_next
move_shape endp
erase proc near
mov cx,char_cnt
mov di,pointer
mov dh,line_on
mov dl,col_on
erase_next:
add dh,[di+2]
add dl,[di+3]
mov ah,2
int 10h
mov al,[di]
mov bl,0
push cx
mov cx,1
mov ah,9
int 10h
pop cx
add di,4
loop erase_next
mov cx,char_cnt
mov di,pointer
mov dh,line_on
inc col_on
mov dl,col_on
ret
erase endp
dly_qrtr proc near
push cx
push dx
mov dx,5000
d11:mov cx,22801
d12:loop d12
dec dx
jnz d11
pop dx
pop cx
ret
dly_qrtr endp
code ends
end main[/size]
怎么样子把它改成斜着跑啊?
我实在是看不懂这个程序到底在说什么
请大家帮帮忙啊
谢谢[/size]
[size=4]
data segment
car db 7
db 52h,7,0,0
db 0b1h,7,0,1
db 0dbh,7,0,1
db 0dbh,7,0,1
db 4fh,7,0,1
db 4fh,7,0,-3
db 2,8,-2,1
char_cnt dw ?
pointer dw ?
line_on db ?
col_on db ?
data ends
code segment
assume cs:code,ds:data
main proc far
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ah,0
mov al,4
call clear_screen
lea di,car
mov dh,5
mov dl,5
mov cx,9
x1:call move_shape
add dh,5
loop x1
ret
main endp
clear_screen proc near
push ax
push bx
push cx
push dx
mov ah,9
mov al,0
mov ch,0
mov cl,0
mov dh,24
mov dl,79
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
plot_next:
add dh,[di+2]
add dl,[di+3]
cmp dl,80
jb mov_crsr
call erase
pop di
pop dx
pop cx
pop bx
pop ax
ret
mov_crsr:
mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
push cx
mov cx,1
mov ah,9
int 10h
pop cx
add di,4
loop plot_next
call dly_qrtr
call erase
jmp short plot_next
move_shape endp
erase proc near
mov cx,char_cnt
mov di,pointer
mov dh,line_on
mov dl,col_on
erase_next:
add dh,[di+2]
add dl,[di+3]
mov ah,2
int 10h
mov al,[di]
mov bl,0
push cx
mov cx,1
mov ah,9
int 10h
pop cx
add di,4
loop erase_next
mov cx,char_cnt
mov di,pointer
mov dh,line_on
inc col_on
mov dl,col_on
ret
erase endp
dly_qrtr proc near
push cx
push dx
mov dx,5000
d11:mov cx,22801
d12:loop d12
dec dx
jnz d11
pop dx
pop cx
ret
dly_qrtr endp
code ends
end main[/size]