data segment
white dw 0000011111000000b
dw 0001111111110000b
dw 0011111111111000b
dw 0111111111111100b
dw 0111111111111100b
dw 1111111111111110b
dw 1111111111111110b
dw 1111111111111110b
dw 1111111111111110b
dw 1111111111111110b
dw 0111111111111100b
dw 0111111111111100b
dw 0011111111111000b
dw 0001111111110000b
dw 0000011111000000b
dw 0000000000000000b
eraser dw 0000000000000000b
bar dw 1111100000011111b
dw 1000000000000001b
dw 1000000000000001b
dw 1000000000000001b
dw 1000000000000001b
dw 0000000000000000b
dw 0000000000000000b
dw 0000000000000000b
dw 0000000000000000b
dw 0000000000000000b
dw 0000000000000000b
dw 1000000000000001b
dw 1000000000000001b
dw 1000000000000001b
dw 1000000000000001b
dw 1111100000011111b
isdea db 0
pan db 0
flag db 0
flag1 dw 00h
flag2 dw 00h
flag3 dw 00h
flag4 dw 00h
flag5 dw 00h
flag6 dw 00h
flag7 dw 00h
flag8 dw 00h
scan dw 0
blackcount dw 0
whitecount dw 0
gun dw 0
count dw 0
lastmousex dw 22
lastmousey dw 22
curmousex dw ?
curmousey dw ? ;用于计时的变量
tmp_es dw 0
tmp_bx dw 0
curuser db 0
playing db 0
b_sec1 db 0
b_sec2 db 0
b_min1 db 0
b_min2 db 0
w_sec1 db 0
w_sec2 db 0
w_min1 db 0
w_min2 db 0
count1 db 18
count2 db 18
msgtime db '00:00',"$"
daytime db '2009/12/24',"$"
message db 'ESC:BACK TO MAIN MENU',"$"
pausemsg db 'SPACE: PAUSE',"$"
newmsg db 'F1: NEW GAME',"$"
;主界面信息
string1 db 'WELCOME TO THIS GAME',"$"
string2 db 'PRESS ESC TO EXIT THE GAME',"$"
string3 db 'PRESS ENTER TO BEGIN THE GAME',"$"
x dw 0
y dw 0
enteronce dw 0
data ends
stack segment para stack
db 256 dup (?)
stack ends
pro_nam segment
assume cs:pro_nam,ss:stack,ds:data
main proc far
start:push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
;绘制主界面
mainmenu:
mov al,0
mov playing,al
mov ah,00h
mov al,13h
int 10h
call back
call bground1
call hori1
call vert1
mov ah,02h
mov dh,2
mov dl,05h
mov bh,0
int 10h
mov dx,offset string1
mov ah,09h
int 21h
mov ah,02h
mov dh,16
mov dl,05h
mov bh,0
int 10h
mov dx,offset string2
mov ah,09h
int 21h
mov ah,02h
mov dh,18
mov dl,05h
mov bh,0
int 10h
mov dx,offset string3
mov ah,09h
int 21h
xx:mov ah,0
int 16h
cmp ah,1ch
je enterr
cmp ah,01h
jne exit1
mov ah,00h
mov al,14
int 10h
mov ah,4ch
int 21h
exit1:jmp xx ;绘制游戏界面
enterr:
mov al,0
mov curuser,al
mov b_sec1,al
mov b_sec2,al
mov b_min1,al
mov b_min2,al
mov w_sec1,al
mov w_sec2,al
mov w_min1,al
mov w_min2,al
mov al,18
mov count1,al
mov count2,al
mov byte ptr playing,1
mov ah,00h
mov al,13h
int 10h
mov ah,05h
mov al,0
int 10h
call initialize
call back
call bground
call hori
call vert
call lbground ;绘制界面上的原始的棋子
;上边六个棋子
mov cx,63
mov dx,23
lea bx,white
call bcircle
mov cx,83
mov dx,23
lea bx,white
call bcircle
mov cx,103
mov dx,23
lea bx,white
call bcircle
mov cx,63
mov dx,43
lea bx,white
call bcircle
mov cx,83
mov dx,43
lea bx,white
call bcircle
mov cx,103
mov dx,43
lea bx,white
call bcircle
;中间20个棋子中间为空
;中间第一行
mov cx,23
mov dx,63
lea bx,white
call bcircle
mov cx,43
mov dx,63
lea bx,white
call bcircle
mov cx,63
mov dx,63
lea bx,white
call bcircle
mov cx,83
mov dx,63
lea bx,white
call bcircle
mov cx,103
mov dx,63
lea bx,white
call bcircle
mov cx,123
mov dx,63
lea bx,white
call bcircle
mov cx,143
mov dx,63
lea bx,white
call bcircle
;中间第二行
mov cx,23
mov dx,83
lea bx,white
call bcircle
mov cx,43
mov dx,83
lea bx,white
call bcircle
mov cx,63
mov dx,83
lea bx,white
call bcircle
mov cx,103
mov dx,83
lea bx,white
call bcircle
mov cx,123
mov dx,83
lea bx,white
call bcircle
mov cx,143
mov dx,83
lea bx,white
call bcircle
;中间第三行
mov cx,23
mov dx,103
lea bx,white
call bcircle
mov cx,43
mov dx,103
lea bx,white
call bcircle
mov cx,63
mov dx,103
lea bx,white
call bcircle
mov cx,83
mov dx,103
lea bx,white
call bcircle
mov cx,103
mov dx,103
lea bx,white
call bcircle
mov cx,123
mov dx,103
lea bx,white
call bcircle
mov cx,143
mov dx,103
lea bx,white
call bcircle
;下边六个棋子
mov cx,63
mov dx,123
lea bx,white
call bcircle
mov cx,83
mov dx,123
lea bx,white
call bcircle
mov cx,103
mov dx,123
lea bx,white
call bcircle
mov cx,63
mov dx,143
lea bx,white
call bcircle
mov cx,83
mov dx,143
lea bx,white
call bcircle
mov cx,103
mov dx,143
lea bx,white
call bcircle
;输出时间信息
MOV AH,02H
MOV DH,2;坐标y
MOV DL,25;坐标x
MOV BH,0
INT 10H;02h设置光标位置
LEA dx,daytime
call printmessage
MOV AH,02H
MOV DH,23;坐标y
MOV DL,2;坐标x
MOV BH,0
INT 10H
LEA dx,MESSAGE
call printmessage
;输出暂停信息
MOV AH,02H
MOV DH,17
MOV DL,25
MOV BH,0
INT 10H
LEA dx,pausemsg
call printmessage
;输出新游戏信息
MOV AH,02H
MOV DH,19
MOV DL,25
MOV BH,0
INT 10H
LEA dx,newmsg
call printmessage
CALL INIT_COUNTING;计时器
call poin
mov ah,0
mov al,3
int 10h
main endp
;计时程序段
init_counting PROC
push es
MOV AL,1CH
MOV AH,35H
INT 21H
sti
PUSH DS
mov tmp_es,ES
mov tmp_bx,BX
MOV DX,OFFSET COUNTING
MOV AX,SEG COUNTING
MOV DS,AX
MOV AL,1CH
MOV AH,25H
INT 21H
POP DS
in al,21h
and al,11111110b
out 21h,al
pop es
ret
init_counting ENDP
;用于计时的程序段
COUNTING PROC
PUSH DS
PUSH AX
PUSH CX
PUSH DX
MOV AX,DATA
MOV DS,AX
cmp playing,0
je l1
cmp curuser,0
je blackside
DEC COUNT1
JNZ l1
MOV COUNT1,18
inc w_sec1
cmp w_sec1,10
jnz showtime
mov w_sec1,0
inc w_sec2
cmp w_sec2,6
jnz showtime
mov w_sec2,0
inc w_min1
cmp w_min1,10
jnz showtime
mov w_min1,0
inc w_min2
showtime:
mov al,w_min2
add al,'0'
mov msgtime,al
mov al,w_min1
add al,'0'
mov msgtime+1,al
mov al,w_sec2
add al,'0'
mov msgtime+3,al
mov al,w_sec1
add al,'0'
mov msgtime+4,al
MOV AH,02H
MOV DH,14
MOV DL,26
MOV BH,0
INT 10H
LEA dx,msgtime
call printmessage
l1:jmp EXIT_NOW
blackside:
DEC COUNT2
JNZ EXIT_NOW
MOV COUNT2,18
inc b_sec1
cmp b_sec1,10
jnz showtime2
mov b_sec1,0
inc b_sec2
cmp b_sec2,6
jnz showtime2
mov b_sec2,0
inc b_min1
cmp b_min1,10
jnz showtime2
mov b_min1,0
inc b_min2
showtime2:
mov al,b_min2
add al,'0'
mov msgtime,al
mov al,b_min1
add al,'0'
mov msgtime+1,al
mov al,b_sec2
add al,'0'
mov msgtime+3,al
mov al,b_sec1
add al,'0'
mov msgtime+4,al
MOV AH,02H
MOV DH,8
MOV DL,26
MOV BH,0
INT 10H
LEA dx,msgtime
call printmessage
EXIT_NOW: POP DX
POP CX
POP AX
POP DS
IRET
COUNTING ENDP
;输出程序
printmessage proc
mov ah,09h
int 21h
ret
printmessage endp
bground1 proc near ; 画棋盘色
mov dx,30
hline11:
mov cx,60
hdot11:
mov al,14
mov ah,0ch
int 10h
inc cx
cmp cx,140
jl hdot11
add dx,1
cmp dx,110
jl hline11
ret
bground1 endp
hori1 proc near ;画网阁
mov dx,30
hline2:
mov cx,60
hdot2:
mov al,0
mov ah,0ch
int 10h
inc cx
cmp cx,141
jl hdot2
add dx,10
cmp dx,111
jl hline2
ret
hori1 endp
vert1 proc near
mov cx,60
vline2:
mov dx,30
vdot2:
mov al,0
mov ah,0ch
int 10h
inc dx
cmp dx,111
jl vdot2
add cx,10
cmp cx,141
jl vline2
ret
vert1 endp
back proc near ;背景色
mov dx,0
hlinet1:
mov cx,0
hdott1:
mov al,8
mov ah,0ch
int 10h
inc cx
cmp cx,320
jl hdott1
add dx,1
cmp dx,200
jl hlinet1
ret
back endp
bground proc near ; 画棋盘色
mov dx,00
hline1:
mov cx,00
;mount d d:\tasm
hdot1:
mov al,14
mov ah,0ch
int 10h
inc cx
cmp cx,340
jl hdot1
add dx,1
cmp dx,200
jl hline1
ret
bground endp
lbground proc near ;画计分牌
mov dx,30
hlie1:
mov cx,200
hdt1:
mov al,14
mov ah,0ch
int 10h
inc cx
cmp cx,260
jl hdt1
add dx,1
cmp dx,110
jl hlie1
;加分割线
mov dx,60
hlie11:
mov cx,200
hdt11:
mov al,7
mov ah,0ch
int 10h
inc cx
cmp cx,260
jl hdt11
add dx,1
cmp dx,80
jl hlie11
ret
lbground endp
hori proc near ;画网阁
mov dx,20
hlinea:
mov cx,60
hdota:
mov al,0
mov ah,0ch
int 10h
inc cx
cmp cx,121
jl hdota
add dx,20
cmp dx,61
jl hlinea
mov dx,60
hlineb:
mov cx,20
hdotb:
mov al,0
mov ah,0ch
int 10h
inc cx
cmp cx,161
jl hdotb
add dx,20
cmp dx,121
jl hlineb
mov dx,120
hlinec:
mov cx,60
hdotc:
mov al,0
mov ah,0ch
int 10h
inc cx
cmp cx,121
jl hdotc
add dx,20
cmp dx,161
jl hlinec
ret
hori endp
vert proc near
mov cx,20
vlinea:
mov dx,60
vdota:
mov al,0
mov ah,0ch
int 10h
inc dx
cmp dx,121
jl vdota
add cx,20
cmp cx,61
jl vlinea
mov cx,60
vlineb:
mov dx,20
vdotb:
mov al,0
mov ah,0ch
int 10h
inc dx
cmp dx,161
jl vdotb
add cx,20
cmp cx,121
jl vlineb
mov cx,120
vlinec:
mov dx,60
vdotc:
mov al,0
mov ah,0ch
int 10h
inc dx
cmp dx,121
jl vdotc
add cx,20
cmp cx,161
jl vlinec
ret
vert endp
poin proc near
push bx
push si
push di
mov si,22
mov di,22
input:
mov ah,01h
int 16h;入口参数: AH =01H——检查普通键盘
;ZF=1——无字符输入,否则,AH=键盘的扫描码,AL=ASCII码。
jz mm
mov ah,0
int 16h ;键盘输入
cmp ah,50h
jz downa
cmp ah,4bh
jz left
cmp ah,4dh
jz righta
cmp ah,48h
jz up
cmp ah,1ch
jz entera
cmp ah,01h
jz goback ;回到主页面
cmp ah,39h
jz pause
cmp ah,3bh
jz new ;新游戏
jmp input
mm: jmp nokey
goback: jmp mainmenu
pause: jmp pause1
new: jmp enterr
righta: jmp righta1
up:mov cx,si
mov dx,di
cmp dx,22
jz up1
lea bx,bar
mov isdea,1
call sign1
sub di,20
mov dx,di
lea bx,bar
mov isdea,1
call sign
jmp input
entera:
jmp entera1
up1:
lea bx,bar
mov isdea,1
call sign1
mov di,162
mov dx,di
lea bx,bar
mov isdea,1
call sign
jmp input
downa:
jmp downa1
left:
mov cx,si
mov dx,di
cmp cx,22
jz left1
lea bx,bar
mov isdea,1
call sign1
sub si,20
mov cx,si
mov dx,di
lea bx,bar
mov isdea,1
call sign
jmp input
left1:
lea bx,bar
mov isdea,1
call sign1
mov si,162
mov cx,si
mov dx,di
lea bx,bar
mov isdea,1
call sign
downa1:
mov cx,si
mov dx,di
cmp dx,162
jz down1
lea bx,bar
mov isdea,1
call sign1
add di,20
mov dx,di
lea bx,bar
mov isdea,1
call sign
jmp input
down1:
lea bx,bar
mov isdea,1
call sign1
mov di,22
mov dx,di
lea bx,bar
mov isdea,1
call sign
jmp input
righta1:
mov cx,si
mov dx,di
cmp cx,162
jz right1
lea bx,bar
mov isdea,1
call sign1
add si,20
mov cx,si
mov dx,di
lea bx,bar
mov isdea,1
call sign
inputa:jmp input
right1:
lea bx,bar
mov isdea,1
call sign1
mov si,22
mov cx,si
mov dx,di
lea bx,bar
mov isdea,1
call sign
entera1:
mov bp,0
mov bx,0
mov bx,enteronce
cmp bx,1
jne first
;第二次按下enter键
mov enteronce,0
mov cx,x ;第一次enter的坐标
mov dx,y
mov x,0
mov y,0
cmp si,cx
jl lef;第二个enter在第一个的左边
cmp si,cx
je upordown
;右边
call white1
jmp input
lef: call white2
jmp inputa
upordown:
cmp di,dx
jl dow;下面
;上边
call white3
jmp input
dow: call white4
a: jmp input
first:
mov bp,0
mov bx,0
add si,10;坐标放到格子中央
add di,10 ;判断要下处是否有棋子,判断中心。
mov cx,si
mov dx,di
mov ah,0dh ;读取颜色
int 10h
sub si,10
sub di,10;恢复坐标
sub cx,10
sub dx,10
cmp al,14
je a;此处无棋子,返回input
;有棋子时
mov x,si
mov y,di
mov enteronce,1
jmp inputa
call count3
;试验程序
mov cx,220
mov dx,90
lea bx,white
call bcirclex
mov cx,220
mov dx,42
lea bx,white
call bcircle
mov curuser,0
jmp inputa
back1: or flag,01h
jmp inputa
next1:
add si,10
add di,10
mov cx,si
mov dx,di
mov ah,0dh ;;;如果放棋子位置不对则从新放
int 10h
sub si,10
sub di,10
cmp al,14
je back2
call count3 ;;如果放上棋子就统计棋子个数
;试验品
mov cx,220
mov dx,42
lea bx,white
call bcirclex
mov cx,220
mov dx,90
lea bx,white
call wcircle
mov curuser,1
jmp input
back2: and flag,00h
jmp input
pause1:mov playing,0
no_space:
mov ah,10h ; yes: remove from buffer
int 16h
cmp ah,39h ; was it the space key?
jne no_space
mov playing,1
jmp input
;添加鼠标
noKey: ;listen to the mouse
mov ax,3
int 33h
mov ax,cx
sub ax,22
mov cx,dx
sub cx,22
mov dx,0
mov bx,20
div bx
mov curmousex,ax
mov ax,cx
mov dx,0
mov bx,20
div bx
mov curmousey,ax
mov cx,curmousex
mov dx,ax
cmp cx,lastmousex
jne newposition
cmp dx,lastmousey
jne newposition
jmp next
newposition:
mov dx,0
mov ax,lastmousex
mov bx,20
mul bx
add ax,22
mov cx,ax
mov dx,0
mov ax,lastmousey
mov bx,20
mul bx
add ax,22
mov dx,ax
lea bx,bar
mov isdea,1
call sign1
mov dx,0
mov ax,curmousex
mov bx,20
mul bx
add ax,22
mov cx,ax
mov dx,0
mov ax,curmousey
mov bx,20
mul bx
add ax,22
mov dx,ax
lea bx,bar
mov isdea,1
call sign
mov ax,curmousex
mov lastmousex,ax
mov ax,curmousey
mov lastmousey,ax
next:
jmp input
pop di
pop si
pop bx
ret
poin endp
;画白棋子
wcircle proc near
push ax
push di
push si
mov di,dx
mov si,cx
add di,16
add si,16
leb1:
mov bp,[bx]
leb2:
rol bp,1
mov ax,bp
and al,00000001b
add al,14
and al,00001111b
mov ah,0ch
int 10h
inc cx
cmp cx,si
jnz leb2
sub cx,16
inc dx
add bx,2
cmp dx,di
jnz leb1
sub si,16
sub di,16
sub dx,16
pop si
pop di
pop ax
ret
wcircle endp
bcircle proc near ;画黑棋子
push ax
push di
push si
mov di,dx
mov si,cx
add di,16
add si,16
leb3:
mov bp,[bx]
leb4:
rol bp,1
mov ax,bp
and al,00000001b
add al,14
cmp al,14
jle @1
mov al,1100b ;黑色
@1:;--------背景色
mov ah,0ch
int 10h
inc cx
cmp cx,si
jnz leb4
sub cx,16
inc dx
add bx,2
cmp dx,di
jnz leb3
sub dx,16
pop si
pop di
pop ax
ret
bcircle endp
bcirclex proc near ;画黑棋子
push ax
push di
push si
mov di,dx
mov si,cx
add di,16
add si,16
leb3x:
mov bp,[bx]
leb4x:
rol bp,1
mov ax,bp
and al,00000001b
add al,14
cmp al,14
je @1x
mov al,14
@1x:
mov ah,0ch
int 10h
inc cx
cmp cx,si
jnz leb4x
sub cx,16
inc dx
add bx,2
cmp dx,di
jnz leb3x
sub dx,16
pop si
pop di
pop ax
ret
bcirclex endp
sign proc near ;isdea ; 画光标
push ax
push di
push si
mov di,dx
mov si,cx
add di,16
add si,16
le3:
mov bp,[bx]
le4:
rol bp,1
mov ax,bp
and al,00000001b
mov ah,al
add al,14
cmp al,14
jle @2
mov al,5
@2:
not ah
and ah,isdea
cmp ah,1
je @3
mov ah,0ch
int 10h
@3:
inc cx
cmp cx,si
jnz le4
sub cx,16
inc dx
add bx,2
cmp dx,di
jnz le3
pop si
pop di
pop ax
ret
sign endp
sign1 proc near ;isdea 隐藏光标
push ax
push di
push si
mov di,dx
mov si,cx
add di,16
add si,16
lee3:
mov bp,[bx]
lee4:
rol bp,1
mov ax,bp
and al,00000001b
mov ah,al
add al,14
cmp al,14
jle @5
mov al,14
@5:
not ah
and ah,isdea
cmp ah,1
je @4
mov ah,0ch
int 10h
@4:
inc cx
cmp cx,si
jnz lee4
sub cx,16
inc dx
add bx,2
cmp dx,di
jnz lee3
pop si
pop di
pop ax
ret
sign1 endp
white1 proc near ;判断右侧,并操作
push scan
push si
push di
push cx
push dx
right21:
add cx,30
add dx,10
mov ah,0dh
int 10h
cmp al,14
je exitr
add cx,20
mov ah,0dh
int 10h
cmp al,14
jne exitr
;右边可以操作
mov enteronce,0
pop dx
pop cx
call erase;cx是 第一次enter的x坐标
add cx,20
call erase
mov cx,si
mov dx,di
lea bx,white
call bcircle
push cx
push dx
jmp bug11
exitr:;右边无法操作
mov enteronce,1
bug11: pop dx
pop cx
pop di
pop si
pop scan
ret
white1 endp
white2 proc near ;判断左侧 右侧放白
push scan
push si
push di
push cx
push dx
right31:
sub cx,10
add dx,10
mov ah,0dh
int 10h
cmp al,14
je exitl
sub cx,20
mov ah,0dh
int 10h
cmp al,14
jne exitl
mov enteronce,0
pop dx
pop cx
call erase ;cx是 第一次enter的x坐标
sub cx,20
call erase
mov cx,si
mov dx,di
lea bx,white
call bcircle;给第二次enter的位置画棋子
push cx
push dx
jmp bug21
exitl:;左边无法操作
mov enteronce,1
bug21: pop dx
pop cx
pop di
pop si
pop scan
ret
white2 endp
white3 proc near ;判断上侧
push scan
push si
push di
push cx
push dx
right41:
sub dx,10
add cx,10
mov ah,0dh
int 10h
cmp al,14
je exitu
sub dx,20
mov ah,0dh
int 10h
cmp al,14
jne exitu
mov enteronce,0
pop dx
pop cx
call erase ;cx是 第一次enter的x坐标
sub dx,20
call erase
mov cx,si
mov dx,di
lea bx,white
call bcircle;给第二次enter的位置画棋子
push cx
push dx
jmp bug31
exitu:mov enteronce,1
bug31: pop dx
pop cx
pop di
pop si
pop scan
ret
white3 endp
white4 proc near ;判断下侧 上放白
push scan
push si
push di
push cx
push dx
right51:
add dx,30
add cx,10
mov ah,0dh
int 10h
cmp al,14
je exitd
add cx,20
mov ah,0dh
int 10h
cmp al,14
jne exitd
mov enteronce,0
pop dx
pop cx
call erase ;cx是 第一次enter的x坐标
add dx,20
call erase
mov cx,si
mov dx,di
lea bx,white
call bcircle;给第二次enter的位置画棋子
push cx
push dx
jmp bug41
exitd:mov enteronce,1
bug41: pop dx
pop cx
pop di
pop si
pop scan
ret
white4 endp
erase proc near ;清除棋子
push ax
push di
push si
push cx
push dx
mov di,dx
mov si,cx
add di,16
add si,16
er1:
mov bp,eraser
er2:
rol bp,1
mov ax,bp
and al,00000001b
add al,14
cmp al,14
je er3
mov al,14
er3:
mov ah,0ch
int 10h
inc cx
cmp cx,si
jnz er2
sub cx,16
inc dx
cmp dx,di
jnz er1
sub dx,16
pop dx
pop cx
pop si
pop di
pop ax
ret
erase endp
count3 proc near ;统计黑白棋子个数,判断胜负
push gun
push ax
push si
push di
push cx
push dx
push blackcount
push whitecount
mov di,12
repat3:mov si,12
add di,20
repat1:add si,20
mov cx,si
mov dx,di
mov ah,0dh
int 10h
cmp al,0
je just1
cmp al,15
je just2
inc gun
cmp gun,64
je result
cmp si,172
je repat3
jmp repat1
just1:inc blackcount
inc gun
cmp si,172
je repat3
jmp repat1
just2: inc whitecount
inc gun
cmp si,172
je repat3
jmp repat1
result:
mov ax,blackcount
add ax,whitecount
mov count,ax
cmp count,64
je showresult1
jmp showresult2
showresult1:
mov ah,02h
mov dh,0
mov dl,26
mov bh,0
int 10h
mov ax,blackcount
call xianshi
mov ax,whitecount
call xianshi
showresult2:
mov ah,02h
mov dh,6
mov dl,30
mov bh,0
int 10h
mov ax,blackcount
call xianshi
mov ah,02h
mov dh,12
mov dl,30
mov bh,0
int 10h
mov ax,whitecount
call xianshi
finish:pop whitecount
pop blackcount
pop dx
pop cx
pop di
pop si
pop ax
pop gun
ret
count3 endp
xianshi proc near ;显示黑白棋子各有多少个
push ax
push bx
push dx
mov dl,10
div dl
mov dl,al
mov bl,ah
add dl,30h
mov ah,02h
int 21h
mov ah,02h
mov dl,bl
add dl,30h
int 21h
pop dx
pop bx
pop ax
ret
xianshi endp
initialize PROC
push ax
push cx
push dx
mov ax,0
int 33h
mov ax,7 ;set the x range of mouse
mov cx,22
mov dx,162
int 33h
mov ax,8 ;set the y range of mouse
mov cx,22
mov dx,162
int 33h
mov ax,4 ;set the position of the mouse
mov cx,22
mov dx,22
int 33h
mov lastmousex,0
mov lastmousey,0
pop dx
pop cx
pop ax
ret
initialize ENDP
pro_nam ends
end start