What does the 2 first bits in a RDP command represent?

Discuss RCP-related matter here.
Post Reply
User avatar
Narann
Posts: 154
Joined: Mon Jun 16, 2014 4:25 pm
Contact:

What does the 2 first bits in a RDP command represent?

Post by Narann » Wed Oct 21, 2015 10:27 am

Edit: As I was writting this post, I finally find the answer by myself, so I share anyway.

A RDP command always starts by this:

Code: Select all

[Command format: 2bits|Op code: 6bits|Arguments...]
The first bit seems to state if the command is "self contain" or need a memory access.
The second bit seems to state if its a RDP command or not.

So the command format represents those values:

00 - DMA: States one of the command argument is a pointer and so, need a DMA transfer to store those data into the DMEM.
01 - I suspect this one mean RDP command with DMA transfer (aka, need a memory transfer first: TMEM?).
10 - Immediate: States the command arguments fits into the 64bits and does not need any memory transfer (and so, can be executed "immediatly").
11 - I don't really understand this. A RDP Immediate command, meaning it could be send to the RDP directly without look for something else.

What is not clear yet:

Does the second bit states for a RDP-only command or a RCP command (implying RSP+RDP)?

I guess the second point is the good one.

What I think:

When the N64 hardware decode a command (pseudo code):

Code: Select all

w0 << the command as a WORD (64 bits)

if first_bit: # immediate mode!
  if second_bit:
    send_cmd_to(RCP, w0);
  else
    send_cmd_to(CPU, w0);
else # arf! DMA transfer require before send the command
  if second_bit:
    transfer_to(DMEM, w0);
    send_cmd_to(CPU, w0);
  else
    transfer_to(TMEM, w0);
    send_cmd_to(RCP, w0);
Such pseudo code can be easily wired up in hardware.

Am I right here?

User avatar
Narann
Posts: 154
Joined: Mon Jun 16, 2014 4:25 pm
Contact:

Re: What does the 2 first bits in a RDP command represent?

Post by Narann » Wed Oct 21, 2015 10:29 am

I quickly tested my assumptions on few commands and fall on this:
  • Set Other Mode: 00 - DMA, CPU
  • Set Blend Color: 11 - Immediate, RDP
  • Pipe Sync: 11 - Immediate, RDP
  • Load Sync: 11 - Immediate, RDP
  • Tile Sync: 11 - Immediate, RDP
  • Set Fog Color: 11 - Immediate, RDP
  • Set Scissor: 11 - Immediate, RDP
  • Set Z Image: 11 - Immediate, RDP
  • Set Color Image: 11 - Immediate, RDP
  • Set Fill Color: 11 - Immediate, RDP
  • Set Fill Rectangle: 11 - Immediate, RDP
Surprisingly, Set Other Mode command seems to need DMA. I really don't know why...

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest