Skip to content

Registers

Ty edited this page Mar 28, 2024 · 2 revisions

Register Usage Notes

Arguments and Modifiers

Register parameters are separated into two types, 'arguments' and 'modifiers'. This was a poor naming choice, and should be changed in the future.
In the context of scripting with gifscript, these two parameters are position independent of one another.
For example, the following is valid gifscript, despite mixing modifiers (modulate and ct24) and arguments (number literals):

// Set TEX0 to modulate, texture address is 0x1000, format is ct24, buffer width is 10, TW/TH is 7,7
tex0 modulate 0x1000 ct24 10 7,7

(In Order)

In some cases, a register can receive multiple of the same literal. I've done my best to try and document this, but this works like a stack, where each literal is 'pushed' to the register. If a literal is noted with (In Order), this means the first literal pushed is treated as the first literal listed, then the second and so on.

PRIM

Tokens:

  • prim

Arguments:

none

Modifiers:

  • Primitive Types (Only one active)
    • point
    • line
    • linestrip
    • triangle,tri
    • trianglestrip,tristrip
    • trianglefan,trifan
    • sprite,rect,quad
  • General Modifiers
    • gouraud -> Gouraud Shading
    • fogging,fog -> Fogging Enable
    • aa1 -> Anti Aliasing
    • texture,textured -> Texturing enable

RGBAQ

Tokens:

  • rgbaq
  • rgba

Arguments:

  • vec3 (R,G,B) -> Alpha is set to 0xff (may be changed to 0x7f in the future)
  • vec4 (R,G,B,A)

Modifiers:

none

UV

Tokens:

  • uv

Arguments:

  • vec2 (U,V) -> gifscript automatically shifts U and V. There is no support for half-pixel offsets currently.

Modifiers:

None

XYZ2

Tokens:

  • xyz2

Arguments:

  • vec3 (X,Y,Z) -> gifscript automatically shifts X and Y. There is no support for half-pixel offsets currently.

Modifiers:

none

TEX0

Tokens:

  • tex0

Arguments:

  • integer (In order)
    • TBP
    • TBW
    • TW
    • TH
  • vec2 (TW,TH)*
  • You can optionally set TW and TH by pushing integers, or by passing a VEC2

Modifiers:

  • Texture Formats (Only one active)
    • ct32,psmct32 -> RGBA32
    • ct24,psmct24 -> RGB24
    • ct16,psmct16 -> RGBA16
  • Texture Functions (Only one active)
    • modulate -> View GS documentation
    • decal -> Sample the texture as is (Default)
    • highlight -> View GS documentation
    • highlight2 -> View GS documentation

FOG

Tokens:

  • fog

Arguments:

  • integer (F)

Modifiers:

none

FOGCOL

Tokens:

  • fogcol

Arguments:

  • vec3 (R,G,B)

Modifiers:

none

SCISSOR

Tokens:

  • scissor

Arguments:

  • vec4 (SCAX0,SCAX1,SCAY0,SCAY1)

Modifiers:

none

SIGNAL

Tokens:

  • signal

Arguments:

  • integer (ID) <-- IDMASK is set to ~0
  • vec2 (ID,IDMSK)

Modifiers:

none

FINISH

Tokens:

  • finish

Arguments:

  • integer (IGNORED)
  • TODO: none

Modifiers:

none

LABEL

Tokens:

  • label

Arguments:

  • integer (ID) <-- IDMSK is set to ~0
  • vec2 (ID,IDMSK)

Modifiers:

none