CdRead

From Final Fantasy Hacktics Wiki
Revision as of 10:19, 5 June 2024 by Talcall (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

00020c3c: 27bdffe8 addiu r29,r29,0xffe8
00020c40: 3c028003 lui r2,0x8003
00020c44: 24421b98 addiu r2,r2,0x1b98
00020c48: afbf0010 sw r31,0x0010(r29)
00020c4c: ac460000 sw r6,0x0000(r2)             0x80031b98 = CDRom subsystem mode
00020c50: 8c420000 lw r2,0x0000(r2)
00020c54: 00000000 nop
00020c58: 30430030 andi r3,r2,0x0030
00020c5c: 10600006 beq r3,r0,0x00020c78         if (mode && 0x30 != 0) // branch if unspecified sector size (defaults to 2048)
00020c60: 00803821 addu r7,r4,r0
00020c64: 34020020 ori r2,r0,0x0020
00020c68: 10620008 beq r3,r2,0x00020c8c         if (mode && 0x30 != 0x20) // branch if sector size 2340
00020c6c: 34020249 ori r2,r0,0x0249                2340 >> 0x2
00020c70: 08008327 j 0x00020c9c                 if (mode && 0x30 = 0x10) // jump if sector size 2328
00020c74: 34020246 ori r2,r0,0x0246                2328 >> 0x2

sector size 2048

00020c78: 34020200 ori r2,r0,0x0200                2048 >> 2
00020c7c: 3c018003 lui r1,0x8003
00020c80: ac221b9c sw r2,0x1b9c(r1)             sector size >> 2
00020c84: 0800832a j 0x00020ca8
00020c88: 00000000 nop

sector size 2340:

00020c8c: 3c018003 lui r1,0x8003
00020c90: ac221b9c sw r2,0x1b9c(r1)             "
00020c94: 0800832a j 0x00020ca8
00020c98: 00000000 nop

sector size 2328:

00020c9c: 3c038003 lui r3,0x8003
00020ca0: 24631b9c addiu r3,r3,0x1b9c           "
00020ca4: ac620000 sw r2,0x0000(r3)

all

00020ca8: 3c038003 lui r3,0x8003
00020cac: 24631b98 addiu r3,r3,0x1b98
00020cb0: 8c620000 lw r2,0x0000(r3)
00020cb4: 00002021 addu r4,r0,r0                Disable previous callback routines
00020cb8: 34420020 ori r2,r2,0x0020             check ?
00020cbc: ac620000 sw r2,0x0000(r3)
00020cc0: 3c018003 lui r1,0x8003
00020cc4: ac251b90 sw r5,0x1b90(r1)             store buffer address to read to
00020cc8: 3c018003 lui r1,0x8003
00020ccc: ac271b8c sw r7,0x1b8c(r1)             store sector count
00020cd0: 0c007ad6 jal 0x0001eb58               CdSyncCallback
00020cd4: 00000000 nop
00020cd8: 00002021 addu r4,r0,r0                disable previous callback routines
00020cdc: 3c018003 lui r1,0x8003
00020ce0: ac221bb0 sw r2,0x1bb0(r1)             store previous callback
00020ce4: 0c007adc jal 0x0001eb70               CdReadyCallback
00020ce8: 00000000 nop
00020cec: 2404ffff addiu r4,r0,0xffff           mode -1
00020cf0: 3c018003 lui r1,0x8003
00020cf4: ac221bb4 sw r2,0x1bb4(r1)             store previous callback
00020cf8: 0c0076ea jal 0x0001dba8               VSync call
00020cfc: 00000000 nop
00020d00: 3c018003 lui r1,0x8003
00020d04: ac221ba8 sw r2,0x1ba8(r1)             store absolute time after program boot
00020d08: 0c007a73 jal 0x0001e9cc               CdStatus
00020d0c: 00000000 nop
00020d10: 304200e0 andi r2,r2,0x00e0            check for play/seek/read
00020d14: 10400004 beq r2,r0,0x00020d28         branch if not doing any of the above
00020d18: 34040009 ori r4,r0,0x0009             pause CD
00020d1c: 00002821 addu r5,r0,r0
00020d20: 0c007b7b jal 0x0001edec               CdControlB issue pause CD instruction. block CPU until finished
00020d24: 00003021 addu r6,r0,r0
00020d28: 0c008299 jal 0x00020a64               cd_read_retry
00020d2c: 00002021 addu r4,r0,r0
00020d30: 0002102a slt r2,r0,r2
00020d34: 8fbf0010 lw r31,0x0010(r29)
00020d38: 27bd0018 addiu r29,r29,0x0018
00020d3c: 03e00008 jr r31
00020d40: 00000000 nop