Hello, this is my first post on this forum and it's unfortunately a z80 question Razz
Anyway, I'm picking up on a project that I started a few months ago that was a ram asm program. I was learning about menu hooks on the pcse and attempting to replace all the text in the menus with a different text, mainly as a joke.

Here's the precarious thing: there is no _SetMenuHook address in any include file I found anywhere on the internet for the pcse. None. That being said, I somehow got the address of 0x5068 and used it in my code. I do not recall at all how I got that address back in January, but it somehow worked perfectly and my ram program called the menu hook as expected. Huh. So my first question is, where did this address come from? Is there a more complete include file that I got it from somewhere? I've scoured the internet (google Razz) and could not seem to be able to find the address again.

Secondly, when I picked this project up again, I wanted to convert it into a flash app. Again, assuming 0x5068 is the address for _SetMenuHook, I threw together this app:


Code:

.nolist
#include "ti84pcse.inc"
.list

_SetMenuHook   equ $5068      ;I somehow do not recall where I got this address. :/

.org 4000h
;Master Field
.db   80h, 0Fh, 0, 0, 0, 0
;Name. Note that the name field reads 80 46 because the name specified here is 6 characters long.
.db   80h, 47h, "Testing"
;Disable TI splash screen.
.db   80h, 90h
;Revision
.db   80h, 21h, 0
;Build
.db   80h, 31h, 1
;Pages
.db   80h, 81h, 1
;Signing Key ID
.db   80h, 12h, 01, 0Fh
;Date stamp.  Nothing ever checks this, so you can put nothing in it.
.db   03h, 22h, 09h, 00h
;Date stamp signature.  Since nothing ever checks this, there's no
;reason ever to update it.  Or even have data in it.
.db   02h, 00
; Final field
.db   80h, 70h
;There's no need for more padding here.  TI just starts execution after
;the last field.

StartApp:
   ld hl, menuHook
   in a, (6)
   bcall(_SetMenuHook)
Exit:
     bjump(_JForceCmdNoChar)
     ret
menuHook:
   add a, e               ;EDIT: Added this in thanks to DrDnar. I accidentally deleted it when removing the code that would have been irrelevant to this post. The outcome is the same, however: the code still does not run.
   jr $                  ;Infinite loop to test if our hook is ever called
   ret


The menu hook that once worked perfectly in the ram program is never being called in this flash app. I do not know if it is because of the header, the org directive, or maybe the menu hook address is somehow off, even though it worked in the ram program. I guess my second question is: How do I get this menu hook to run in this flash app? What am I doing wrong, or better yet, what has changed specifically between the flash app and the ram program that would change the outcome of the same code? Thanks so much for your time in reading all this and maybe answering some of the questions. Smile
Anyone? D:
I can only answer your first question: please try to look up the most actual file, and as far as I know, about everyone uses that, and contribute to that. It's located at WikiTI and here is the link Smile
For the second question you have to ask a more ASM skilled programmer
I guess I'll try to keep looking. Thanks for the reply, and if anyone else knows anything or can help me out, I would really appreciate it.
Congratulations, you found a new bcall.
I'm sorry you didn't ask sooner before your exploration; I had to find almost all the hooks for Graph3DC.
Code:
_SetMenuHook   .equ   $5068
_ClrMenuHook   .equ   $506B

Your problem: in a, (6) is no longer sufficient to get the page for a Flash app. Feel free to use the following that I developed for my apps:

Code:
GetCurrentPage:
   push bc
      in a,($0E)
      rrca
      and $80
      ld b,a
      in a,($06)
      or b
      pop bc
   ret
. . . I feel really stupid for not noticing that.
KermMartian wrote:
I'm sorry you didn't ask sooner before your exploration; I had to find almost all the hooks for Graph3DC.
Code:
_SetMenuHook   .equ   $5068
_ClrMenuHook   .equ   $506B

Your problem: in a, (6) is no longer sufficient to get the page for a Flash app. Feel free to use the following that I developed for my apps:

Code:
GetCurrentPage:
   push bc
      in a,($0E)
      rrca
      and $80
      ld b,a
      in a,($06)
      or b
      pop bc
   ret


I cannot thank you enough. It means a ton and I'm super happy to finally have an answer. Very Happy
  
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