Hello, this is my first post on this forum and it's unfortunately a z80 question
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 ) 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:
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.
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 ) 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.