Title: Bank 0C event scripting code(WIP) Post by: Jigglysaint on June 26, 2010, 06:07:47 PM This is an partical list of the various opcodes that are used in bank 0C for scripting purposes:
84 xx xx yy yy - Spawn event at yy yy 88 xx xx - Interaction co-ordinates are now this 98 xx xx - Display text. B0 xx - Check dungeon room flag B1 xx - Set dungeon room flag B6 xx - set global event flags. How it works is that it's in sets of 16 bits. For example, values 00 to 0F will set bits for C6D0 and C6D1. Value 00 to 07 set the 8 bits in the first ram spot, and values 08 to 0F set the value for the second spot. 0F is the value for the level 3 turnstile event to be triggered, and that translates into C6D1(80). For the value, the upper nybble indicates which 16 bits to reference. 30 will set the bit that cleans the ocean because 0 sets bit 0, and 3 means it's the third pair. B6 will set the value during an event, but in other cases, both to write and to check, the value is loaded using 3E(right into A) and then it goes to a subroutine at 31F3. For example, the code to set the Maku Gate is 12, and somewhere in bank 10 is a code that indeed does that. The other in the global scripts in bank 04 checks for that value the same way. CD - perform following event if item flag has not been set D3 yy xx xx - Check for switch index. For example, 01 would mean check to see if switch 01 has been pressed. D5 xx xx yy - Check memory location for exact value, exit script on false DD xx xx - Spawn an item E0 - Load ASM routine from bank 15 E3 xx - Load sound effect E8 - Set tile at event location. F6 - Check monster clear flag Title: Re: Bank 0C event scripting code(WIP) Post by: Lin on July 01, 2010, 05:25:18 AM Wow, this is surely going to come in handy. Thanks!
And I think the reason I couldn't find the "checking code" for the opcodes is because it probably loads the accumulator with the opcode and does RST 00, which is what the game does with everything else. Title: Re: Bank 0C event scripting code(WIP) Post by: Lin on October 22, 2010, 01:20:05 AM I've been debugging with various opcodes, and 83 catches my attention. It calls procedure 486, which I could've sworn is used for loading palettes, but also seems to be loaded with other things. Basically what it does is reads a 3 bytes pointer to read data from and throws 0x100 bytes of it into 0xC300. I'm not sure why, or what I'll call it. Other than that, 80 sets the interaction is enabled (atleast that's what I have marked for Dx44), 81 sets Dx45, and 82 I believe is not used.
Also, F5 and F6 seem to be the same thing, except something gets added to an address based on the lower nybble in the opcode. Are you sure F6 checks the monster clear flag? It doesn't seem like it, because something gets loaded and that gets written to Dx46. |