; RomBoot.Asm - psx bootcart loader ; (c)2000 Double Dutch Designs Limited ; www.doubledutchdesigns.co.uk ; Last altered 14th June 2000 include ../incs/equates.inc include ../incs/macros.inc org external_rom RomBoot dw Start2 ; after cd boot db "Licensed by Sony Computer Entertainment Inc." db "*Retro & other products are NOT licensed by Sony Computer Entertainment Inc! ",0 dw Start1 ; on switch on db "Licensed by Sony Computer Entertainment Inc." db "*Retro & other products are NOT licensed by Sony Computer Entertainment Inc! ",0 Switch equ external_rom+switch1mb Start1 la v0,Switch lbu v0,(v0) nop andi v0,v0,1 beqz v0,Continue nop li t0,$400 la t1,rom+$6000 ; point to bit of psx os move v0,zero move v1,zero @Checksum lw t2,(t1) subiu t0,t0,1 addu v0,v0,t2 ; do add crc xor v1,v1,t2 ; do xor crc bnez t0,@Checksum addiu t1,t1,4 la s0,@TableA ; old os li t0,$28550249 ; is add bad? bne v0,t0,@NotA ; yep! not A nop li t0,$93d5601d ; is xor bad? beq v1,t0,@Okay ; nope! is A nop @NotA li t0,$0b8af1c9 ; is add bad? bne v0,t0,Continue ; yep! not B nop li t0,$051ad5ff ; is xor bad? bne v1,t0,Continue ; yep! not B nop la s0,@TableB ; new os @Okay la t0,$a001b9b0 sw zero,(t0) lw t0,(s0) nop jalr t0 nop lw t0,4(s0) nop jalr t0 nop lw t0,8(s0) nop jal t0 nop callc0 PatchA0Table callc0 InstallExceptionHandlers callb0 ResetEntryInt li v0,hardware sw zero,gpu1(v0) ; reset li t0,$03000001 sw t0,gpu1(v0) ; disable display sw zero,interrupt_mask(v0) sw zero,interrupt_reg(v0) li a0,$a001b9b0 lw a0,(a0) callc0 InstallDevices li a0,$a000e000 li a1,$2000 callc0 SysInitMemory lw t0,$c(s0) nop jalr t0 li a0,4 move a0,zero callc0 InitException li a0,1 callc0 InitDefInt lw t0,$10(s0) nop jalr t0 li a0,$10 lw t0,$14(s0) li a0,1 jalr t0 li a1,4 li a0,1 callc0 InitRCnt j Transfer nop @TableA dw $bfc00410 ; 0 dw $bfc042c0 ; 4 dw $bfc04290 ; 8 dw $bfc045f0 ; $c dw $bfc04658 ; $10 dw $bfc0470c ; $14 @TableB dw $bfc00420 ; 0 dw $bfc042d0 ; 4 dw $bfc042a0 ; 8 dw $bfc04610 ; $c dw $bfc04678 ; $10 dw $bfc0472c ; $14 Start2 la v0,Switch lbu v0,(v0) nop andi v0,v0,1 beqz v0,Continue nop Transfer la t0,EndOfBoot lw t2,$18(t0) lw t3,$1c(t0) addiu t4,t0,$800 @Loop lbu t5,(t4) addiu t4,t4,1 sb t5,(t2) subiu t3,t3,1 bnez t3,@Loop addiu t2,t2,1 ; free! lw ra,$10(t0) lw sp,$2c(t0) lw gp,$3c(t0) Continue jr ra nop EndOfBoot