Hmm, well is the location of the "ret" as of now "$99c3"? I know it's subject to change.
ACagliano wrote:
Hmm, well is the location of the "ret" as of now "$99c3"? I know it's subject to change.
Around there, but I'm not precisely sure about that. Why do you ask?
I'm on about replacing the "ret" with a jump to a very small piece of code, then to ret from that.
ACagliano wrote:
I'm on about replacing the "ret" with a jump to a very small piece of code, then to ret from that.
Why not search forward and back from that address looking for the $C9?
What if I end up replacing the wrong C9? Is there any other C9 in the interrupt stub besides this one?
A good question, but no, there's not, especially close to $99C3.
Ok, so I'll just start at the beginning and look for the first 'ret'. That's easy enough. But if I have already changed the stub's ending to 'jp MyCode', how would I check for that?

its a 'cp $C9' for the ret? what is it for the jp?
It would be better to start at $99C3 and work outwards:
Code:
#define Cn2_End_Guess $99C3

  ld hl,Cn2_End_Guess
  push hl
    pop de
Search_Up:
  ld a,(hl)
  cp $C9
  jr z,FoundHL
  dec hl
  inc de
  ld a,(de)
  cp $C9
  jr z,FoundDE
  jr Search_Up
FoundDE:
  ex de,hl
FoundHL:
  // location of $C9 (ret) is in hl
Ok, but let's assume that the end of the code can be either "C9" OR "jr MyCode"?

What would you have to do to add the "jr MyCode" as a search term?
You would look up the hex code for 'jr' and/or 'jp' and add a check for that. I'm not going to write your whole program for you. Smile
Nah, didn't want you to. was merely curious if I needed to do a two-byte check for the full command or if just searching for the jp in that general location would work.
Ok, Im having a few more issues. (In all, my program is coming well though).

The issues are this...

1. Is there anything immediately after the Cn2 interrupt stub that I should not write over?
2. I kind of need to return pointers to an appvar within the code I'm appending to the interrupt. Will bcall(_ChkFindSym) disable interrupts? If so, can I just reenable them after?
bump
ACagliano wrote:
Ok, Im having a few more issues. (In all, my program is coming well though).

The issues are this...

1. Is there anything immediately after the Cn2 interrupt stub that I should not write over?

Not as I recall. Two extra bytes to change 'ret' into 'jp' should be ok.
Quote:
2. I kind of need to return pointers to an appvar within the code I'm appending to the interrupt. Will bcall(_ChkFindSym) disable interrupts? If so, can I just reenable them after?
I'm not sure, but you can test it. If it does, do im 2 \ ei.
KermMartian wrote:
ACagliano wrote:
Ok, Im having a few more issues. (In all, my program is coming well though).

The issues are this...

1. Is there anything immediately after the Cn2 interrupt stub that I should not write over?

Not as I recall. Two extra bytes to change 'ret' into 'jp' should be ok.
Quote:
2. I kind of need to return pointers to an appvar within the code I'm appending to the interrupt. Will bcall(_ChkFindSym) disable interrupts? If so, can I just reenable them after?
I'm not sure, but you can test it. If it does, do im 2 \ ei.


On response 1: I was actually planning on ldiring the entire "appended code" there Smile
Well, the stub is at $9999, in the middle of AppBackupScreen, which goes from 9872h to 9B72h. Presumably there's room, but you might not want to block yourself from using it for other things.
KermMartian wrote:
Well, the stub is at $9999, in the middle of AppBackupScreen, which goes from 9872h to 9B72h. Presumably there's room, but you might not want to block yourself from using it for other things.


Ok then what other memory areas can I use. That won't get overwritten Smile. I can't jp into my program code, bc that moves around.
bump
ACagliano wrote:
KermMartian wrote:
Well, the stub is at $9999, in the middle of AppBackupScreen, which goes from 9872h to 9B72h. Presumably there's room, but you might not want to block yourself from using it for other things.


Ok then what other memory areas can I use. That won't get overwritten Smile. I can't jp into my program code, bc that moves around.
So? You can still figure out where it is, assuming you're moving into some safe sort of RAM. If you just mean the program stored in user RAM, then we're back to why you should be using SafeRAM, and why this general sort of thing is fidgety.
Hey Kerm shouldn't we just give him the updated one with the hook for this kind of purpose Wink
  
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 3 of 5
» All times are GMT - 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