⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 shubiao.asm

📁 一个五子棋游戏可以图形显示棋盘和网格线然后选择棋子 有一定智能
💻 ASM
字号:
FILL MACRO  COLOR,NUM1,NUM2,NUM3,NUM4
       LOCAL S0,S1
       PUSH AX
       PUSH CX
       PUSH DX
       MOV  AL,COLOR
       MOV  DX,NUM1
S0:
       MOV  CX,NUM2
S1:
       MOV  AH,0CH
       INT  10H
       INC  CX
       CMP  CX,num3
       JLE  S1
       INC  DX
       CMP  DX,num4
       JLE  S0
       POP  DX
       POP  CX
       POP  AX
   ENDM
SETCURSOR MACRO X,Y
 MOV AH,2
 MOV BH,0
 MOV DH,X
 MOV DL,Y
 INT 10H
 ENDM
SHOWINFO MACRO MESSAGE
 LEA DX,MESSAGE
 MOV AH,09H
 INT 21H
 ENDM
DATA SEGMENT
 MOUSE  DB   266 DUP(65)
 INFO1  DB   'GAME     SCORE     MUSIC     EXIT? '
 info2  db   'begin','$'
 LEN_STR DW  $-INFO1
DATA ENDS

PROGNAM SEGMENT
   ASSUME    CS: PROGNAM, DS:DATA,ES:DATA
MAIN PROC FAR
       MOV AX,DATA
       MOV DS,AX
       MOV ES,AX
       MOV AL,12H       ;640*480,graph having 256 kinds of color
       MOV AH,0
       INT 10H
       FILL 9,0,0,639,479

      
  ;--------------------------------------
     ; call printwelcome
      ; SHOWINFO INFO1
      ; MOV AH,1         ;print the key,begin showing
      ; INT 21H
      ;draw the chess board
       FILL 6,55,55,425,425

       MOV AL,0         ;the color of pixel is black
       MOV BH,0         ;page number
       MOV DX,60        ;pixel row

;begin draw the heng  line
;***********************************************************
begin1:
       MOV CX,60        ;pixel column
begin2: 
       MOV AH,0CH       ;write the graphical pixel
       INT 10H
       INC cX
       CMP cX,420       ;column ends of 190
       JNZ begin2
       ADD DX,30        ;next row
       CMP DX,420       ;row ends of 190
       JLE begin1
;***********************************************************
;begin draw the  shu line
;***********************************************************
       MOV CX,60        ;pixel column begins of 10
begin3:
       MOV DX,60        ;pixel row begins of 10
begin4:
       MOV AH,0CH       ;write the graphical pixel
       INT 10H
       INC DX    
       CMP DX,420       ;row ends of 190
       JNZ begin4
       ADD CX,30        ;next column
       CMP CX,420       ;column ends of 190
       JLE begin3
;***********************************************************
;draw the instructions part
       FILL 6,10,430,560,425
       FILL 6,10,55,425,55
;design mouse
;(bx,cx)the location of the cursor,ES:DX the head address of the cursor
;mask (0-1f:background;20-3f:graph)
       LEA DX,MOUSE
       MOV BX,10
       MOV CX,10
       MOV AL,9
       MOV AH,0
       INT 33H          
       MOV AL,0         ;mouse chu shi hua
       MOV AH,0
       INT 33H
       MOV AL,1         ;show the cursor
       MOV AH,0
       INT 33h
       call printwelcome
       call print

       MOV AH,1         ;get key
       INT 21H
       MOV AH,4CH       ;return dos
       INT 21H
MAIN ENDP
printwelcome proc near
  push ax
  push bx
  push cx
  push dx
  SETCURSOR 2,13
  MOV BX,OFFSET INFO1
 output:
     ; call delay1
      mov al,[bx]
      cmp al,'?'
      je exit0
      mov ah,02h
      mov dl,[bx]
      int 21h
      inc bx
      jmp output
  exit0:
       pop dx
       pop cx
       pop bx
       pop ax
       ret
   printwelcome endp
 print proc near
    push ax
    push bx
    push cx
    push dx
    SETCURSOR  15,45
    SHOWINFO info2
    pop dx
    pop cx
    pop bx
    pop ax
    ret
print endp     

     PROGNAM ENDS
       END


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -