MIPS Assembly programming for
the Playstation 1 (PS1/PSX)
The Playstation was Sony's first home
console, While inferior in some ways to the more powerful N64, the
Playstations huge storage capability, combined with an impressive
game library saw the Playstation become the most popular console of
the period, catapulting the playstation to the top of the console
market.
|
|
|
|
Cpu |
33.87 mhz R3000 (MIPS I) |
Ram |
2MB |
Video |
1MB VRAM |
Resolution |
256x224 / 320x240 / 640x480 |
|
|
Documentation
Nocash PSXSPX Playstation
Specifications
Memory Map
KUSEG |
KSEG0
(Cached) |
KSEG1
(Uncached) |
KSEG2
(IO Ports) |
Size |
Purpose |
0x00000000 |
0x80000000 |
0xA0000000 |
-- |
2048K
|
Main RAM (first 64K reserved for
BIOS) |
0x1F000000 |
0x9F000000 |
0xBF000000 |
-- |
8192K |
Expansion Region 1 (ROM/RAM) |
0x1F800000 |
0x9F800000 |
-- |
-- |
1K |
Scratchpad (D-Cache used as Fast
RAM) |
0x1F801000 |
0x9F801000 |
0xBF801000 |
-- |
8K |
I/O Ports |
0x1F802000 |
0x9F802000 |
0xBF802000 |
-- |
8K |
Expansion Region 2 (I/O Ports) |
0x1FA00000 |
0x9FA00000 |
0xBFA00000 |
-- |
2048K |
Expansion Region 3 (whatever
purpose) |
0x1FC00000
|
0x9FC00000
|
0xBFC00000
|
-- |
512K |
BIOS ROM (Kernel) (4096K max) |
-- |
-- |
-- |
0xFFFE0000
|
0.5K |
I/O Ports (Cache Control) |
Gpu Commands
Written to port 0x1F801810
Function |
Byte |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Clear
Cache |
0 |
0x01 |
0 |
Function |
Byte |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Set
Screen Width |
0 |
0x06 |
End X |
Start X |
Function |
Byte |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Send
image to Framebuffer |
0 |
0xA0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CPU
to VRAM |
1 |
Y |
X |
|
2 |
H |
W |
|
3 |
Pixel 2 |
Pixel 1 |
|
.. |
.. |
... |
|
n |
Pixel n*2+1 |
Pixel n*2 |
Function |
Byte |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Fill
Area |
0 |
0x02 |
Color |
|
1 |
Y |
X |
|
2 |
H |
W |
Function |
Byte |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Copy
Rectangle |
0 |
0x80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VRAM
to VRAM |
1 |
SY |
SX |
|
2 |
DY |
DX |
|
3 |
H |
W |
Function |
Byte |
31 |
30 |
29 |
28 |
27 |
26 |
25 |
24 |
23 |
22 |
21 |
20 |
19 |
18 |
17 |
16 |
15 |
14 |
13 |
12 |
11 |
10 |
9 |
8 |
7 |
6 |
5 |
4 |
3 |
2 |
1 |
0 |
Get
image from Framebuffer |
0 |
0xC0 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VRAM
to CPU |
1 |
Y |
X |
|
2 |
H |
W |
read
from GPUREAD port |
3 |
Pixel 2 |
Pixel 1 |
|
.. |
.. |
... |
|
n |
Pixel n*2+1 |
Pixel n*2 |
Screen Memory
Each pixel is represented by one BIG ENDIAN word, in the format %-BBBBBGGGGGRRRRR
Joypad Bits
We want to start the joypad reading routine.
First we set up a valid stack pointer, Next we're going to call the
bios function at address 0x000000B0
The command is stored in register T1, A1,A2,A3 and A4 contain the
parameters
We point A0 and A2 to 'Joydata'... once we perform these two bios
calls, the JoyData memory will automatically be updated with the
data from the joypad
|
|
The format of the bits in 'JoyData are shown below:
|
Bits |
Byte
|
7 |
6
|
5
|
4 |
3
|
2
|
1
|
0
|
0 |
N/A |
1 |
0x41 �A� |
2 |
0x5A �Z� |
3 |
LEFT |
DOWN |
RGHT |
UP |
START |
1 |
1 |
SELECT |
4 |
SQUARE |
X |
O |
TRIANGL |
R1 |
L1 |
R2 |
L2 |
Endian
The N64 is BIG ENDIAN
the PSX is LITTLE ENDIAN
| |
Buy my Assembly programming book on Amazon in Print or Kindle!
Available worldwide! Search 'ChibiAkumas' on your local Amazon website!
Click here for more info!
|