Well the zeros are there for a reason. Let's look at the entire hex information that encapsulates the northern toad town shop. The item slots are stored in memory linearly, one after another. There's no room for control codes in between the slots. That's not to say they aren't somewhere else nearby, but this is exactly where they are. The zeros are just part of how the variables are stored in memory. Items have four bytes, prices have two bytes. It can't be any other way because that's how the shop data is laid out.
Here are the first two item slots, separated by the || :
[00 00 00 98] [00 00 00 05] [00 24] [00 2A] || [00 00 00 8F] [00 00 00 0A] [00 24] [00 26]
00 00 00 98 is a fright jar. 00 00 00 05 is the price (5 coins). 00 24 is the text group (always 24 for shop items). 00 2A is the descriptor. Changing this changes what shows up on the item description.
00 00 00 8F is a sleepy sheep. 00 00 00 0A is the price (10 coins). Same text group. Different descriptor for a different item.
There is no other information for an item slot than those four attributes. So, why do we need to know about control codes regarding how the game lets you buy items if that's all we want to do with them anyways? I mean, if I wanted to make it possible to change how the shop actually functions, then yeah, I'd probably need to find control codes for that sort of thing.
EDIT: In regards to control codes, however, can I pick your brain (or anybody else's)?
I'm trying to figure out a fairly common control code. Check this out:
Format : 02 FE 36 3C XX 00 00 YY YY 00 00 00 ZZ
XX = ??? (Usually 80-8F)
YY = Item ID
ZZ = Text Group (24)
02 FE 36 3C 80
A0F69C : "Lucky Star"
7F5C64 : "First Degree Card"
7F5CA0 : "Second Degree Card"
7F5CDC : "Third Degree Card"
7F5D18 : "Fourth Degree Card"
7F5D54 : "Diploma"
9E5618 : "Koopa Legends"
The same code of [02 FE 36 3C 80] seems to appear for all "key items" you obtain. In my searching, however, there are other control codes that have 81-8F. Sometimes the 02 in front is different as well (SOMETIMES, there are multiple control codes in a row
, like [FE 36 3C 80] [FE 36 3C 81] [FE 36 3C 82] . Often times, the last byte goes up sequentially like this. BUT, it does seem for getting key items, the control code 02 FE 36 3C 80 is always used. So...what does this control code actually mean, and what do the variations
mean? If I could figure that out, I could add this information into the document.
I have a few ideas to as what the control codes mean. Perhaps ending in 80 means you are receiving the item, and 81-8F have to do with other aspects of items. Or maybe the control code doesn't have to do with receiving or using items at all?
EDIT2: More information! See Reply #13 : http://www.romhacking.net/forum/index.php/topic,17948.0.html
Notice the control code for enemy attacks as well. The last four bytes are [FE 36 3C 8X]. So...the plot thickens.
EDIT3: More thoughts, cause why not:
If it's a control code, that means its part of the MIPS instruction set right? Cause that's what the N64 uses? If so, I suspect byteswapping the ROM would definitely be a bad idea...cause that would be confusing if you were jumping to addresses. Here's the data for when you obtain the First Degree Card (The non-byteswapped version):
02 00 36 FE 80 3C 00 00 0A 00 00 00 24
I did some research on the instruction set, looking for opcodes. It turns out, the JUMP opcode has the following format:
[6 bits for the op code][26 bits for the address to jump to]
The opcode for J (Jump) is 000010, aka "2" in binary/hex.
Except I'm confused because it's 6 bits for the op code and 26 bits for the address. Not being in multiples of 4 is messing with my head
In the datasheet it says the following (instr_index is the 26 bit address):
The low 28 bits of the target address is the instr_index field shifted left 2bits. The remaining upper bits are the corresponding
bits of the address of the instruction in the delay slot (not the branch itself).
Jump to the effective target address. Execute the instruction that follows the jump, in the branch delay slot, before
executing the jump itself.