Re: A86: menu


[Prev][Next][Index][Thread]

Re: A86: menu






Brock Wilcox wrote:

> I am trying to write a program that accesses TI-OS's menu routines.
> Idealy the program would still be running while the menu is being
> displayed. I wrote a short program using some rom addresses someone
> posted, but it doesn't work. Any suggestions? Help would be greatly
> appreaciated.
>
> --Retupmoc7
>
> Here is the program:
>
> #include ti-86.h
>
>   .org $D748
>
>   LD hl,Menu1
>   CALL $49c8
>   JP $49e8

Change jp to call and it will execute the assembly that follows while
the menu is up

None of this code will work unless you load it onto RAM page 0.

> Menu1:
>   .db $09 ; $09 = new menu, $08 = submenu
>   .db $03 ; number of menu items
>   .dw Item1 ; pointers to entries
>   .dw Item2
>   .dw Item3
>
> Item1:
>   .db $05 ; this item is a sub-menu
>   .dw Menu2 ; pointer to menu

You can't use labels like this if you load it onto page 0.  The easiest
way to find out what value belongs here is to put a random two bytes,
run the program to put it correctly in the RAM and then use a memory
editor to find the correct addresses.  At any rate, you will probably
need two programs, one to install the menu data, and another that
invokes the menu and runs your other code.

>   .db "Menu2",0 ; appears in menu
>
> Item2:
>   .db $06 ; nothing

You can instead put $00,$00 as your pointer if you want.

> Item3:
>   .db $01 ; execute assembly
>   .dw $0000 ; dummy pointer
>   .db $C3 ; JP
>   .dw Hello ; pointer to code
>   .db "Hello",0 ; appears in menu
>
> Menu2:
>   .db $08 ; $09 = new menu, $08 = submenu
>   .db $01 ; number of menu items
>   .dw Item4 ; pointer to sub-menu
>
> Item4:
>   .db $01 ; execute assembly
>   .dw $0000 ; dummy pointer
>   .db $C3 ; JP
>   .dw Hi ; pointer to code
>   .db "Hi",0 ; appears in menu

Any code or data that you want to run from the menu will also have to be
copied onto page 0.

> Hello:
>   CALL sys_clrlcdfull
>   LD HL,$0000
>   LD (CURROW),HL
>   LD HL,STR0
>   CALL SYS_PUTS
>   CALL sys_waitkey
>   RET
>
> Hi:
>   LD HL,$0101
>   LD (CURROW),HL
>   LD HL,STR1
>   CALL SYS_PUTS
>   CALL sys_waitkey
>   RET
>
> ; DATA
>
> STR0:
>   .db "Hello",0
>
> STR1:
>   .db "Hi",0
>
> sys_waitkey:
>   EI
> sys_waitkey_loop:
>   HALT
>   CALL sys_getk
>   OR A
>   JR Z,sys_waitkey_loop
>   RET
>
>   .end
>
> ______________________________________________________
> Get Your Private, Free Email at http://www.hotmail.com




References: