startup.s
来自「ESS3890+SL原代码(1*16内存)」· S 代码 · 共 521 行 · 第 1/2 页
S
521 行
nop beq r2,r3,Set19 ; goto Set19 addi r0,#0xd,r2 ; r2 = 13 (Flush) nopNextCmd: addi r7,#0x1,r7 ; increment loop counter addi r10,#0x10,r10 ; move pointer to next cmdblk bne r7,r11,LoopCmd ; loop if not done nop nopCopy:; copy data from source address to destination address; arguments : src_addr, dest_addr, size; Temp variables:; r13 : address of source data; r12 : address of destination; r6 : loop counter; r10: start address of command arguments; ld 0x4[r10],r13 ; address of source data ld 0x8[r10],r12 ; address of destination ld 0xc[r10],r6 ; r6 : loop countersize to copy nop beq r0,r6,NextCmd ; do copy if size > 0 nop nopLoopCopy: ld 0x0[r13],r2 ; load one dword nop nop st 0x0[r12],r2 ; copy to dest nop addi r13,#0x4,r13 ; move pointer to next dword data addi r12,#0x4,r12 ; move pointer to next target address addi r6,#-1,r6 ; decrement loop counter bne r6,r0,LoopCopy ; loop copy nop nop beq r0,r0,NextCmd ; continue to next command if done nop nop Clear:; clear memory starting from given address to 0; arguments : start_addr, size; Temp variables:; r13 : address of source data; r6 : loop counter; r10: start address of command arguments; ld 0x4[r10],r13 ; starting address to clear ld 0x8[r10],r6 ; loop counter : size to clear nop beq r0,r6,NextCmd ; do clear if size >0 nop nopLoopClear: st 0x0[r13],r0 ; clear one dword nop addi r13,#0x4,r13 ; move to next address addi r6,#-1,r6 ; decrement loop counter bne r6,r0,LoopClear ; loop clear nop nop beq r0,r0,NextCmd ; continue to next command if done nop nopSet25:; set new value of r25; arguments : value; Temp variables:; r10: start address of command arguments; beq r0,r0,NextCmd ; continue to next command ld 0x4[r10],r25 ; r25 = value nopSet24:; set new value of r24; arguments : value; Temp variables:; r10: start address of command arguments; beq r0,r0,NextCmd ; continue to next command ld 0x4[r10],r24 ; r24 = value nopSet23:; set new value of r23; arguments : value; Temp variables:; r10: start address of command arguments; beq r0,r0,NextCmd ; continue to next command ld 0x4[r10],r23 ; r23 = value nopSet4:; set new value of r4; arguments : value; Temp variables:; r10: start address of command arguments; beq r0,r0,NextCmd ; continue to next command ld 0x4[r10],r4 ; r23 = value nop Set5:; set new value of r5; arguments : value; Temp variables:; r10: start address of command arguments; beq r0,r0,NextCmd ; continue to next command ld 0x4[r10],r5 ; r23 = value nop Set22:; set new value of r22; arguments : value; Temp variables:; r10: start address of command arguments; beq r0,r0,NextCmd ; continue to next command ld 0x4[r10],r22 ; r22 = value nop Set29:; set new value of r29; arguments : value; Temp variables:; r10: start address of command arguments; beq r0,r0,NextCmd ; continue to next command ld 0x4[r10],r29 ; r29 = value nopSet19:; set new value of r19; arguments : value; Temp variables:; r10: start address of command arguments; beq r0,r0,NextCmd ; continue to next command ld 0x4[r10],r19 ; r19 = value nop Jump:; jump to given address; arguments : dest_addr; Temp variables:; r13 : address to jump to; r10: start address of command arguments; ld 0x4[r10],r13 ; r13 : address to jump nop jspci r13,#0x0,r0 ; jump nop nopJsr:; call subroutine starting at given address; arguments : subroutine_addr; Temp variables:; r13 : address to jump to; r10: start address of command arguments; addi r0,#0xafe0,r29 ld 0x4[r10],r13 ; address to jump nop st 0x20[r0],r6 st 0x24[r0],r7 jspci r13,#0x0,r31 st 0x28[r0],r10 st 0x2c[r0],r11 ; save registers ld 0x20[r0],r6 ld 0x24[r0],r7 beq r0,r0,NextCmd ; continue to next command ld 0x28[r0],r10 ld 0x2c[r0],r11 ; restore registers; Power up always starts here; Temp. vars:; r1: PSW; r3: MEMDELAY; r27: omnibasepowerup: addi r0,#0xc3,r1 movtos r1,psw ; set PSW addi r0,#0x2000,r27 ; r27 = 0x2000 sh r0,r27,r27,#16 ; r27 = r27 << 16 (i.e. omnibase); Set buscon_dma_control (0x204 for .5M; 0x384 for 2M) addi r0,#_DRAM_CONTROL_,r2 ; r2 = DRAM configuration ; .5M/2MB, 2T3T3T st 0x8100[r27],r2 ; mvd[buscon_dma_control] = r2; Set buscon_dma_scale_type (set BIG_MEM_BIT (0x20) for 2M. 0 for .5M) addi r0,#_BIG_MEM_BIT_,r2 ; Optionally use 1Mx16bits DRAM st 0x87ec[r27],r2 ; mvd[buscon_dma_scale_type] = r2; Set riface_width addi r0,#0x1,r2 ; Width for 3210 (bank 0 is DRAM) st 0x4000[r27],r2 ; mvd[riface_width] = 0x1;; Set riface_wait_state addi r0,#_MEMDELAYH_,r3 ; r3 = 0x1d (wait state) sh r0,r3,r3,#16 ; r3 << = 16 (0x1d0000) addi r3,#_MEMDELAYL_,r3 ; r3 = Wait states of memory banks ; 1d001e = 1 (0x1a, 0, 0, 0x1e) ; bank3: 6 wait states ; bank2: 32 wait states ; bank1: 32 wait states ; bank0: 2 wait states st 0x4004[r27],r3 ; mvd[riface_wait_state] = 0x1d001e; Setup DRAM refresh/control early addi r0,#0x92,r2 ; 8ms/729 = (2048 - n*8) * 12.5ns ; n = 0x92 st 0x8104[r27],r2 ; mvd[buscon_dram_reftime] = 0x92 addi r0,#0x1ff,r2 ; deltas = ((0x80-dy)<<9) | (0x200-dx) st 0x8438[r27],r2 ; mvd[buscon_dma_deltas_ref] = 0x200-1 addi r0,#0x1000,r2 st 0x8538[r27],r2 ; mvd[buscon_dma_xpos_ref] = ; BDMA_WIDTH0 + BDMA_INC2 st 0x8638[r27],r0 ; mvd[buscon_dma_ypos_ref] = 0 addi r0,#0x6e23,r2 ; Enable 4T for noise reduction ; Enable 6T for NR ; Enable level priority and limit ; transfer block ; Reset DMA ; EDO!! st 0x87e0[r27],r2 ; mvd[buscon_dma_cntl] = 0x6e23 addi r0,#0x6e21,r2 ; Done with reset DMA st 0x87e0[r27],r2 ; mvd[buscon_dma_cntl] = 0x6e21 nop nop nop nop beq r0,r0,ParseCmd ; goto ParseCmd nopLastLoc: nop
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?