I have the following code that displays a custom menu when the [prgm] key is pressed from homescreen. (There is a separate program to install the code as a hook)(Right now it just prints "test"). The custom [prgm] menu modifies vram, as you might imagine. When the custom menu is exited, it should restore the home screen exactly as it was. I know that "call _DrawStatusBar" will redraw the status bar, but i dont know how to restore the homescreen.

RawKey Hook:

Code:
.nolist
#include "ti84pce.inc"

#define saferam plotSScreen
#macro relocate(new_location)
 #define old_location eval($)
 .org new_location
 #define g_location eval(new_location)
#endmacro
 
#macro endrelocate()
 #ifdef g_location
 .org $-g_location + old_location
 #undefine g_location
 #undefine old_location
 #endif
#endmacro
.list      
    .db $83
    ld  hl,(rawKeyHookPtr)
    ld  bc,5+hook_start-$
    add hl,bc
    ld  de,saferam
    ld  bc,hook_end-hook_start
    ldir
   ;ret
    jp  saferam
 

hook_start:
   relocate(saferam)
      ;call _SaveScreen
      ld c,a
        cp kPrgm        ; was Prgms   pressed?
      ret nz
      
      ld hl,$D007E0
      ld b,(hl)
      ld a,kQuit
      cp b
      jr nz,returnNormal
      
      ;enter menu

      xor a
      ld (penCol),a
      ld (penRow),a
      ld hl,RKHTest
      call _VPutS
      
keyWaitLoop:
      call _GetCSC
      cp 0
      jr z,keyWaitLoop
      
      ld c,0
returnNormal:
      ;call _RetScreen
      ;call _DrawStatusBar
      ld a,c
      ret
RKHTest:
 .db "test",0
   endrelocate()
hook_end:
I already gave you the equates yesterday I thought, which is probably why they are in your code Wink


Code:
_SaveScreen
_RetScreen


And that's it. You might be messing up some saferam area you aren't supposed to.
Hmm. Those work very well! Very Happy
When i first tried using them they(or something else) caused a crash, so thats why they were commented Razz
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 1 of 1
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement