We can decrease the Stack Pointer faster than X. We now set X to 0xA0 to be decreased to 0x8F, but we can use a trick here. We decrease Y from 0x00 all the way to 0xF9 to prepare for the write to $F9 Additionally, we now skip the A0 A0 at $8D, so Y is now usable. We write 0x20 to $86, which executes JSR $0000 for us without using the 4-byte block at the end. ![]() This is necessary because we can only write specific values to even addresses (using only X). We decrease $3F from 0x00 to 0xFF to execute even addresses after this point. No matter whether we execute odd or even addresses, we will hit the 0xFF at $0F (skipping over $10), then we will execute 0x00 at $12, and then 0xFF at $14 (skipping over $15 and $16), to assure we execute $17 every loop. Another preparation to skip over problematic addresses ($10 in this case). Since X is 0xFF, this decreases $0F from 0x00 to 0xFF. We want X to be odd so the second byte is different (it happens to do nothing here). Note how using C6 14 (DEC $14) as an instruction wouldn't have worked due to the 0x10 bit in 0x14 not being in 0xC6. This is done to (eventually) skip over the counter at $15 and the byte at $16, as 0xFF is a 3 byte instruction. X is 0x00, so this decreases $14 from 0x00 to 0xFF. The Stack Pointer is at 0x04, and just about to overwrite the NMI mode with a bad value. ![]() After both X and Y are usable, we can change their values and either use STX $ZZ,y or STY $ZZ,x to make the write. But we can make Y usable by somehow avoiding the A0 A0 block at $8D. ![]() To make that write, we need at least two registers.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |