abstract width, height, and depth
This commit is contained in:
parent
d5bfc3482f
commit
48939bb3d4
2 changed files with 39 additions and 6 deletions
37
dlist.asm
37
dlist.asm
|
@ -1,6 +1,10 @@
|
||||||
// write some F3DZEX instructions to a0
|
// write some F3DZEX instructions to a0
|
||||||
// clobbers t0,t1,a0
|
// clobbers t0,t1,a0
|
||||||
|
|
||||||
|
constant WIDTH(320)
|
||||||
|
constant HEIGHT(240)
|
||||||
|
constant HICOLOR(0)
|
||||||
|
|
||||||
define dpos(0)
|
define dpos(0)
|
||||||
|
|
||||||
macro WriteDL(evaluate L, evaluate R) {
|
macro WriteDL(evaluate L, evaluate R) {
|
||||||
|
@ -31,6 +35,7 @@ if {dpos} >= 0x8000 {
|
||||||
// G_AD_DISABLE | G_CD_MAGICSQ | G_TC_FILT | G_TF_BILERP |
|
// G_AD_DISABLE | G_CD_MAGICSQ | G_TC_FILT | G_TF_BILERP |
|
||||||
// G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_MDSFT_TEXTPERSP |
|
// G_TT_NONE | G_TL_TILE | G_TD_CLAMP | G_MDSFT_TEXTPERSP |
|
||||||
// G_CYC_FILL | G_PM_NPRIMITIVE
|
// G_CYC_FILL | G_PM_NPRIMITIVE
|
||||||
|
// TODO: try running without this
|
||||||
WriteDL(0xEF382C30, 0x00000000)
|
WriteDL(0xEF382C30, 0x00000000)
|
||||||
|
|
||||||
// G_GEOMETRYMODE
|
// G_GEOMETRYMODE
|
||||||
|
@ -38,7 +43,7 @@ if {dpos} >= 0x8000 {
|
||||||
WriteDL(0xD9000000, 0x00220405)
|
WriteDL(0xD9000000, 0x00220405)
|
||||||
|
|
||||||
// G_SETSCISSOR coordinate order: (top, left), (right, bottom)
|
// G_SETSCISSOR coordinate order: (top, left), (right, bottom)
|
||||||
WriteDL(0xED000000 | (0 << 14) | (0 << 2), (640 << 14) | (480 << 2))
|
WriteDL(0xED000000 | (0 << 14) | (0 << 2), (WIDTH << 14) | (HEIGHT << 2))
|
||||||
|
|
||||||
// G_SETBLENDCOLOR
|
// G_SETBLENDCOLOR
|
||||||
// sets alpha component to 8, everything else to 0
|
// sets alpha component to 8, everything else to 0
|
||||||
|
@ -54,14 +59,38 @@ if {dpos} >= 0x8000 {
|
||||||
// G_MOVEWORD, sets G_MW_CLIP+$001C
|
// G_MOVEWORD, sets G_MW_CLIP+$001C
|
||||||
WriteDL(0xDB04001C, 0x10000 - 2)
|
WriteDL(0xDB04001C, 0x10000 - 2)
|
||||||
|
|
||||||
// G_SETCIMG, set our color buffer (fmt 0, bit size %11, width)
|
|
||||||
WriteDL(0xFF180000 | (640 - 1), VIDEO_C_BUFFER)
|
|
||||||
|
|
||||||
// G_SETZIMG, set our z buffer
|
// G_SETZIMG, set our z buffer
|
||||||
WriteDL(0xFE000000, VIDEO_Z_BUFFER)
|
WriteDL(0xFE000000, VIDEO_Z_BUFFER)
|
||||||
|
|
||||||
|
// G_SETCIMG, set our z buffer as a color buffer so we can wipe it
|
||||||
|
WriteDL(0xFF100000 | (WIDTH - 1), VIDEO_Z_BUFFER)
|
||||||
|
|
||||||
|
WriteDL(0xE3000A01, 0x00300000) // G_SETOTHERMODE_H
|
||||||
|
WriteDL(0xE200001C, 0x00000000) // G_SETOTHERMODE_L
|
||||||
|
WriteDL(0xF7000000, 0xFFFCFFFC) // G_SETFILLCOLOR to default z value
|
||||||
|
// G_FILLRECT the whole z buffer
|
||||||
|
WriteDL(0xF6000000 | ((WIDTH - 1) << 14) | ((HEIGHT - 1) << 2), 0)
|
||||||
|
WriteDL(0xE7000000, 0) // G_RDPPIPESYNC
|
||||||
|
|
||||||
|
// G_SETCIMG, set our color buffer
|
||||||
|
if HICOLOR {
|
||||||
|
WriteDL(0xFF180000 | (WIDTH - 1), VIDEO_C_BUFFER)
|
||||||
|
} else {
|
||||||
|
WriteDL(0xFF100000 | (WIDTH - 1), VIDEO_C_BUFFER)
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteDL(0xF8000000, 0x0A0A0A00) // G_SETFOGCOLOR
|
||||||
|
WriteDL(0xDB080000, 0x3E80C280) // set fog distance (float?)
|
||||||
|
WriteDL(0xE7000000, 0) // G_RDPPIPESYNC
|
||||||
|
|
||||||
// G_SETFILLCOLOR
|
// G_SETFILLCOLOR
|
||||||
|
if HICOLOR {
|
||||||
WriteDL(0xF7000000, 0x007FFFFF)
|
WriteDL(0xF7000000, 0x007FFFFF)
|
||||||
|
} else {
|
||||||
|
WriteDL(0xF7000000, 0x03FF03FF)
|
||||||
|
}
|
||||||
|
|
||||||
|
WriteDL(0xE7000000, 0) // G_RDPPIPESYNC
|
||||||
|
|
||||||
// G_FILLRECT coordinate order: (right, bottom), (top, left)
|
// G_FILLRECT coordinate order: (right, bottom), (top, left)
|
||||||
// note that the coordinates are all inclusive!
|
// note that the coordinates are all inclusive!
|
||||||
|
|
8
main.asm
8
main.asm
|
@ -154,10 +154,14 @@ MainLoop:
|
||||||
sw t0, VI_Y_SCALE(a0)
|
sw t0, VI_Y_SCALE(a0)
|
||||||
|
|
||||||
j MainLoop
|
j MainLoop
|
||||||
nop // delay slot
|
nop
|
||||||
|
|
||||||
SetupScreen:
|
SetupScreen:
|
||||||
ScreenNTSC(640, 480, BPP32|INTERLACE|AA_MODE_2, VIDEO_C_BUFFER | UNCACHED)
|
if HICOLOR {
|
||||||
|
ScreenNTSC(WIDTH, HEIGHT, BPP32|INTERLACE|AA_MODE_2|PIXEL_ADV_3, VIDEO_C_BUFFER | UNCACHED)
|
||||||
|
} else {
|
||||||
|
ScreenNTSC(WIDTH, HEIGHT, BPP16|AA_MODE_2|PIXEL_ADV_3, VIDEO_C_BUFFER | UNCACHED)
|
||||||
|
}
|
||||||
jr ra
|
jr ra
|
||||||
nop
|
nop
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue