Quite a few long nights and a lot of lines transcribed, I now have a few more questions. Forgive me if I'm asking too much, personally I wish there was a way to ask quick questions without making something as big as a "post" on a forum.
So, in a routine I found, it jumps to a location.
This location does have stuff, and I wrote it all out.
While using the debugger I set the zero flag such that I'd
land on the JSR that would send me to the location in order
to check a few things.
Upon doing so though I got a completely different set of instructions.
I then picked one of the instructions, looked it up in the
hex editor, and found only one instance of it.
I was like "Ok this has everything the same except for the first byte".
meaning, of XXXX the one on the far left is different.
I then thought, ok, maybe something jumps here.
So I just look up the address to where it'd jump, leaving
the first part wild card since I don't know what type of jump
they might use to get here.
Even then, nothing appeared except for things where it wasn't a jump command.
At this point I was hoping I had written something wrong, but I hadn't.
So I don't know what to do.
The jump instruct in the hex is JSR B767.
In test code it's
0b767 (where the next instruction starts)
this next instruction, the one it starts at after the JSR,
occurs only in one location in the rom though, and that is at 3767.
Also, as an aside, PLB, from the manual on the langauge,
pulls the top 8 byte of the stack and has it replace B register
which stores the bank one is currently in.
I could see this holding purpose if one needed to get back to
a location without a JMP (since maybe the location is variable),
but then they proceed to RTL, which should return them to where
they want regardless of the bank they are in.
(I am assuming that since JSL can go "anywhere", RTL can return "anywhere").
I guess if the return location is on the stack and was stuck under
the bank data register 8 bits I can see that being a reason to PLB
before RTL, but beyond that, I don't see why.
update on the last part:
So, if when one JSL's it pushes the address lets say the current address location is 018040 the when it's put on the stack it's:
40 placed, 80 placed, and lastly 01 placed.
In this idea, PLB will take the 01, and then RTL takes the 8040 to return. (this is if RTL doesn't incorporate the bank for some reason, even though JSL does).
And as a final addition:
Also, one of my JMPs, JMP 8D70, which in test code goes to there (in the debugger), but that location would be 0D70.
Since the JMP is evident in the hex, I feel like that should head to 8D70, but the test code shows otherwise. So I don't know why what I debug and step through gives different from logical progression from finding the breakpoints, finding them in hex, finding corresponding jumps, and following manually.
edit: Upon looking at:
ASM Hacking for Dummies
I noticed 5.1 so I think that might have something to do with these issues.