donut-decomp/asm/os/OSCrc.s
2022-07-21 16:12:13 +01:00

109 lines
5 KiB
ArmAsm

.include "macros.inc"
.section .text, "ax" # 0x80006A00 - 0x80406260
.global OSCalcCRC32
OSCalcCRC32:
/* 800281E0 00024020 2C 04 00 00 */ cmpwi r4, 0
/* 800281E4 00024024 3C E0 80 40 */ lis r7, $$2LOCAL$$2OSCalcCRC32__FPCvUl$$2crc32_table@ha
/* 800281E8 00024028 39 00 FF FF */ li r8, -1
/* 800281EC 0002402C 38 E7 78 00 */ addi r7, r7, $$2LOCAL$$2OSCalcCRC32__FPCvUl$$2crc32_table@l
/* 800281F0 00024030 41 82 01 1C */ beq lbl_8002830C
/* 800281F4 00024034 54 80 F0 BF */ rlwinm. r0, r4, 0x1e, 2, 0x1f
/* 800281F8 00024038 7C 09 03 A6 */ mtctr r0
/* 800281FC 0002403C 41 82 00 D4 */ beq lbl_800282D0
lbl_80028200:
/* 80028200 00024040 89 23 00 00 */ lbz r9, 0(r3)
/* 80028204 00024044 55 06 E1 3E */ srwi r6, r8, 4
/* 80028208 00024048 7D 00 4A 78 */ xor r0, r8, r9
/* 8002820C 0002404C 55 25 E1 3E */ srwi r5, r9, 4
/* 80028210 00024050 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 80028214 00024054 89 23 00 01 */ lbz r9, 1(r3)
/* 80028218 00024058 7C 07 00 2E */ lwzx r0, r7, r0
/* 8002821C 0002405C 7C C6 02 78 */ xor r6, r6, r0
/* 80028220 00024060 7C C0 2A 78 */ xor r0, r6, r5
/* 80028224 00024064 55 25 E1 3E */ srwi r5, r9, 4
/* 80028228 00024068 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 8002822C 0002406C 54 C6 E1 3E */ srwi r6, r6, 4
/* 80028230 00024070 7C 07 00 2E */ lwzx r0, r7, r0
/* 80028234 00024074 7C C8 02 78 */ xor r8, r6, r0
/* 80028238 00024078 7D 00 4A 78 */ xor r0, r8, r9
/* 8002823C 0002407C 89 23 00 02 */ lbz r9, 2(r3)
/* 80028240 00024080 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 80028244 00024084 55 06 E1 3E */ srwi r6, r8, 4
/* 80028248 00024088 7C 07 00 2E */ lwzx r0, r7, r0
/* 8002824C 0002408C 7C C6 02 78 */ xor r6, r6, r0
/* 80028250 00024090 7C C0 2A 78 */ xor r0, r6, r5
/* 80028254 00024094 55 25 E1 3E */ srwi r5, r9, 4
/* 80028258 00024098 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 8002825C 0002409C 54 C6 E1 3E */ srwi r6, r6, 4
/* 80028260 000240A0 7C 07 00 2E */ lwzx r0, r7, r0
/* 80028264 000240A4 7C C8 02 78 */ xor r8, r6, r0
/* 80028268 000240A8 7D 00 4A 78 */ xor r0, r8, r9
/* 8002826C 000240AC 89 23 00 03 */ lbz r9, 3(r3)
/* 80028270 000240B0 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 80028274 000240B4 55 06 E1 3E */ srwi r6, r8, 4
/* 80028278 000240B8 7C 07 00 2E */ lwzx r0, r7, r0
/* 8002827C 000240BC 38 63 00 04 */ addi r3, r3, 4
/* 80028280 000240C0 7C C6 02 78 */ xor r6, r6, r0
/* 80028284 000240C4 7C C0 2A 78 */ xor r0, r6, r5
/* 80028288 000240C8 55 25 E1 3E */ srwi r5, r9, 4
/* 8002828C 000240CC 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 80028290 000240D0 54 C6 E1 3E */ srwi r6, r6, 4
/* 80028294 000240D4 7C 07 00 2E */ lwzx r0, r7, r0
/* 80028298 000240D8 7C C8 02 78 */ xor r8, r6, r0
/* 8002829C 000240DC 7D 00 4A 78 */ xor r0, r8, r9
/* 800282A0 000240E0 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 800282A4 000240E4 55 06 E1 3E */ srwi r6, r8, 4
/* 800282A8 000240E8 7C 07 00 2E */ lwzx r0, r7, r0
/* 800282AC 000240EC 7C C6 02 78 */ xor r6, r6, r0
/* 800282B0 000240F0 7C C0 2A 78 */ xor r0, r6, r5
/* 800282B4 000240F4 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 800282B8 000240F8 54 C6 E1 3E */ srwi r6, r6, 4
/* 800282BC 000240FC 7C 07 00 2E */ lwzx r0, r7, r0
/* 800282C0 00024100 7C C8 02 78 */ xor r8, r6, r0
/* 800282C4 00024104 42 00 FF 3C */ bdnz lbl_80028200
/* 800282C8 00024108 70 84 00 03 */ andi. r4, r4, 3
/* 800282CC 0002410C 41 82 00 40 */ beq lbl_8002830C
lbl_800282D0:
/* 800282D0 00024110 7C 89 03 A6 */ mtctr r4
lbl_800282D4:
/* 800282D4 00024114 89 23 00 00 */ lbz r9, 0(r3)
/* 800282D8 00024118 55 06 E1 3E */ srwi r6, r8, 4
/* 800282DC 0002411C 38 63 00 01 */ addi r3, r3, 1
/* 800282E0 00024120 7D 00 4A 78 */ xor r0, r8, r9
/* 800282E4 00024124 55 25 E1 3E */ srwi r5, r9, 4
/* 800282E8 00024128 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 800282EC 0002412C 7C 07 00 2E */ lwzx r0, r7, r0
/* 800282F0 00024130 7C C6 02 78 */ xor r6, r6, r0
/* 800282F4 00024134 7C C0 2A 78 */ xor r0, r6, r5
/* 800282F8 00024138 54 00 16 BA */ rlwinm r0, r0, 2, 0x1a, 0x1d
/* 800282FC 0002413C 54 C6 E1 3E */ srwi r6, r6, 4
/* 80028300 00024140 7C 07 00 2E */ lwzx r0, r7, r0
/* 80028304 00024144 7C C8 02 78 */ xor r8, r6, r0
/* 80028308 00024148 42 00 FF CC */ bdnz lbl_800282D4
lbl_8002830C:
/* 8002830C 0002414C 7D 03 40 F8 */ nor r3, r8, r8
/* 80028310 00024150 4E 80 00 20 */ blr
/* 80028314 00024154 00 00 00 00 */ .4byte 0x00000000 /* unknown instruction */
/* 80028318 00024158 00 00 00 00 */ .4byte 0x00000000 /* unknown instruction */
/* 8002831C 0002415C 00 00 00 00 */ .4byte 0x00000000 /* unknown instruction */
.section .rodata, "wa" # 0x80406560 - 0x80421040
.global $$2LOCAL$$2OSCalcCRC32__FPCvUl$$2crc32_table
$$2LOCAL$$2OSCalcCRC32__FPCvUl$$2crc32_table:
.4byte 0
.4byte 0x1DB71064
.4byte 0x3B6E20C8
.4byte 0x26D930AC
.4byte 0x76DC4190
.4byte 0x6B6B51F4
.4byte 0x4DB26158
.4byte 0x5005713C
.4byte 0xEDB88320
.4byte 0xF00F9344
.4byte 0xD6D6A3E8
.4byte 0xCB61B38C
.4byte 0x9B64C2B0
.4byte 0x86D3D2D4
.4byte 0xA00AE278
.4byte 0xBDBDF21C