mirror of
https://github.com/Zenithsiz/dcb.git
synced 2026-02-04 00:21:57 +00:00
872 lines
22 KiB
YAML
872 lines
22 KiB
YAML
---
|
|
# Entry point
|
|
- name: start
|
|
signature: fn() -> !
|
|
desc: Executable start
|
|
inline_comments:
|
|
0x80056280: Zero out ZeroStart .. HeapStart word by word.
|
|
0x80056284: ^
|
|
0x80056288: ^
|
|
0x8005628c: ^
|
|
0x800562a8: Initialize stack to (*StackTop - 0x10) | 0x80000000
|
|
0x800562f8: "args: (HeapStart + 0x4, (*StackTop - 0x10) - *StackSize - (HeapStart & 0x1fff_ffff))"
|
|
0x80056314: "Seems to never be reached, as we get to the title screen before this instruction"
|
|
0x80056324: "args: (something1_data2, something1_data2)"
|
|
labels:
|
|
0x80056280: zero_loop
|
|
start_pos: 0x80056270
|
|
end_pos: 0x80056330
|
|
|
|
# Main game loop
|
|
- name: main_loop
|
|
signature: fn() -> !
|
|
desc: Runs the main loop of the game.
|
|
Never seems to return.
|
|
inline_comments:
|
|
0x80013e50: The return address is stored, but it seems it's never popped.
|
|
0x80013e54: Just sets `something1_executed` to 1.
|
|
0x80013e5c: Setup interrupts and DMA and possibly other stuff.
|
|
0x80013e6c: "args: (0)"
|
|
0x80013e84: "args: (0x140, 0xf0, 0, 0)"
|
|
labels:
|
|
0x80013ef4: "0"
|
|
0x80013f48: "1"
|
|
0x80013f54: "2"
|
|
0x80013f6c: "3"
|
|
0x80013f8c: "4"
|
|
start_pos: 0x80013e4c
|
|
end_pos: 0x80013fa4
|
|
|
|
# ???
|
|
- name: something1
|
|
signature: fn()
|
|
desc: If something1_executed is 0, sets it to 1.
|
|
Also calls `call_func_arr(something1_data2, something1_data2)` if 0,
|
|
but this seems to be a nop.
|
|
inline_comments:
|
|
0x80056348: If *something1_executed != 0, skip
|
|
0x80056350: Else set it to 1.
|
|
0x80056368: "args: (something1_data2, something1_data2). Seems like a nop?"
|
|
labels:
|
|
0x80056370: skip
|
|
start_pos: 0x80056330
|
|
end_pos: 0x80056388
|
|
|
|
- name: call_func_arr
|
|
desc: Calls all functions from `start` to `end` (exclusive).
|
|
Since it's only called from `start` and `something1` with no
|
|
functions, it seems that this is never used.
|
|
After running the game for a bit it doesn't seem to be triggered,
|
|
all the way from the start of a new game to the battle arena fight.
|
|
signature: "fn(start: *fn(), end: *fn())"
|
|
inline_comments:
|
|
0x800563a0: If `start >= end`, return
|
|
0x800563a8: Load the current function
|
|
0x800563b0: If it was null, skip the call.
|
|
0x800563b8: Else call it
|
|
0x800563c0: Go to the next function
|
|
0x800563c8: Until we hit `end`, keep going.
|
|
labels:
|
|
0x800563a8: loop
|
|
0x800563c0: skip_call
|
|
0x800563d0: exit
|
|
start_pos: 0x80056388
|
|
end_pos: 0x800563e4
|
|
|
|
# ?
|
|
- name: something3
|
|
signature: fn()
|
|
desc: Calls `something5`.
|
|
inline_comments:
|
|
0x80056604: "Loads FuncList1[3]"
|
|
0x8005660c: "Calls FuncList1[3] (i.e. something5)"
|
|
start_pos: 0x800565f4
|
|
end_pos: 0x80056624
|
|
|
|
# ?
|
|
- name: something5
|
|
signature: fn()
|
|
desc: Setups interrupt and DMA.
|
|
If called again, simply returns.
|
|
inline_comments:
|
|
0x8005679c: Loads *something5_data1
|
|
0x800567a4: "If the loaded value is not zero, exit"
|
|
0x800567c0: Stop all interrupts by writing 0 to I_MASK
|
|
0x800567c4: "Before the write goes through, save the current interrupts (?)"
|
|
0x800567cc: Set I_STAT to the previous I_MASK value.
|
|
0x800567dc: Set the DMA control registers to 0x33333333
|
|
0x800567e0: "args: (something5_data1, 0x33333333), Zero out `something5_data1[..0x33333333]`"
|
|
0x800567e8: "Save all registers with `save_registers` and check return value"
|
|
0x800567f0: "If the return value isn't 0, call `func_831`. This shouldn't happen, as `save_registers` always returns 0"
|
|
0x800567f8: "args: (something5_data1 as *u8 + 0x38, 0x41a)"
|
|
0x80056810: "Set the exception exit function as something5_data5 - 1; args: (something5_data5 as *u8 - 0x4)"
|
|
0x80056814: Set something5_data5 to 0xfdc
|
|
labels:
|
|
0x80056850: exit
|
|
0x80056800: skip_call
|
|
start_pos: 0x80056788
|
|
end_pos: 0x80056860
|
|
|
|
# ?
|
|
- name: something6
|
|
signature: "fn(arg: u32)"
|
|
desc: ""
|
|
inline_comments:
|
|
0x80056404: Get the gpu status from `GPU_STAT`
|
|
0x80056408: Read the horizontal retrace from timer1
|
|
0x80056418: Read the horizontal retrace again.
|
|
0x80056420: While the horizontal retraces are different, loop.
|
|
0x8005642c:
|
|
"TODO: Check what this load is about, it's 0 at the start of the program.
|
|
Seems to store the result from the timing"
|
|
0x80056438: Get the difference between data_w462 and the current horizontal retrace timer.
|
|
0x8005643c: "If arg < 0, return something6_data1, (Note: `main_loop` doesn't supply any arguments)"
|
|
0x80056458: If arg == 1, return the difference between data_w462 and the current time & 0xFFFF.
|
|
0x80056460: If arg <= 0, $v0 = data_w463, else $v0 = data_w463 + arg - 1
|
|
0x80056488: If arg <= 0, $a1 = 0, else $a1 = arg - 1
|
|
0x80056494: "args: arg <= 0 ? (data_w463, 0) : (data_w463 + arg - 1, arg - 1)"
|
|
labels:
|
|
0x80056408: timer_loop
|
|
0x80056454: skip_exit
|
|
0x80056480: 2
|
|
0x80056488: 3
|
|
0x80056494: 4
|
|
0x800564f0: 5
|
|
0x80056508: 6
|
|
0x80056520: 7
|
|
0x80056544: exit_with_s1
|
|
0x80056548: exit
|
|
start_pos: 0x800563e4
|
|
end_pos: 0x8005655c
|
|
|
|
# ?
|
|
- name: something7
|
|
signature: "fn(a: u32, b: u32)"
|
|
inline_comments:
|
|
0x80056578: If something6_data1 >= a, return
|
|
0x8005659c: If (b << 15 - 1) != -1, goto try_again
|
|
0x800565dc: If something6_data1 < a, try again, else exit.
|
|
0x800565a8: "args: (0x8001311c)"
|
|
0x800565b0: "args: (0)"
|
|
0x800565bc: "args: (0x3, 0), This call and the above one seem to setup interrupts"
|
|
labels:
|
|
0x80056584: try_start
|
|
0x800565cc: try_again
|
|
0x800565e4: exit
|
|
start_pos: 0x8005655c
|
|
end_pos: 0x800565f4
|
|
|
|
#?
|
|
- name: something4
|
|
signature: fn()
|
|
labels:
|
|
0x80056ac0: "0"
|
|
0x80056ae0: "1"
|
|
0x80056b04: "2"
|
|
0x80056b1c: "3"
|
|
0x80056b34: "4"
|
|
0x80056b44: "5"
|
|
0x80056b54: "6"
|
|
0x80056b58: "7"
|
|
start_pos: 0x80056a30
|
|
end_pos: 0x80056b78
|
|
|
|
- name: memset_zero
|
|
signature: "fn(u32* ptr, u32 size)"
|
|
desc: "Zeroes out the memory at `ptr` for `size` words.\n"
|
|
inline_comments:
|
|
0x80056c90: "If size == 0, return"
|
|
0x80056c94: size--
|
|
0x80056c9c: "*ptr = 0"
|
|
0x80056ca0: size--
|
|
0x80056ca4: "While size != -1, continue"
|
|
0x80056ca8: ptr++
|
|
labels:
|
|
0x80056c9c: loop
|
|
0x80056cac: exit
|
|
start_pos: 0x80056c90
|
|
end_pos: 0x80056cb4
|
|
|
|
- name: save_registers
|
|
signature: fn(u32* pos)
|
|
desc: "Saves the following registers in `pos[0x0 .. 0x30]`.\n$ra, $gp, $sp, $fp,\n$s0, $s1, $s2, $s3,\n$s4, $s5, $s6, $s7,\n"
|
|
start_pos: 0x8006a674
|
|
end_pos: 0x8006a6b0
|
|
|
|
- name: load_registers
|
|
signature: fn(u32* pos)
|
|
desc: "Loads the following registers from `pos[0x0 .. 0x30]`.\n$ra, $gp, $sp, $fp,\n$s0, $s1, $s2, $s3,\n$s4, $s5, $s6, $s7,\n"
|
|
start_pos: 0x8006a6b0
|
|
end_pos: 0x8006a6fc
|
|
|
|
- name: prng_next
|
|
signature: fn()
|
|
desc: |-
|
|
Advances the current prng, stored at `cur_prng_value`.
|
|
Returns `cur_prng_value << 0x10 | 0x7fff`.
|
|
start_pos: 0x80069124
|
|
end_pos: 0x80069154
|
|
|
|
- name: something8
|
|
signature: "fn(a: u32, b: u32, c: u32, d: u32)"
|
|
desc: ""
|
|
inline_comments:
|
|
0x80061910: "args: ($s1, $s0, c & 0xffff, d & 0xffff)"
|
|
start_pos: 0x800618e4
|
|
end_pos: 0x80061954
|
|
|
|
- name: modify_spu_delay1
|
|
signature: "fn() -> u32"
|
|
desc: |-
|
|
Sets `SPU_DELAY` to `(SPU_DELAY & 0xf0fffff) | 0x2000ffff`
|
|
and returns the new value
|
|
inline_comments:
|
|
0x8004b45c: "$v0 = *SPU_DELAY"
|
|
0x8004b474: "*SPU_DELAY = $v0"
|
|
start_pos: 0x8004b428
|
|
end_pos: 0x8004b450
|
|
|
|
- name: modify_spu_delay2
|
|
signature: "fn() -> u32"
|
|
desc: |-
|
|
Sets `SPU_DELAY` to `(SPU_DELAY & 0xf0fffff) | 0x2200ffff`
|
|
and returns the new value
|
|
inline_comments:
|
|
0x8004b45c: "$v0 = *SPU_DELAY"
|
|
0x8004b474: "*SPU_DELAY = $v0"
|
|
start_pos: 0x8004b450
|
|
end_pos: 0x8004b478
|
|
|
|
- name: calc_0x890e6fbd
|
|
signature: "fn() -> u32"
|
|
desc: |-
|
|
Simply calculates and returns `0x890e6fbd`.
|
|
inline_comments:
|
|
0x8004b480: "$sp[0x4] = 0xd;"
|
|
0x8004b488: "$sp[0x4] = 0x0;"
|
|
0x8004b4a4: "$sp[0x4] *= 13;"
|
|
0x8004b4b4: "$sp[0x0] += 1;"
|
|
0x8004b4c4: "if $sp[0x0] <= 0x3c { goto .loop; }"
|
|
comments:
|
|
0x8004b48c: |-
|
|
let value = 0xd;
|
|
for _ in 0..0x3c {
|
|
value *= 13;
|
|
}
|
|
return value;
|
|
labels:
|
|
0x8004b48c: "loop"
|
|
0x8004b4b8: "while_condition"
|
|
start_pos: 0x8004b478
|
|
end_pos: 0x8004b4d4
|
|
|
|
- name: something9
|
|
start_pos: 0x80013fa4
|
|
end_pos: 0x800141b8
|
|
labels:
|
|
0x80013fe4: "0"
|
|
0x80014058: "1"
|
|
0x80014064: "2"
|
|
0x80014094: "3"
|
|
0x80014198: "4"
|
|
0x8001419c: "5"
|
|
|
|
- name: something10
|
|
start_pos: 0x800141b8
|
|
end_pos: 0x800142d0
|
|
|
|
- name: something11
|
|
start_pos: 0x800142d0
|
|
end_pos: 0x80014364
|
|
|
|
- name: something12
|
|
start_pos: 0x80015328
|
|
end_pos: 0x800157b0
|
|
|
|
- name: something13
|
|
start_pos: 0x800148f8
|
|
end_pos: 0x80014970
|
|
|
|
- name: something14
|
|
start_pos: 0x80014b94
|
|
end_pos: 0x80014c08
|
|
|
|
- name: something15
|
|
start_pos: 0x8002a7cc
|
|
end_pos: 0x8002ab5c
|
|
|
|
- name: something16
|
|
start_pos: 0x8001b358
|
|
end_pos: 0x8001b438
|
|
|
|
- name: something17
|
|
start_pos: 0x8002c1c0
|
|
end_pos: 0x8002cc44
|
|
|
|
- name: something18
|
|
start_pos: 0x80015a3c
|
|
end_pos: 0x80015ad8
|
|
|
|
- name: something19
|
|
start_pos: 0x800162f0
|
|
end_pos: 0x80016878
|
|
|
|
- name: something20
|
|
start_pos: 0x8001963c
|
|
end_pos: 0x80019ea4
|
|
|
|
- name: something21
|
|
start_pos: 0x8001a1d8
|
|
end_pos: 0x8001a600
|
|
|
|
- name: something22
|
|
start_pos: 0x8001a870
|
|
end_pos: 0x8001a9b0
|
|
|
|
- name: something23
|
|
start_pos: 0x8001b088
|
|
end_pos: 0x8001b10c
|
|
|
|
- name: something24
|
|
start_pos: 0x8001b734
|
|
end_pos: 0x8001b90c
|
|
|
|
- name: something25
|
|
start_pos: 0x8001bb44
|
|
end_pos: 0x8001bb94
|
|
|
|
- name: something26
|
|
start_pos: 0x8001bc38
|
|
end_pos: 0x8001bca4
|
|
|
|
- name: something27
|
|
start_pos: 0x8001c0a8
|
|
end_pos: 0x8001c1e0
|
|
|
|
- name: something28
|
|
start_pos: 0x8001c220
|
|
end_pos: 0x8001d900
|
|
|
|
- name: something29
|
|
start_pos: 0x8001da24
|
|
end_pos: 0x8001dfe0
|
|
|
|
- name: something30
|
|
start_pos: 0x8001e180
|
|
end_pos: 0x8001e53c
|
|
|
|
- name: something31
|
|
start_pos: 0x8001e850
|
|
end_pos: 0x8001e894
|
|
|
|
- name: something32
|
|
start_pos: 0x8001f094
|
|
end_pos: 0x8001f3c0
|
|
|
|
- name: something33
|
|
start_pos: 0x8001f5cc
|
|
end_pos: 0x8001f5fc
|
|
|
|
- name: something34
|
|
start_pos: 0x8001f630
|
|
end_pos: 0x8001f660
|
|
|
|
- name: something35
|
|
start_pos: 0x8001f6c4
|
|
end_pos: 0x8001f768
|
|
|
|
- name: something36
|
|
start_pos: 0x8001f768
|
|
end_pos: 0x8001f824
|
|
|
|
- name: something37
|
|
start_pos: 0x8001f824
|
|
end_pos: 0x8001f8b0
|
|
|
|
- name: something38
|
|
start_pos: 0x8001f8b0
|
|
end_pos: 0x8001f94c
|
|
|
|
# A functions
|
|
- name: InitHeap
|
|
signature: "fn(addr: *u32, size: u32)"
|
|
desc: Calls A(0x39)
|
|
inline_comments:
|
|
0x8006a738: Register tailcall. Likely to prevent calling in KSEG0 and do it in KUSEG
|
|
0x8006a73c: "arg: 0x39"
|
|
start_pos: 0x8006a734
|
|
end_pos: 0x8006a744
|
|
- name: FlushCache
|
|
signature: "fn()"
|
|
desc: Calls A(0x44)
|
|
start_pos: 0x8006a744
|
|
end_pos: 0x8006a754
|
|
- name: GPU_cw
|
|
signature: "fn(cmd: u32)"
|
|
desc: Calls A(0x49)
|
|
start_pos: 0x8006a754
|
|
end_pos: 0x8006a764
|
|
- name: _bu_init
|
|
signature: "fn()"
|
|
desc: Calls A(0x70)
|
|
start_pos: 0x80068804
|
|
end_pos: 0x80068814
|
|
- name: CdRemove
|
|
signature: "fn()"
|
|
desc: Calls A(0x72)
|
|
start_pos: 0x8006a76c
|
|
end_pos: 0x8006a77c
|
|
- name: _card_info
|
|
signature: "fn(port: u32)"
|
|
desc: Calls A(0xab)
|
|
start_pos: 0x80068814
|
|
end_pos: 0x80068824
|
|
- name: _card_async_load_directory
|
|
signature: "fn(port: u32)"
|
|
desc: Calls A(0xac)
|
|
start_pos: 0x80068824
|
|
end_pos: 0x80068834
|
|
|
|
# B Functions
|
|
- name: DeliverEvent
|
|
signature: "fn(class: u32, spec: u32)"
|
|
desc: Calls B(0x07)
|
|
start_pos: 0x8006a784
|
|
end_pos: 0x8006a794
|
|
- name: OpenEvent
|
|
signature: "fn(class: u32, spec: u32, mode: u32, func: u32)"
|
|
desc: Calls B(0x08)
|
|
start_pos: 0x8006a794
|
|
end_pos: 0x8006a7a4
|
|
- name: WaitEvent
|
|
signature: "fn(event: u32)"
|
|
desc: Calls B(0x0a)
|
|
start_pos: 0x8006a7a4
|
|
end_pos: 0x8006a7b4
|
|
- name: TestEvent
|
|
signature: "fn(event: u32)"
|
|
desc: Calls B(0x0b)
|
|
start_pos: 0x8006a7b4
|
|
end_pos: 0x8006a7c4
|
|
- name: EnableEvent
|
|
signature: "fn(event: u32)"
|
|
desc: Calls B(0x0c)
|
|
start_pos: 0x8006a7c4
|
|
end_pos: 0x8006a7d4
|
|
- name: InitPad
|
|
signature: "fn(buf1: *mut u8, size1: u32, buf2: *mut u8, size2: u32)"
|
|
desc: Calls B(0x12)
|
|
start_pos: 0x8006af54
|
|
end_pos: 0x8006af64
|
|
- name: StartPad
|
|
signature: "fn()"
|
|
desc: Calls B(0x13)
|
|
start_pos: 0x8006af64
|
|
end_pos: 0x8006af74
|
|
- name: OutdatedPadInitAndStart
|
|
signature: "fn(type: u32, button_dest: *mut u8, unused1: u32, unused2: u32)"
|
|
desc: Calls B(0x15)
|
|
start_pos: 0x8006af74
|
|
end_pos: 0x8006af84
|
|
- name: ReturnFromException
|
|
signature: "fn()"
|
|
desc: Calls B(0x17)
|
|
start_pos: 0x8006a7d4
|
|
end_pos: 0x8006a7e4
|
|
- name: SetDefaultExitFromException
|
|
signature: "fn()"
|
|
desc: Calls B(0x18)
|
|
start_pos: 0x8006a7e4
|
|
end_pos: 0x8006a7f4
|
|
- name: SetCustomExitFromException
|
|
signature: "fn(addr: fn())"
|
|
desc: Calls B(0x19)
|
|
start_pos: 0x8006a7f4
|
|
end_pos: 0x8006a804
|
|
- name: FileOpen
|
|
signature: "fn(filename: *const str, access_mode: u32)"
|
|
desc: Calls B(0x32)
|
|
start_pos: 0x8006a824
|
|
end_pos: 0x8006a834
|
|
- name: FileSeek
|
|
signature: "fn(fd: u32, offset: u32, seek_type: u32)"
|
|
desc: Calls B(0x33)
|
|
start_pos: 0x8006a834
|
|
end_pos: 0x8006a844
|
|
- name: FileRead
|
|
signature: "fn(fd: u32, dst: *mut u8, length: u32)"
|
|
desc: Calls B(0x34)
|
|
start_pos: 0x8006a844
|
|
end_pos: 0x8006a854
|
|
- name: FileWrite
|
|
signature: "fn(fd: u32, src: *const u8, length: u32)"
|
|
desc: Calls B(0x35)
|
|
start_pos: 0x8006a854
|
|
end_pos: 0x8006a864
|
|
- name: FileClose
|
|
signature: "fn(fd: u32)"
|
|
desc: Calls B(0x36)
|
|
start_pos: 0x8006a864
|
|
end_pos: 0x8006a874
|
|
- name: firstfile
|
|
signature: "fn(filename: *const str, dir_entry: u32)"
|
|
desc: Calls B(0x42)
|
|
start_pos: 0x8006acb4
|
|
end_pos: 0x8006acc4
|
|
- name: nextfile
|
|
signature: "fn(dir_entry: u32)"
|
|
desc: Calls B(0x43)
|
|
start_pos: 0x8006a874
|
|
end_pos: 0x8006a884
|
|
- name: InitCard
|
|
signature: "fn(pad_enable: u32)"
|
|
desc: Calls B(0x4a)
|
|
start_pos: 0x80068994
|
|
end_pos: 0x800689a4
|
|
- name: StartCard
|
|
signature: "fn()"
|
|
desc: Calls B(0x4b)
|
|
start_pos: 0x800689a4
|
|
end_pos: 0x800689b4
|
|
- name: StopCard
|
|
signature: "fn()"
|
|
desc: Calls B(0x4c)
|
|
start_pos: 0x800689b4
|
|
end_pos: 0x800689c4
|
|
- name: write_card_sector
|
|
signature: "fn(port: u32, sector: u32, src: *const u8)"
|
|
desc: Calls B(0x4e)
|
|
start_pos: 0x80068874
|
|
end_pos: 0x80068884
|
|
- name: read_card_sector
|
|
signature: "fn(port: u32, sector: u32, dst: *mut u8)"
|
|
desc: Calls B(0x4f)
|
|
start_pos: 0x80069024
|
|
end_pos: 0x80069034
|
|
- name: allow_new_card
|
|
signature: "fn()"
|
|
desc: Calls B(0x50)
|
|
start_pos: 0x80068884
|
|
end_pos: 0x80068894
|
|
- name: ChangeClearPad
|
|
signature: "fn(pad: u32)"
|
|
desc: Calls B(0x5b)
|
|
start_pos: 0x8006a884
|
|
end_pos: 0x8006a894
|
|
- name: get_card_status
|
|
signature: "fn(slot: u32)"
|
|
desc: Calls B(0x5c)
|
|
start_pos: 0x80069034
|
|
end_pos: 0x80069044
|
|
|
|
# C Functions
|
|
- name: SysEnqIntRP
|
|
signature: "fn(priority: u32, struct: u32)"
|
|
desc: Calls C(0x02)
|
|
start_pos: 0x8006af84
|
|
end_pos: 0x8006af94
|
|
- name: SysDeqIntRP
|
|
signature: "fn(priority: u32, struct: u32)"
|
|
desc: Calls C(0x03)
|
|
start_pos: 0x8006af94
|
|
end_pos: 0x8006afa4
|
|
- name: ChangeClearRCnt
|
|
signature: "fn(t: u32, flag: u32)"
|
|
desc: Calls C(0x0a)
|
|
start_pos: 0x8006a894
|
|
end_pos: 0x8006a8a0
|
|
|
|
# Std
|
|
- name: sprintf
|
|
signature: "fn sprintf(buffer: *char, format: *const char, ...) -> i32"
|
|
inline_comments:
|
|
0x80069d6c: "if *buffer == '\\0' { goto.65; }"
|
|
0x80069d84: "if *buffer == '%' { goto .58; }"
|
|
comments:
|
|
0x80069d24: "Save arguments on wasted space."
|
|
0x80069d30: |-
|
|
Reserve stack space and save all additional
|
|
registers there
|
|
labels:
|
|
0x80069d84: "0"
|
|
0x80069db4: "1"
|
|
0x80069de8: "2"
|
|
0x80069e04: "3"
|
|
0x80069e14: "4"
|
|
0x80069e30: "5"
|
|
0x80069e4c: "6"
|
|
0x80069e84: "7"
|
|
0x80069e98: "8"
|
|
0x80069ed4: "9"
|
|
0x80069ee0: "10"
|
|
0x80069f34: "11"
|
|
0x80069f70: "12"
|
|
0x80069f7c: "13"
|
|
0x80069f9c: "14"
|
|
0x80069fbc: "15"
|
|
0x80069fc0: "16"
|
|
0x80069fe4: "17"
|
|
0x80069ff0: "18"
|
|
0x80069FFC: "66"
|
|
0x8006a008: "19"
|
|
0x8006a028: "20"
|
|
0x8006a058: "21"
|
|
0x8006a06c: "22"
|
|
0x8006a080: "23"
|
|
0x8006a0b0: "24"
|
|
0x8006a0b4: "25"
|
|
0x8006a0f4: "26"
|
|
0x8006a108: "27"
|
|
0x8006a118: "28"
|
|
0x8006a14c: "29"
|
|
0x8006a164: "30"
|
|
0x8006a180: "31"
|
|
0x8006a1a0: "32"
|
|
0x8006a1d0: "33"
|
|
0x8006a1f4: "34"
|
|
0x8006a208: "35"
|
|
0x8006a210: "36"
|
|
0x8006a22c: "37"
|
|
0x8006a268: "38"
|
|
0x8006a280: "39"
|
|
0x8006a2a0: "40"
|
|
0x8006a2b4: "41"
|
|
0x8006a2c0: "42"
|
|
0x8006a2c8: "43"
|
|
0x8006a2f8: "44"
|
|
0x8006a328: "45"
|
|
0x8006a33c: "46"
|
|
0x8006a344: "47"
|
|
0x8006a364: "48"
|
|
0x8006a380: "49"
|
|
0x8006a39c: "50"
|
|
0x8006a3cc: "51"
|
|
0x8006a3ec: "52"
|
|
0x8006a43c: "53"
|
|
0x8006a458: "54"
|
|
0x8006a478: "55"
|
|
0x8006a4a4: "56"
|
|
0x8006a4ac: "57"
|
|
0x8006a4b8: "58"
|
|
0x8006a4c4: "59"
|
|
0x8006a4ec: "60"
|
|
0x8006a514: "61"
|
|
0x8006a518: "62"
|
|
0x8006a534: "63"
|
|
0x8006a550: "64"
|
|
0x8006a570: "65"
|
|
start_pos: 0x80069d24
|
|
end_pos: 0x8006a5a4
|
|
|
|
- name: memcpy_args_reversed
|
|
signature: "fn(src: *const u8, dst: *mut u8, len: u32) -> *mut u8"
|
|
desc: |-
|
|
`memcpy` with the first two arguments swapped.
|
|
inline_comments:
|
|
0x80069044: "if src == NULL { return 0; }"
|
|
0x80069048: ""
|
|
0x8006904c: "if len <= 0 { return src; }"
|
|
comments:
|
|
0x80069054: |-
|
|
do {
|
|
*dst = *src;
|
|
src += 1;
|
|
len -= 1;
|
|
dst += 1;
|
|
} while (len > 0)
|
|
labels:
|
|
0x80069054: "loop"
|
|
0x8006906c: "end"
|
|
0x80069070: "on_null"
|
|
start_pos: 0x80069044
|
|
end_pos: 0x80069078
|
|
|
|
- name: mem_zero
|
|
signature: "fn(dst: *mut u8, len: u32) -> *mut u8"
|
|
desc: |-
|
|
Zeroes out `len` bytes of `dst`.
|
|
If `len <= 0`, returns `NULL`.
|
|
Otherwise returns `dst`.
|
|
inline_comments:
|
|
0x80069084: "if dst == NULL { return 0; }"
|
|
0x80069088: ""
|
|
0x8006908c: ""
|
|
0x80069090: "if len > 0 { _ret = dst; }"
|
|
0x80069094: "if len <= 0 { return 0; }"
|
|
comments:
|
|
0x8006909c: |-
|
|
do {
|
|
*dst = 0;
|
|
len -= 1;
|
|
dst += 1;
|
|
} while (len > 0)
|
|
labels:
|
|
0x8006909c: "loop"
|
|
0x800690ac: "end"
|
|
start_pos: 0x80069084
|
|
end_pos: 0x800690b4
|
|
|
|
- name: memcpy
|
|
signature: "fn(dst: *mut u8, src: *const u8, len: u32) -> *mut u8"
|
|
inline_comments:
|
|
0x800690b4: "if ptr == NULL { return 0; }"
|
|
0x800690b8: ""
|
|
0x800690bc: "if len <= 0 { return 0; }"
|
|
comments:
|
|
0x800690c4: |-
|
|
do {
|
|
*dst = *src;
|
|
src += 1;
|
|
len -= 1;
|
|
dst += 1;
|
|
} while (len > 0)
|
|
labels:
|
|
0x800690c4: "loop"
|
|
0x800690dc: "end"
|
|
0x800690e0: "on_null"
|
|
start_pos: 0x800690b4
|
|
end_pos: 0x800690e8
|
|
|
|
- name: memset
|
|
signature: "fn(dst: *mut u8, value: u32, len: u32) -> *mut u8"
|
|
inline_comments:
|
|
0x800690f4: "if ptr == NULL { return 0; }"
|
|
0x800690f8: ""
|
|
0x800690fc: ""
|
|
0x80069100: "if len > 0 { _ret = ptr; }"
|
|
0x80069104: "if len <= 0 { return 0; }"
|
|
comments:
|
|
0x8006910c: |-
|
|
do {
|
|
*dst = value;
|
|
len -= 1;
|
|
ptr += 1;
|
|
} while (len > 0)
|
|
labels:
|
|
0x8006910c: "loop"
|
|
0x8006911c: "end"
|
|
start_pos: 0x800690f4
|
|
end_pos: 0x80069124
|
|
|
|
- name: strcat
|
|
signature: "fn(dst: *mut u8, src: *const u8) -> *mut u8"
|
|
desc: ""
|
|
inline_comments:
|
|
0x8006917c: "if dst == NULL { return NULL; }"
|
|
0x80069180: ""
|
|
0x80069184: "if src == NULL { return NULL; }"
|
|
0x8006918c: "let dst_len = strlen(dst);"
|
|
0x80069190: ""
|
|
0x80069194: ""
|
|
0x80069198: "let src_len = strlen(src);"
|
|
0x800691a4: "if dst + dst_len == src + src_len { return NULL; }"
|
|
0x800691b4: "dst += 1; if *dst == 0 { goto go_back_1_dst; }"
|
|
0x800691cc: "dst -= 1;"
|
|
0x800691e8: "return dst;"
|
|
comments:
|
|
0x800691ac: |-
|
|
Skips `dst` until it hits one-past '\\0'.
|
|
Then backs up one and begins appending `src`
|
|
0x800691bc: |-
|
|
// Note: This causes `dst` to be one-past the null.
|
|
do {
|
|
let tmp = *dst;
|
|
dst += 1;
|
|
} while tmp != 0
|
|
0x800691d0: |-
|
|
// Note: The null is copied in this loop too.
|
|
do {
|
|
let tmp = *src;
|
|
*dst = src;
|
|
src += 1;
|
|
dst += 1;
|
|
} while tmp != 0
|
|
labels:
|
|
0x800691bc: "advance_dst_until_past_null"
|
|
0x800691cc: "go_back_1_dst"
|
|
0x800691d0: "loop"
|
|
0x800691ec: "on_null"
|
|
0x800691f0: "exit"
|
|
start_pos: 0x80069164
|
|
end_pos: 0x80069208
|
|
|
|
- name: strlen
|
|
signature: "fn(ptr: *const u8) -> u32"
|
|
desc: ""
|
|
inline_comments:
|
|
0x800692d8: "if ptr == NULL { return 0; }"
|
|
labels:
|
|
0x800692e8: "increase_len"
|
|
0x800692ec: "loop"
|
|
0x80069300: "on_null"
|
|
start_pos: 0x800692d4
|
|
end_pos: 0x80069308
|
|
|
|
# TODO: Investigate this more, seems weird
|
|
- name: strcmp
|
|
signature: "fn(lhs: *const u8, rhs: *const u8) -> u32"
|
|
desc: ""
|
|
inline_comments:
|
|
0x80069214: "if lhs == NULL { goto .lhs_null; }"
|
|
0x8006921c: "if rhs != NULL { goto .start_cmp; }"
|
|
0x80069224: "if lhs == rhs { return 0; } // Same as `rhs == NULL`"
|
|
0x80069228: ""
|
|
0x8006922c: "if lhs == NULL { return -1; } // Always true?"
|
|
0x80069234: "// Dead code?"
|
|
0x8006925c: "rhs += 1;"
|
|
0x80069248: "lhs += 1;"
|
|
0x8006926c: "return lhs[0] - rhs[-1]; // Note: This is because we don't advance `lhs` when we don't take the branch"
|
|
comments:
|
|
0x8006924c: |-
|
|
// Note: Includes the code from `.2` and `.1`
|
|
loop {
|
|
let left = *lhs;
|
|
let right = *rhs;
|
|
rhs += 1;
|
|
if left == right {
|
|
if *right == 0 { return 0; }
|
|
}
|
|
}
|
|
0x8006926c: |-
|
|
// This is because we update `rhs` prematurely in the previous loop.
|
|
// Note: This returns the lexicographic order by comparing the last character.
|
|
return lhs[0] - rhs[-1];
|
|
labels:
|
|
0x80069224: "lhs_null"
|
|
0x8006923c: "1"
|
|
0x80069244: "2"
|
|
0x8006924c: "start_cmp"
|
|
0x80069270: "exit"
|
|
start_pos: 0x80069214
|
|
end_pos: 0x80069278
|
|
|
|
- name: strcpy
|
|
signature: "fn(dst: *mut u8, src: *const u8) -> *mut u8"
|
|
desc: ""
|
|
inline_comments:
|
|
0x80069284: "if dst == NULL { return NULL; }"
|
|
0x80069288: ""
|
|
0x8006928c: "if dst == NULL { return NULL; }"
|
|
0x800692bc: "// Returns the original `lhs`"
|
|
comments:
|
|
0x80069294: |-
|
|
let tmp = *rhs;
|
|
rhs += 1;
|
|
*lhs = tmp;
|
|
lhs += 1;
|
|
if tmp == 0 { return lhs; }
|
|
0x800692a8: |-
|
|
do {
|
|
let tmp = *rhs;
|
|
rhs += 1;
|
|
*lhs = tmp;
|
|
lhs += 1;
|
|
if tmp == 0 { return lhs; }
|
|
}
|
|
labels:
|
|
0x800692a8: "loop"
|
|
0x800692bc: "end"
|
|
0x800692c0: "on_null"
|
|
start_pos: 0x80069284
|
|
end_pos: 0x800692c8
|