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

📄 group2.asm

📁 一个五子棋游戏可以图形显示棋盘和网格线然后选择棋子 有一定智能
💻 ASM
📖 第 1 页 / 共 2 页
字号:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
extrn music:far
red_chr macro                                       ;read char
        mov ah,0
        int 16h
endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
string  macro p1                              ;output char line
        mov ah,9
        lea dx,p1
        int 21h
endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
win macro opr1,opr2,opr3,opr4,opr5,opr6       ;new window
         mov ah,06h
         mov al,opr1
         mov bh,opr2
         mov ch,opr3
         mov cl,opr4
         mov dh,opr5
         mov dl,opr6
         int 10h
endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pos_curse macro op1,op2,op3                     ;put cursor positio
         mov ah,2
         mov bh,op1
         mov dh,op2
         mov dl,op3
         int 10h
endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
pos_get  macro                             ;get cursor position
         mov ah,03h
         mov bh,0
         int 10h
endm
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
date     segment                              ;data segment define
         manu     db 'File  Edit  About  Music  Help $'
         filnm    db 'please your file name:',13,10,'$'
         mass_1   db 'F1 Active manu     F10 Active help','$'
         manu_1   db ' New      ',13,10,'$'
         manu_2   db ' Open     ',13,10,'$'
         manu_3   db ' Save     ',13,10,'$'
         manu_4   db ' Save as  ',13,10,'$'
         manu_5   db ' Exit     ','$'
         handle   dw ?
         message1 db ' Please input your creat file name:','$'
         message2 db ' Please input your save file name:','$'
         message3 db ' Please input your open file name:','$'
         message4 db ' ***The file is not save! Save it now? (Y/N)***: ','$'
         path     db 50 dup(0),'$'
         buffer   db 2000 dup(?)
         bak      db 3850 dup(0)
         line     db ?
         row      db ?
        char     db ?
     help_mas1 db ' NCIT 00090B4 No.2 Group$'
    help_mas2 db 'The group monitor:   zhu Zhengqiang  $'
    help_mas3 db 'The group menber:Sun Lixin Gan Xiaowei Wang Xiaoyu Li Wenjun $'
    help_mas4 db '*************************************************************$'
    help_mas5 db 'Press F1 show the menu file:NEW OPEN  SAVE SAVEAS  CLOS.$'
    help_mas6 db 'You can use UP DOWN LEFT RIGHT to choose the fuction you need$'
    help_mas7 db 'Press F10 to show the help massage.F9 to operate the music.$'
    data  db  'Today ??/??/','$'
   hanglie db '???//???','$' 
    date     ends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
code     segment                       
main     proc far                             ;main program
         assume cs:code,ds:date
start:
         push ds
         sub  ax,ax
         push ax
         mov  ax,date
         mov  ds,ax
         call wind
         call edit
     
         ret
main     endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
wind proc near        
    
         win 0,1eh,1,0,24,79
         win 1,30h,0,0,0,79
         win 0,30h,24,0,24,79
show:
         pos_curse 0,0,1
         mov ah,9
         lea dx,manu
         int 21h
show_2:
         pos_curse 0,24,1
         mov ah,9
         lea dx,mass_1
         int 21h

         call win3
         call win4
         pos_curse  0,1,0
         mov row,dh
         mov line,dl


wind endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
edit proc near
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
char_get:                          ;read char
      call com
com proc near                  ;judge if function key
        pos_get
        mov  row,dh
        mov  line,dl
first:
        pos_curse 0,row,line
j00:    mov ah,0
        int 16h                            ;从键盘读字符 ah=扫描码 al=字符码
        push ax
        lea dx,buffer
        mov buffer[bx],al
        inc bx

        cmp  ah,48h              ;up 
        jz   up_1
        cmp  ah,50h              ;down
        jz   down_1
        cmp  ah,4bh              ;left
        jz   left
        cmp  ah,4dh              ;right
        jz   right
        cmp  ah,1ch              ;enter
        jz   enter_1
        call fuc_key
        mov ah,2
        mov dl,al
        int 21h
        pop ax
        call  manu_show
        jmp   j6
down_1:
        jmp down
enter_1:
        jmp enter_2
up_1:   jmp up
left:                                         ;cursor move left
        pos_get
        mov row,dh
        mov dl,line
        cmp line,0
        jnz direct
        mov line,79
        dec row
        cmp row,0
        je  stop2                                            
        jmp first
        
stop2: 
         mov row,1
        jmp first
direct:   
        dec line
        call win4                  ;show the cursor position
        jmp first
right:                                 ;cursor move right
        pos_get
        mov row,dh
        mov dl,line
        cmp line,79
        jnz direct2
        mov line,0
        inc row
        cmp row,24
        je  returns1       
        jmp first
direct2:
     inc  line
    call win4
     jmp first
enter_2:jmp enter
up:                                           ;cursor move up
        pos_get
        mov row,dh
        mov dl,line
        dec row
        cmp row,0
        je  stop1
        call win4
        jmp first
stop1:  mov row,1
        jmp first
down:                                         ;cursor move down
        pos_get
        mov row,dh
        mov dl,line   
        inc row
        cmp row,24
        je  stop3
       call win4
        jmp first
stop3:  mov row,23
        jmp first
  returns1:
  jmp returns
