Omnimaga

Calculator Community => TI Calculators => ASM => Topic started by: Sorunome on December 23, 2014, 01:21:37 pm

Title: TIOS Menu
Post by: Sorunome on December 23, 2014, 01:21:37 pm
Is there a bcall for the TIOS menu? Would it be possible to get it to use custom tokens?
Or do i have to re-write the menu like Omnicalc does it?
Title: Re: TIOS Menu
Post by: chickendude on December 24, 2014, 03:06:29 am
What do you mean? You mean a bcall to draw a TIOS-style menu? Or are you trying to add an entry to an existing TI OS menu?
Title: Re: TIOS Menu
Post by: Sorunome on December 24, 2014, 05:19:57 am
A bcall to an TIOS-style menu. KermM pointed me to this now http://wikiti.brandonw.net/index.php?title=83Plus:OS:Dialog_context
Title: Re: TIOS Menu
Post by: chickendude on December 24, 2014, 09:47:28 am
Ah ok, i was gonna point you to one of Kerm's threads over at Cemetech anyway (http://www.cemetech.net/forum/viewtopic.php?t=10701) :P In particular, BrandonW's ddemo.
Title: Re: TIOS Menu
Post by: Sorunome on January 09, 2015, 09:22:50 am
Um yeah I like can't get it working properly....
Code: [Select]
Menu:
res indicrun,(iy+indicflags)
res apptextsave,(iy+appflags)


ld hl,rawKeyHookPtr
ld de,appBackUpScreen
ld bc,4
ldir
ld a,(flags+34h)
ld (de),a


ld hl,cmdShadow
ld de,appBackUpScreen+5
ld bc,128
ldir


ld hl,structStart
ld de,ramCode
ld bc,structEnd-structStart
ldir
ld hl,dialogCallback
in a,(6)
bcall(_DialogInit)
bcall(_runIndicOff)
bcall(_StartDialog)

; bcall(_CursorOff)
; bcall(_ClrLCDFull)

res appCurWord,(iy+appFlags)

ld hl,appBackUpScreen+5
ld de,cmdShadow
ld bc,128
ldir

ld a,kQuit ; homescreen
ld (cxCurApp),a

ld hl,appBackUpScreen
ld de,rawKeyHookPtr
ld bc,4
ldir
ld a,(hl)
ld (flags+34h),a

xor a
bcall(_GetDialogNumOP1)
ld a,9
bcall(_DispOP1a)
xor a
ret
dialogCallback:
xor a
ret

structStart:
.db 1
.db 1
.db 1
.dw sOptions-structStart
.db 5
.db 1
.db 1
.dw sItem1-structStart
.db 5
.db 1
.db 2
.dw sItem2-structStart
.db 0
sOptions:
.db 7,"VECTORS"
sItem1:
.db 4,"abs("
sItem2:
.db 5,"norm("
structEnd:

When exiting it like exits back into the stat menu (where it was before it got called) but I want it to exit to the homescreen and I can't find any way of getting which option was pushed
Title: Re: TIOS Menu
Post by: chickendude on January 09, 2015, 11:45:44 pm
Do you think you could share the code that loads the hook?
Title: Re: TIOS Menu
Post by: Sorunome on January 10, 2015, 05:04:35 am
is this enough?
Code: [Select]
_keyHook_statKey:
ld a,(menucurrent)
cp mStat
jr z,{+1@}
cp mPrgmStat
jp z,{+1@}

ld a,kStat
jp ReturnNZ
@:
call Menu
jp ReturnZ
T´hat gets called if the stat key is pressed, no changing of registers.
Title: Re: TIOS Menu
Post by: chickendude on January 10, 2015, 06:07:00 am
What about changing the final "xor a"s to "ld a,kQuit"?
Code: [Select]
Menu:
res indicRun,(iy+indicFlags)
res appTextSave,(iy+appFlags)


ld hl,rawKeyHookPtr
ld de,appBackUpScreen
ld bc,4
ldir
ld a,(flags+34h)
ld (de),a


ld hl,cmdShadow
ld de,appBackUpScreen+5
ld bc,128
ldir


ld hl,structStart
ld de,ramCode
ld bc,structEnd-structStart
ldir
ld hl,dialogCallback
in a,(6)
bcall(_DialogInit)
bcall(_RunIndicOff)
bcall(_StartDialog)

; bcall(_CursorOff)
; bcall(_ClrLCDFull)

res appCurWord,(iy+appFlags)

ld hl,appBackUpScreen+5
ld de,cmdShadow
ld bc,128
ldir

ld hl,cmdShadow
ld de,textShadow
ld bc,128
ldir

ld a,kQuit ; homescreen
ld (cxCurApp),a

ld hl,appBackUpScreen
ld de,rawKeyHookPtr
ld bc,4
ldir
ld a,(hl)
ld (flags+34h),a

xor a
bcall(_GetDialogNumOP1)
ld a,9
bcall(_DispOP1A)
ld a,kQuit
ret
dialogCallback:
ld a,kQuit
ret