Skip to main content TerryFunggg Blog

How to Read the Packets Command on Psx-Spx

How to read the Command on psxspx

For GPU Display Control Commands (GP1) - Display mode as example:

Sending Packets:

Packets structure: Command + Params (32bit)

  • 0xCCPPPPPP

Command:

asm code snippet start

0x00   ; Reset GPU
0x03   ; Display enable
0x08   ; Display mode
0x06   ; Horizontal display range
...

asm code snippet end

Packets:

code snippet start

GP1(08h) - Display mode

  0-1   Horizontal Resolution 1     (0=256, 1=320, 2=512, 3=640) ;GPUSTAT.17-18
  2     Vertical Resolution         (0=240, 1=480, when Bit5=1)  ;GPUSTAT.19
  3     Video Mode                  (0=NTSC/60Hz, 1=PAL/50Hz)    ;GPUSTAT.20
  4     Display Area Color Depth    (0=15bit, 1=24bit)           ;GPUSTAT.21
  5     Vertical Interlace          (0=Off, 1=On)                ;GPUSTAT.22
  6     Horizontal Resolution 2     (0=256/320/512/640, 1=368)   ;GPUSTAT.16
  7     "Reverseflag"               (0=Normal, 1=Distorted)      ;GPUSTAT.14
  8-23  Not used (zero)

code snippet end

The most left column is pos, the third column is the bit value

If we want to send a Display mode command,

For example set display mode 640x480, 60Hz, 15bit, Vertical Interlace on(Reverseflag not use):

code snippet start

bit: 00100111
--------------
pos: 76543210

code snippet end

In this example we want width as 640, in manual first line it say:

“0-1 Horizontal Resolution 1 (0=256, 1=320, 2=512, 3=640)”

0-1 means on the byte the most right side will represent the Width resolution

00 mean 256, 01 mean 320, 10 mean 512, 11 mean 640. So the right side at position 0 and 1 is 11.

The position 2 is “Vertical Resolution”, we want 480, so is ‘1’ on position 2

We want 60Hz, in position 3 is 0. And so on.

Noticed that GP1(08h) - Display mode - 08h, which mean 0x08 + hex number.

So as our config: 00110111 change to decimal is 55.

55 change to Hexadecimal is 37

so the final packets send to GP1 is:

asm code snippet start

li $t1, 0x08000037

asm code snippet end