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

📄 fmenu.asm

📁 按(F1)键显示(Choice)下拉菜单的功能选项
💻 ASM
📖 第 1 页 / 共 3 页
字号:
red_chr macro                              ;读取字符宏定义
        mov ah,0
        int 16h
endm
string  macro p1                          ;输入字符光标
        mov ah,9
        lea dx,p1
        int 21h
endm
win macro opr1,opr2,opr3,opr4,opr5,opr6    ;建立窗口
         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               ;定义光标位置
         mov ah,2
         mov bh,op1
         mov dh,op2
         mov dl,op3
         int 10h
endm
pos_get  macro                             ;显示光标位置
         mov ah,03h
         mov bh,0
         int 10h
endm
Init_game macro op1,op2,op3,op4,op5,op6     
    mov cx,00h       
    mov dh,op1       
    mov dl,op2
op6:mov ah,02h
    mov bh,00h           
    int 10h
    push cx
    mov ah,0ah
    mov al,op3
    mov bh,00h
    mov cx,01h
    int 10h
    pop cx
    inc cx
    inc op4
    cmp cx,op5
    jne op6  
endm
clear_screen macro op1,op2,op3,op4 ;清屏宏定义    
    mov ah,06h          
    mov al,00h
    mov bh,07h
    mov ch,op1
    mov cl,op2
    mov dh,op3
    mov dl,op4
    int 10h
    mov ah,02h
    mov bh,00h
    mov dh,00h
    mov dl,00h
    int 10h
endm
menu2  macro op1,op2,op3 ;菜单显示宏定义      
   mov ah,02h
   mov bh,00h
   mov dh,op1
   mov dl,op2
   int 10h
   mov ah,09h
   lea dx,op3
   int 21h
   
STACK     SEGMENT PARA STACK 'STACK'
          DB 200 DUP ('STACK')
STACK     ENDS
;;;;;;;;;;;;;;;;;;;;;;;;;;;

endm 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;;;

data     segment                           ;定义数据段
         menu     db 'Choice(F1)   Help(F10) $'
        
         mass_1   db 'F1 Active choice     F10 Active help','$'
         manu_1   db ' appg1    ',13,10,'$'
         manu_2   db ' appg2     ',13,10,'$'
         manu_3   db ' appg3    ',13,10,'$'
         manu_4   db ' appg4  ',13,10,'$'
         manu_5   db ' Exit     ','$'
         handle   dw ?
         ;message1 db ' Please input file name:','$'
         ;message2 db ' Please input save file name:','$'
         ;message3 db ' Please input open file name:','$'
         message4 db '     *** Welcome to use,Press ENTER To Exit *** ','$'
         path     db 50 dup(0),'$'
         buffer   db 2000 dup(?)
         bak      db 3850 dup(0)
         line     db ?
         row      db ?
         char     db ?
    help_mas1 db ' Menu Direction,Welcome to use! $'       ;帮助内容
    help_mas2 db 'This is the Function Menu! ~~~editor:AP04064_45~~~ $'
    help_mas3 db '==========================================================$'
    help_mas4 db '1, Press F1 to active choice. $'
    help_mas5 db '2, There are four functions in this Menu. $'
    help_mas6 db '   aggp1: fangzhen programme; aggp2: testword; $'
    help_mas7 db '   aggp3: head programme    ; aggp4: null. $'
    help_mas8 db '3, Press F10 to show the help massage.Press Esc To Quit.$'         ;加上一行帮助语句
    date  db  'today ??/??/','$'      ;调用日期
    hanglie db '???//???','$'        ;行//列
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;    
    
    buf1  db '1  2  38  9  47  6  5'
    buf2  db '1  2  3  412 13 14 511 16 15 610 9  8  7'
    buf3  db '1  2  3  4  516 17 18 19 615 24 25 20 714 23 22 21 813 12 11 10 9'
    dbuf  db 14 dup(?)
    i1    db 0dh,0ah,'this is a fangzhen programme'
          db 0dh,0ah,'input q to exit'
          db 0dh,0ah,'Please input a number(3--5):','$'
    i2    db 0dh,0ah,'input error,please reinput!','$'
    n     db ?
    b     db 1

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
        
ZK   db "WELCOME TO PLAY$"     
no   db "date:2003/6/24$"
meg  db "press Enter key to continue.......$"
meg1 db "when a letter is dropping,please hit it!$"
meg2 db "press space key to pause!$"
meg3 db "press ESC key to return main interface!$"
meg4 db "press letter 'E' to exit!$"
speed dw 600d
letters db "jwmilzoeucgpravskntxhdyqfb"   
        db "iytpkwnxlsvxrmofzhgaebudjq"
        db "nwimzoexrphysfqtvdcgljukda"
letters_bak db "jwmilzoeucgpravskntxhdyqfb"   
            db "iytpkwnxlsvxrmofzhgaebudjq"   
            db "nwimzoexrphysfqtvdcgljukda"
letter_counter db 0        
life_flag db 78 dup(0)
position_flag db 78 dup(0)      
present_position db 1 
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 full db 0
 buff1 db '   Welcome you to run this programme!'
       db '                                     '
       db '           *****Please press any key*****$'
 buff2 db '       My heart beats with yours!'
      db '             ***** Please q to quit *****$'
data ends
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
code     segment                       
main     proc far                           ;主程序
         assume cs:code,ds:data
start:
         push ds
         sub  ax,ax
         push ax
         mov  ax,data
         mov  ds,ax
         call wind                 
         call edit                                
         ret
main     endp
wind    proc near                              ;创建窗口子程序
        win 0,7eh,1,0,30,79                    ;定义窗口背景
        win 1,3fh,0,0,0,79
        win 0,2fh,24,0,24,79
show:			                     ;显示菜单位置及内容
        pos_curse 0,0,1			 
        mov ah,9
        lea dx,menu
        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:                             ;读字符
      call com
com proc near                         ;定义功能鍵
        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                    ;上
        jz   up_1
        cmp  ah,50h                    ;下
        jz   down_1
        cmp  ah,4bh                    ;左
        jz   left
        cmp  ah,4dh                    ;右
        jz   right
        cmp  ah,1ch                    ;回车
        jz   enter_1
        call fuc_key
        mov ah,2
        mov dl,al
        int 21h
        pop ax
        call  menu_show
        jmp   j6
down_1:
        jmp down
enter_1:
        jmp enter_2
up_1:   jmp up
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                      ;显示光标位置
        jmp first
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:                                     ;上移光标
        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:                                    ;下移光标
        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:                                   ;回车换行
        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,24
 	mov line,0
	jmp first
j6:     
        ret
com     endp
fuc_key proc near                 ;功能键子程序  
 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:                             ;HOME键的功能
        pos_get
        mov row,dh
        mov line,0
       call win4
        jmp first    
_end:                             ;END键的功能
        pos_get
        mov row,dh
        mov line,79
       call win4
        jmp first
bak_sp:                           ;退格键的功能
        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:                                ;DEL删除
        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                       ;显示帮助信息
      call savedisplay               ;显示帮助信息每行的位置
      pos_get
      push dx
      win 0,67h,4,5,21,70
      pos_curse 0,6,20
      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
      pos_curse 0,20,11
      string help_mas8                 ;可共显示8行
      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              ;清屏
      call backdisplay
help endp 
fuc_key endp
menu_show proc near                     ;显示菜单
        call savedisplay
        push cx
        cmp ah,3bh                      ;F1功能
        jz  menu_sh
        jmp char_get
menu_sh:                                ;定义菜单的背景字体颜色
        pos_get
        push dx
        win 0,8eh,2,1,7,11
        win 0,65h,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                 
        jz  manu_n
        jmp manu_hid
manu_hid:                               ;菜单隐藏
        win 0,1eh,1,1,7,11
        call backdisplay
        jmp char_get
manu_n:					;开始定义各个菜单项
        win 0,65h,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  appg1_1
        cmp ah,50h
        je  manu_o
        jmp manu_hid
manu_n0:
        jmp manu_n
manu_o:
        win 0,65h,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 appg2_1
        cmp ah,50h
        je  manu_s
        jmp manu_hid
appg1_1:  jmp appg1_2
manu_s:
        win 0,65h,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  appg3_1
        cmp ah,48h
        je  manu_s
        cmp ah,50h
        je  manu_a
        jmp manu_hid
appg2_1: jmp appg2
manu_n1:
        jmp manu_n
manu_a:
        win 0,65h,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  appg3_2
        cmp ah,48h
        je  manu_a
        cmp ah,50h
        je  manu_e
        jmp manu_hid
manu_n2:
        jmp manu_n1
appg1_2:  jmp appg1
appg3_1: call appg3
appg3_2: call appg4
manu_e:
        win 0,65h,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
        je  manu_n2
        cmp ah,48h
        je  manu_e
        cmp ah,1ch
        je  exit 
        jmp manu_hid
exit:
        call backdisplay
        win 0,07h,15,10,17,61
        win 0,24h,14,9,16,60
        mov dh,15
        mov dl,9
        mov bh,0
        mov ah,2
        int 10h
        lea  dx,message4
        mov ah,9     
        int 21h
        mov ah,1
        int 21h
        cmp al,79h                                    
        jnz q
        call quitt
q:      cmp al,6eh
        jz  quit
quit:   win 0,07h,0,0,24,79
        pos_curse 0,0,0
        mov ah,4ch
        int 21h
        ret
menu_show endp
appg1 proc near                        ;功能软件1
 mov ax,data
      mov ds,ax
      call clear
lop:  lea dx,i1
      mov ah,9
      int 21h
      mov ah,1
      int 21h
      cmp al,'q'
      jz quit1
      lea si,buf1
      mov n,7
      mov cl,3
      call clear
      cmp al,'3'
      jz  s
      lea si,buf2
      mov n,10
      mov cl,4
      cmp al,'4'
      jz  s
      lea si,buf3
      mov cl,5
      mov n,13
      cmp al,'5'
      jz s
      lea dx,i2
      mov ah,9
      int 21h
      call clear
      jmp lop
s:    
      mov bl,n
      lea di,dbuf
l:    mov al,[si]
      mov [di],al
      inc si
      inc di
      dec bl
      jne l
      mov [di],byte ptr '$'
      mov ah,2
      mov dh,b
      mov dl,0
      int 10h
      lea dx,dbuf
      mov ah,9
      int 21h
      inc b
      loop s
      
      jmp lop

⌨️ 快捷键说明

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