Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; You may customize this and other start-up templates;
- ; The location of this template is c:\emu8086\inc\0_com_template.txt
- org 100h
- jmp print_menu
- print_menu:
- call clear_screen
- mov ax, current_menu
- cmp ax, 1
- je print_menu_1
- cmp ax, 2
- je print_menu_2
- cmp ax, 3
- je print_menu_3
- input:
- mov dx, msg4
- mov ah, 9
- int 21h
- mov ah, 0
- int 16h
- cmp ah, 50h
- je up_pressed
- cmp ah, 48h
- je down_pressed
- cmp ah, 4dh
- je handle_buttonclick
- cmp ah, 4bh
- je exit
- jmp print_menu
- inc_menu:
- inc [current_menu]
- jmp print_menu
- dec_menu:
- dec [current_menu]
- jmp print_menu
- up_pressed:
- jmp inc_menu
- down_pressed:
- jmp dec_menu
- print_menu_1:
- mov dx, offset M1
- mov ah, 9
- int 21h
- jmp input
- print_menu_2:
- mov dx, offset M2
- mov ah, 9
- int 21h
- jmp input
- print_menu_3:
- mov dx, offset M3
- mov ah, 9
- int 21h
- jmp input
- end:
- mov ah, 4ch
- mov al, 0
- int 21h
- handle_buttonclick:
- mov ax, [current_menu]
- cmp ax, 1
- je b1c
- cmp ax, 2
- je b2c
- cmp ax, 3
- je b3c
- b1c:
- call clear_screen
- mov dx, msg1
- mov ah, 9
- int 21h
- mov ah, 0
- int 16h
- jmp print_menu
- b2c:
- call clear_screen
- mov dx, msg2
- mov ah, 9
- int 21h
- mov ah, 0
- int 16h
- jmp print_menu
- b3c:
- call clear_screen
- mov dx, msg3
- mov ah, 9
- int 21h
- mov ah, 0
- int 16h
- jmp print_menu
- exit:
- call clear_screen
- mov ah, 4ch
- mov al, 0
- int 21h
- clear_screen proc near
- mov ah,0
- mov al,3
- int 10h
- ret
- clear_screen endp
- msg3: db 'You clicked button 3.', 0ah, 0dh, 24h
- msg2: db 'you clicked button 2', 0ah, 0dh, 24h
- msg1: db 'you clicked button 3', 0ah, 0dh, 24h
- msg4: db ' ', 0ah, 0dh
- db 'MS DOS GUI Demo', 0ah, 0dh, 24h
- apn db ?
- current_menu dw 1
- M1 dw ' ', 0ah, 0dh
- dw ' --------------- ', 0ah, 0dh
- dw ' | >Button 1 | ', 0ah, 0dh
- dw ' | | ', 0ah, 0dh
- dw ' | Button 2 | ', 0ah, 0dh
- dw ' | | ', 0ah, 0dh
- dw ' | Button 3 | ', 0ah, 0dh
- dw ' --------------- ', 0ah, 0dh
- dw '$', 0ah, 0dh
- M2 dw ' ', 0ah, 0dh
- dw ' --------------- ', 0ah, 0dh
- dw ' | Button 1 | ', 0ah, 0dh
- dw ' | | ', 0ah, 0dh
- dw ' | >Button 2 | ', 0ah, 0dh
- dw ' | | ', 0ah, 0dh
- dw ' | Button 3 | ', 0ah, 0dh
- dw ' --------------- ', 0ah, 0dh
- dw '$', 0ah, 0dh
- M3 dw ' ', 0ah, 0dh
- dw ' --------------- ', 0ah, 0dh
- dw ' | Button 1 | ', 0ah, 0dh
- dw ' | | ', 0ah, 0dh
- dw ' | Button 2 | ', 0ah, 0dh
- dw ' | | ', 0ah, 0dh
- dw ' | >Button 3 | ', 0ah, 0dh
- dw ' --------------- ', 0ah, 0dh
- dw '$', 0ah, 0dh
- ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement