(details and layout)

This commit is contained in:
Lephenixnoir 2020-03-02 17:17:22 +01:00
parent 000466d42e
commit a3bb642352
2 changed files with 128 additions and 120 deletions

View File

@ -4,15 +4,18 @@ Disassembly objective:
Understand the return-to-menu mechanism and hidden functions of GetKey().
Discovered RAM memory:
0x8801b62c "setjmp_buffers" (jmp_buf[2])
A datable with two jump buffers of 80 bytes each.
0x8801b6cc "setjmp_buffer_index" (u8)
Index into the jump buffer table at 0x8801b62c.
0x8801b6cd (u8)
Controls the setup of a setjmp() at the start of GetKeyWait_Main.
0x8801b6ce (u8)
Copied to 0x8801b6cd in state #4 around <80089e38>.
This group of variables is related to an obscure long-jump-based scheme that
manages global state for GetKeyWait. Check "GetKeyWait_Dispatcher.txt" for
more details.
0x8801b62c "setjmp_buffers" (jmp_buf[2])
A datable with two jump buffers of 80 bytes each.
0x8801b6cc "setjmp_buffer_index" (u8)
Index into the jump buffer table at 0x8801b62c.
0x8801b6cd (u8)
Controls the setup of a setjmp() at the start of GetKeyWait_Main.
0x8801b6ce (u8)
Copied to 0x8801b6cd in state #4 around <80089e38>.
0x8801340c (i8[16])
0x8801341c (i8[16])
@ -27,7 +30,7 @@ Call graph:
----------------------------------------------------------------------------
<80056802> GetKeyWait_Main
%aca setjmp (DONE)
<80089d8a> GetKeyWait_Dispatcher (WIP - Lephe)
<80089d8a> GetKeyWait_Dispatcher (STALLED - Lephe)
<80055d48> ? probably enables the keyboard interrupt
<80057982> ?
<800578ba>
@ -587,124 +590,123 @@ Call graph:
80056c38: 000b rts
80056c3a: 68f6 mov.l @r15+, r8
---
<80057982>
80057982: 4f22 sts.l pr, @-r15
80057984: 4f12 sts.l macl, @-r15
80057986: 4f02 sts.l mach, @-r15
80057988: d636 mov.l 0x800854c2, r6
8005798a: 460b jsr @r6
8005798c: 0009 nop
8005798e: 8801 cmp/eq #1, r0
80057990: 8b3b bf <80057a0a>
80057982: 4f22 sts.l pr, @-r15
80057984: 4f12 sts.l macl, @-r15
80057986: 4f02 sts.l mach, @-r15
80057988: d636 mov.l 0x800854c2, r6
8005798a: 460b jsr @r6
8005798c: 0009 nop
8005798e: 8801 cmp/eq #1, r0
80057990: 8b3b bf <80057a0a>
# RTC_TimeCategorySinceReset()
80057992: bf92 bsr <800578ba>
80057994: 0009 nop
80057996: 2008 tst r0, r0
80057998: 8901 bt <8005799e>
8005799a: 8801 cmp/eq #1, r0
8005799c: 8b0d bf <800579ba>
# RTC_TimeCategorySinceReset()
80057992: bf92 bsr <800578ba>
80057994: 0009 nop
80057996: 2008 tst r0, r0
80057998: 8901 bt <8005799e>
8005799a: 8801 cmp/eq #1, r0
8005799c: 8b0d bf <800579ba>
# If it returns 0 or 1...
8005799e: d12f mov.l %03b RTC_GetTicks, r1
800579a0: 410b jsr @r1
800579a2: 0009 nop
800579a4: 4011 cmp/pz r0
800579a6: 8d01 bt.s <800579ac>
800579a8: 6203 mov r0, r2
800579aa: 723f add #63, r2
800579ac: e6fa mov #-6, r6
800579ae: 426c shad r6, r2
800579b0: 6023 mov r2, r0
800579b2: c801 tst #1, r0
800579b4: 891f bt <800579f6>
800579b6: a022 bra <800579fe>
800579b8: 0009 nop
# If it returns 0 or 1...
8005799e: d12f mov.l %03b RTC_GetTicks, r1
800579a0: 410b jsr @r1
800579a2: 0009 nop
800579a4: 4011 cmp/pz r0
800579a6: 8d01 bt.s <800579ac>
800579a8: 6203 mov r0, r2
800579aa: 723f add #63, r2
800579ac: e6fa mov #-6, r6
800579ae: 426c shad r6, r2
800579b0: 6023 mov r2, r0
800579b2: c801 tst #1, r0
800579b4: 891f bt <800579f6>
800579b6: a022 bra <800579fe>
800579b8: 0009 nop
# If it returns something else...
800579ba: 8802 cmp/eq #2, r0
800579bc: 8901 bt <800579c2>
800579be: 8803 cmp/eq #3, r0
800579c0: 8b5c bf <80057a7c>
800579c2: d226 mov.l %03b RTC_GetTicks, r2
800579c4: 420b jsr @r2
800579c6: 0009 nop
800579c8: 4011 cmp/pz r0
800579ca: 8d01 bt.s <800579d0>
800579cc: 6503 mov r0, r5
800579ce: 753f add #63, r5
800579d0: e7fa mov #-6, r7
800579d2: d128 mov.l 0x2aaaaaab, r1
800579d4: 457c shad r7, r5
800579d6: 315d dmuls.l r5, r1
800579d8: 060a sts mach, r6
800579da: 6063 mov r6, r0
800579dc: 4004 rotl r0
800579de: c901 and #1, r0
800579e0: 360c add r0, r6
800579e2: 6463 mov r6, r4
800579e4: 4600 shll r6
800579e6: 364c add r4, r6
800579e8: 4600 shll r6
800579ea: 3568 sub r6, r5
800579ec: 6053 mov r5, r0
800579ee: 8804 cmp/eq #4, r0
800579f0: 8905 bt <800579fe>
800579f2: 8805 cmp/eq #5, r0
800579f4: 8903 bt <800579fe>
# If it returns something else...
800579ba: 8802 cmp/eq #2, r0
800579bc: 8901 bt <800579c2>
800579be: 8803 cmp/eq #3, r0
800579c0: 8b5c bf <80057a7c>
800579c2: d226 mov.l %03b RTC_GetTicks, r2
800579c4: 420b jsr @r2
800579c6: 0009 nop
800579c8: 4011 cmp/pz r0
800579ca: 8d01 bt.s <800579d0>
800579cc: 6503 mov r0, r5
800579ce: 753f add #63, r5
800579d0: e7fa mov #-6, r7
800579d2: d128 mov.l 0x2aaaaaab, r1
800579d4: 457c shad r7, r5
800579d6: 315d dmuls.l r5, r1
800579d8: 060a sts mach, r6
800579da: 6063 mov r6, r0
800579dc: 4004 rotl r0
800579de: c901 and #1, r0
800579e0: 360c add r0, r6
800579e2: 6463 mov r6, r4
800579e4: 4600 shll r6
800579e6: 364c add r4, r6
800579e8: 4600 shll r6
800579ea: 3568 sub r6, r5
800579ec: 6053 mov r5, r0
800579ee: 8804 cmp/eq #4, r0
800579f0: 8905 bt <800579fe>
800579f2: 8805 cmp/eq #5, r0
800579f4: 8903 bt <800579fe>
800579f6: b06d bsr <80057ad4>
800579f8: 0009 nop
800579fa: a03d bra <80057a78>
800579fc: 0009 nop
800579f6: b06d bsr <80057ad4>
800579f8: 0009 nop
800579fa: a03d bra <80057a78>
800579fc: 0009 nop
800579fe: b06f bsr <80057ae0>
80057a00: 0009 nop
80057a02: a039 bra <80057a78>
80057a04: 0009 nop
800579fe: b06f bsr <80057ae0>
80057a00: 0009 nop
80057a02: a039 bra <80057a78>
80057a04: 0009 nop
80057a0a: d616 mov.l 0x800854c2, r6
80057a0c: 460b jsr @r6
80057a0e: 0009 nop
80057a10: 8802 cmp/eq #2, r0
80057a12: 8b33 bf <80057a7c>
80057a14: bf51 bsr <800578ba>
80057a16: 0009 nop
80057a18: 2008 tst r0, r0
80057a1a: 892d bt <80057a78>
80057a1c: 8801 cmp/eq #1, r0
80057a1e: 8903 bt <80057a28>
80057a20: 8802 cmp/eq #2, r0
80057a22: 8901 bt <80057a28>
80057a24: 8803 cmp/eq #3, r0
80057a26: 8b29 bf <80057a7c>
80057a28: b06c bsr <80057b04>
80057a2a: 0009 nop
80057a2c: 2008 tst r0, r0
80057a2e: 8b23 bf <80057a78>
80057a30: b06b bsr <80057b0a>
80057a32: e401 mov #1, r4
80057a34: d50d mov.l 0x8008547c, r5
80057a36: 450b jsr @r5
80057a38: e400 mov #0, r4
80057a3a: d60d mov.l 0x8005a8a0, r6
80057a3c: 460b jsr @r6
80057a3e: 0009 nop
80057a40: 2008 tst r0, r0
80057a42: 8901 bt <80057a48>
80057a44: ba2a bsr <80056e9c>
80057a46: 0009 nop
80057a48: a019 bra <80057a7e>
80057a4a: e0ff mov #-1, r0
80057a78: a001 bra <80057a7e>
80057a7a: e001 mov #1, r0
80057a7c: 0029 movt r0
80057a7e: 4f06 lds.l @r15+, mach
80057a80: 4f16 lds.l @r15+, macl
80057a82: 4f26 lds.l @r15+, pr
80057a84: 000b rts
80057a86: 0009 nop
80057a0a: d616 mov.l 0x800854c2, r6
80057a0c: 460b jsr @r6
80057a0e: 0009 nop
80057a10: 8802 cmp/eq #2, r0
80057a12: 8b33 bf <80057a7c>
80057a14: bf51 bsr <800578ba>
80057a16: 0009 nop
80057a18: 2008 tst r0, r0
80057a1a: 892d bt <80057a78>
80057a1c: 8801 cmp/eq #1, r0
80057a1e: 8903 bt <80057a28>
80057a20: 8802 cmp/eq #2, r0
80057a22: 8901 bt <80057a28>
80057a24: 8803 cmp/eq #3, r0
80057a26: 8b29 bf <80057a7c>
80057a28: b06c bsr <80057b04>
80057a2a: 0009 nop
80057a2c: 2008 tst r0, r0
80057a2e: 8b23 bf <80057a78>
80057a30: b06b bsr <80057b0a>
80057a32: e401 mov #1, r4
80057a34: d50d mov.l 0x8008547c, r5
80057a36: 450b jsr @r5
80057a38: e400 mov #0, r4
80057a3a: d60d mov.l 0x8005a8a0, r6
80057a3c: 460b jsr @r6
80057a3e: 0009 nop
80057a40: 2008 tst r0, r0
80057a42: 8901 bt <80057a48>
80057a44: ba2a bsr <80056e9c>
80057a46: 0009 nop
80057a48: a019 bra <80057a7e>
80057a4a: e0ff mov #-1, r0
80057a78: a001 bra <80057a7e>
80057a7a: e001 mov #1, r0
80057a7c: 0029 movt r0
80057a7e: 4f06 lds.l @r15+, mach
80057a80: 4f16 lds.l @r15+, macl
80057a82: 4f26 lds.l @r15+, pr
80057a84: 000b rts
80057a86: 0009 nop

View File

@ -141,5 +141,11 @@ a4150044 CPG.SSCGCR
a4150050 CPG.FLLFRQ
a4150060 CPG.LSTATS
# Compare Match Timer
a44a0000 CMT.CMSTR
a44a0060 CMT.CMCSR
a44a0064 CMT.CMCNT
a44a0068 CMT.CMCOR
# More addresses are around on Casiopeia.
# See http://www.casiopeia.net/forum/viewtopic.php?f=11&t=1756#p14588.