User Tools

Site Tools


super_mario_64:fast3d_display_list_commands

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
super_mario_64:fast3d_display_list_commands [2019/03/16 17:52]
David Fixed [BC: G_MOVEWORD]
super_mario_64:fast3d_display_list_commands [2022/05/31 02:34] (current)
David [B2: G_RDPHALF_CONT]
Line 29: Line 29:
 Takes a block of memory from an address and puts it in the location pointed to by an index and an offset. Takes a block of memory from an address and puts it in the location pointed to by an index and an offset.
  
-''​03 ​[<color #​ff1010>​nn</​color>​] ​[<color #ff7f27>oo</​color>​] [<color #00a2e8>ii</​color>​] [<color #​A946F2>​aa aa aa aa</​color>​]''​+''​03 [<color #ff7f27>ii</​color>​] [<color #ff1010>nnnn</​color>​] [<color #​A946F2>​aa aa aa aa</​color>​]''​
  
-| <color #ff1010>n</​color>​ | (((//Size in bytes of memory to be moved//) >> 3)+1)*8 ​+| <color #ff7f27>i</​color>​ | Index into table of DMEM addresses ​
-| <color #ff7f27>o</​color>​ | Offset from indexed base address (*8) | +| <color #ff1010>n</​color>​ | Size in bytes of memory to be moved |
-| <color #​00a2e8>​i</​color>​ | Index into table of DMEM addresses ​|+
 | <color #​A946F2>​a</​color>​ | Segmented address of memory | | <color #​A946F2>​a</​color>​ | Segmented address of memory |
  
-<color #00a2e8>​**i**</​color>​ is an index into a table of addresses of DMEM. Given enumerations for <color #00a2e8>​**i**</​color>​ are: +<color #ff7f27>​**i**</​color>​ is an index into a table of addresses of DMEM. Given enumerations for <color #ff7f27>​**i**</​color>​ are:
-  * <color #​22b14c>​G_MV_MMTX</​color>​ = 2 +
-  * <color #​22b14c>​G_MV_PMTX</​color>​ = 6 +
-  * <color #​22b14c>​G_MV_VIEWPORT</​color>​ = 8 +
-  * <color #​22b14c>​G_MV_LIGHT</​color>​ = 10 +
-  * <color #​22b14c>​G_MV_POINT</​color>​ = 12 +
-  * <color #​22b14c>​G_MV_MATRIX</​color>​ = 14+
  
-Note however that only <color #22b14c>VIEWPORT</​color>​<color #22b14c>LIGHT</​color>​, and <color #22b14c>MATRIX</​color> ​are used by any of the macros given to programmers.+  * <color #22b14c>G_MV_VIEWPORT</​color> ​= 0x80 
 +  * <color #22b14c>G_MV_LOOKATY</​color> ​= 0x82 
 +  * <color #22b14c>G_MV_LOOKATX</​color> ​= 0x84 
 +  * <color #​22b14c>​G_MV_L0</​color>​ = 0x86 
 +  * <color #​22b14c>​G_MV_L1</​color>​ = 0x88 
 +  * <color #​22b14c>​G_MV_L2</​color>​ = 0x8a 
 +  * <color #​22b14c>​G_MV_L3</​color>​ = 0x8c 
 +  * <color #​22b14c>​G_MV_L4</​color>​ = 0x8e 
 +  * <color #​22b14c>​G_MV_L5</​color>​ = 0x90 
 +  * <color #​22b14c>​G_MV_L6</​color>​ = 0x92 
 +  * <color #​22b14c>​G_MV_L7</​color>​ = 0x94 
 +  * <color #​22b14c>​G_MV_TXTATT</​color>​ = 0x96
  
-Note: In Super Mario 64, this is mainly used to load vector lighting ambient/​diffuse RGBA values.\\  +Note: <color #​22b14c>​G_MV_TXTATT</​color>​ is not used by any of the macros given to programmers. 
-Example: Loads diffuse RGBA from 0x0 in Segment 0x0E; loads ambient ​RGBA from 0x08 in Segment 0x0E + 
-  03 86 00 10 0E 00 00 00 +In Super Mario 64, this is mainly used to load vector lighting ambient/​diffuse RGBA values. 
-  03 88 00 10 0E 00 00 08+  
 +The ambient ​light is loaded using G_MV_L1 (0x88), and the segment address points to 8 bytes defining the ambient color RGB value. 
 + 
 +  03 88 00 10 0E 00 00 00 // This loads the ambient light from segment address 0x0E000000. 
 +   
 +  At address 0x0E000000:​ 
 +  FF FF FF 00 FF FF FF 00 // Sets the ambient color to be white. The zeroes here don't matter. 
 +   
 +  Note 1: The last 4 bytes should match the first 4 since it is a copy of the RGB color. 
 +  Note 2: The 4th and 8th bytes are just padding; they don't represent the alpha value. 
 + 
 +The diffuse light is loaded using G_MV_L0 (0x86), and the segment address points to 16 bytes defining the color RGB value and normalized direction that the light is coming from. 
 + 
 +  03 86 00 10 0E 00 00 08 // This loads the diffuse light from segment address 0x0E000008. 
 +   
 +  At address 0x0E000008:​ 
 +  7F 7F 7F 00 7F 7F 7F 00 // Sets the diffuse light color to be gray. 
 +  28 28 28 00 00 00 00 00 // SM64 usually sets the normalized direction as (0x28, 0x28, 0x28) 
 +   
 +  Note: All the zeroes here are for padding, since diffuse lights are 16-byte aligned. 
 + 
 +The normalized direction is calculated using the following formula: 
 +  First calculate variable '​d'​ as: d = 127/​square_root(x*x + y*y + z*z) 
 +  Then the normalized direction is: Xn = x*d; Yn = y*d; Zn = z*d 
 +   
 +  Note: Xn, Yn, and Zn should be signed bytes.
  
 ---- ----
Line 82: Line 111:
 ==== B2: G_RDPHALF_CONT ==== ==== B2: G_RDPHALF_CONT ====
 Acts as an indicator that the command continues with the given lower word. This is used only when operators longer than 64bits are in use. Acts as an indicator that the command continues with the given lower word. This is used only when operators longer than 64bits are in use.
 +
 +Note: When this command gets executed, it will immediately send all the previous data (from RDPHALF_1 and/or RDPHALF_2) to the RDP.
  
 ''​B2 00 00 00 [<color #​ff7f27>​CC CC CC CC</​color>​]''​ ''​B2 00 00 00 [<color #​ff7f27>​CC CC CC CC</​color>​]''​
Line 256: Line 287:
  
 ==== BD: G_POPMTX ==== ==== BD: G_POPMTX ====
-Pops num matrices ​from the stack specified by modelview matrix ​stack.+Pops a matrix ​from the stack.
  
-''​D8380002 <color #​00a2e8>​aaaaaaaa</​color>​''​ +''​BD000000 00 00 00 00''​
- +
-| <color #​00a2e8>​a</​color>​ | The number of matrices to pop |+
  
 +Removes the top matrix from the matrix stack in dmem
 ---- ----
  
Line 453: Line 483:
 Sets the scissoring rectangle. Sets the scissoring rectangle.
  
-''​ED [<color #​00a2e8>​xx x</​color>​][<​color #​22b14c>​y yy</​color>​] [<color #​ff7f27>​m</​color>​][<color #​ed1c24>​vv v</​color>​][<​color #​B755FF>​w ww</​color>​]''​+''​ED [<color #​00a2e8>​xx x</​color>​][<​color #​22b14c>​y yy</​color>​] ​0[<color #​ff7f27>​m</​color>​] [<color #​ed1c24>​vv v</​color>​][<​color #​B755FF>​w ww</​color>​]''​
  
 | <color #​00a2e8>​x</​color>​ | Upper-left X coordinate of rectangle | | <color #​00a2e8>​x</​color>​ | Upper-left X coordinate of rectangle |
Line 509: Line 539:
 Sets the texture coordinates and size Sets the texture coordinates and size
  
-''​F2 ​00 00 00 00 [<color darkred>​WW W</​color>​][<​color ​darkgreen>H HH</​color>​]''​+''​F2 [<color darkred>SS S</​color>​][<​color darkgreen>​T TT</​color>​] 0[<color #​00a2e8>​I</​color>​] [<color purple>WW W</​color>​][<​color ​darkcyan>H HH</​color>​]''​
  
 +| <color darkred>​SSS</​color>​ | Upper-left corner of texture to load, S-axis |
 +| <color darkgreen>​TTT</​color>​ | Upper-left corner of texture to load, T-axis |
 +| <color #​00a2e8>​I</​color>​ | Tile descriptor to load into |
 | <color darkred>​W</​color>​ | (width - 1) << 2 | | <color darkred>​W</​color>​ | (width - 1) << 2 |
 | <color darkgreen>​H</​color>​ | (height - 1) << 2 | | <color darkgreen>​H</​color>​ | (height - 1) << 2 |
Line 843: Line 876:
 |in_bufp ​   |$22|| |in_bufp ​   |$22||
 |zero       |$0 || |zero       |$0 ||
 + 
 ---- ----
 ===== References ===== ===== References =====
super_mario_64/fast3d_display_list_commands.1552758761.txt.gz · Last modified: 2019/03/16 17:52 by David