首页
社区
课程
招聘
[原创]16位汇编写的五子棋
发表于: 2016-7-30 09:30 11959

[原创]16位汇编写的五子棋

2016-7-30 09:30
11959

data segment
SG DB 'http://bbs.bccn.net/'
SG3 DB 'Do you want to play again?(Yes/No)'
sg1 db 0dbh,0dbh
sg2 db 0dbh
row db 15
col db 40
circle DB 00H,00H,07H,0C0H,1FH,0F0H,3FH,0F8H,3FH,0F8H,7FH,0FCH,7FH,0FCH,7FH,0FCH
        DB 7FH,0FCH,7FH,0FCH,3FH,0F8H,3FH,0F8H,1FH,0F8H,07H,0C0H,00H,00H,00H,00H
flag db 1
status db 1
victory db 0
num db 1
form db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
      db 40 dup (0)
data ends
;

code segment
assume cs:code,ds:data,es:data
start:
push ds
sub ax,ax
push ax
mov ax,data
mov ds,ax
mov ax,data
mov es,ax

fflag:
mov num,1
mov row,15
mov col,40
mov status,1
mov victory,0
mov num,1

mov si,offset form
mov cx,488h
again:
mov byte ptr [si],0
inc si
loop again

MOV AH,00H
MOV AL,12H
INT 10H
MOV AH,0BH
MOV BH,01
MOV BL,00H
INT 10H

mov        dh,0
mov        dl,0
mov        ah,2
mov        bh,0
int        10h
mov cx,29
flag1:
push cx
mov cx,80
flag2:
push cx
mov        ah,9
mov        al,0dbh
mov        bh,0h
mov        bl,00111001B
mov        cx,1
int        10h
inc dl
mov        ah,2
mov        bh,0
int        10h
pop cx
loop flag2
inc dh
mov dl,0
pop cx
loop flag1

mov bp,offset sg1
mov cx,1
mov dx,0f28h
mov bh,0h
mov al,0h
mov bl,00000000b
mov ah,13h
int 10h

mov bp,offset sg1
mov cx,1
mov dx,0f29h
mov bh,0h
mov al,0h
mov bl,00000000b
mov ah,13h
int 10h

MOV BP,OFFSET SG
MOV     CX,20
MOV     DX,1D3BH
MOV BH,0H
MOV AL,0H
MOV BL,00111010B
MOV AH,13H
INT 10H

keyboard:
MOV  AH,0
INT  16H
PUSH AX
MOV  AH,1
INT  16H
JZ keyboard2
  POP AX
JMP keyboard
EXIT1:
JMP EXIT
keyboard2:
  POP AX
  CMP  AL,1BH
  jz exit1
  CMP al,'a'
  jz left
  CMP al,'s'
  jz down
  CMP al,'d'
  jz right
  CMP al,'w'
  jz up
  cmp al,' '
  jz  blank
   
  jmp keyboard
up:
call up1
jmp keyboard

down:
call down1
jmp keyboard

left:
call left1
jmp keyboard
right:
call right1
jmp keyboard
blank:
mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz bno1
jmp keyboard

bno1:
cmp byte ptr [si],2
jnz bdrawcircle1
jmp keyboard

bdrawcircle1:
mov si,offset circle

cmp flag,1
jz bflag1
cmp flag,2
jz bflag2

bflag1:
call show2
call judgeperfect
cmp victory,1
jz flag3

mov flag,2

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax

mov byte ptr [si],1
jmp keyboard

fflag1:
jmp fflag

bflag2:
call show2
call judgeperfect
cmp victory,1
jz flag3

mov flag,1

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax

mov byte ptr [si],2
jmp keyboard

FLAG3:
MOV  AH,0
INT  16H
CMP  AL,1BH
JZ  EXIT
JMP FLAG3

EXIT:
mov ax,0003h
int 10h

MOV BP,OFFSET SG3
MOV     CX,34
MOV     DX,0H
MOV BH,0H
MOV AL,0H
MOV BL,00001111B
MOV AH,13H
INT 10H

MOV  AH,0
INT  16H
cmp al,'y'
jz fflag1
cmp al,'Y'
jz fflag1

MOV AX,4C00H
INT 21H

up1 proc near
mov bp,offset sg1
mov cx,2
mov dh,row
mov dl,col
mov bh,0h
mov al,0h
mov bl,00111001b
mov ah,13h
int 10h

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz uno1
mov status,1
jmp ucircle1
uno1:
cmp byte ptr [si],2
jnz uflag1
mov status,2

ucircle1:
mov si,offset circle
call show

uflag1:
cmp row,0
jz up11
dec row       

up11:
mov bp,offset sg1
mov cx,2
mov dh,row
mov dl,col
mov bh,0h
mov al,0h
mov bl,00000000b
mov ah,13h
int 10h

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz uno12
mov status,1
jmp ucircle2
uno12:
cmp byte ptr [si],2
jnz uexit
mov status,2

ucircle2:
mov si,offset circle
call show1

uexit:
RET
up1 endp

down1 proc near
mov bp,offset sg1
mov cx,2
mov dh,row
mov dl,col
mov bh,0h
mov al,0h
mov bl,00111001b
mov ah,13h
int 10h

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz dno1
mov status,1
jmp dcircle1

dno1:
cmp byte ptr[si],2
jnz dflag1
mov status,2

dcircle1:
mov si,offset circle
call show

dflag1:
cmp row,28
jz down11
inc row

down11:       
mov bp,offset sg1
mov cx,2
mov dh,row
mov dl,col
mov bh,0h
mov al,0h
mov bl,00000000b
mov ah,13h
int 10h

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz dno12
mov status,1
jmp dcircle2
dno12:
cmp byte ptr [si],2
jnz dexit
mov status,2

dcircle2:
mov si,offset circle
call show1

dexit:

ret
down1 endp

left1 proc near
mov bp,offset sg1
mov cx,2
mov dh,row
mov dl,col
mov bh,0h
mov al,0h
mov bl,00111001b
mov ah,13h
int 10h

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz lno1
mov status,1
jmp lcircle1
lno1:
cmp byte ptr [si],2
jnz lflag1
mov status,2

lcircle1:
mov si,offset circle
call show

lflag1:
cmp col,0
jz left11
dec col
dec col

left11:       
mov bp,offset sg1
mov cx,2
mov dh,row
mov dl,col
mov bh,0h
mov al,0h
mov bl,00000000b
mov ah,13h
int 10h

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz lno12
mov status,1
jmp lcircle2
lno12:
cmp byte ptr [si],2
jnz lexit
mov status,2

lcircle2:
mov si,offset circle
call show1

lexit:

ret
left1 endp

right1 proc near
mov bp,offset sg1
mov cx,2
mov dh,row
mov dl,col
mov bh,0h
mov al,0h
mov bl,00111001b
mov ah,13h
int 10h

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz rno1
mov status,1
jmp rcircle1
rno1:
cmp byte ptr [si],2
jnz rflag1
mov status,2

rcircle1:
mov si,offset circle
call show

rflag1:
cmp col ,78
jz right11
inc col
inc col

right11:       
mov bp,offset sg1
mov cx,2
mov dh,row
mov dl,col
mov bh,0h
mov al,0h
mov bl,00000000b
mov ah,13h
int 10h

mov si,offset form

mov al,row
mov bl,40
mul bl
add si,ax

mov al,col
mov ah,0
mov bl,2
div bl
add si,ax
cmp byte ptr [si],1
jnz rno12
mov status,1
jmp rcircle2
rno12:
cmp byte ptr [si],2
jnz rexit
mov status,2

rcircle2:
mov si,offset circle
call show1

rexit:
ret
right1 endp

show proc near

push ax
push bx
push cx
push dx
push si
push bp

  push ax
  mov al,row
  mov bl,16
  mul bl
  mov dx,ax
  pop ax

  mov bh,0    ;页
mov bp,16  ;外圈(行) ,垂直点数
sh0:
  push bp
  mov bp,16  ;内圈(列),水平点数

  push ax
  mov al,col
  mov bl,8
  mul bl
  mov cx,ax
  pop ax

  mov ax,[si] ;取值
xchg al,ah  ;交换
mov di,ax
  mov ah,0ch
  cmp status,1
  jz person1
  cmp status,2
  jz person2

person1:
  mov al,00001011b
  jmp sh2
person2:
mov al,00001100b

sh2:
  shl di,1  ;移出到 cf
jnc sh3 ;无点
int 10h ;有点印出
sh3:   
  inc cx  ;下一点
dec bp  ;完了一列?
jnz sh2 ;未
add si,2 ;下一行
pop bp  ;
inc dx  ;坐标移下一行
dec bp  ;行回圈
jnz sh0

pop bp
pop si
pop dx
pop cx
pop bx
pop ax

ret
show endp

show1 proc near
push ax
push bx
push cx
push dx
push si
push bp

push ax
mov al,row
mov bl,16
mul bl
mov dx,ax
pop ax

mov bh,0    ;页
mov bp,16  ;外圈(行) ,垂直点数
sh01:
push bp
mov bp,16  ;内圈(列),水平点数

push ax
mov al,col
mov bl,8
mul bl
mov cx,ax
pop ax

mov ax,[si] ;取值
xchg al,ah  ;交换
mov di,ax
mov ah,0ch

cmp status,1
jz person11
cmp status,2
jz person21

person11:
mov al,00001010b
jmp sh21
person21:
mov al,00001110b

sh21:
shl di,1  ;移出到 cf
jnc sh31 ;无点
int 10h ;有点印出
sh31:   
inc cx  ;下一点
dec bp  ;完了一列?
jnz sh21 ;未
add si,2 ;下一行
pop bp  ;
inc dx  ;坐标移下一行
dec bp  ;行回圈
jnz sh01

pop bp
pop si
pop dx
pop cx
pop bx
pop ax

ret
show1 endp

show2 proc near
push ax
push bx
push cx
push dx
push si
push bp

push ax
mov al,row
mov bl,16
mul bl
mov dx,ax
pop ax

mov bh,0    ;页
mov bp,16  ;外圈(行) ,垂直点数
sh02:
push bp
mov bp,16  ;内圈(列),水平点数

push ax
mov al,col
mov bl,8
mul bl
mov cx,ax
pop ax

mov ax,[si] ;取值
xchg al,ah  ;交换
mov di,ax
mov ah,0ch
cmp flag,1
jz ssetcolor1
cmp flag,2
jz ssetcolor2

ssetcolor1:
mov al,00001010b
jmp sh22

ssetcolor2:
mov al,00001110b

sh22:
shl di,1  ;移出到 cf
jnc sh32 ;无点
int 10h ;有点印出
sh32:   
inc cx  ;下一点
dec bp  ;完了一列?
jnz sh22 ;未
add si,2 ;下一行
pop bp  ;
inc dx  ;坐标移下一行
dec bp  ;行回圈
jnz sh02

pop bp
pop si
pop dx
pop cx
pop bx
pop ax

ret
show2 endp

judgeperfect proc near
mov al,row
mov bl,col
mov cl,flag

inc al
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz next1
mov num,1
jmp jup

next1:
inc num
inc al
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz next2
mov num,1
jmp jup

next2:
inc num
inc al
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz next3
mov num,1
jmp jup

next3:
inc num
inc al
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz next4
mov num,1
jmp jup

next4:
inc num
cmp num,5
jz jvictory
jmp jexit

jvictory:
mov victory,1
mov num,1
jmp jexit

jup:
mov cl,flag
mov al,row
mov bl,col

dec al
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz unext1
mov num,1
jmp jleft

unext1:
inc num
dec al
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz unext2
mov num,1
jmp jleft

unext2:
inc num
dec al
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz unext3
mov num,1
jmp jleft

unext3:
inc num
dec al
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz unext4
mov num,1
jmp jleft

unext4:
inc num
cmp num,5
jz ujvictory
jmp jexit

ujvictory:
mov victory,1
mov num,1
jmp jexit

jleft:
mov cl,flag
mov al,row
mov bl,col

inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lnext1
mov num,1
jmp jright

lnext1:
inc num
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lnext2
mov num,1
jmp jright

lnext2:
inc num
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lnext3
mov num,1
jmp jright

lnext3:
inc num
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lnext4
mov num,1
jmp jright

lnext4:
inc num
cmp num,5
jz ljvictory
jmp jexit

ljvictory:
mov victory,1
mov num,1
jmp jexit

jright:
mov al,row
mov bl,col
mov cl,flag

dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz rnext1
mov num,1
jmp jleftoblique1

rnext1:
inc num
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz rnext2
mov num,1
jmp jleftoblique1

rnext2:
inc num
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz rnext3
mov num,1
jmp jleftoblique1

rnext3:
inc num
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz rnext4
mov num,1
jmp jleftoblique1

rnext4:
inc num
cmp num,5
jz rvictory
jmp jexit

rvictory:
mov victory,1
mov num,1
jmp exit

jleftoblique1:
mov al,row
mov bl,col
mov cl,flag

dec al
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lbnext1
mov num,1
jmp jleftoblique2

lbnext1:
inc num
dec al
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lbnext2
mov num,1
jmp jleftoblique2

lbnext2:
inc num
dec al
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lbnext3
mov num,1
jmp jleftoblique2

lbnext3:
inc num
dec al
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lbnext4
mov num,1
jmp jleftoblique2

lbnext4:
inc num
cmp num,5
jz lbvictory
jmp jexit

lbvictory:
mov victory,1
mov num,1

jleftoblique2:
mov al,row
mov bl,col
mov cl,flag

inc al
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lb1next1
mov num,1
jmp jrightoblique1

