Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A comprehensive guide to F3DZEX/F3DEX2 Display Lists
My intention for this post is to, over a period of time, compile my knowledge of N64 Zelda Display Lists into a guide that hopefully, everyone can understand. This is by no means a display list porting tutorial, but for anyone wishing to learn how to do that, this should prove to be valuable information. Keep in mind that I will update this over a period of time--I'm not writing everything at once. Without further delay: Zelda 64 Display Lists!

I should start with a simple definition for what a "F3DZEX" is. 

Quote:The N64's Reality Co-Processor (specifically, the RSP component) is reprogrammable, allowing developers to add extra/custom functionality to the Co-processor. Microcode (sometimes appearing as "ucode", standing for μcode) is thus the set of instructions that can be loaded/executed on the RSP.

F3DZEX is nothing more than one of these microcodes. It stands for "Fast 3D Zelda Extended".

Quote:F3DZEX is a 3D based graphics microcode, and the primary graphics microcode used by the Zelda 64 engine. F3DZEX is based off of the F3DEX2 microcode, and actually shares the same graphics binary interface.

G[raphics] B[inary] I[nterface] is a collection of 64 bit commands which instruct both the RSP and the RDP units.

There are no major differences between 2.06H and 2.08J of the F3DZEX microcode

The above quotes are taken from the cloudmodding wiki.

Next what a display list is. Think of it as a packet of information--instructions, if you will. The game reads these instructions to figure out how to process model and texture data. Said list of instructions is sure to include what model data and what texture data they are relevant to. It's a very specific format.

Throughout this tutorial, I will refer to these instructions in two ways: Their internal opcode name (What they're called in the software development kit) and what we as a modding community have learned to refer to them as. 

In the first section of this tutorial, you will learn how to locate a binary (when I say binary, I mean "raw hex data") display list within a file, yes, by using a hex editor. The most surefire way is to look for the end of one.

See to the opcode G_ENDDL (G for "Graphics" and "ENDDL" for "End Display List"). This is otherwise known as a "DF Command". In hexadecimal, it looks like this: 
DF 00 00 00 00 00 00 00
All instructions are exactly eight bytes (0x08 bytes, or 64 bits) long.
I'm making an assumption here that your hex editor is aligned to sixteen-byte (0x10) strings. This would place out G_ENDDL instruction under either column 00 or column 08. If you've found one of these, then congratulations! You've taken the first step to understanding F3DZEX. You've (probably) found the end of a display list.
Finding the beginning of a display list, programmatically, is a little trickier. Technically, display lists can "start" with almost any instruction. Most commonly, you'll see them start with the following opcodes: G_MTX, G_DL, G_RDPPIPESYNC, and G_TEXTURE. (0xDA, 0xDE, 0xE7, or 0xD7 commands, respectively.) Most of the time, especially in Ocarina of Time, you will see display lists start with G_RDPPIPESYNC (0xE7 Commands), but that does not explicitly mark the start of a display list and it would do you well to remember that.
Anyway, to find the beginning of a display list, you basically just have to work your way backward from the DF command you found earlier until you see one of those instructions. I'll refer to object_sk2.zobj for this example.
The first proper DF command you will find starts at 0x5718 in object_sk2.zobj. Working your way backward you will find that the start of this display list is at 0x53D0 and in this case, it happens to be an E7 command. You can tell that this is the start of the display list because the eight bytes before it doesn't look anything like a display list opcode. 
00 BB FF DD 00 00 78 FF <- Is not valid display list data, it's most likely vertex data which
we will get into later.
Congratulations. You've found your very first display list. We can define it as such:
Start: 0x53D0
End: (0x5718 + 0x08) (0x5720) ; We add eight because the DF command is eight bytes long.
We will refer to this as display list 0x0053D0 in object_sk2.zobj for future reference. 
Next: Breaking this down into its basic components.
I think me is smarter?
Heh, I'm looking forward to the rest of your guide! I wonder what will be covered in the future. Smile

Forum Jump:

Users browsing this thread:
1 Guest(s)