Ha! I did know part of it! SEP and REP, 8-bit/16-bit how many values it loads at once... I just drive to slow and could have never explained it as pretty as m06 does.
That being said, that code at $9A6D, it kinda makes sense how it works, but I'd be guessing the whole way. By the way, where is this "Madsiur's custom event 83 readme"? I need to save that one.
As far as portable and reusable: Yeah, long as you treat it as an event command.
Least that's what I see it doing. Still don't fully get the "exit" though. Please correct me if I'm wrong, it has been known to happen. (The added comments to that block of code is what I'm talking about btw)
That being said, that code at $9A6D, it kinda makes sense how it works, but I'd be guessing the whole way. By the way, where is this "Madsiur's custom event 83 readme"? I need to save that one.
As far as portable and reusable: Yeah, long as you treat it as an event command.
Code:
F1/A049 C2 21 REP #$21
F1/A04B A5 E5 LDA $E5 (Load low and middle byte of currnt offset) (Load the location of where the command was used?)
F1/A04D 69 05 00 ADC #$0005 (Command + parameters length)(Account for length of command in order to return to byte after in the event of return)
F1/A050 85 E5 STA $E5 (Save in $E5)(Save the address for no-jump/return)
F1/A052 7B TDC (Transfer D to C)
F1/A053 E2 20 SEP #$20 (8 bit accum./memory)
F1/A055 65 E7 ADC $E7 (Add to A $E7)
F1/A057 85 E7 STA $E7 (Store A in $E7)
F1/A059 5C 6D 9A C0 JMP $C09A6D (Make a 5 bytes jump from the command number in the event)(Failed check,continue with normal script)
F1/A05D C2 20 REP #$20 (16 bit accum./memory)
F1/A05F A6 EC LDX $EC (Load parameter 2 and 3)
F1/A061 86 E5 STX $E5 (store the low and middle byte of the offset in $E5)(Load the desired JMP address "/0000" if check OK)
F1/A063 E2 20 SEP #$20 (8 bit accum./memory)
F1/A065 A5 EE LDA $EE (Load parameter 4) (Load "00/" of desired JMP address)
F1/A067 18 CLC (clear carry)
F1/A068 69 CA ADC #$CA (Add #$CA to the high byte of the offset) (Add CA to the high byte of address like other event commands)
F1/A06A 85 E7 STA $E7 (Store high byte of the offset in $E7)
F1/A06C 5C 6D 9A C0 JMP $C09A6D (Make the event branching/jumping effective)
Least that's what I see it doing. Still don't fully get the "exit" though. Please correct me if I'm wrong, it has been known to happen. (The added comments to that block of code is what I'm talking about btw)
The only true wisdom is knowing you know nothing.