lb1next1:
inc num
inc al
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lb1next2
mov num,1
jmp jrightoblique1

lb1next2:
inc num
inc al
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lb1next3
mov num,1
jmp jrightoblique1

lb1next3:
inc num
inc al
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz lb1next4
mov num,1
jmp jrightoblique1

lb1next4:
inc num
cmp num,5
jz lb1victory
jmp jexit

lb1victory:
mov victory,1
mov num,1
jmp jexit

jrightoblique1:
mov al,row
mov bl,col
mov cl,flag

inc al
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz rb1next1
mov num,1
jmp jrightoblique2

rb1next1:
inc num
inc al
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz rb1next2
mov num,1
jmp jrightoblique2

rb1next2:
inc num
inc al
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz rb1next3
mov num,1
jmp jrightoblique2

rb1next3:
inc num
inc al
dec bl
dec bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz rb1next4
mov num,1
jmp jrightoblique2

rb1next4:
inc num
cmp num,5
jz rb1victory
jmp jexit

rb1victory:
mov victory,1
mov num,1
jmp jexit

jrightoblique2:
mov al,row
mov bl,col
mov cl,flag

dec al
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz jr2next1
mov num,1
jmp jexit

jr2next1:
inc num
dec al
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz jr2next2
mov num,1
jmp jexit

jr2next2:
inc num
dec al
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz jr2next3
mov num,1
jmp jexit

jr2next3:
inc num
dec al
inc bl
inc bl
mov si,offset form

push ax
push bx
mov bl,40
mul bl
add si,ax
pop bx
pop ax

push ax
mov al,bl
mov ah,0
push bx
mov bl,2
div bl
add si,ax
pop bx
pop ax
cmp byte ptr [si],cl
jz jr2next4
mov num,1
jmp jexit

jr2next4:
inc num
cmp num,5
jz jr2victory
jmp jexit

jr2victory:
mov victory,1
mov num,1
jmp jexit

jexit:
mov num,1
ret
judgeperfect endp

code ends
end start


[招生]科锐逆向工程师培训(2024年11月15日实地,远程教学同时开班, 第51期)

收藏
免费 3
支持
分享
最新回复 (14)
雪    币: 68
活跃值: (190)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
2
沙发吗 呵呵
2016-7-30 16:59
0
雪    币: 1
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
3
不明觉厉啊!
2016-7-30 17:25
0
雪    币: 144
活跃值: (38)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
学习学习
2016-7-30 18:40
0
雪    币: 739
活跃值: (2304)
能力值: ( LV3,RANK:20 )
在线值:
发帖
回帖
粉丝
5
碉堡了
2016-8-1 16:39
0
雪    币: 254
活跃值: (15)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
FKL
6
写的很不错
2016-8-1 22:24
0
雪    币: 4902
活跃值: (120)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
7
这个强大。。
谢谢指教了
2016-8-2 08:45
0
雪    币: 202
活跃值: (40)
能力值: ( LV5,RANK:60 )
在线值:
发帖
回帖
粉丝
8
写五子棋的程序要点是什么?
个人觉得:
1、显示技术,要会画棋盘、棋子,这个比较简单,要处理棋子与棋盘的覆盖问题同时要避免屏幕闪烁,先画棋盘,再画棋子的办法,必然会造成闪烁;
2、定位算法,要能识别那些位置能够放棋子那些位置不能放棋子,需要一个内存表来定位棋格位置;
3、五子棋识别算法,要知道什么时候那些连成了线;

掌握了这些,用啥语言无所谓吧。用汇编,难度在于界面美化而不是算法。
2016-8-3 11:38
0
雪    币: 441
活跃值: (46)
能力值: ( LV3,RANK:30 )
在线值:
发帖
回帖
粉丝
9
美化也不难,用心就行
2016-8-4 09:38
0
雪    币: 96
活跃值: (36)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
10
我最佩服就是这种,拿汇编写游戏的人
难的不是程序,难的是bug'太难调试了
2016-8-5 18:43
0
雪    币: 0
活跃值: (143)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
11
佩服,真的佩服....用汇编写个小东西不难,但是难在耐心....
2016-8-15 12:58
0
雪    币: 206
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
13
吓死我个小白了
2019-5-25 18:56
0
雪    币: 12291
活跃值: (5043)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
14

看不懂,感觉很强大
2019-5-25 20:58
0
雪    币: 16
能力值: ( LV1,RANK:0 )
在线值:
发帖
回帖
粉丝
15
太长了,看得我头都的大了,关键是看不懂
2019-5-29 14:32
0
游客
登录 | 注册 方可回帖
返回
//