attempt at building a cd image (failed)
[psx_test1] / src / startup.S
1 #include <regdef.h>
2
3         .equ REG_BASE, 0x1f80
4         .equ REG_GP0, 0x1810
5         .equ REG_GP1, 0x1814
6
7         .set noreorder
8         .section .startup
9
10         .extern main
11
12         .globl _start
13 _start:
14         lui a0, REG_BASE
15
16         # setup screen mode
17         sw zero, REG_GP1(a0)    # GP1 0: reset
18
19         li t0, 0x03000000       # GP1 3: display enable
20         sw t0, REG_GP1(a0)
21         li t0, 0x08000009       # GP1 8: display mode (320x240 15bpp PAL)
22         sw t0, REG_GP1(a0)
23         li t0, 0x06c60260       # GP1 6: horiz. display range (608-3168)
24         sw t0, REG_GP1(a0)
25         li t0, 0x07049c1f       # GP1 7: vert. display range (31-295)
26         sw t0, REG_GP1(a0)
27
28         li t0, 0xe1000600       # GP0 e1: draw mode (draw allowed & dither enable)
29         sw t0, REG_GP0(a0)
30         li t0, 0xe3000000       # draw area top left (0, 0)
31         sw t0, REG_GP0(a0)
32         li t0, 0xe4041d3f       # draw area bottom right (319,263)
33         sw t0, REG_GP0(a0)
34         li t0, 0xe5000000       # draw offset (0, 0)
35         sw t0, REG_GP0(a0)
36
37         # clear screen
38         li t0, 0x02302010       # cmd 2: fill area (BBGGRR)
39         sw t0, REG_GP0(a0)
40         sw zero, REG_GP0(a0)    # ... top left 0,0 (YYYYXXXX)
41         li t0, 0x00ef013f       # ... size 319x239 (HHHHWWWW)
42         sw t0, REG_GP0(a0)
43
44         # draw gouraud triangle
45         li t0, 0x30ff0000       # cmd 30: draw gouraud triangle (+BBGGRR vert0)
46         sw t0, REG_GP0(a0)
47         li t0, 160 | (16 << 16) # ... vertex(160, 16)
48         sw t0, REG_GP0(a0)
49
50         li t0, 0x0000ff00       # ... color vert1
51         sw t0, REG_GP0(a0)
52         li t0, 32 | (180 << 16) # ... vertex(32, 180)
53         sw t0, REG_GP0(a0)
54
55         li t0, 0x000000ff       # ... color vert2
56         sw t0, REG_GP0(a0)
57         li t0, 280 | (220 << 16) # ... vertex(220, 280)
58         sw t0, REG_GP0(a0)
59
60         #jal main
61         nop
62
63 0:      b 0b
64         nop
65
66 # vi:ts=8 sts=8 sw=8 ft=mips: