Final Fantasy IX (CD4):ROM map

From Data Crystal
Jump to navigation Jump to search

Encounter check

00038d3c: 3c028008 lui r2,0x8008
00038d40: 8c44aecc lw r4,-0x5134(r2)
00038d44: 27bdffe0 addiu r29,r29,0xffe0
00038d48: afbf001c sw r31,0x001c(r29)
00038d4c: afb20018 sw r18,0x0018(r29)
00038d50: afb10014 sw r17,0x0014(r29)
00038d54: afb00010 sw r16,0x0010(r29)
00038d58: 908216ec lbu r2,0x16ec(r4)
00038d5c: 00000000 nop
00038d60: 10400096 beq r2,r0,0x00038fbc
00038d64: 00008021 addu r16,r0,r0
00038d68: 3c038008 lui r3,0x8008
00038d6c: 8c62ae4c lw r2,-0x51b4(r3)
00038d70: 00000000 nop
00038d74: 284203c1 slti r2,r2,0x03c1
00038d78: 14400091 bne r2,r0,0x00038fc0
00038d7c: 0010102b sltu r2,r0,r16
00038d80: 3c128008 lui r18,0x8008
00038d84: ac60ae4c sw r0,-0x51b4(r3)		;store 0 in distance walked
00038d88: 908316ef lbu r3,0x16ef(r4)		;r3 = encounter rate
00038d8c: 8e42ae50 lw r2,-0x51b0(r18)
00038d90: 3c118008 lui r17,0x8008
00038d94: 00431021 addu r2,r2,r3		;r2 = cumulative encounter rate
00038d98: ae42ae50 sw r2,-0x51b0(r18)		;store cumulative encounter rate in 0x8007ae50
00038d9c: 3c028008 lui r2,0x8008
00038da0: 8e23b720 lw r3,-0x48e0(r17)
00038da4: 2442b92d addiu r2,r2,0xb92d
00038da8: 0062182b sltu r3,r3,r2
00038dac: 14600003 bne r3,r0,0x00038dbc
00038db0: 00000000 nop
00038db4: 0c012fc8 jal 0x0004bf20
00038db8: 00000000 nop
00038dbc: 8e22b720 lw r2,-0x48e0(r17)
00038dc0: 8e43ae50 lw r3,-0x51b0(r18)
00038dc4: 90440000 lbu r4,0x0000(r2)
00038dc8: 24420001 addiu r2,r2,0x0001
00038dcc: 000318c3 sra r3,r3,0x03
00038dd0: 0083202a slt r4,r4,r3
00038dd4: 10800079 beq r4,r0,0x00038fbc
00038dd8: ae22b720 sw r2,-0x48e0(r17)
00038ddc: 3c028008 lui r2,0x8008
00038de0: 8c43b708 lw r3,-0x48f8(r2)
00038de4: 24020001 addiu r2,r0,0x0001
00038de8: 10620005 beq r3,r2,0x00038e00
00038dec: ae40ae50 sw r0,-0x51b0(r18)
00038df0: 0c02eeea jal 0x000bbba8
00038df4: 3c108008 lui r16,0x8008
00038df8: 0800e383 j 0x00038e0c
00038dfc: 00408821 addu r17,r2,r0

Display Memoria on the World Map, generate random bolts

  • 0xc6acc-0xc6efc - Displays Memoria on the World Map, generates random bolts with the Tetra Master PRNG (!)
000c6acc: 24130001 addiu r19,r0,0x0001
000c6ad0: 3c05800d lui r5,0x800d
000c6ad4: 24a5df80 addiu r5,r5,0xdf80
000c6ad8: 3c03800d lui r3,0x800d
000c6adc: 2463dfa0 addiu r3,r3,0xdfa0
000c6ae0: 94a20002 lhu r2,0x0002(r5)
000c6ae4: 94640002 lhu r4,0x0002(r3)
000c6ae8: 2442ff00 addiu r2,r2,0xff00
000c6aec: a4a20002 sh r2,0x0002(r5)
000c6af0: 9462000a lhu r2,0x000a(r3)
000c6af4: 24840100 addiu r4,r4,0x0100
000c6af8: a4640002 sh r4,0x0002(r3)
000c6afc: 94640012 lhu r4,0x0012(r3)
000c6b00: 2442ffc0 addiu r2,r2,0xffc0
000c6b04: 2484fe80 addiu r4,r4,0xfe80
000c6b08: a462000a sh r2,0x000a(r3)
000c6b0c: 08031b0b j 0x000c6c2c
000c6b10: a4640012 sh r4,0x0012(r3)
000c6b14: 00008021 addu r16,r0,r0
000c6b18: 3c02800d lui r2,0x800d
000c6b1c: 24454870 addiu r5,r2,0x4870
000c6b20: 3c03800d lui r3,0x800d
000c6b24: 2463df88 addiu r3,r3,0xdf88
000c6b28: 94620004 lhu r2,0x0004(r3)
000c6b2c: 94640002 lhu r4,0x0002(r3)
000c6b30: 2442fff8 addiu r2,r2,0xfff8
000c6b34: 2484fff0 addiu r4,r4,0xfff0
000c6b38: a4620004 sh r2,0x0004(r3)
000c6b3c: a4640002 sh r4,0x0002(r3)
000c6b40: 3c03800d lui r3,0x800d
000c6b44: 2463df90 addiu r3,r3,0xdf90
000c6b48: 94620004 lhu r2,0x0004(r3)
000c6b4c: 94640002 lhu r4,0x0002(r3)
000c6b50: 2442fff0 addiu r2,r2,0xfff0
000c6b54: 2484fff8 addiu r4,r4,0xfff8
000c6b58: a4620004 sh r2,0x0004(r3)
000c6b5c: a4640002 sh r4,0x0002(r3)
000c6b60: 94a20002 lhu r2,0x0002(r5)
000c6b64: 02001821 addu r3,r16,r0
000c6b68: 06010002 bgez r16,0x000c6b74
000c6b6c: 2444fff6 addiu r4,r2,0xfff6
000c6b70: 26030003 addiu r3,r16,0x0003
000c6b74: 00031083 sra r2,r3,0x02
000c6b78: 00821023 subu r2,r4,r2
000c6b7c: a4a20002 sh r2,0x0002(r5)
000c6b80: 26100001 addiu r16,r16,0x0001
000c6b84: 2a02000a slti r2,r16,0x000a
000c6b88: 1440fff5 bne r2,r0,0x000c6b60
000c6b8c: 24a50008 addiu r5,r5,0x0008
000c6b90: 00008021 addu r16,r0,r0
000c6b94: 3c124ec4 lui r18,0x4ec4
000c6b98: 3652ec4f ori r18,r18,0xec4f
000c6b9c: 3c02800d lui r2,0x800d
000c6ba0: 24514910 addiu r17,r2,0x4910
000c6ba4: 0c018acf jal 0x00062b3c		;PRNG call
000c6ba8: 26100001 addiu r16,r16,0x0001
000c6bac: 00520018 mult r2,r18
000c6bb0: 96250000 lhu r5,0x0000(r17)
000c6bb4: 00021fc3 sra r3,r2,0x1f
000c6bb8: 24a5fffa addiu r5,r5,0xfffa
000c6bbc: 00004010 mfhi r8
000c6bc0: 00082083 sra r4,r8,0x02
000c6bc4: 00832023 subu r4,r4,r3
000c6bc8: 00041840 sll r3,r4,0x01
000c6bcc: 00641821 addu r3,r3,r4
000c6bd0: 00031880 sll r3,r3,0x02
000c6bd4: 00641821 addu r3,r3,r4
000c6bd8: 00431023 subu r2,r2,r3
000c6bdc: 00a22821 addu r5,r5,r2
000c6be0: 0c018acf jal 0x00062b3c		;PRNG call
000c6be4: a6250000 sh r5,0x0000(r17)
000c6be8: 00520018 mult r2,r18
000c6bec: 96250002 lhu r5,0x0002(r17)
000c6bf0: 00021fc3 sra r3,r2,0x1f
000c6bf4: 24a5fffa addiu r5,r5,0xfffa
000c6bf8: 00004010 mfhi r8
000c6bfc: 00082083 sra r4,r8,0x02
000c6c00: 00832023 subu r4,r4,r3
000c6c04: 00041840 sll r3,r4,0x01
000c6c08: 00641821 addu r3,r3,r4
000c6c0c: 00031880 sll r3,r3,0x02
000c6c10: 00641821 addu r3,r3,r4
000c6c14: 00431023 subu r2,r2,r3
000c6c18: 00a22821 addu r5,r5,r2
000c6c1c: a6250002 sh r5,0x0002(r17)
000c6c20: 2a02000a slti r2,r16,0x000a
000c6c24: 1440ffdf bne r2,r0,0x000c6ba4
000c6c28: 26310008 addiu r17,r17,0x0008
000c6c2c: 326200ff andi r2,r19,0x00ff
000c6c30: 104000a7 beq r2,r0,0x000c6ed0
000c6c34: 3c02800d lui r2,0x800d
000c6c38: 328500ff andi r5,r20,0x00ff
000c6c3c: 8c44f428 lw r4,-0x0bd8(r2)
000c6c40: 0c02e0e2 jal 0x000b8388
000c6c44: 24a50028 addiu r5,r5,0x0028
000c6c48: 0040a821 addu r21,r2,r0
000c6c4c: 86a30024 lh r3,0x0024(r21)
000c6c50: 2402ffff addiu r2,r0,0xffff
000c6c54: 1062009e beq r3,r2,0x000c6ed0
000c6c58: 3c118008 lui r17,0x8008
000c6c5c: 3c028008 lui r2,0x8008
000c6c60: 2456b92d addiu r22,r2,0xb92d
000c6c64: 26b00024 addiu r16,r21,0x0024
000c6c68: 0c018acf jal 0x00062b3c		;PRNG call
000c6c6c: 00000000 nop
000c6c70: 00402021 addu r4,r2,r0
000c6c74: 04810003 bgez r4,0x000c6c84
000c6c78: 00021303 sra r2,r2,0x0c
000c6c7c: 24820fff addiu r2,r4,0x0fff
000c6c80: 00021303 sra r2,r2,0x0c
000c6c84: 00021300 sll r2,r2,0x0c
000c6c88: 86030004 lh r3,0x0004(r16)
000c6c8c: 00821023 subu r2,r4,r2
000c6c90: 0043102a slt r2,r2,r3
000c6c94: 10400089 beq r2,r0,0x000c6ebc
000c6c98: 00000000 nop
000c6c9c: 8e05ffe8 lw r5,-0x0018(r16)
000c6ca0: 8ea30000 lw r3,0x0000(r21)
000c6ca4: 8e04ffec lw r4,-0x0014(r16)
000c6ca8: 000517c2 srl r2,r5,0x1f
000c6cac: 00a21021 addu r2,r5,r2
000c6cb0: 00021043 sra r2,r2,0x01
000c6cb4: 0062a023 subu r20,r3,r2
000c6cb8: 000417c2 srl r2,r4,0x1f
000c6cbc: 00822021 addu r4,r4,r2
000c6cc0: 00042043 sra r4,r4,0x01
000c6cc4: 8e02ffe0 lw r2,-0x0020(r16)
000c6cc8: 8e03fff0 lw r3,-0x0010(r16)
000c6ccc: 00449823 subu r19,r2,r4
000c6cd0: 000317c2 srl r2,r3,0x1f
000c6cd4: 00621821 addu r3,r3,r2
000c6cd8: 8e02ffe4 lw r2,-0x001c(r16)
000c6cdc: 00031843 sra r3,r3,0x01
000c6ce0: 10a00023 beq r5,r0,0x000c6d70
000c6ce4: 00439023 subu r18,r2,r3
000c6ce8: 8e22b720 lw r2,-0x48e0(r17)
000c6cec: 00000000 nop
000c6cf0: 0056102b sltu r2,r2,r22
000c6cf4: 1440000a bne r2,r0,0x000c6d20
000c6cf8: 00000000 nop
000c6cfc: 0c012fc8 jal 0x0004bf20
000c6d00: 00000000 nop
000c6d04: 8e22b720 lw r2,-0x48e0(r17)
000c6d08: 00000000 nop
000c6d0c: 0056102b sltu r2,r2,r22
000c6d10: 14400003 bne r2,r0,0x000c6d20
000c6d14: 00000000 nop
000c6d18: 0c012fc8 jal 0x0004bf20
000c6d1c: 00000000 nop
000c6d20: 8e24b720 lw r4,-0x48e0(r17)
000c6d24: 00000000 nop
000c6d28: 90850000 lbu r5,0x0000(r4)
000c6d2c: 8e03ffe8 lw r3,-0x0018(r16)
000c6d30: 00051200 sll r2,r5,0x08
000c6d34: 00451025 or r2,r2,r5
000c6d38: 0043001a div r2,r3
000c6d3c: 14600002 bne r3,r0,0x000c6d48
000c6d40: 00000000 nop
000c6d44: 0007000d break 0x00001c00
000c6d48: 2401ffff addiu r1,r0,0xffff
000c6d4c: 14610004 bne r3,r1,0x000c6d60
000c6d50: 3c018000 lui r1,0x8000
000c6d54: 14410002 bne r2,r1,0x000c6d60
000c6d58: 00000000 nop
000c6d5c: 0006000d break 0x00001800
000c6d60: 00001810 mfhi r3
000c6d64: 24840001 addiu r4,r4,0x0001
000c6d68: ae24b720 sw r4,-0x48e0(r17)
000c6d6c: 0283a021 addu r20,r20,r3
000c6d70: 8e02ffec lw r2,-0x0014(r16)
000c6d74: 00000000 nop
000c6d78: 10400023 beq r2,r0,0x000c6e08
000c6d7c: 00000000 nop
000c6d80: 8e22b720 lw r2,-0x48e0(r17)
000c6d84: 00000000 nop
000c6d88: 0056102b sltu r2,r2,r22
000c6d8c: 1440000a bne r2,r0,0x000c6db8
000c6d90: 00000000 nop
000c6d94: 0c012fc8 jal 0x0004bf20
000c6d98: 00000000 nop
000c6d9c: 8e22b720 lw r2,-0x48e0(r17)
000c6da0: 00000000 nop
000c6da4: 0056102b sltu r2,r2,r22
000c6da8: 14400003 bne r2,r0,0x000c6db8
000c6dac: 00000000 nop
000c6db0: 0c012fc8 jal 0x0004bf20
000c6db4: 00000000 nop
000c6db8: 8e24b720 lw r4,-0x48e0(r17)
000c6dbc: 00000000 nop
000c6dc0: 90850000 lbu r5,0x0000(r4)
000c6dc4: 8e03ffec lw r3,-0x0014(r16)
000c6dc8: 00051200 sll r2,r5,0x08
000c6dcc: 00451025 or r2,r2,r5
000c6dd0: 0043001a div r2,r3
000c6dd4: 14600002 bne r3,r0,0x000c6de0
000c6dd8: 00000000 nop
000c6ddc: 0007000d break 0x00001c00
000c6de0: 2401ffff addiu r1,r0,0xffff
000c6de4: 14610004 bne r3,r1,0x000c6df8
000c6de8: 3c018000 lui r1,0x8000
000c6dec: 14410002 bne r2,r1,0x000c6df8
000c6df0: 00000000 nop
000c6df4: 0006000d break 0x00001800
000c6df8: 00001810 mfhi r3
000c6dfc: 24840001 addiu r4,r4,0x0001
000c6e00: ae24b720 sw r4,-0x48e0(r17)
000c6e04: 02639821 addu r19,r19,r3
000c6e08: 8e02fff0 lw r2,-0x0010(r16)
000c6e0c: 00000000 nop
000c6e10: 10400024 beq r2,r0,0x000c6ea4
000c6e14: 02802021 addu r4,r20,r0
000c6e18: 8e22b720 lw r2,-0x48e0(r17)
000c6e1c: 00000000 nop
000c6e20: 0056102b sltu r2,r2,r22
000c6e24: 1440000a bne r2,r0,0x000c6e50
000c6e28: 00000000 nop
000c6e2c: 0c012fc8 jal 0x0004bf20
000c6e30: 00000000 nop
000c6e34: 8e22b720 lw r2,-0x48e0(r17)
000c6e38: 00000000 nop
000c6e3c: 0056102b sltu r2,r2,r22
000c6e40: 14400003 bne r2,r0,0x000c6e50
000c6e44: 00000000 nop
000c6e48: 0c012fc8 jal 0x0004bf20
000c6e4c: 00000000 nop
000c6e50: 8e24b720 lw r4,-0x48e0(r17)
000c6e54: 00000000 nop
000c6e58: 90850000 lbu r5,0x0000(r4)
000c6e5c: 8e03fff0 lw r3,-0x0010(r16)
000c6e60: 00051200 sll r2,r5,0x08
000c6e64: 00451025 or r2,r2,r5
000c6e68: 0043001a div r2,r3
000c6e6c: 14600002 bne r3,r0,0x000c6e78
000c6e70: 00000000 nop
000c6e74: 0007000d break 0x00001c00
000c6e78: 2401ffff addiu r1,r0,0xffff
000c6e7c: 14610004 bne r3,r1,0x000c6e90
000c6e80: 3c018000 lui r1,0x8000
000c6e84: 14410002 bne r2,r1,0x000c6e90
000c6e88: 00000000 nop
000c6e8c: 0006000d break 0x00001800
000c6e90: 00001810 mfhi r3
000c6e94: 24840001 addiu r4,r4,0x0001
000c6e98: ae24b720 sw r4,-0x48e0(r17)
000c6e9c: 02439021 addu r18,r18,r3
000c6ea0: 02802021 addu r4,r20,r0
000c6ea4: 02602821 addu r5,r19,r0
000c6ea8: 86070000 lh r7,0x0000(r16)
000c6eac: 86020002 lh r2,0x0002(r16)
000c6eb0: 02403021 addu r6,r18,r0
000c6eb4: 0c031bc0 jal 0x000c6f00
000c6eb8: afa20010 sw r2,0x0010(r29)
000c6ebc: 26100040 addiu r16,r16,0x0040
000c6ec0: 86030000 lh r3,0x0000(r16)
000c6ec4: 2402ffff addiu r2,r0,0xffff
000c6ec8: 1462ff67 bne r3,r2,0x000c6c68
000c6ecc: 26b50040 addiu r21,r21,0x0040
000c6ed0: 8fbf0034 lw r31,0x0034(r29)
000c6ed4: 8fb60030 lw r22,0x0030(r29)
000c6ed8: 8fb5002c lw r21,0x002c(r29)
000c6edc: 8fb40028 lw r20,0x0028(r29)
000c6ee0: 8fb30024 lw r19,0x0024(r29)
000c6ee4: 8fb20020 lw r18,0x0020(r29)
000c6ee8: 8fb1001c lw r17,0x001c(r29)
000c6eec: 8fb00018 lw r16,0x0018(r29)
000c6ef0: 03e00008 jr r31
000c6ef4: 27bd0038 addiu r29,r29,0x0038
000c6ef8: 03e00008 jr r31
000c6efc: 00000000 nop

Enemy ATB advance

000eab30: 304200ff andi r2,r2,0x00ff
000eab34: 1040004f beq r2,r0,0x000eac74
000eab38: 00000000 nop
000eab3c: 1200004d beq r16,r0,0x000eac74
000eab40: 24110001 addiu r17,r0,0x0001
000eab44: 920200b3 lbu r2,0x00b3(r16)
000eab48: 00000000 nop
000eab4c: 14400045 bne r2,r0,0x000eac64
000eab50: 00000000 nop
000eab54: 920200cf lbu r2,0x00cf(r16)
000eab58: 00000000 nop
000eab5c: 14400041 bne r2,r0,0x000eac64
000eab60: 00000000 nop
000eab64: 96020028 lhu r2,0x0028(r16)
000eab68: 00000000 nop
000eab6c: 1040003d beq r2,r0,0x000eac64
000eab70: 00000000 nop
000eab74: 8e040068 lw r4,0x0068(r16)
000eab78: 00000000 nop
000eab7c: 00041402 srl r2,r4,0x10
000eab80: 30420001 andi r2,r2,0x0001
000eab84: 10400037 beq r2,r0,0x000eac64
000eab88: 3c028010 lui r2,0x8010
000eab8c: 8c424f88 lw r2,0x4f88(r2)          ;r2 = 0x80104f88
000eab90: 00000000 nop
000eab94: 904312b6 lbu r3,0x12b6(r2)         ;r3 = (r2+0x12b6)
000eab98: 30820001 andi r2,r4,0x0001
000eab9c: 10430031 beq r2,r3,0x000eac64      ;if(b2==r3), branch to 0x000eac64
000eaba0: 26050028 addiu r5,r16,0x0028
000eaba4: 90a30006 lbu r3,0x0006(r5)         ;ATB_advance = (r5+0x6)
000eaba8: 94a20004 lhu r2,0x0004(r5)
000eabac: 8e040024 lw r4,0x0024(r16)
000eabb0: 00031e00 sll r3,r3,0x18
000eabb4: 00031e03 sra r3,r3,0x18            ;Keep last byte of ATB_advance
000eabb8: 00431021 addu r2,r2,r3             ;current_ATB += ATB_advance
000eabbc: a4a20004 sh r2,0x0004(r5)          ;Store current_ATB in (r5+0x4)
000eabc0: 00021400 sll r2,r2,0x10
000eabc4: 84830004 lh r3,0x0004(r4)
000eabc8: 00021403 sra r2,r2,0x10
000eabcc: 0043102a slt r2,r2,r3
000eabd0: 94830004 lhu r3,0x0004(r4)
000eabd4: 14400023 bne r2,r0,0x000eac64
000eabd8: 02002021 addu r4,r16,r0
000eabdc: a4a30004 sh r3,0x0004(r5)
000eabe0: 3c050202 lui r5,0x0202
000eabe4: 0c030269 jal 0x000c09a4
000eabe8: 34a50002 ori r5,r5,0x0002
000eabec: 304200ff andi r2,r2,0x00ff
000eabf0: 1440001c bne r2,r0,0x000eac64
000eabf4: 00000000 nop
000eabf8: 8e020068 lw r2,0x0068(r16)
000eabfc: 00000000 nop
000eac00: 30420001 andi r2,r2,0x0001
000eac04: 1040000f beq r2,r0,0x000eac44
000eac08: 02002021 addu r4,r16,r0
000eac0c: 0c030269 jal 0x000c09a4
000eac10: 24050c00 addiu r5,r0,0x0c00
000eac14: 304200ff andi r2,r2,0x00ff
000eac18: 10400006 beq r2,r0,0x000eac34
000eac1c: 00000000 nop
000eac20: a21100b3 sb r17,0x00b3(r16)
000eac24: 0c02ced7 jal 0x000b3b5c
000eac28: 02002021 addu r4,r16,r0
000eac2c: 0803ab19 j 0x000eac64
000eac30: 00000000 nop

Tetra Master PRNG (BIOS)

seed × 0x41C64E6D + 0x3039
07c02200: 3c03a001 lui r3,0xa001
07c02204: 8c639010 lw r3,-0x6ff0(r3)		;r3 = seed
07c02208: 3c0141c6 lui r1,0x41c6
07c0220c: 34214e6d ori r1,r1,0x4e6d		;r1 = 0x41C64E6D
07c02210: 00610019 multu r3,r1
07c02214: 3c01a001 lui r1,0xa001
07c02218: 00001812 mflo r3
07c0221c: 24633039 addiu r3,r3,0x3039		;r3 = r3 × 0x41C64E6D + 0x3039
07c02220: 00031402 srl r2,r3,0x10		;r2 = r3 >> 0x10
07c02224: 30427fff andi r2,r2,0x7fff		;r2 &= 0x7FFF
07c02228: 03e00008 jr r31			;jump to r31
07c0222c: ac239010 sw r3,-0x6ff0(r1)		;store new seed in 0xA0009010