Users browsing this thread: 1 Guest(s)
Addresses After Editing Events

#1
Posts: 6
Threads: 3
Thanks Received: 0
Thanks Given: 2
Joined: Jul 2020
Reputation: 0
Status
None
I've been browsing the help files on this page and looking through the tools available and had a question about editing the hex events.  I have never edited a ROM before but my previous experience with hex and assembly left me with a question:

If I edit an existing event by adding actions that were not previously there, won't the additional data shift everything after it forward however many bytes it added, thus causing all of their address references to be off?  Can you move it to the end of the file and update the event trigger address to preserve the integrity of the surrounding data?  Do you just overwrite any data that comes after it instead of shifting it (the tutorial screenshots seemed to be overwriting)?
  Find
Quote  

#2
Posts: 3,792
Threads: 270
Thanks Received: 755
Thanks Given: 384
Joined: Oct 2011
Reputation: 63
Status
Tissue-aware
Any event must start in the $CA-$CC banks because of what event offset can take NPCs / event triggers. However you can insert a B2 command in banks $CA-$CC that let you call an event routine elsewhere in the ROM and continue your event anywhere past bank $CC. And yes, normally you would overwrite the bytes when editing something instead of inserting them to not shift everything after.
  Find
Quote  
[-] The following 1 user says Thank You to madsiur for this post:
  • Fast Moon (07-20-2020)

#3
Posts: 6
Threads: 3
Thanks Received: 0
Thanks Given: 2
Joined: Jul 2020
Reputation: 0
Status
None
(07-20-2020, 09:29 AM)madsiur Wrote: Any event must start in the $CA-$CC banks because of what event offset can take NPCs / event triggers. However you can insert a B2 command in banks $CA-$CC that let you call an event routine elsewhere in the ROM and continue your event anywhere past bank $CC. And yes, normally you would overwrite the bytes when editing something instead of inserting them to not shift everything after.

Okay, thank you.  I saw the B2 command and wondered if that was good to use if I wanted to extend an existing event while preserving the integrity of the data surrounding it.
  Find
Quote  

#4
Posts: 3,792
Threads: 270
Thanks Received: 755
Thanks Given: 384
Joined: Oct 2011
Reputation: 63
Status
Tissue-aware
(07-20-2020, 06:12 PM)Fast Moon Wrote: I saw the B2 command and wondered if that was good to use if I wanted to extend an existing event while preserving the integrity of the data surrounding it.

Yes, that's its use. You just make room for 4 bytes in banks $CA-$CC, put those 4 bytes in the empty space where you jump to, then add your stuff and finish by a return byte ($FE).
  Find
Quote  



Forum Jump:

Users browsing this thread: 1 Guest(s)


Theme by Madsiur2017Custom Graphics by JamesWhite