📄 all.asm
字号:
mov Hchar01,2
mov Icount,5
mov Ichar1,39
mov Ichar2,39
mov Hcount1,2
mov Hcount_cx,2
lea di,Istar2
mov dh,4
mov dl,2
call move_shape1
lea di,Istar3
mov dh,4
mov dl,76
call move_shape2
call Imust_2
dec Icount0
jne Iagain1
;---J--*****************************--J---
Jagain:
mov Icol,4
mov Icol01,4
mov Ichar0,2
mov Ichar01,2
mov Ichar02,2
mov Ichar1,39
mov Ichar2,39
mov Icount0,4
mov Icount1,2
mov Icount_cx,8
mov Jcool3,4
mov Icol0,4
lea di,Istar2
mov dh,4
mov dl,2
call move_shape1
lea di,Istar3
mov dh,4
mov dl,76
call move_shape2
call Jmust_21
dec Jcount
jne Jagain
;---K--*****************************--K---
mov Icount0,13
Kagain1:
mov Icol,2
mov Icol0,2
mov Icol01,2
mov Ichar0,2
mov Ichar01,2
mov Icount,5
mov Ichar1,76
mov Ichar2,2
mov Icount1,2
mov Icount_cx,2
lea di,Kstar2
mov dh,10
mov dl,40
call move_shape1
lea di,Kstar3
mov dh,10
mov dl,38
call move_shape2
call Kmust_2
dec Icount0
jne Kagain1
;---L--*****************************--L---
Lagain:
lea di,car
mov dh,3
mov dl,39
call move_shape1
lea di,jeep
mov dh,3
mov dl,41
call move_shape2
call Lmust_2
cmp Lchar1,40
jb Lagain
dec Lcount_cx
call dly_qrtr
call dly_qrtr
lea di,car
mov dh,3
mov dl,40
call move_shape1
lea di,jeep
mov dh,3
mov dl,40
call move_shape2
call Lerase
;---M--*****************************--M---
HONG7
mov Icount,2
mov cool,2000
Magain1:
lea di,Mcar
mov dh,10
mov dl,3
call move_shape1
call Mmust_2
lea di,Mstar
mov dh,10
mov dl,75
call move_shape1
call Mmust_21
lea di,Mstar1
mov dh,10
mov dl,65
call move_shape1
dec Icount
call Mmust_2
lea di,Mstar
mov dh,10
mov dl,3
call move_shape1
dec Icount
call Mmust_21
;---N--*****************************--N---
mov Lcount_cx,80
mov Ncount_cx1,5
mov Lchar1,2
Nagain: lea di,car
mov dh,3
mov dl,2
call Nmust_2
Nagain1: lea di,car
mov dh,3
mov dl,4
call Nmust_21
dec Lcount_cx
jne Nagain1
;---O--*****************************--O---
mov Lcount_cx,30
mov Ncount_cx1,3
mov Ocount_cx2,9
mov Lchar1,2
Oagain:
lea di,car
mov dh,3
mov dl,2
call Omust_1
Oagain1: lea di,car
mov dh,3
mov dl,4
call Omust_2
dec Lcount_cx
jne Oagain1
lea di,car
mov dh,3
mov dl,2
mov Lchar1,2
call Omust_21
;-------------------------------------
mov Lcount_cx,30
mov Ncount_cx1,3
mov Ocount_cx2,9
mov Lchar1,2
lea di,jeep
mov dh,3
mov dl,77
call Omust_1
Oagain2: lea di,jeep
mov dh,3
mov dl,75
call Omust_2
dec Lcount_cx
jne Oagain2
lea di,jeep
mov dh,3
mov dl,77
mov Lchar1,2
call Omust_21
;---P--*****************************--P---
mov Icol,1
mov Ichar0,2
mov Ichar1,7
mov Ichar2,74
mov Pchar3,4
mov Pchar4,16
mov Icount_cx,5
mov Ncount_cx1,5
mov Ocount_cx2,6
Pagain: lea di,car
mov dh,3
mov dl,2
call Pmust_2
lea di,jeep
mov dh,3
mov dl,73
call Pmust_2
lea di,Pstar
mov dh,4
mov dl,8
call Pmust_21
lea di,jeep
mov dh,3
mov dl,76
call Pmust_22
;---Q--*****************************--Q---
mov Lchar1,1
mov Lchar2,78
mov Icount,0
mov Lchar0,2
Qagain: mov Lcount_cx,38
lea di,car
mov dh,3
mov dl,1
call move_shape1
lea di,jeep
mov dh,3
mov dl,78
call move_shape2
cmp Lchar0,1
je Qexit11
call Qmust_2
call dly_qrtr
dec Lchar0
jmp Qagain
Qexit11: call Qerase1
pop cx
ret ;return to main program
main endp ;end of main part of program
;--<<<***************>>>CLEAR_SCREEN<<<**************>>>-- ;CLEAR_SCREEN程序部分实现清屏
clear_screen proc near
push ax
push bx
push cx
push dx
mov ah,6 ;scroll up function
mov al,0 ;code to blank screen
cmp count,1
je exit
mov ch,0 ;upper left row
mov cl,0 ;upper left column
mov dh,24 ;lower right row
mov dl,79 ;lower right column
mov bh,7
jmp exit1
exit: mov ch,4
mov cl,3
mov dh,16
mov dl,63
mov bh,7
exit1: int 10h
pop dx
pop cx
pop bx
pop ax
ret
clear_screen endp
;--<<<***************>>>MOVE_SHAPE<<<**************>>>--
move_shape proc near ;move_shape程序部分实现写方框功能
HONG
sub ch,ch
mov cl,[di]
inc di
HONG5
plot_nextR:
add dh,[di+2] ;update row pointer
add dl,[di+3] ;update column pointer
cmp Bcount0,3
je exit2R
cmp Bcount0,2
je exit9R
cmp Bcount0,1
je exit10R
cmp dl,78
jb mov_crsrR
jmp exit1R
exit2R: cmp dl,1
jnb mov_crsrR
jmp exit1R
exit9R: cmp dh,17
jb mov_crsrR
jmp exit1R
exit10R: cmp dh,3
ja mov_crsrR
exit1R: HONG1
ret
mov_crsrR:
mov ah,2
int 10h
mov al,[di] ;fetch char value
mov bl,[di+1] ;fetch char attribute
HONG6
loop plot_nextR
exit4R: dec Bcount
je exit3R
call dly_qrtr ;调用延迟子程序
jmp exit4R
exit3R: call Berase1 ;调用清除或改变光标位置的字符或其属性子程序
mov Bcount,5
jmp short plot_nextR
move_shape endp
;----------------------------------------
move_shape1 proc near ;move_shape1和move_shape2程序为存放光标的起始位置
HONG
cmp Scount,1
je Sexit20
sub ch,ch
mov cl,[di]
inc di
mov char_cnt1,cx
mov pointer1,di
mov line_on1,dh
mov col_on1,dl
mov char,cx
jmp Sexit21
Sexit20: mov point1,di
mov Hline1,dh
mov Hcol1,dl
Sexit21: HONG1
ret
move_shape1 endp
;-----------------------------------
move_shape2 proc near
HONG
sub ch,ch
mov cl,[di]
inc di
cmp Scount,1
je Sexit23
mov char_cnt2,cx
mov pointer2,di
mov line_on2,dh
mov col_on2,dl
mov char,cx
jmp Sexit22
Sexit23: mov point2,di
mov Hline2,dh
mov Hcol2,dl
Sexit22: HONG1
ret
move_shape2 endp
;--<<<****************>>>MUST_2<<<***************>>>-- ;MUST_2部分用于显示图形
Smust_2 proc near
HONG
Sexit4: sub cx,cx
HONG2
mov char,cx
jmp Splot_next
Sexit3: sub cx,cx
HONG3
mov char,cx
jmp Splot_next
Sexit5: call dly_qrtr
call dly_qrtr
call dly_qrtr
call dly_qrtr
call dly_qrtr
call Serase
mov Schar0,2
jmp Sexit4
Splot_next: add dh,[di+2]
add dl,[di+3]
cmp Scount,1
jne Sexit1
cmp dl,3
je Sexit2
jmp Sexit
Sexit1: cmp dl,39
je Sexit2
Sexit: mov ah,2
int 10h
mov al,[di]
mov bl,[di+1]
HONG6
loop Splot_next
cmp Schar0,1
je Sexit5
dec Schar0
jmp Sexit3
Sexit2: call Serase
HONG1
ret
Smust_2 endp
;---A_X--*******************************--A_X---
A_Xmust_2 proc near
push ax
push bx
push dx
mov ah,0fh
int 10h
mov A_Xcool0,1
A_Xplot_next:
mov dh,line_on1
mov dl,col_on1
mov ah,2
int 10h
mov al,40h
mov bl,0ch
push cx
mov cx,1
mov ah,09
int 10h
pop cx
call dly_qrtr
call dly_qrtr
call dly_qrtr
mov dl,A_Xcool0
cmp A_Xchar0,dl
je A_Xexit3
call A_Xerase
jmp A_Xplot_next
A_Xexit3: cmp col_on1,74
je A_Xexit1
cmp col_on1,38
jne A_Xexit7
add col_on1,2
mov A_Xcool0,1
mov line_on1,4
jmp A_Xplot_next
A_Xexit7: add col_on1,2
mov A_Xcool0,1
mov line_on1,4
cmp A_Xcount,1
je A_Xexit5
cmp A_Xchar0,5
je A_Xexit4
inc A_Xchar0
jmp A_Xplot_next
A_Xexit5: cmp A_Xchar0,1
je A_X
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -