Cb read
(Redirected from 00020840 - 00020a60)
Jump to navigation
Jump to search
00020840: 27bdffd0 addiu r29,r29,0xffd0 00020844: afb10024 sw r17,0x0024(r29) 00020848: 00a08821 addu r17,r5,r0 # p2 0002084c: 308400ff andi r4,r4,0x00ff 00020850: 34020001 ori r2,r0,0x0001 00020854: afbf0028 sw r31,0x0028(r29) 00020858: 1482003a bne r4,r2,0x00020944 # 0002085c: afb00020 sw r16,0x0020(r29) 00020860: 3c108003 lui r16,0x8003 00020864: 26101ba0 addiu r16,r16,0x1ba0 # number of sections to load 00020868: 8e020000 lw r2,0x0000(r16) 0002086c: 00000000 nop 00020870: 18400038 blez r2,0x00020954 # branch if erroneous 00020874: 00000000 nop 00020878: 3c038003 lui r3,0x8003 0002087c: 8c631b9c lw r3,0x1b9c(r3) # num bytes per sector 00020880: 34020200 ori r2,r0,0x0200 00020884: 14620010 bne r3,r2,0x000208c8 # branch if not 2048 bytes per sector 00020888: 27a40010 addiu r4,r29,0x0010
fft's sectors are all 2328 bytes? so this code will never run. probably.
0002088c: 0c007bd5 jal 0x0001ef54 # S 021 CDGetSector filesize = 3 store file's metadata (format CdIFILE) to stack 00020890: 34050003 ori r5,r0,0x0003 00020894: 0c007c30 jal 0x0001f0c0 # SYS CDPosToInt <- get LBA of file 00020898: 27a40010 addiu r4,r29,0x0010 # parse location of file header? 0002089c: 3c038003 lui r3,0x8003 000208a0: 8c631bac lw r3,0x1bac(r3) 000208a4: 00000000 nop 000208a8: 10430007 beq r2,r3,0x000208c8 # branch if it matches file to load's LBA file (ideally, always) 000208ac: 00000000 nop 000208b0: 3c048001 lui r4,0x8001 000208b4: 24840420 addiu r4,r4,0x0420 000208b8: 0c0088a3 jal 0x0002228c # Write String to Terminal "CdRead: sector error\n" 000208bc: 00000000 nop 000208c0: 2402ffff addiu r2,r0,0xffff 000208c4: ae020000 sw r2,0x0000(r16) # store cd Read failstate = -1 000208c8: 3c108003 lui r16,0x8003 000208cc: 26101b94 addiu r16,r16,0x1b94 000208d0: 8e040000 lw r4,0x0000(r16) # ram address to load file into 000208d4: 3c058003 lui r5,0x8003 000208d8: 8ca51b9c lw r5,0x1b9c(r5) # load sector size >> 2 000208dc: 0c007bd5 jal 0x0001ef54 # S 021 CDGetSector 000208e0: 00000000 nop 000208e4: 3c028003 lui r2,0x8003 000208e8: 8c421b9c lw r2,0x1b9c(r2) 000208ec: 8e030000 lw r3,0x0000(r16) # Ram address to load into 000208f0: 00021080 sll r2,r2,0x02 # sector size 000208f4: 00431021 addu r2,r2,r3 # sector size + ram address to load into (word of last address of file) 000208f8: ae020000 sw r2,0x0000(r16) # re-store 000208fc: 3c028003 lui r2,0x8003 00020900: 8c421ba0 lw r2,0x1ba0(r2) # number of sections of file to load 00020904: 00000000 nop 00020908: 2442ffff addiu r2,r2,0xffff 0002090c: 3c018003 lui r1,0x8003 00020910: ac221ba0 sw r2,0x1ba0(r1) # restore 00020914: 3c028003 lui r2,0x8003 00020918: 8c421ba0 lw r2,0x1ba0(r2) # this does nothing 0002091c: 3c028003 lui r2,0x8003 00020920: 8c421bac lw r2,0x1bac(r2) # LBA of file to load 00020924: 00000000 nop 00020928: 24420001 addiu r2,r2,0x0001 # add 1 (oh interesting... so, this is called multiple times for large files then?) 0002092c: 3c018003 lui r1,0x8003 00020930: ac221bac sw r2,0x1bac(r1) 00020934: 3c028003 lui r2,0x8003 00020938: 8c421bac lw r2,0x1bac(r2) 0002093c: 08008255 j 0x00020954 00020940: 00000000 nop
if p1 = 1;
00020944: 3c038003 lui r3,0x8003 00020948: 24631ba0 addiu r3,r3,0x1ba0 0002094c: 2402ffff addiu r2,r0,0xffff # -1 00020950: ac620000 sw r2,0x0000(r3) # skip moving a sector
00020954: 0c0076ea jal 0x0001dba8 # Vsync 00020958: 2404ffff addiu r4,r0,0xffff 0002095c: 3c038003 lui r3,0x8003 00020960: 24631ba4 addiu r3,r3,0x1ba4 00020964: ac620000 sw r2,0x0000(r3) # store frame counter since game open 00020968: 3c028003 lui r2,0x8003 0002096c: 8c421ba0 lw r2,0x1ba0(r2) # number of sections of file to load 00020970: 00000000 nop 00020974: 04410003 bgez r2,0x00020984 # loop for all sections of file to load! 00020978: 00000000 nop 0002097c: 0c008299 jal 0x00020a64 # cd_read_retry 00020980: 34040001 ori r4,r0,0x0001 # 1 (disables doing certain things?) 00020984: 0c0076ea jal 0x0001dba8 # Vsync 00020988: 2404ffff addiu r4,r0,0xffff 0002098c: 3c038003 lui r3,0x8003 00020990: 8c631ba8 lw r3,0x1ba8(r3) # another reference to absolute time after boot 00020994: 00000000 nop 00020998: 246304b0 addiu r3,r3,0x04b0 # + 0x4b0 0002099c: 0062182a slt r3,r3,r2 000209a0: 10600003 beq r3,r0,0x000209b0 # branch if vsync came back early? 000209a4: 2402ffff addiu r2,r0,0xffff 000209a8: 3c018003 lui r1,0x8003 000209ac: ac221ba0 sw r2,0x1ba0(r1) # set number of file sections to load = -1 (fail state) 000209b0: 3c028003 lui r2,0x8003 000209b4: 8c421ba0 lw r2,0x1ba0(r2) 000209b8: 00000000 nop 000209bc: 1040000a beq r2,r0,0x000209e8 # branch if 0 file sections to load 000209c0: 00000000 nop 000209c4: 0c0076ea jal 0x0001dba8 # Vsync 000209c8: 2404ffff addiu r4,r0,0xffff 000209cc: 3c038003 lui r3,0x8003 000209d0: 8c631ba8 lw r3,0x1ba8(r3) 000209d4: 00000000 nop 000209d8: 246304b0 addiu r3,r3,0x04b0 000209dc: 0062182a slt r3,r3,r2 000209e0: 1060001a beq r3,r0,0x00020a4c # end if vsync came back early? 000209e4: 00000000 nop 000209e8: 3c048003 lui r4,0x8003 000209ec: 8c841bb0 lw r4,0x1bb0(r4) # 000209f0: 0c007ad6 jal 0x0001eb58 # CdSyncCallback define cd sync callback for after CDlPause 000209f4: 00000000 nop 000209f8: 3c048003 lui r4,0x8003 000209fc: 8c841bb4 lw r4,0x1bb4(r4) # 00020a00: 0c007adc jal 0x0001eb70 # CdReadyCallback define cd ready callback from variables set elsewhere 00020a04: 00000000 nop 00020a08: 34040009 ori r4,r0,0x0009 00020a0c: 00002821 addu r5,r0,r0 00020a10: 0c007ae2 jal 0x0001eb88 # CdControl CDlPause 00020a14: 00003021 addu r6,r0,r0 00020a18: 3c038003 lui r3,0x8003 00020a1c: 8c631b88 lw r3,0x1b88(r3) # get CDReadCallback func 00020a20: 00000000 nop 00020a24: 10600009 beq r3,r0,0x00020a4c # skip if NULL 00020a28: 00000000 nop 00020a2c: 3c028003 lui r2,0x8003 00020a30: 8c421ba0 lw r2,0x1ba0(r2) # num file sections to load 00020a34: 00000000 nop 00020a38: 14400002 bne r2,r0,0x00020a44 # if not 0, parse 5 00020a3c: 34040005 ori r4,r0,0x0005 00020a40: 34040002 ori r4,r0,0x0002 # else parse 2 00020a44: 0060f809 jalr r3,r31 # do routine as defined by last CDReadCallback 00020a48: 02202821 addu r5,r17,r0 # p2 00020a4c: 8fbf0028 lw r31,0x0028(r29) 00020a50: 8fb10024 lw r17,0x0024(r29) 00020a54: 8fb00020 lw r16,0x0020(r29) 00020a58: 27bd0030 addiu r29,r29,0x0030 00020a5c: 03e00008 jr r31 00020a60: 00000000 nop