enter:                                    ;enter to the next line
        ;mov buffer[bx],13
        ;inc bx
        pos_get
        mov row,dh
        mov line,dl
        inc row
        cmp row,24
        je  returns
        mov line,0
     call win4
        jmp first
returns:mov row,23
 	mov line,0
	jmp first
j6:     ret
com     endp
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
fuc_key proc near            ;judge the next key if function-key
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
      cmp ah,43h
      jnz next                                   ;F9 active the music
     call music
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 next: cmp ah,47h        ;home
        jz  home
        cmp ah,4fh        ;end
        jz  _end
        cmp ah,0eh        ;backspace
        jz  bak_sp
        cmp ah,53h
        jz  del
        cmp ah,44h        ;F10
        jz  help_0
        ret
help_0: call help
home:                     ;cursor move to the first row of the line
        pos_get
        mov row,dh
        mov line,0
       call win4
        jmp first    
_end:                    ;cursor move to the last row of the line
        pos_get
        mov row,dh
        mov line,79
       call win4
        jmp first
bak_sp:                   ;delete the char before the cursor
        pos_get
        mov row,dh
        mov line,dl
        cmp line,0
        je  stop
        dec line
        jmp ab
stop:	mov line,0 
ab:     pos_get 0,row,line
        mov ah,2
        mov dl,00
        int 21h
         call win4
        jmp first
del:                        ;delete the char after the cursor
        pos_get
        mov row,dh
        mov line,dl
        dec line
        pos_get 0,row,line
        mov ah,2
        mov dl,00
        int 21h
        inc line
       call win4
        jmp first
cm:     cmp line,00
        jz  pos_cm
pos_cm:
        pos_curse 0,0,0
        jmp first
help proc near                       ;show the help massage
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        call savedisplay
      pos_get
      push dx
      win  0,24h,4,5,21,74
    pos_curse 0,6,25
      string help_mas1
    pos_curse 0,8,11
      string help_mas2
    pos_curse 0,10,11
      string help_mas3
    pos_curse 0,12,11
      string help_mas4
    pos_curse 0,14,11
      string help_mas5
    pos_curse 0,16,11
      string help_mas6
      pos_curse 0,18,11
      string help_mas7
      pop dx
      pos_curse 0,dh,dl
      mov  ah,0
      int  16h
      cmp  ah,36h                       ;F10 active help
      jnz  cls
      call help
cls:    win 0,1eh,9,10,13,70      ;clean the help window
        call backdisplay
help endp 
fuc_key endp

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
manu_show proc near              ;show the manu
        call savedisplay
        push cx
        cmp ah,3bh                      ;judge if F1  
        jz  manu_sh
        jmp char_get
manu_sh:
        pos_get
        push dx
        win 0,07h,2,1,7,11
        win 0,71h,1,0,6,10
        pos_curse 0,1,0
        string manu_1
        string manu_2
        string manu_3
        string manu_4
        string manu_5
        pop dx
        dec dl
        pos_curse 0,dh,dl
copmar:    
        red_chr 
        cmp ah,50h                 ;judge if down
        jz  manu_n
        jmp manu_hid
      
manu_hid:                         ;hide the manu
        win 0,1eh,1,1,7,11
        call backdisplay
        jmp char_get
manu_n:
        win 0,71h,5,1,5,8
        pos_curse 0,5,0
        string manu_5
        win 0,15h,1,1,1,8
        pos_curse 0,1,0
        string manu_1
        red_chr
        cmp ah,48h
        je  manu_n
        cmp al,0dh
        jz  new_1
        cmp ah,50h
        je  manu_o
        jmp manu_hid
manu_n0:
        jmp manu_n
manu_o:
        win 0,71h,1,1,1,8
        pos_curse 0,1,0
        string manu_1
        win 0,15h,2,1,2,8
        pos_curse 0,2,0
        string manu_2
        red_chr
        cmp ah,48h
        je  manu_o
        cmp al,0dh
        jz open_1
        cmp ah,50h
        je  manu_s
        jmp manu_hid
new_1:  jmp new_2
manu_s:
        win 0,71h,2,1,2,8
        pos_curse 0,2,0
        string manu_2
        win 0,15h,3,1,3,8
        pos_curse 0,3,0
        string manu_3
        red_chr
        cmp al,0dh
        jz  save_1
        cmp ah,48h
        je  manu_s
        cmp ah,50h
        je  manu_a
        jmp manu_hid
open_1: jmp open_2
manu_n1:
        jmp manu_n
manu_a:
        win 0,71h,3,1,3,8
        pos_curse 0,3,0
        string manu_3
        win 0,15h,4,1,4,8
        pos_curse 0,4,0
        string manu_4 
        red_chr
        cmp ah,1ch
        jz  save_2
        cmp ah,48h
        je  manu_a
        cmp ah,50h
        je  manu_e
        jmp manu_hid
manu_n2:
        jmp manu_n1
new_2:  jmp new
save_1: call save
save_2: call saveas
manu_e:
        win 0,71h,4,1,4,8
        pos_curse 0,4,0
        string manu_4
        win 0,15h,5,1,5,8
        pos_curse 0,5,0
        string manu_5
        red_chr
        cmp ah,50h

⌨️ 快捷键说明

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