[A86] menu demo
[Prev][Next][Index][Thread]
[A86] menu demo
I'm sure someone's done this before (probably Clem ;), but here's some
sample code using system menus in case anyone's interested. I think this
demonstrates everything that can be done with menus without setting up a
custom app (which I don't know how to do) except for dynamic menus that
are built by a subroutine.
-josh
_ASAPloadmenu equ 49C8h
_funcDisp equ 49E8h
_mon equ 4084h
.org $d748
ld hl,themenu
call _ASAPloadmenu
jp _funcDisp
; need to return to the context monitor
; for the menu to work.
themenu:
.db $09 ; system menu (not app menu), flushSys first
; app menus will be above any open sys menus
; unless you're writing your own app, use sys menus.
; Low bit tells it to clear any existing sys menus first.
.db 5 ; 5 menu items
.dw item1,item2,$0000,item3,$ff00+'A'
; Note that these pointers will become invalid if
; another asm program is loaded. It might be wise
; to copy the menu someplace safe before loading it.
; OTOH, most asm programs will call _flushallmenus
; so the menu will be removed and there's nothing
; to worry about.
item1: ; string, clean paste
.db $00,"paste",0
item2: ; execute code
.db $04
jp item2code
.db "code",0
item3: ; submenu
.db $05
.dw menu2
.db "sub",0
item2code:
; This code is jumped to from inside
; the context monitor, so there is no
; valid return address on the stack.
; You need to jump to _mon when done.
; load rom jump table
; so _mon address is correct
ld a,$0d
out (5),a
ld hl,$fc00
ld bc,$0400
invloop:
ld a,(hl)
xor $ff
ld (hl),a
cpi
jp po,_mon
jr invloop
menu2:
.db $08 ; system menu (not app menu)
.db 2 ; 2 menu items
.dw item4,item5
item4: ; Ans+1
.db $80,"+1",0
item5: ; built-in menu
.db $02,$2b ; program editor main menu
.db "prgm",0
________________________________________________________________
GET INTERNET ACCESS FROM JUNO!
Juno offers FREE or PREMIUM Internet access for less!
Join Juno today! For your FREE software, visit:
http://dl.www.juno.com/get/web/.
Follow-Ups: