Browse Source

further cleanup of mostly video-related code

master
Connor Olding 1 year ago
parent
commit
ddfb8eb503
6 changed files with 31 additions and 35 deletions
  1. 0
    1
      dlist.asm
  2. 21
    21
      inc/n64_dp.inc
  3. 3
    3
      inc/n64_vi.inc
  4. 4
    4
      init.asm
  5. 1
    1
      kernel.asm
  6. 2
    5
      main.asm

+ 0
- 1
dlist.asm View File

@@ -176,7 +176,6 @@ if HIRES {
gPipeSync()
gSetCombine(15,15,31,4,7,7,7,4, 15,15,31,4,7,7,7,4)
gSetOtherMode(G_PM_NPRIMITIVE | G_CYC_1CYCLE | G_TP_NONE | G_TD_CLAMP | G_TL_TILE | G_TT_NONE | G_TF_AVERAGE | G_TC_FILT | G_CK_NONE | G_CD_MAGICSQ | G_AD_PATTERN, G_AC_NONE | G_ZS_PIXEL | Z_CMP | Z_UPD)
// CULL_FRONT is dying on N64?
gGeometryMode(0, G_ZBUFFER | G_SHADE | G_CULL_FRONT | G_SHADING_SMOOTH)

gSetSegment6(model)

+ 21
- 21
inc/n64_dp.inc View File

@@ -15,26 +15,26 @@ constant DPS_BUFTEST_ADDR($08) // $04200008 Span Buffer Test Address Register
constant DPS_BUFTEST_DATA($0C) // $0420000C Span Buffer Test Data Register

// DPC_STATUS Read Flags:
constant DPC_XBS($001) // Use XBUS DMEM DMA Or DRAM DMA (Bit 0)
constant DPC_FRZ($002) // RDP Frozen (Bit 1)
constant DPC_FLUSH($004) // RDP Flushed (Bit 2)
constant DPC_GCL($008) // GCLK Alive (Bit 3)
constant DPC_TMB($010) // TMEM Busy (Bit 4)
constant DPC_PLB($020) // RDP PIPELINE Busy (Bit 5)
constant DPC_CMB($040) // RDP COMMAND Unit Busy (Bit 6)
constant DPC_CMR($080) // RDP COMMAND Buffer Ready (Bit 7)
constant DPC_DMA($100) // RDP DMA Busy (Bit 8)
constant DPC_CME($200) // RDP COMMAND END Register Valid (Bit 9)
constant DPC_CMS($400) // RDP COMMAND START Register Valid (Bit 10)
constant DPC_XBS($001) // Use XBUS DMEM DMA Or DRAM DMA
constant DPC_FRZ($002) // RDP Frozen
constant DPC_FLUSH($004) // RDP Flushed
constant DPC_GCL($008) // GCLK Alive
constant DPC_TMB($010) // TMEM Busy
constant DPC_PLB($020) // RDP PIPELINE Busy
constant DPC_CMB($040) // RDP COMMAND Unit Busy
constant DPC_CMR($080) // RDP COMMAND Buffer Ready
constant DPC_DMA($100) // RDP DMA Busy
constant DPC_CME($200) // RDP COMMAND END Register Valid
constant DPC_CMS($400) // RDP COMMAND START Register Valid

// DPC_STATUS Write Flags:
constant DPC_XBS_CLR($001) // Clear XBUS DMEM DMA (Bit 0)
constant DPC_XBS_SET($002) // Set XBUS DMEM DMA (Bit 1)
constant DPC_FRZ_CLR($004) // Clear FREEZE (Bit 2)
constant DPC_FRZ_SET($008) // Set FREEZE (Bit 3)
constant DPC_FLUSH_CLR($010) // Clear FLUSH (Bit 4)
constant DPC_FLUSH_SET($020) // Set FLUSH (Bit 5)
constant DPC_TMC_CLR($040) // Clear TMEM COUNTER (Bit 6)
constant DPC_PLC_CLR($080) // Clear PIPELINE COUNTER (Bit 7)
constant DPC_CMC_CLR($100) // Clear COMMAND COUNTER (Bit 8)
constant DPC_CLK_CLR($200) // Clear CLOCK COUNTER (Bit 9)
constant DPC_XBS_CLR($001) // Clear XBUS DMEM DMA
constant DPC_XBS_SET($002) // Set XBUS DMEM DMA
constant DPC_FRZ_CLR($004) // Clear FREEZE
constant DPC_FRZ_SET($008) // Set FREEZE
constant DPC_FLUSH_CLR($010) // Clear FLUSH
constant DPC_FLUSH_SET($020) // Set FLUSH
constant DPC_TMC_CLR($040) // Clear TMEM COUNTER
constant DPC_PLC_CLR($080) // Clear PIPELINE COUNTER
constant DPC_CMC_CLR($100) // Clear COMMAND COUNTER
constant DPC_CLK_CLR($200) // Clear CLOCK COUNTER

+ 3
- 3
inc/n64_vi.inc View File

@@ -25,10 +25,10 @@ constant DIVOT_EN($0010) // Divot Enable (Used With Anti-alias)
constant VBUS_CLK_EN($0020) // Video Bus Clock Enable
constant INTERLACE($0040) // Interlace/Serrate (Used With Interlaced Display)
constant TST_MODE($0080) // Test Mode
constant AA_MODE_0($0000) // AA Mode 0 = Anti­-alias & Resample (Always Fetch Extra Lines)
constant AA_MODE_1($0100) // AA Mode 1 = Anti­-alias & Resample (Fetch Extra Lines When Needed)
constant AA_MODE_0($0000) // AA Mode 0 = Anti­alias & Resample (Always Fetch Extra Lines)
constant AA_MODE_1($0100) // AA Mode 1 = Anti­alias & Resample (Fetch Extra Lines When Needed)
constant AA_MODE_2($0200) // AA Mode 2 = Resample Only
constant AA_MODE_3($0300) // AA Mode 3 = Replicate Pixels & No Interpolation
constant AA_MODE_3($0300) // AA Mode 3 = Replicate Pixels & No Interpolation
constant DIAG_0($0400) // Diagnotic 0
constant DIAG_1($0800) // Diagnotic 1
constant PIXEL_ADV_0($0000) // Pixel Advance 0

+ 4
- 4
init.asm View File

@@ -5,7 +5,7 @@
-
ld t3, 0(t1)
ld t4, 8(t1)
addiu t1, t1, 0x10
addiu t1, 0x10
sd t3, 0(t0)
sd t4, 8(t0)
cache 0x19, 0(t0) // tell data cache to write itself out
@@ -13,7 +13,7 @@
// an instruction cache line is 2 rows, and a data cache line is 1 row,
// so poking at the start of each row is enough to flush them both.
bne t1, t2,-
addiu t0, t0, 0x10
addiu t0, 0x10

// flush denormals to 0 and enable invalid operations
li a0, 0x01000800 // TODO: use flag constants
@@ -44,7 +44,7 @@
tlbwi
nop
nop
subiu t1, t1, 1
subiu t1, 1
bgez t1,-
nop
mtc0 r0, CP0_EntryHi
@@ -82,7 +82,7 @@
lui t2, PI_BASE
-
lw t0, PI_STATUS(t2)
andi t0, t0, 3
andi t0, 3
bnez t0,-
nop
//

+ 1
- 1
kernel.asm View File

@@ -27,7 +27,7 @@ include "init.asm"

Drive64Init:
lui t9, CI_BASE
lui t2, 0x5544 // "UD" of "UDEV"
lui t2, 0x5544 // "UD" of "UDEV"
lw t1, CI_HW_MAGIC(t9)
ori t2, 0x4556 // "EV" of "UDEV"


+ 2
- 5
main.asm View File

@@ -1,4 +1,3 @@
// built on the N64 ROM template by krom
arch n64.cpu
endian msb

@@ -11,7 +10,7 @@ include "inc/kernel.inc"
output "test.z64", create
fill 1052672 // ROM size

origin 0x00000000
origin 0
base 0x80000000

include "header.asm"
@@ -93,7 +92,7 @@ Start3D:

lui a0, MAIN_BASE
jal PushVideoTask
ori a0, a0, MAIN_SP_TASK
ori a0, MAIN_SP_TASK

SP_DMA_WAIT()

@@ -174,8 +173,6 @@ if MAIN_DECOMP_IMAGE {
include "dlist.asm"
include "task.asm"

//align(16); insert FONT, "res/dwarf.1bpp"

if pc() > (MAIN_BASE << 16) {
error "ran out of memory for code and data"
}

Loading…
Cancel
Save