Re: Gen III: Access Pokémon beyond the sixth slot sub-glitches.
Posted by: TheZZAZZGlitch
Date: 2016-05-12 17:58:06
1.a) Is it possible to make the console read code from only one word every double-word ?
Would there be a method (mainly having a certain quantity for every Code Item) to create code from PC Items in RS ?
Kind of. It's possible to write code with only x1 item quantities, because the opcode '0001' corresponds to a completely valid instruction 'lsl r0, r0, #0x4', which would have no effect if r0 is never used.
The problem would be storing data. The easy way of storing pointers/addresses in PC items would be gone. Loading any 32-bit constant would take 8 items (8 instructions - 4 8-bit loads and 4 shifts). The item count (and the amount of work to prepare the necessary items) would increase dramatically.
We should probably get consistent ACE on Emerald before trying R/S.
1.b) Else, the only way to store code in RS that I see is with Pokémon data (8 bytes per 8 bytes).
What would the 8 bytes of code look like ? (If it doesn't bother too much to work on that)
The bytes would obviously vary depending on what we want to do. But the last two bytes would always be:
[tt]E0 26[/tt].
The instruction is "b $+0x50". It just jumps 0x50 bytes forward.
If this sequence of bytes happened to be hard to obtain, some other instructions would work as well: D3 26 (bcc $+0x50 - jumps on unset carry flag), D9 26 (bls $+0x50 - jumps on unset carry flag or set zero flag), D7 26 (bvc $+0x50 - jump on no overflow).
2) I tried your setup to execute overworld scripts, but things didn't work well.
Instead of having credits executed / an item obtained / nothing, I got a message box full of OE (RAM was overwritten by 0x101C).
For that, I used Glitch Move 0x1608 (pointer at 0x02030400), with a jump towards 0x02025E98 (03 99 5E 02 02 FF FF 08), then copied your code to use overworld scripts at 0x02025E98.
I tried it with 25 01 13 02 (special 0x113, end)), a paste of the script to get an item, 02 (end), and it always ended up with a message box and RAM being overwritten.
The code probably attempted to execute a garbage script. The script pointer in my example was hardcoded to 0x0E0F14E8 - did you remember to change that?
The underlined part should be changed to where the script is stored (it could be in ROM, in RAM, or in the save data):
[tt]78 46 09 30 86 46 03 49 01 48 08 47 F0 BD XX XX E8 14 0F 0E F9 8E 09 08 25 13 01 02[/tt]
Also, in order to work, the code has to be 4-byte aligned (it must start at an address ending with either 0, 4, 8 or C).