Points of Required Attention™
Please chime in on a proposed restructuring of the ROM hacking sections.
Views: 88,483,954
Main | FAQ | Uploader | IRC chat | Radio | Memberlist | Active users | Latest posts | Calendar | Stats | Online users | Search 04-25-24 11:43 PM
Guest: Register | Login

0 users currently in ROM Hacking | 3 guests

Main - ROM Hacking - Questions on PHA, PLA, Transfers, and the JMP thats 6C0000 New thread | New reply


infidelity
Posted on 06-24-11 09:10 PM Link | Quote | ID: 144091


Fuzz Ball
Level: 66

Posts: 179/968
EXP: 2367964
Next: 93887

Since: 05-24-07

Last post: 958 days
Last view: 814 days
I understand Push and Pull Accumulator, and how it pertains to the stack. Why do we need it if you have empty unused registers in a rom? Why bother transfering? Why are those sometimes needed to make certain code work. And where does 6C0000go, to $0000?

kuja killer
Posted on 06-24-11 10:18 PM (rev. 2 of 06-24-11 10:27 PM) Link | Quote | ID: 144092


Level: 55

Posts: 247/628
EXP: 1243829
Next: 70360

Since: 03-20-07
From: Lake Havasu City, Arizona

Last post: 281 days
Last view: 6 days
The difference between the 4C jump, and 6C jump is well...6C jumps to whatever the address is of 2 registers.

Like 6C 00 00 looks at what's in 00 and 01 RAM.
If 00 contains 65, and 01 RAM contains 80, then a 6C 00 00 jumps to - 8065

If you got a 6C 9C 00, then it looks at 9C, and 9D ram. Like 9C has 22, and 9D has B4....then that 6C 9C 00 jumps to - B422

Make sense ??
-------------------
the whole pla and pha thing, it''s just simpler sometimes cause they only take 1 byte, instead of 2 or 3 like lda's and sta's.

Like PHA the number, PLA it later, only took ya 2 bytes, while if ya just did like a STA to whatever, then LDA it back later, took 4 bytes. just can save a little space sometimes.

infidelity
Posted on 06-24-11 10:57 PM Link | Quote | ID: 144093


Fuzz Ball
Level: 66

Posts: 180/968
EXP: 2367964
Next: 93887

Since: 05-24-07

Last post: 958 days
Last view: 814 days
Your 6C example makes perfect sense. But, are there 6C's that have the last byte either 01-FF or does it always have to be a zero, for it to read 2 registers to do the jmp properly? And i find it strange too, why not just perform a regular 4C jmp instead.

kuja killer
Posted on 06-24-11 11:06 PM (rev. 2 of 06-24-11 11:08 PM) Link | Quote | ID: 144094


Level: 55

Posts: 248/628
EXP: 1243829
Next: 70360

Since: 03-20-07
From: Lake Havasu City, Arizona

Last post: 281 days
Last view: 6 days
ummm, dont think it has to always be 00, but there's no sense in having anything else, because ya know, like all the rest of the 100-7FF RAM is all the other stuff like enemy's positions and timers and sprite's x/y and tile/color data and all that kind of stuff...not code.

Just only with the regular 00-FF RAM, so like 99.9% of the time, yea it'll be like 6C xx 00 (only the middle one being important.

The 6C type of jump can be very important for some jump tables.
Any game with IRQ's (megaman 3-6 for example) depend on that whole 6C thing to know where to go for any individual IRQ thingy.

And especially how to jump to enemy/boss AI. All starts by looking at those big tables for jumping to their code.

You know that from your experience with mm4. Like a enemy has it's code at B925, and it uses the 6C jump to get to it.

infidelity
Posted on 06-25-11 10:15 AM (rev. 2 of 06-25-11 10:22 AM) Link | Quote | ID: 144101


Fuzz Ball
Level: 66

Posts: 181/968
EXP: 2367964
Next: 93887

Since: 05-24-07

Last post: 958 days
Last view: 814 days
Cant you do the exact same thing with 4Cxxxx as it goes with jumping to AI and IRQ code and what not. Does 6Cxxxx really need to be used to do specific jumps, cause i just keep thinking 4C can do it too. 6C loads registers for adrss, 4C you enter manual.

Kawa
Posted on 06-25-11 10:26 AM Link | Quote | ID: 144102


CHIKKN NI A BAAZZKIT!!!
80's Cheerilee is best pony
Level: 138

Posts: 4861/5344
EXP: 30943720
Next: 719261

Since: 02-20-07
From: The Netherlands

Last post: 4497 days
Last view: 2633 days
Imagine an offset table filled with 16-bit values. To jump to a given entry n in the table, load the (n*2)th value into the registers, then call 6C on those registers.

This works for any table, just point out which one first.

4C works only for that specific hardcoded offset.

____________________
Wife make lunch - Shampoo
Opera - give it a spin
Spare some of your free time?
<GreyMaria> I walked around the Lake so many goddamn times that my sex drive was brutally murdered
Kawa rocks — byuu

Main - ROM Hacking - Questions on PHA, PLA, Transfers, and the JMP thats 6C0000 New thread | New reply

Acmlmboard 2.1+4δ (2023-01-15)
© 2005-2023 Acmlm, blackhole89, Xkeeper et al.

Page rendered in 0.029 seconds. (339KB of memory used)
MySQL - queries: 47, rows: 72/73, time: 0.016 seconds.