172 lines
7.7 KiB
ArmAsm
172 lines
7.7 KiB
ArmAsm
|
.include "macros.inc"
|
||
|
|
||
|
.section .text1, "ax" # 0x80006A00 - 0x80406260
|
||
|
.global ImaAdpcmInit
|
||
|
ImaAdpcmInit:
|
||
|
/* 8014EB00 0014A940 38 C0 00 01 */ li r6, 1
|
||
|
/* 8014EB04 0014A944 90 C3 00 00 */ stw r6, 0(r3)
|
||
|
/* 8014EB08 0014A948 38 00 00 00 */ li r0, 0
|
||
|
/* 8014EB0C 0014A94C 38 60 00 00 */ li r3, 0
|
||
|
/* 8014EB10 0014A950 90 04 00 00 */ stw r0, 0(r4)
|
||
|
/* 8014EB14 0014A954 90 C5 00 00 */ stw r6, 0(r5)
|
||
|
/* 8014EB18 0014A958 4E 80 00 20 */ blr
|
||
|
/* 8014EB1C 0014A95C 00 00 00 00 */ .4byte 0x00000000 /* unknown instruction */
|
||
|
|
||
|
.global ImaAdpcmSetContext
|
||
|
ImaAdpcmSetContext:
|
||
|
/* 8014EB20 0014A960 88 A4 00 03 */ lbz r5, 3(r4)
|
||
|
/* 8014EB24 0014A964 88 04 00 02 */ lbz r0, 2(r4)
|
||
|
/* 8014EB28 0014A968 50 A0 44 2E */ rlwimi r0, r5, 8, 0x10, 0x17
|
||
|
/* 8014EB2C 0014A96C 88 84 00 00 */ lbz r4, 0(r4)
|
||
|
/* 8014EB30 0014A970 7C 00 07 34 */ extsh r0, r0
|
||
|
/* 8014EB34 0014A974 90 83 00 04 */ stw r4, 4(r3)
|
||
|
/* 8014EB38 0014A978 90 03 00 00 */ stw r0, 0(r3)
|
||
|
/* 8014EB3C 0014A97C 4E 80 00 20 */ blr
|
||
|
|
||
|
.global ImaAdpcmDecode
|
||
|
ImaAdpcmDecode:
|
||
|
/* 8014EB40 0014A980 94 21 FF E0 */ stwu r1, -0x20(r1)
|
||
|
/* 8014EB44 0014A984 3D 00 80 41 */ lis r8, g_Ima_Adpcm_StepTable@ha
|
||
|
/* 8014EB48 0014A988 3C E0 80 41 */ lis r7, g_Ima_Adpcm_IndexTable@ha
|
||
|
/* 8014EB4C 0014A98C 39 20 00 00 */ li r9, 0
|
||
|
/* 8014EB50 0014A990 93 E1 00 1C */ stw r31, 0x1c(r1)
|
||
|
/* 8014EB54 0014A994 39 68 E4 50 */ addi r11, r8, g_Ima_Adpcm_StepTable@l
|
||
|
/* 8014EB58 0014A998 39 47 E5 08 */ addi r10, r7, g_Ima_Adpcm_IndexTable@l
|
||
|
/* 8014EB5C 0014A99C 39 00 00 58 */ li r8, 0x58
|
||
|
/* 8014EB60 0014A9A0 93 C1 00 18 */ stw r30, 0x18(r1)
|
||
|
/* 8014EB64 0014A9A4 38 E0 80 00 */ li r7, -32768
|
||
|
/* 8014EB68 0014A9A8 38 00 7F FF */ li r0, 0x7fff
|
||
|
/* 8014EB6C 0014A9AC 93 A1 00 14 */ stw r29, 0x14(r1)
|
||
|
/* 8014EB70 0014A9B0 7C A9 03 A6 */ mtctr r5
|
||
|
/* 8014EB74 0014A9B4 2C 05 00 00 */ cmpwi r5, 0
|
||
|
/* 8014EB78 0014A9B8 40 81 01 80 */ ble lbl_8014ECF8
|
||
|
lbl_8014EB7C:
|
||
|
/* 8014EB7C 0014A9BC 89 84 00 00 */ lbz r12, 0(r4)
|
||
|
/* 8014EB80 0014A9C0 83 C3 00 04 */ lwz r30, 4(r3)
|
||
|
/* 8014EB84 0014A9C4 55 85 07 7E */ clrlwi r5, r12, 0x1d
|
||
|
/* 8014EB88 0014A9C8 7C AA 28 AE */ lbzx r5, r10, r5
|
||
|
/* 8014EB8C 0014A9CC 57 DD 08 3C */ slwi r29, r30, 1
|
||
|
/* 8014EB90 0014A9D0 7F EB EA AE */ lhax r31, r11, r29
|
||
|
/* 8014EB94 0014A9D4 7C A5 07 74 */ extsb r5, r5
|
||
|
/* 8014EB98 0014A9D8 7C BE 2A 15 */ add. r5, r30, r5
|
||
|
/* 8014EB9C 0014A9DC 90 A3 00 04 */ stw r5, 4(r3)
|
||
|
/* 8014EBA0 0014A9E0 40 80 00 08 */ bge lbl_8014EBA8
|
||
|
/* 8014EBA4 0014A9E4 91 23 00 04 */ stw r9, 4(r3)
|
||
|
lbl_8014EBA8:
|
||
|
/* 8014EBA8 0014A9E8 80 A3 00 04 */ lwz r5, 4(r3)
|
||
|
/* 8014EBAC 0014A9EC 2C 05 00 58 */ cmpwi r5, 0x58
|
||
|
/* 8014EBB0 0014A9F0 40 81 00 08 */ ble lbl_8014EBB8
|
||
|
/* 8014EBB4 0014A9F4 91 03 00 04 */ stw r8, 4(r3)
|
||
|
lbl_8014EBB8:
|
||
|
/* 8014EBB8 0014A9F8 55 85 07 7B */ rlwinm. r5, r12, 0, 0x1d, 0x1d
|
||
|
/* 8014EBBC 0014A9FC 7F FD 1E 70 */ srawi r29, r31, 3
|
||
|
/* 8014EBC0 0014AA00 41 82 00 08 */ beq lbl_8014EBC8
|
||
|
/* 8014EBC4 0014AA04 7F BD FA 14 */ add r29, r29, r31
|
||
|
lbl_8014EBC8:
|
||
|
/* 8014EBC8 0014AA08 55 85 07 BD */ rlwinm. r5, r12, 0, 0x1e, 0x1e
|
||
|
/* 8014EBCC 0014AA0C 41 82 00 0C */ beq lbl_8014EBD8
|
||
|
/* 8014EBD0 0014AA10 7F E5 0E 70 */ srawi r5, r31, 1
|
||
|
/* 8014EBD4 0014AA14 7F BD 2A 14 */ add r29, r29, r5
|
||
|
lbl_8014EBD8:
|
||
|
/* 8014EBD8 0014AA18 55 85 07 FF */ clrlwi. r5, r12, 0x1f
|
||
|
/* 8014EBDC 0014AA1C 41 82 00 0C */ beq lbl_8014EBE8
|
||
|
/* 8014EBE0 0014AA20 7F E5 16 70 */ srawi r5, r31, 2
|
||
|
/* 8014EBE4 0014AA24 7F BD 2A 14 */ add r29, r29, r5
|
||
|
lbl_8014EBE8:
|
||
|
/* 8014EBE8 0014AA28 55 85 07 39 */ rlwinm. r5, r12, 0, 0x1c, 0x1c
|
||
|
/* 8014EBEC 0014AA2C 41 82 00 14 */ beq lbl_8014EC00
|
||
|
/* 8014EBF0 0014AA30 80 A3 00 00 */ lwz r5, 0(r3)
|
||
|
/* 8014EBF4 0014AA34 7C BD 28 50 */ subf r5, r29, r5
|
||
|
/* 8014EBF8 0014AA38 90 A3 00 00 */ stw r5, 0(r3)
|
||
|
/* 8014EBFC 0014AA3C 48 00 00 10 */ b lbl_8014EC0C
|
||
|
lbl_8014EC00:
|
||
|
/* 8014EC00 0014AA40 80 A3 00 00 */ lwz r5, 0(r3)
|
||
|
/* 8014EC04 0014AA44 7C A5 EA 14 */ add r5, r5, r29
|
||
|
/* 8014EC08 0014AA48 90 A3 00 00 */ stw r5, 0(r3)
|
||
|
lbl_8014EC0C:
|
||
|
/* 8014EC0C 0014AA4C 80 A3 00 00 */ lwz r5, 0(r3)
|
||
|
/* 8014EC10 0014AA50 2C 05 80 00 */ cmpwi r5, -32768
|
||
|
/* 8014EC14 0014AA54 40 80 00 08 */ bge lbl_8014EC1C
|
||
|
/* 8014EC18 0014AA58 90 E3 00 00 */ stw r7, 0(r3)
|
||
|
lbl_8014EC1C:
|
||
|
/* 8014EC1C 0014AA5C 80 A3 00 00 */ lwz r5, 0(r3)
|
||
|
/* 8014EC20 0014AA60 2C 05 7F FF */ cmpwi r5, 0x7fff
|
||
|
/* 8014EC24 0014AA64 40 81 00 08 */ ble lbl_8014EC2C
|
||
|
/* 8014EC28 0014AA68 90 03 00 00 */ stw r0, 0(r3)
|
||
|
lbl_8014EC2C:
|
||
|
/* 8014EC2C 0014AA6C 7D 8C 26 70 */ srawi r12, r12, 4
|
||
|
/* 8014EC30 0014AA70 83 A3 00 04 */ lwz r29, 4(r3)
|
||
|
/* 8014EC34 0014AA74 55 9F 07 7E */ clrlwi r31, r12, 0x1d
|
||
|
/* 8014EC38 0014AA78 80 A3 00 00 */ lwz r5, 0(r3)
|
||
|
/* 8014EC3C 0014AA7C 7F EA F8 AE */ lbzx r31, r10, r31
|
||
|
/* 8014EC40 0014AA80 57 BE 08 3C */ slwi r30, r29, 1
|
||
|
/* 8014EC44 0014AA84 7F CB F2 AE */ lhax r30, r11, r30
|
||
|
/* 8014EC48 0014AA88 7F FF 07 74 */ extsb r31, r31
|
||
|
/* 8014EC4C 0014AA8C 7F FD FA 15 */ add. r31, r29, r31
|
||
|
/* 8014EC50 0014AA90 93 E3 00 04 */ stw r31, 4(r3)
|
||
|
/* 8014EC54 0014AA94 40 80 00 08 */ bge lbl_8014EC5C
|
||
|
/* 8014EC58 0014AA98 91 23 00 04 */ stw r9, 4(r3)
|
||
|
lbl_8014EC5C:
|
||
|
/* 8014EC5C 0014AA9C 83 E3 00 04 */ lwz r31, 4(r3)
|
||
|
/* 8014EC60 0014AAA0 2C 1F 00 58 */ cmpwi r31, 0x58
|
||
|
/* 8014EC64 0014AAA4 40 81 00 08 */ ble lbl_8014EC6C
|
||
|
/* 8014EC68 0014AAA8 91 03 00 04 */ stw r8, 4(r3)
|
||
|
lbl_8014EC6C:
|
||
|
/* 8014EC6C 0014AAAC 55 9F 07 7B */ rlwinm. r31, r12, 0, 0x1d, 0x1d
|
||
|
/* 8014EC70 0014AAB0 7F DD 1E 70 */ srawi r29, r30, 3
|
||
|
/* 8014EC74 0014AAB4 41 82 00 08 */ beq lbl_8014EC7C
|
||
|
/* 8014EC78 0014AAB8 7F BD F2 14 */ add r29, r29, r30
|
||
|
lbl_8014EC7C:
|
||
|
/* 8014EC7C 0014AABC 55 9F 07 BD */ rlwinm. r31, r12, 0, 0x1e, 0x1e
|
||
|
/* 8014EC80 0014AAC0 41 82 00 0C */ beq lbl_8014EC8C
|
||
|
/* 8014EC84 0014AAC4 7F DF 0E 70 */ srawi r31, r30, 1
|
||
|
/* 8014EC88 0014AAC8 7F BD FA 14 */ add r29, r29, r31
|
||
|
lbl_8014EC8C:
|
||
|
/* 8014EC8C 0014AACC 55 9F 07 FF */ clrlwi. r31, r12, 0x1f
|
||
|
/* 8014EC90 0014AAD0 41 82 00 0C */ beq lbl_8014EC9C
|
||
|
/* 8014EC94 0014AAD4 7F DF 16 70 */ srawi r31, r30, 2
|
||
|
/* 8014EC98 0014AAD8 7F BD FA 14 */ add r29, r29, r31
|
||
|
lbl_8014EC9C:
|
||
|
/* 8014EC9C 0014AADC 55 8C 07 39 */ rlwinm. r12, r12, 0, 0x1c, 0x1c
|
||
|
/* 8014ECA0 0014AAE0 41 82 00 14 */ beq lbl_8014ECB4
|
||
|
/* 8014ECA4 0014AAE4 81 83 00 00 */ lwz r12, 0(r3)
|
||
|
/* 8014ECA8 0014AAE8 7D 9D 60 50 */ subf r12, r29, r12
|
||
|
/* 8014ECAC 0014AAEC 91 83 00 00 */ stw r12, 0(r3)
|
||
|
/* 8014ECB0 0014AAF0 48 00 00 10 */ b lbl_8014ECC0
|
||
|
lbl_8014ECB4:
|
||
|
/* 8014ECB4 0014AAF4 81 83 00 00 */ lwz r12, 0(r3)
|
||
|
/* 8014ECB8 0014AAF8 7D 8C EA 14 */ add r12, r12, r29
|
||
|
/* 8014ECBC 0014AAFC 91 83 00 00 */ stw r12, 0(r3)
|
||
|
lbl_8014ECC0:
|
||
|
/* 8014ECC0 0014AB00 81 83 00 00 */ lwz r12, 0(r3)
|
||
|
/* 8014ECC4 0014AB04 2C 0C 80 00 */ cmpwi r12, -32768
|
||
|
/* 8014ECC8 0014AB08 40 80 00 08 */ bge lbl_8014ECD0
|
||
|
/* 8014ECCC 0014AB0C 90 E3 00 00 */ stw r7, 0(r3)
|
||
|
lbl_8014ECD0:
|
||
|
/* 8014ECD0 0014AB10 81 83 00 00 */ lwz r12, 0(r3)
|
||
|
/* 8014ECD4 0014AB14 2C 0C 7F FF */ cmpwi r12, 0x7fff
|
||
|
/* 8014ECD8 0014AB18 40 81 00 08 */ ble lbl_8014ECE0
|
||
|
/* 8014ECDC 0014AB1C 90 03 00 00 */ stw r0, 0(r3)
|
||
|
lbl_8014ECE0:
|
||
|
/* 8014ECE0 0014AB20 81 83 00 00 */ lwz r12, 0(r3)
|
||
|
/* 8014ECE4 0014AB24 38 84 00 01 */ addi r4, r4, 1
|
||
|
/* 8014ECE8 0014AB28 B0 A6 00 00 */ sth r5, 0(r6)
|
||
|
/* 8014ECEC 0014AB2C B1 86 00 02 */ sth r12, 2(r6)
|
||
|
/* 8014ECF0 0014AB30 38 C6 00 04 */ addi r6, r6, 4
|
||
|
/* 8014ECF4 0014AB34 42 00 FE 88 */ bdnz lbl_8014EB7C
|
||
|
lbl_8014ECF8:
|
||
|
/* 8014ECF8 0014AB38 83 E1 00 1C */ lwz r31, 0x1c(r1)
|
||
|
/* 8014ECFC 0014AB3C 83 C1 00 18 */ lwz r30, 0x18(r1)
|
||
|
/* 8014ED00 0014AB40 83 A1 00 14 */ lwz r29, 0x14(r1)
|
||
|
/* 8014ED04 0014AB44 38 21 00 20 */ addi r1, r1, 0x20
|
||
|
/* 8014ED08 0014AB48 4E 80 00 20 */ blr
|
||
|
/* 8014ED0C 0014AB4C 00 00 00 00 */ .4byte 0x00000000 /* unknown instruction */
|
||
|
|
||
|
.section .data4, "wa" # 0x80406560 - 0x80421040
|
||
|
.global g_Ima_Adpcm_StepTable
|
||
|
g_Ima_Adpcm_StepTable:
|
||
|
.incbin "baserom.dol", 0x40A550, 0xB8
|
||
|
.global g_Ima_Adpcm_IndexTable
|
||
|
g_Ima_Adpcm_IndexTable:
|
||
|
.incbin "baserom.dol", 0x40A608, 0x10
|