Skip to content

Instantly share code, notes, and snippets.

@PikalaxALT PikalaxALT/save.s
Last active Nov 18, 2018

Embed
What would you like to do?
output by arm-none-eabi-gcc-8.1.0
.file ""
.text
.syntax divided
.section .rodata
.align 2
.thumb
.syntax unified
.align 1
.p2align 2,,3
.arch armv4t
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type SetSectorDamagedStatus, %function
SetSectorDamagedStatus:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
movs r3, #1
ldr r2, .L5
lsls r3, r3, r1
ldr r1, [r2]
cmp r0, #1
beq .L2
orrs r1, r3
.L3:
movs r0, #0
str r1, [r2]
@ sp needed
bx lr
.L2:
bics r1, r3
b .L3
.L6:
.align 2
.L5:
.word gDamagedSaveSectors
.size SetSectorDamagedStatus, .-SetSectorDamagedStatus
.align 1
.p2align 2,,3
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type TryWriteSector, %function
TryWriteSector:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
movs r4, r0
bl ProgramFlashSectorAndVerify
movs r1, r4
cmp r0, #0
bne .L10
movs r0, #1
bl SetSectorDamagedStatus
movs r0, #1
.L9:
@ sp needed
pop {r4}
pop {r1}
bx r1
.L10:
movs r0, #0
bl SetSectorDamagedStatus
movs r0, #255
b .L9
.size TryWriteSector, .-TryWriteSector
.align 1
.p2align 2,,3
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type ReadSomeUnknownSectorAndVerify.constprop.9, %function
ReadSomeUnknownSectorAndVerify.constprop.9:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
movs r3, #128
push {r4, r5, lr}
ldr r4, .L20
lsls r3, r3, #5
movs r2, r4
movs r5, r1
movs r1, #0
bl ReadFlash
ldr r2, .L20+4
ldr r3, .L20+8
ldrb r2, [r4, r2]
ldrb r3, [r4, r3]
lsls r2, r2, #8
orrs r2, r3
ldr r3, .L20+12
ldrb r3, [r4, r3]
lsls r3, r3, #16
orrs r2, r3
ldr r3, .L20+16
ldrb r3, [r4, r3]
lsls r3, r3, #24
orrs r3, r2
ldr r2, .L20+20
movs r0, #0
cmp r3, r2
bne .L12
movs r1, #248
movs r2, #0
movs r3, r4
lsls r1, r1, #4
adds r0, r4, r1
.L13:
ldmia r3!, {r1}
adds r2, r2, r1
cmp r3, r0
bne .L13
lsrs r1, r2, #16
adds r2, r1, r2
ldr r1, .L20+24
mov ip, r1
ldr r0, .L20+28
ldr r1, .L20+32
add r3, r3, ip
ldrb r1, [r3, r1]
ldrb r3, [r3, r0]
lsls r2, r2, #16
lsls r3, r3, #8
lsrs r2, r2, #16
orrs r3, r1
movs r0, #2
cmp r2, r3
beq .L19
.L12:
@ sp needed
pop {r4, r5}
pop {r1}
bx r1
.L19:
movs r1, #248
movs r3, #0
lsls r1, r1, #4
.L14:
ldrb r2, [r4, r3]
strb r2, [r5, r3]
adds r3, r3, #1
cmp r3, r1
bne .L14
movs r0, #1
b .L12
.L21:
.align 2
.L20:
.word gSharedMem
.word 4089
.word 4088
.word 4090
.word 4091
.word 134291493
.word -3968
.word 4085
.word 4084
.size ReadSomeUnknownSectorAndVerify.constprop.9, .-ReadSomeUnknownSectorAndVerify.constprop.9
.global __umodsi3
.align 1
.p2align 2,,3
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type WriteSomeFlashByte0x25ToPrevSector.constprop.10, %function
WriteSomeFlashByte0x25ToPrevSector.constprop.10:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr}
ldr r5, .L26
ldrh r3, [r5]
subs r3, r3, #1
adds r0, r0, r3
lsls r0, r0, #16
movs r1, #14
lsrs r0, r0, #16
bl __umodsi3
movs r3, #1
ldr r6, .L26+4
ldr r2, [r6]
ands r3, r2
lsls r4, r3, #3
subs r4, r4, r3
lsls r4, r4, #1
adds r4, r0, r4
ldr r3, .L26+8
lsls r4, r4, #16
lsrs r4, r4, #16
ldr r1, .L26+12
ldr r3, [r3]
movs r2, #37
movs r0, r4
bl .L28
movs r1, r4
cmp r0, #0
bne .L25
movs r0, #1
bl SetSectorDamagedStatus
movs r0, #1
.L24:
@ sp needed
pop {r4, r5, r6}
pop {r1}
bx r1
.L25:
movs r0, #0
bl SetSectorDamagedStatus
ldr r3, .L26+16
ldrh r3, [r3]
strh r3, [r5]
ldr r3, .L26+20
ldr r3, [r3]
movs r0, #255
str r3, [r6]
b .L24
.L27:
.align 2
.L26:
.word gFirstSaveSector
.word gSaveCounter
.word ProgramFlashByte
.word 4088
.word gLastKnownGoodSector
.word gPrevSaveCounter
.size WriteSomeFlashByte0x25ToPrevSector.constprop.10, .-WriteSomeFlashByte0x25ToPrevSector.constprop.10
.align 1
.p2align 2,,3
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type sub_812556C.constprop.12, %function
sub_812556C.constprop.12:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, lr}
mov lr, r10
mov r6, r8
mov r7, r9
ldr r3, .L49
subs r5, r0, #1
lsls r5, r5, #16
ldrh r0, [r3]
lsrs r5, r5, #16
adds r0, r5, r0
lsls r0, r0, #16
push {r6, r7, lr}
movs r1, #14
lsrs r0, r0, #16
mov r8, r3
bl __umodsi3
ldr r3, .L49+4
mov r10, r3
movs r1, #0
mov r2, r10
movs r3, #1
mov ip, r1
movs r1, #128
ldr r2, [r2]
ands r3, r2
lsls r4, r3, #3
subs r4, r4, r3
ldr r3, .L49+8
lsls r2, r5, #3
lsls r1, r1, #5
adds r3, r3, r2
mov r9, r1
movs r2, #0
lsls r4, r4, #1
adds r4, r0, r4
lsls r4, r4, #16
ldr r0, [r3]
ldr r6, .L49+12
ldrh r3, [r3, #4]
lsrs r4, r4, #16
.L30:
mov r1, ip
ldr r7, [r6]
strb r1, [r7, r2]
adds r2, r2, #1
cmp r2, r9
bne .L30
ldr r2, [r6]
ldr r1, .L49+16
strh r5, [r2, r1]
ldr r1, .L49+20
ldr r5, .L49+24
str r5, [r2, r1]
mov r5, r10
ldr r1, .L49+28
ldr r5, [r5]
str r5, [r2, r1]
movs r1, #0
cmp r3, #0
beq .L33
.L31:
ldrb r5, [r0, r1]
strb r5, [r2, r1]
adds r1, r1, #1
lsls r5, r1, #16
lsrs r5, r5, #16
cmp r5, r3
bcc .L31
lsrs r1, r3, #2
beq .L33
movs r3, #0
movs r5, #0
.L34:
ldmia r0!, {r7}
mov ip, r7
adds r3, r3, #1
lsls r3, r3, #16
add r5, r5, ip
lsrs r3, r3, #16
cmp r3, r1
bne .L34
lsrs r3, r5, #16
adds r3, r3, r5
lsls r3, r3, #16
lsrs r3, r3, #16
.L32:
ldr r1, .L49+32
strh r3, [r2, r1]
ldr r3, .L49+36
movs r0, r4
ldr r3, [r3]
bl .L28
ldr r3, .L49+40
movs r5, #0
mov r9, r3
.L35:
ldr r3, [r6]
ldrb r2, [r3, r5]
mov r3, r9
movs r1, r5
movs r0, r4
ldr r3, [r3]
bl .L28
adds r5, r5, #1
cmp r0, #0
beq .L35
movs r1, r4
movs r0, #0
bl SetSectorDamagedStatus
ldr r3, .L49+44
ldr r3, [r3]
movs r0, #1
cmp r3, #0
beq .L36
mov r2, r8
ldr r3, .L49+48
ldrh r3, [r3]
strh r3, [r2]
mov r2, r10
ldr r3, .L49+52
ldr r3, [r3]
str r3, [r2]
adds r0, r0, #254
.L36:
@ sp needed
pop {r2, r3, r4}
mov r8, r2
mov r9, r3
mov r10, r4
pop {r4, r5, r6, r7}
pop {r1}
bx r1
.L33:
movs r3, #0
b .L32
.L50:
.align 2
.L49:
.word gFirstSaveSector
.word gSaveCounter
.word .LANCHOR0
.word gFastSaveSection
.word 4084
.word 4088
.word 134291493
.word 4092
.word 4086
.word EraseFlashSector
.word ProgramFlashByte
.word gDamagedSaveSectors
.word gLastKnownGoodSector
.word gPrevSaveCounter
.size sub_812556C.constprop.12, .-sub_812556C.constprop.12
.align 1
.p2align 2,,3
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type WriteSingleChunk.constprop.16, %function
WriteSingleChunk.constprop.16:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, lr}
movs r7, r0
mov lr, r8
ldr r3, .L65
ldrh r0, [r3]
adds r0, r7, r0
lsls r0, r0, #16
movs r1, #14
push {lr}
lsrs r0, r0, #16
bl __umodsi3
movs r2, #1
ldr r3, .L65+4
mov ip, r3
ldr r3, [r3]
ands r2, r3
lsls r3, r2, #3
subs r3, r3, r2
lsls r3, r3, #1
adds r0, r0, r3
lsls r0, r0, #16
lsrs r3, r0, #16
mov r8, r3
ldr r3, .L65+8
lsls r2, r7, #3
adds r3, r3, r2
movs r1, #128
ldr r5, [r3]
ldrh r6, [r3, #4]
movs r4, #0
movs r3, #0
ldr r2, .L65+12
lsls r1, r1, #5
.L52:
ldr r0, [r2]
strb r4, [r0, r3]
adds r3, r3, #1
cmp r3, r1
bne .L52
ldr r1, [r2]
ldr r3, .L65+16
ldr r2, .L65+20
strh r7, [r1, r3]
ldr r3, .L65+24
str r2, [r1, r3]
mov r3, ip
ldr r2, [r3]
ldr r3, .L65+28
str r2, [r1, r3]
movs r3, #0
cmp r6, #0
beq .L55
.L53:
ldrb r2, [r5, r3]
strb r2, [r1, r3]
adds r3, r3, #1
lsls r2, r3, #16
lsrs r2, r2, #16
cmp r2, r6
bcc .L53
lsrs r6, r6, #2
beq .L55
movs r3, #0
movs r2, #0
.L56:
ldmia r5!, {r4}
adds r3, r3, #1
lsls r3, r3, #16
adds r2, r2, r4
lsrs r3, r3, #16
cmp r3, r6
bne .L56
lsrs r3, r2, #16
adds r2, r3, r2
lsls r2, r2, #16
lsrs r2, r2, #16
.L54:
ldr r3, .L65+32
mov r0, r8
strh r2, [r1, r3]
bl TryWriteSector
@ sp needed
pop {r2}
mov r8, r2
pop {r4, r5, r6, r7}
pop {r1}
bx r1
.L55:
movs r2, #0
b .L54
.L66:
.align 2
.L65:
.word gFirstSaveSector
.word gSaveCounter
.word .LANCHOR0
.word gFastSaveSection
.word 4084
.word 134291493
.word 4088
.word 4092
.word 4086
.size WriteSingleChunk.constprop.16, .-WriteSingleChunk.constprop.16
.align 1
.p2align 2,,3
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type WriteSaveBlockChunks.constprop.15, %function
WriteSaveBlockChunks.constprop.15:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, lr}
mov lr, r8
ldr r3, .L75
ldr r2, .L75+4
push {lr}
str r2, [r3]
ldr r3, .L75+8
cmp r0, r3
bne .L74
ldr r6, .L75+12
ldr r3, .L75+16
ldrh r0, [r6]
ldr r5, .L75+20
strh r0, [r3]
ldr r4, [r5]
ldr r7, .L75+24
adds r0, r0, #1
lsls r0, r0, #16
str r4, [r7]
lsrs r0, r0, #16
movs r1, #14
mov r8, r3
bl __umodsi3
adds r4, r4, #1
str r4, [r5]
movs r4, #0
strh r0, [r6]
.L70:
movs r0, r4
adds r4, r4, #1
bl WriteSingleChunk.constprop.16
cmp r4, #14
bne .L70
ldr r3, .L75+28
ldr r3, [r3]
movs r0, #1
cmp r3, #0
beq .L69
mov r3, r8
ldrh r3, [r3]
strh r3, [r6]
ldr r3, [r7]
str r3, [r5]
adds r0, r0, #254
.L69:
@ sp needed
pop {r2}
mov r8, r2
pop {r4, r5, r6, r7}
pop {r1}
bx r1
.L74:
bl WriteSingleChunk.constprop.16
b .L69
.L76:
.align 2
.L75:
.word gFastSaveSection
.word gSharedMem
.word 65535
.word gFirstSaveSector
.word gLastKnownGoodSector
.word gSaveCounter
.word gPrevSaveCounter
.word gDamagedSaveSectors
.size WriteSaveBlockChunks.constprop.15, .-WriteSaveBlockChunks.constprop.15
.align 1
.p2align 2,,3
.global Save_EraseAllData
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type Save_EraseAllData, %function
Save_EraseAllData:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, lr}
movs r4, #0
ldr r5, .L80
.L78:
movs r0, r4
ldr r3, [r5]
adds r4, r4, #1
bl .L28
cmp r4, #32
bne .L78
@ sp needed
pop {r4, r5}
pop {r0}
bx r0
.L81:
.align 2
.L80:
.word EraseFlashSector
.size Save_EraseAllData, .-Save_EraseAllData
.align 1
.p2align 2,,3
.global Save_ResetSaveCounters
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type Save_ResetSaveCounters, %function
Save_ResetSaveCounters:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
@ link register save eliminated.
movs r3, #0
ldr r2, .L83
str r3, [r2]
ldr r2, .L83+4
strh r3, [r2]
ldr r2, .L83+8
@ sp needed
str r3, [r2]
bx lr
.L84:
.align 2
.L83:
.word gSaveCounter
.word gFirstSaveSector
.word gDamagedSaveSectors
.size Save_ResetSaveCounters, .-Save_ResetSaveCounters
.align 1
.p2align 2,,3
.global Save_WriteDataInternal
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type Save_WriteDataInternal, %function
Save_WriteDataInternal:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, lr}
mov lr, r10
mov r7, r9
mov r6, r8
lsls r0, r0, #24
push {r6, r7, lr}
lsrs r0, r0, #24
cmp r0, #5
bhi .L86
ldr r3, .L118
lsls r0, r0, #2
ldr r3, [r3, r0]
mov pc, r3
.section .rodata
.align 2
.L88:
.word .L86
.word .L92
.word .L91
.word .L90
.word .L102
.word .L103
.text
.L102:
movs r4, #28
ldr r5, .L118+4
.L89:
movs r0, r4
ldr r3, [r5]
adds r4, r4, #1
bl .L28
cmp r4, #32
bne .L89
.L86:
bl SaveSerializedGame
ldr r0, .L118+8
bl WriteSaveBlockChunks.constprop.15
.L101:
movs r0, #0
@ sp needed
pop {r2, r3, r4}
mov r8, r2
mov r9, r3
mov r10, r4
pop {r4, r5, r6, r7}
pop {r1}
bx r1
.L103:
movs r4, #28
ldr r5, .L118+4
.L87:
movs r0, r4
ldr r3, [r5]
adds r4, r4, #1
bl .L28
cmp r4, #32
bne .L87
.L90:
movs r0, #10
bl GetGameStat
ldr r3, .L118+12
cmp r0, r3
bls .L117
.L93:
ldr r1, .L118+16
ldr r3, .L118+20
adds r6, r1, r3
ldr r3, .L118+24
mov r10, r3
movs r3, #0
mov r9, r3
ldr r3, .L118+28
movs r2, #248
movs r5, #28
mov r8, r3
ldr r4, .L118+32
lsls r2, r2, #4
adds r4, r4, #112
add r10, r10, r1
.L100:
movs r3, r6
.L94:
mov r0, r9
strb r0, [r3]
adds r3, r3, #1
cmp r3, r10
bne .L94
movs r3, #37
mov r0, r8
strb r3, [r6, r0]
movs r0, #32
ldr r3, .L118+28
adds r3, r6, r3
strb r0, [r3, #1]
subs r0, r0, #31
strb r0, [r3, #2]
adds r0, r0, #7
strb r0, [r3, #3]
movs r3, #0
cmp r2, #0
beq .L97
.L95:
ldrb r0, [r1, r3]
strb r0, [r6, r3]
adds r3, r3, #1
lsls r0, r3, #16
lsrs r0, r0, #16
cmp r0, r2
bcc .L95
lsrs r2, r2, #2
beq .L97
movs r3, #0
movs r0, #0
.L98:
ldmia r1!, {r7}
mov ip, r7
adds r3, r3, #1
lsls r3, r3, #16
add r0, r0, ip
lsrs r3, r3, #16
cmp r2, r3
bne .L98
lsrs r3, r0, #16
adds r3, r3, r0
lsls r3, r3, #16
lsrs r3, r3, #16
.L96:
ldr r2, .L118+36
strb r3, [r6, r2]
lsrs r3, r3, #8
adds r2, r6, r2
strb r3, [r2, #1]
movs r1, r6
movs r0, r5
bl TryWriteSector
adds r4, r4, #8
cmp r5, #29
beq .L86
ldr r1, [r4]
ldrh r2, [r4, #4]
movs r5, #29
b .L100
.L91:
bl SaveSerializedGame
movs r0, #0
bl WriteSaveBlockChunks.constprop.15
b .L101
.L92:
bl SaveSerializedGame
movs r0, #0
bl WriteSaveBlockChunks.constprop.15
movs r0, #1
bl WriteSaveBlockChunks.constprop.15
movs r0, #2
bl WriteSaveBlockChunks.constprop.15
movs r0, #3
bl WriteSaveBlockChunks.constprop.15
movs r0, #4
bl WriteSaveBlockChunks.constprop.15
b .L101
.L117:
movs r0, #10
bl IncrementGameStat
b .L93
.L97:
movs r3, #0
b .L96
.L119:
.align 2
.L118:
.word .L88
.word EraseFlashSector
.word 65535
.word 998
.word gSharedMem+122880
.word -122880
.word -118784
.word 4088
.word .LANCHOR0
.word 4084
.size Save_WriteDataInternal, .-Save_WriteDataInternal
.align 1
.p2align 2,,3
.global Save_WriteData
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type Save_WriteData, %function
Save_WriteData:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r3, .L126
ldr r3, [r3]
lsls r0, r0, #24
push {r4, lr}
lsrs r4, r0, #24
movs r0, #255
cmp r3, #1
beq .L125
.L121:
@ sp needed
pop {r4}
pop {r1}
bx r1
.L125:
movs r0, r4
bl Save_WriteDataInternal
ldr r3, .L126+4
ldr r3, [r3]
movs r0, #1
cmp r3, #0
beq .L121
movs r0, r4
bl DoSaveFailedScreen
movs r0, #255
b .L121
.L127:
.align 2
.L126:
.word gFlashMemoryPresent
.word gDamagedSaveSectors
.size Save_WriteData, .-Save_WriteData
.align 1
.p2align 2,,3
.global sub_8125D80
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type sub_8125D80, %function
sub_8125D80:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r3, .L132
ldr r3, [r3]
push {r4, r5, r6, lr}
movs r0, #1
cmp r3, #1
beq .L131
.L129:
@ sp needed
pop {r4, r5, r6}
pop {r1}
bx r1
.L131:
bl SaveSerializedGame
ldr r2, .L132+4
ldr r3, .L132+8
ldr r6, .L132+12
str r2, [r3]
ldrh r0, [r6]
ldr r3, .L132+16
ldr r5, .L132+20
strh r0, [r3]
ldr r4, [r5]
ldr r3, .L132+24
adds r0, r0, #1
lsls r0, r0, #16
str r4, [r3]
lsrs r0, r0, #16
movs r1, #14
bl __umodsi3
movs r3, #0
ldr r2, .L132+28
strh r3, [r2]
ldr r2, .L132+32
adds r4, r4, #1
strh r0, [r6]
str r4, [r5]
str r3, [r2]
movs r0, #0
b .L129
.L133:
.align 2
.L132:
.word gFlashMemoryPresent
.word gSharedMem
.word gFastSaveSection
.word gFirstSaveSector
.word gLastKnownGoodSector
.word gSaveCounter
.word gPrevSaveCounter
.word gUnknown_03005EB4
.word gDamagedSaveSectors
.size sub_8125D80, .-sub_8125D80
.align 1
.p2align 2,,3
.global sub_8125DA8
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type sub_8125DA8, %function
sub_8125DA8:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, lr}
ldr r4, .L142
ldrh r0, [r4]
cmp r0, #12
ble .L141
ldr r3, .L142+4
ldr r3, [r3]
cmp r3, #0
bne .L137
movs r0, #1
.L139:
@ sp needed
pop {r4}
pop {r1}
bx r1
.L141:
bl WriteSingleChunk.constprop.16
ldrh r3, [r4]
adds r3, r3, #1
strh r3, [r4]
ldr r3, .L142+4
ldr r3, [r3]
movs r0, #0
cmp r3, #0
beq .L139
ldr r3, .L142+8
ldrh r2, [r3]
ldr r3, .L142+12
strh r2, [r3]
ldr r3, .L142+16
ldr r2, [r3]
ldr r3, .L142+20
str r2, [r3]
.L137:
movs r0, #0
bl DoSaveFailedScreen
movs r0, #1
b .L139
.L143:
.align 2
.L142:
.word gUnknown_03005EB4
.word gDamagedSaveSectors
.word gLastKnownGoodSector
.word gFirstSaveSector
.word gPrevSaveCounter
.word gSaveCounter
.size sub_8125DA8, .-sub_8125DA8
.align 1
.p2align 2,,3
.global sub_8125DDC
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type sub_8125DDC, %function
sub_8125DDC:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {lr}
movs r0, #14
bl sub_812556C.constprop.12
ldr r3, .L150
ldr r3, [r3]
cmp r3, #0
bne .L149
.L145:
movs r0, #0
@ sp needed
pop {r1}
bx r1
.L149:
movs r0, #0
bl DoSaveFailedScreen
b .L145
.L151:
.align 2
.L150:
.word gDamagedSaveSectors
.size sub_8125DDC, .-sub_8125DDC
.align 1
.p2align 2,,3
.global sub_8125E04
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type sub_8125E04, %function
sub_8125E04:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, lr}
ldr r5, .L161
ldrh r0, [r5]
adds r0, r0, #13
lsls r0, r0, #16
movs r1, #14
lsrs r0, r0, #16
bl __umodsi3
movs r3, #1
ldr r6, .L161+4
ldr r2, [r6]
ands r3, r2
lsls r4, r3, #3
subs r4, r4, r3
ldr r3, .L161+8
ldr r1, .L161+12
ldr r3, [r3]
lsls r4, r4, #1
adds r4, r0, r4
ldrb r2, [r3, r1]
lsls r4, r4, #16
ldr r3, .L161+16
lsrs r4, r4, #16
ldr r3, [r3]
movs r0, r4
bl .L28
movs r1, r4
cmp r0, #0
bne .L159
movs r0, #1
bl SetSectorDamagedStatus
ldr r3, .L161+20
ldr r3, [r3]
cmp r3, #0
bne .L160
.L155:
movs r0, #0
@ sp needed
pop {r4, r5, r6}
pop {r1}
bx r1
.L159:
movs r0, #0
bl SetSectorDamagedStatus
ldr r3, .L161+24
ldrh r3, [r3]
strh r3, [r5]
ldr r3, .L161+28
ldr r3, [r3]
str r3, [r6]
ldr r3, .L161+20
ldr r3, [r3]
cmp r3, #0
beq .L155
.L160:
movs r0, #0
bl DoSaveFailedScreen
b .L155
.L162:
.align 2
.L161:
.word gFirstSaveSector
.word gSaveCounter
.word gFastSaveSection
.word 4088
.word ProgramFlashByte
.word gDamagedSaveSectors
.word gLastKnownGoodSector
.word gPrevSaveCounter
.size sub_8125E04, .-sub_8125E04
.align 1
.p2align 2,,3
.global sub_8125E2C
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type sub_8125E2C, %function
sub_8125E2C:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r3, .L167
ldr r3, [r3]
push {lr}
movs r0, #1
cmp r3, #1
beq .L166
.L164:
@ sp needed
pop {r1}
bx r1
.L166:
bl SaveSerializedGame
ldr r3, .L167+4
ldr r2, .L167+8
str r2, [r3]
ldr r3, .L167+12
ldrh r2, [r3]
ldr r3, .L167+16
strh r2, [r3]
ldr r3, .L167+20
ldr r2, [r3]
ldr r3, .L167+24
str r2, [r3]
movs r3, #0
ldr r2, .L167+28
strh r3, [r2]
ldr r2, .L167+32
movs r0, #1
str r3, [r2]
bl sub_812556C.constprop.12
movs r0, #0
b .L164
.L168:
.align 2
.L167:
.word gFlashMemoryPresent
.word gFastSaveSection
.word gSharedMem
.word gFirstSaveSector
.word gLastKnownGoodSector
.word gSaveCounter
.word gPrevSaveCounter
.word gUnknown_03005EB4
.word gDamagedSaveSectors
.size sub_8125E2C, .-sub_8125E2C
.align 1
.p2align 2,,3
.global sub_8125E6C
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type sub_8125E6C, %function
sub_8125E6C:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r3, .L177
ldrh r0, [r3]
push {r4, lr}
adds r4, r0, #1
lsls r4, r4, #16
lsrs r4, r4, #16
strh r4, [r3]
cmp r4, #4
bhi .L170
adds r0, r0, #2
lsls r0, r0, #16
lsrs r0, r0, #16
bl sub_812556C.constprop.12
movs r0, r4
bl WriteSomeFlashByte0x25ToPrevSector.constprop.10
ldr r3, .L177+4
ldr r3, [r3]
movs r4, #0
cmp r3, #0
bne .L176
.L172:
movs r0, r4
@ sp needed
pop {r4}
pop {r1}
bx r1
.L170:
movs r0, r4
bl WriteSomeFlashByte0x25ToPrevSector.constprop.10
ldr r3, .L177+4
ldr r3, [r3]
movs r4, #1
cmp r3, #0
beq .L172
.L176:
movs r0, #1
bl DoSaveFailedScreen
b .L172
.L178:
.align 2
.L177:
.word gUnknown_03005EB4
.word gDamagedSaveSectors
.size sub_8125E6C, .-sub_8125E6C
.align 1
.p2align 2,,3
.global Save_LoadGameData
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type Save_LoadGameData, %function
Save_LoadGameData:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 12
@ frame_needed = 0, uses_anonymous_args = 0
push {r4, r5, r6, r7, lr}
mov lr, fp
mov r7, r10
mov r6, r9
mov r5, r8
push {r5, r6, r7, lr}
ldr r3, .L262
ldr r3, [r3]
lsls r0, r0, #24
sub sp, sp, #12
lsrs r0, r0, #24
cmp r3, #1
beq .LCB1313
b .L252 @long jump
.LCB1313:
cmp r0, #3
bne .LCB1315
b .L182 @long jump
.LCB1315:
ldr r3, .L262+4
ldr r2, .L262+8
str r2, [r3]
movs r3, #0
mov r9, r3
str r3, [sp, #4]
mov fp, r3
ldr r3, .L262+12
movs r4, #0
mov r8, r3
ldr r7, .L262+16
mov r6, r9
b .L187
.L184:
adds r4, r4, #1
cmp r4, #14
beq .L253
.L187:
movs r3, #128
movs r0, r4
lsls r3, r3, #5
movs r1, #0
bl ReadFlash
ldr r3, .L262+4
ldr r0, [r3]
mov r3, r8
ldr r3, [r0, r3]
movs r2, r0
cmp r3, r7
bne .L184
ldr r1, .L262+20
mov r9, r1
ldr r3, .L262+24
ldrh r3, [r0, r3]
mov ip, r3
lsls r3, r3, #3
add r3, r3, r9
ldrh r3, [r3, #4]
lsrs r3, r3, #2
beq .L185
movs r5, r3
movs r1, #0
movs r6, #0
movs r3, r0
mov r9, r5
.L186:
ldmia r3!, {r5}
mov r10, r5
adds r1, r1, #1
lsls r1, r1, #16
add r6, r6, r10
lsrs r1, r1, #16
cmp r1, r9
bne .L186
lsrs r3, r6, #16
adds r3, r3, r6
lsls r3, r3, #16
lsrs r3, r3, #16
.L185:
ldr r1, .L262+28
ldrh r1, [r0, r1]
movs r6, #1
cmp r1, r3
bne .L184
ldr r3, .L262+32
ldr r3, [r0, r3]
mov r1, ip
str r3, [sp, #4]
movs r3, r6
lsls r3, r3, r1
mov r1, fp
adds r4, r4, #1
orrs r1, r3
mov fp, r1
cmp r4, #14
bne .L187
.L253:
movs r7, #0
cmp r6, #0
beq .L188
ldr r1, .L262+36
mov r3, fp
mov ip, r1
add r3, r3, ip
movs r6, r3
rsbs r7, r6, #0
adcs r7, r7, r6
movs r3, #253
rsbs r7, r7, #0
bics r7, r3
adds r7, r7, #255
.L188:
movs r3, #0
str r3, [sp, #8]
mov r8, r3
str r3, [sp]
ldr r3, .L262+16
mov r10, r7
ldr r6, .L262+12
mov fp, r3
movs r7, r2
b .L193
.L190:
adds r4, r4, #1
cmp r4, #28
beq .L254
.L193:
movs r3, #128
movs r2, r7
lsls r3, r3, #5
movs r0, r4
movs r1, #0
bl ReadFlash
ldr r3, .L262+4
ldr r0, [r3]
ldr r3, [r0, r6]
movs r7, r0
cmp r3, fp
bne .L190
ldr r2, .L262+20
mov ip, r2
ldr r3, .L262+24
ldrh r3, [r0, r3]
mov r9, r3
lsls r3, r3, #3
add r3, r3, ip
ldrh r3, [r3, #4]
lsrs r3, r3, #2
beq .L191
mov ip, r3
movs r1, #0
movs r2, #0
movs r3, r0
.L192:
ldmia r3!, {r5}
mov r8, r5
adds r1, r1, #1
lsls r1, r1, #16
add r2, r2, r8
lsrs r1, r1, #16
cmp r1, ip
bne .L192
lsrs r3, r2, #16
adds r3, r3, r2
lsls r3, r3, #16
lsrs r3, r3, #16
.L191:
movs r1, #1
ldr r2, .L262+28
ldrh r2, [r0, r2]
mov r8, r1
cmp r2, r3
bne .L190
ldr r3, .L262+32
ldr r3, [r0, r3]
mov r2, r9
str r3, [sp, #8]
movs r3, r1
lsls r3, r3, r2
ldr r2, [sp]
adds r4, r4, #1
orrs r2, r3
str r2, [sp]
cmp r4, #28
bne .L193
.L254:
mov r3, r8
movs r2, r7
mov r7, r10
cmp r3, #0
bne .L194
cmp r7, #1
bne .LCB1507
b .L255 @long jump
.LCB1507:
cmp r7, #0
bne .L199
ldr r3, .L262+40
str r7, [r3]
ldr r3, .L262+44
strh r7, [r3]
movs r3, #0
movs r6, #0
str r3, [sp, #4]
b .L206
.L182:
ldr r4, .L262+48
movs r0, #28
movs r1, r4
bl ReadSomeUnknownSectorAndVerify.constprop.9
movs r7, r0
cmp r0, #1
bne .LCB1527
b .L256 @long jump
.LCB1527:
.L222:
movs r0, r7
add sp, sp, #12
@ sp needed
pop {r2, r3, r4, r5}
mov r8, r2
mov r9, r3
mov r10, r4
mov fp, r5
pop {r4, r5, r6, r7}
pop {r1}
bx r1
.L252:
movs r2, #4
ldr r3, .L262+52
movs r7, #255
strh r2, [r3]
b .L222
.L194:
ldr r3, .L262+56
ldr r1, [sp]
cmp r1, r3
beq .L197
cmp r7, #1
bne .LCB1560
b .L257 @long jump
.LCB1560:
.L199:
movs r3, #0
movs r6, #0
movs r7, #2
ldr r1, .L262+40
str r3, [r1]
ldr r1, .L262+44
strh r3, [r1]
adds r3, r3, #2
str r3, [sp, #4]
.L206:
ldr r3, .L262+24
movs r4, #0
mov fp, r3
str r7, [sp]
.L214:
movs r3, #128
movs r1, #0
lsls r3, r3, #5
movs r0, r6
bl ReadFlash
ldr r3, .L262+4
ldr r1, [r3]
mov r3, fp
ldrh r2, [r1, r3]
cmp r2, #0
bne .L207
ldr r3, .L262+44
strh r4, [r3]
movs r3, #137
lsls r3, r3, #4
mov r9, r3
movs r3, #137
mov r8, r1
ldr r2, .L262+20
lsls r3, r3, #2
.L208:
movs r0, #0
movs r7, #0
mov r10, r3
.L210:
mov r5, r8
ldmia r5!, {r3}
mov ip, r3
adds r0, r0, #1
lsls r0, r0, #16
mov r8, r5
add r7, r7, ip
lsrs r0, r0, #16
cmp r0, r10
bcc .L210
ldr r5, .L262+12
lsrs r3, r7, #16
adds r3, r3, r7
ldr r0, .L262+16
ldr r5, [r1, r5]
lsls r3, r3, #16
lsrs r3, r3, #16
cmp r5, r0
beq .L258
.L211:
adds r4, r4, #1
lsls r4, r4, #16
lsrs r4, r4, #16
adds r6, r6, #1
cmp r4, #14
beq .L213
.L261:
ldr r3, .L262+4
ldr r2, [r3]
b .L214
.L197:
cmp r7, #1
beq .L259
ldr r3, .L262+40
ldr r1, [sp, #8]
str r1, [r3]
movs r3, #1
ands r3, r1
lsls r6, r3, #3
subs r6, r6, r3
lsls r6, r6, #25
lsrs r6, r6, #24
cmp r7, #255
bne .LCB1654
b .L219 @long jump
.LCB1654:
movs r3, #1
movs r7, #1
str r3, [sp, #4]
b .L206
.L255:
ldr r3, .L262+40
ldr r1, [sp, #4]
str r1, [r3]
movs r3, r1
ands r3, r7
.L249:
lsls r6, r3, #3
subs r6, r6, r3
movs r3, #1
lsls r6, r6, #25
lsrs r6, r6, #24
str r3, [sp, #4]
b .L206
.L259:
ldr r3, [sp, #4]
adds r3, r3, #1
bne .L220
ldr r3, [sp, #8]
cmp r3, #0
bne .L220
.L203:
movs r1, #0
ldr r3, .L262+40
str r1, [r3]
movs r3, #1
movs r6, #0
str r3, [sp, #4]
b .L206
.L207:
ldr r3, .L262+20
mov ip, r3
lsls r2, r2, #3
add r2, r2, ip
ldrh r3, [r2, #4]
mov r8, r1
mov r9, r3
lsrs r3, r3, #2
bne .L208
ldr r5, .L262+12
ldr r0, .L262+16
ldr r5, [r1, r5]
cmp r5, r0
bne .L211
.L258:
ldr r0, .L262+28
ldrh r0, [r1, r0]
cmp r0, r3
bne .L211
mov r3, r9
cmp r3, #0
beq .L211
movs r3, #0
b .L212
.L260:
ldr r1, .L262+4
ldr r1, [r1]
.L212:
ldrb r1, [r1, r3]
ldr r0, [r2]
strb r1, [r0, r3]
adds r3, r3, #1
ldrh r1, [r2, #4]
lsls r3, r3, #16
lsrs r3, r3, #16
cmp r1, r3
bhi .L260
adds r4, r4, #1
lsls r4, r4, #16
lsrs r4, r4, #16
adds r6, r6, #1
cmp r4, #14
bne .L261
.L213:
ldr r7, [sp]
bl LoadSerializedGame
ldr r3, .L262+52
ldr r2, [sp, #4]
strh r2, [r3]
movs r2, #0
ldr r3, .L262+60
str r2, [r3]
b .L222
.L220:
ldr r3, [sp, #4]
cmp r3, #0
bne .L221
ldr r3, [sp, #8]
adds r3, r3, #1
beq .L203
.L221:
ldr r3, [sp, #4]
ldr r1, [sp, #8]
movs r0, r3
cmp r0, r1
bcs .L205
ldr r3, .L262+40
str r1, [r3]
movs r3, #1
ands r3, r1
b .L249
.L256:
movs r3, #248
lsls r3, r3, #4
adds r1, r4, r3
movs r0, #29
bl ReadSomeUnknownSectorAndVerify.constprop.9
movs r7, r0
b .L222
.L263:
.align 2
.L262:
.word gFlashMemoryPresent
.word gFastSaveSection
.word gSharedMem
.word 4088
.word 134291493
.word .LANCHOR0
.word 4084
.word 4086
.word 4092
.word -16383
.word gSaveCounter
.word gFirstSaveSector
.word gSharedMem+122880
.word gSaveFileStatus
.word 16383
.word gGameContinueCallback
.L219:
movs r3, #255
str r3, [sp, #4]
b .L206
.L257:
ldr r1, [sp, #4]
ldr r3, .L264
str r1, [r3]
movs r3, #255
ands r7, r1
lsls r6, r7, #3
subs r6, r6, r7
lsls r6, r6, #25
lsrs r6, r6, #24
str r3, [sp, #4]
movs r7, #255
b .L206
.L205:
ldr r3, .L264
ldr r1, [sp, #4]
str r1, [r3]
movs r3, #1
ands r3, r1
b .L249
.L265:
.align 2
.L264:
.word gSaveCounter
.size Save_LoadGameData, .-Save_LoadGameData
.align 1
.p2align 2,,3
.global unref_sub_8125F4C
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type unref_sub_8125F4C, %function
unref_sub_8125F4C:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
movs r2, #128
lsls r2, r2, #5
push {r4, lr}
adds r1, r0, r2
movs r4, r0
movs r3, r0
movs r2, #0
.L267:
strb r2, [r3]
adds r3, r3, #1
cmp r3, r1
bne .L267
movs r3, #128
movs r2, r4
lsls r3, r3, #5
movs r1, #0
movs r0, #30
bl ReadFlash
ldr r3, .L269
ldr r0, [r4, r3]
ldr r3, .L269+4
mov ip, r3
add r0, r0, ip
rsbs r3, r0, #0
adcs r0, r0, r3
@ sp needed
pop {r4}
pop {r1}
bx r1
.L270:
.align 2
.L269:
.word 4084
.word -134291493
.size unref_sub_8125F4C, .-unref_sub_8125F4C
.align 1
.p2align 2,,3
.global unref_sub_8125FA0
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type unref_sub_8125FA0, %function
unref_sub_8125FA0:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
ldr r3, .L278
ldr r3, [r3]
push {r4, lr}
cmp r3, #1
beq .L276
.L272:
ldr r4, .L278+4
movs r0, #30
ldr r3, [r4]
bl .L28
ldr r3, [r4]
movs r0, #31
bl .L28
movs r0, #3
.L275:
@ sp needed
pop {r4}
pop {r1}
bx r1
.L276:
movs r0, #0
bl Save_WriteDataInternal
ldr r3, .L278+8
ldr r3, [r3]
cmp r3, #0
bne .L277
ldr r4, .L278+4
movs r0, #30
ldr r3, [r4]
bl .L28
ldr r3, [r4]
movs r0, #31
bl .L28
movs r0, #0
bl Save_LoadGameData
movs r0, #1
b .L275
.L277:
movs r0, #0
bl DoSaveFailedScreen
b .L272
.L279:
.align 2
.L278:
.word gFlashMemoryPresent
.word EraseFlashSector
.word gDamagedSaveSectors
.size unref_sub_8125FA0, .-unref_sub_8125FA0
.align 1
.p2align 2,,3
.global unref_sub_8125FF0
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type unref_sub_8125FF0, %function
unref_sub_8125FF0:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
movs r2, #128
push {r4, r5, lr}
lsls r5, r1, #16
ldr r1, .L291
lsls r2, r2, #5
adds r4, r1, r2
movs r3, r1
movs r2, #0
lsrs r5, r5, #16
.L281:
strb r2, [r3]
adds r3, r3, #1
cmp r4, r3
bne .L281
movs r2, #37
ldr r3, .L291+4
strb r2, [r1, r3]
adds r3, r1, r3
subs r2, r2, #5
strb r2, [r3, #1]
subs r2, r2, #31
strb r2, [r3, #2]
adds r2, r2, #7
strb r2, [r3, #3]
cmp r5, #0
beq .L282
movs r3, #0
.L283:
ldrb r2, [r0, r3]
strb r2, [r1, r3]
adds r3, r3, #1
lsls r2, r3, #16
lsrs r2, r2, #16
cmp r2, r5
bcc .L283
.L282:
movs r2, #128
movs r0, #30
lsls r2, r2, #5
bl ProgramFlashSectorAndVerifyNBytes
subs r3, r0, #1
sbcs r0, r0, r3
rsbs r3, r0, #0
movs r0, #254
ands r0, r3
adds r0, r0, #1
@ sp needed
pop {r4, r5}
pop {r1}
bx r1
.L292:
.align 2
.L291:
.word gSharedMem
.word 4084
.size unref_sub_8125FF0, .-unref_sub_8125FF0
.align 1
.p2align 2,,3
.global unref_sub_8126068
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type unref_sub_8126068, %function
unref_sub_8126068:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
lsls r0, r0, #24
push {lr}
lsrs r0, r0, #24
bl ProgramFlashSectorAndVerify
subs r3, r0, #1
sbcs r0, r0, r3
rsbs r3, r0, #0
movs r0, #254
ands r0, r3
adds r0, r0, #1
@ sp needed
pop {r1}
bx r1
.size unref_sub_8126068, .-unref_sub_8126068
.align 1
.p2align 2,,3
.global unref_sub_8126080
.syntax unified
.code 16
.thumb_func
.fpu softvfp
.type unref_sub_8126080, %function
unref_sub_8126080:
@ Function supports interworking.
@ args = 0, pretend = 0, frame = 0
@ frame_needed = 0, uses_anonymous_args = 0
movs r3, #128
push {lr}
lsls r0, r0, #24
movs r2, r1
lsrs r0, r0, #24
lsls r3, r3, #5
movs r1, #0
bl ReadFlash
@ sp needed
movs r0, #1
pop {r1}
bx r1
.size unref_sub_8126080, .-unref_sub_8126080
.global sUnusedFlashSectors
.comm gGameContinueCallback,4,4
.comm gSaveFileStatus,2,2
.comm gUnknown_03005EB4,2,2
.comm gFastSaveSection,4,4
.comm gSaveCounter,4,4
.comm gDamagedSaveSectors,4,4
.comm gLastKnownGoodSector,2,2
.comm gPrevSaveCounter,4,4
.comm gFirstSaveSector,2,2
.section .rodata
.align 2
.set .LANCHOR0,. + 0
.type sSaveBlockChunks, %object
.size sSaveBlockChunks, 112
sSaveBlockChunks:
.word gSaveBlock2
.short 2192
.space 2
.word gSaveBlock1
.short 3968
.space 2
.word gSaveBlock1+3968
.short 3968
.space 2
.word gSaveBlock1+7936
.short 3968
.space 2
.word gSaveBlock1+11904
.short 3136
.space 2
.word gPokemonStorage
.short 3968
.space 2
.word gPokemonStorage+3968
.short 3968
.space 2
.word gPokemonStorage+7936
.short 3968
.space 2
.word gPokemonStorage+11904
.short 3968
.space 2
.word gPokemonStorage+15872
.short 3968
.space 2
.word gPokemonStorage+19840
.short 3968
.space 2
.word gPokemonStorage+23808
.short 3968
.space 2
.word gPokemonStorage+27776
.short 3968
.space 2
.word gPokemonStorage+31744
.short 2000
.space 2
.type sHallOfFameChunks, %object
.size sHallOfFameChunks, 16
sHallOfFameChunks:
.word gSharedMem+122880
.short 3968
.space 2
.word gSharedMem+126848
.short 3968
.space 2
.type sUnusedFlashSectors, %object
.size sUnusedFlashSectors, 2
sUnusedFlashSectors:
.byte 30
.byte 31
.ident "GCC: (devkitARM release 49) 8.1.0"
.text
.code 16
.align 1
.L28:
bx r3
.text
.align 2, 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.