📄 main.asm
字号:
;---------------------
;main model
;*********************
setcursor macro page,crow,ccol ;set cursor
mov ah,2
mov bh,page ;page No
mov dh,crow ;row
mov dl,ccol ;column
int 10h
endm
showmess macro mess ;print ASCII string
lea dx,mess ;String address
mov ah,09h
int 21h
endm
setwin macro color,uprow,upcol,dnrow,dncol ;set windows
mov ah,06h
mov al,0
mov bh,color ;windows color
mov ch,uprow ;row of left upper
mov cl,upcol ;column of left upper
mov dh,dnrow ;row of right lower
mov dl,dncol ;column of right lower
int 10h
endm
datainit macro b_col,b_rad,b_spd
setcursor 0,6d,73d
mov al,dataw
mov b_col,al
call printhex
setcursor 0,10d,73d
mov al,dataw+1
mov b_rad,al
call printhex
setcursor 0,14d,73d
mov al,dataw+2
mov b_spd,al
call printhex
endm
data_seg segment
mess0 db '****************************Wellcome to ball-plucking***************************'
db 'Make by Chen Yuqiu*Huang Lei*Hao Jibin*'
db 'Gao Jianguo*Ren Guoxing*Zhen Chengfang ',0ah,0dh
db '-------------------------------------------------------------------------------','$'
mess1 db 'set ball color(0~F) : ','$'
mess2 db 'set ball radius(1~F): ','$'
mess3 db 'set ball speed(1~9) : ','$'
mess4 db ' Opration instrustion: ','$'
opr1 db 'F1=draw in Keyboard F2=draw in Mouse ','$'
opr2 db 'Space=continue F3=redraw ESC= Exit ','$'
opr3 db 'Enter =Save point Esc= Finish ','$'
opr4 db 'Right mouse s key to Finish ','$'
data_seg ends
code_seg segment
main proc far
assume cs:code_seg
assume ds:data_seg
start:
push ds
mov ax,0
push ax
mov ax,data_seg
mov ds,ax
mov ah,0 ;640*480*16 color model
mov al,12h
int 10h
mov ah,0bh ;color model ID
mov bh,0
mov bl,1h
int 10h
setwin 1h,0,0,30d,80d ;clear screen
setwin 2h,0,0,3d,80d ;3*80 ;top window
setcursor 0,0,0 ;
showmess mess0 ;show head message
setwin 3h,4,0,25d,48d ;left window
setwin 8h,4,49d,25d,50d
setwin 3h,4,51d,25d,80h ;right window
setcursor 0,6,51d ;right window message
showmess mess1
setcursor 0,10d,51d
showmess mess2
setcursor 0,14d,51d
showmess mess3
setcursor 0,26d,0d
showmess mess4 ;end
call openfile
call readfile
datainit b_color,b_radius,b_speed
call closefile
call mouseint
call mouseshow
redraw0:
setwin 3h,4,0,25d,48d ;left window
setcursor 0,26d,30d ;bottom information
showmess opr1
choose:
call setdata
mov ah,0bh ;test keyboard input
int 21h
inc al
jnz choose ;no keyboard input
mov ah,0
int 16h
cmp ah,3bh
je preF1 ;F1 to draw in keyboard
cmp ah,3ch
je preF2 ;F2 to draw in mouse
jmp choose
preF1:
setcursor 0,26d,30d
showmess opr3
call drawpoly ;draw polygon useing keyboard
mov y,200d
mov x,200d
call drawball ;draw ball
jmp finish
preF2:
setcursor 0,26d,30d
showmess opr4
call mousedraw ;draw polygon useing mouse
mov ax,pointx+2
mov x,ax
mov ax,pointy+2
mov y,ax
call drawball ;draw ball
finish:
setcursor 0,26d,30d
showmess opr2
loopin0:
mov ah,0bh ;test keyboard input state
int 21h
inc al
jnz loopin0
mov ah,07h
int 21h
cmp al,1bh ; ESC to exit
je exitm
cmp al,20h ; Space to continue
je move
cmp al,3dh ;F3 jmpe to redraw
jne loopin0
jmp redraw0
move:
call moveball ; mov ball
jmp finish
exitm:
call openfile
call writefile ;save ball variable
call closefile
mov ah,00h ;80*25 text
mov al,02h
int 10h
ret
main endp
include keyboard.asm ;include file
include ball.asm
include file.asm
include mouse.asm
include dataset.asm
include move.asm
code_seg ends
end start
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -