Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save lunasorcery/bcb582cb425c5e52cbdf2b96a1bba973 to your computer and use it in GitHub Desktop.
Save lunasorcery/bcb582cb425c5e52cbdf2b96a1bba973 to your computer and use it in GitHub Desktop.
; EU 0x087E70E0 / NA 0x087E4230:
; loaded to RAM at 030008f0
; sprite decompression function (8bit indexed)
; r0: compressed sprite source ptr
; r1: vram destination ptr
; r2: width
; r3: height
.arm
add lr, lr, #1
stmdb sp!, {r4-r9}
mov r6, r2
mov r7, r3
mov r9, #0
_EU087E70F4_NA087E4244:
mov r2, #0
add r8, r1, r6, lsl #3
_EU087E70FC_NA087E424C:
ldrb r3, [r0], #1
and r2, r2, #1
subs r3, r3, r2
bls _EU087E7134_NA087E4284
mov r4, #0
subs r3, r3, #2
bcc _EU087E7134_NA087E4284
_EU087E7118_NA087E4268:
strh r4, [r1], #2
tst r1, #7
addeq r1, r1, #56
subs r3, r3, #2
bcs _EU087E7118_NA087E4268
cmp r1, r8
bcs _EU087E71A0_NA087E42F0
_EU087E7134_NA087E4284:
ldrb r2, [r0], #1
tst r2, r2
beq _EU087E7198_NA087E42E8
tst r3, #1
addne r2, r2, #1
ldreqb r4, [r0], #1
orreq r4, r4, r9
subs r2, r2, #2
bcc _EU087E718C_NA087E42DC
_EU087E7158_NA087E42A8:
ldrb r5, [r0], #1
orr r5, r5, r9
orrs r4, r4, r5, lsl #8
strh r4, [r1], #2
tst r1, #7
addeq r1, r1, #56
ldrb r4, [r0], #1
orr r4, r4, r9
subs r2, r2, #2
bcs _EU087E7158_NA087E42A8
tst r2, #1
subeq r0, r0, #1
beq _EU087E7198_NA087E42E8
_EU087E718C_NA087E42DC:
strh r4, [r1], #2
tst r1, #7
addeq r1, r1, #56
_EU087E7198_NA087E42E8:
cmp r1, r8
bcc _EU087E70FC_NA087E424C
_EU087E71A0_NA087E42F0:
add r1, r1, #8
tst r1, #63
subne r1, r1, r6, lsl #3
subeq r1, r1, #64
subs r7, r7, #1
ldrneb r3, [r0, #0]
cmpne r3, #255
bne _EU087E70F4_NA087E4244
cmp r7, #0
beq _EU087E71FC_NA087E434C
mov r4, #0
_EU087E71CC_NA087E431C:
add r8, r1, r6, lsl #3
_EU087E71D0_NA087E4320:
str r4, [r1], #4
str r4, [r1], #60
cmp r1, r8
bcc _EU087E71D0_NA087E4320
add r1, r1, #8
tst r1, #63
subne r1, r1, r6, lsl #3
subeq r1, r1, #64
subs r7, r7, #1
bne _EU087E71CC_NA087E431C
add r0, r0, #1
_EU087E71FC_NA087E434C:
ldmia sp!, {r4-r9}
bx lr
; EU 0x087E7204 / NA 0x087E4354:
; loaded at 0x03000a14
; sprite decompression function (4bit indexed)
; r0: compressed sprite source ptr
; r1: vram destination ptr
; r2: width
; r3: height
.arm
add lr, lr, #1
stmdb sp!, {r4-r9}
mov r6, r2
mov r7, r3
mov r9, #0
_EU087E7218_NA087E4368:
mov r2, #0
add r8, r1, r6, lsl #2
_EU087E7220_NA087E4370:
ldrb r3, [r0], #1
and r2, r2, #1
subs r3, r3, r2
bls _EU087E7258_NA087E43A8
mov r4, #0
subs r3, r3, #2
bcc _EU087E7258_NA087E43A8
_EU087E723C_NA087E438C:
strh r4, [r1], #2
tst r1, #3
addeq r1, r1, #28
subs r3, r3, #2
bcs _EU087E723C_NA087E438C
cmp r1, r8
bcs _EU087E72C4_NA087E4414
_EU087E7258_NA087E43A8:
ldrb r2, [r0], #1
tst r2, r2
beq _EU087E72BC_NA087E440C
tst r3, #1
addne r2, r2, #1
ldreqb r4, [r0], #1
orreq r4, r4, r9
subs r2, r2, #2
bcc _EU087E72B0_NA087E4400
_EU087E727C_NA087E43CC:
ldrb r5, [r0], #1
orr r5, r5, r9
orrs r4, r4, r5, lsl #8
strh r4, [r1], #2
tst r1, #3
addeq r1, r1, #28
ldrb r4, [r0], #1
orr r4, r4, r9
subs r2, r2, #2
bcs _EU087E727C_NA087E43CC
tst r2, #1
subeq r0, r0, #1
beq _EU087E72BC_NA087E440C
_EU087E72B0_NA087E4400:
strh r4, [r1], #2
tst r1, #3
addeq r1, r1, #28
_EU087E72BC_NA087E440C:
cmp r1, r8
bcc _EU087E7220_NA087E4370
_EU087E72C4_NA087E4414:
add r1, r1, #4
tst r1, #31
subne r1, r1, r6, lsl #2
subeq r1, r1, #32
subs r7, r7, #1
ldrneb r3, [r0, #0]
cmpne r3, #255
bne _EU087E7218_NA087E4368
cmp r7, #0
beq _EU087E731C_NA087E446C
mov r4, #0
_EU087E72F0_NA087E4440:
add r8, r1, r6, lsl #2
_EU087E72F4_NA087E4444:
str r4, [r1], #32
cmp r1, r8
bcc _EU087E72F4_NA087E4444
add r1, r1, #4
tst r1, #31
subne r1, r1, r6, lsl #2
subeq r1, r1, #32
subs r7, r7, #1
bne _EU087E72F0_NA087E4440
add r0, r0, #1
_EU087E731C_NA087E446C:
ldmia sp!, {r4-r9}
bx lr
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment