organize disassemblies of fx@3.10

This commit is contained in:
Lephenixnoir 2020-02-28 07:48:14 +01:00
parent c70d17018f
commit 0384bc38aa
Signed by untrusted user: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
7 changed files with 195 additions and 188 deletions

View File

@ -1,45 +0,0 @@
Syscall %ac9 longjmp() from Graph 35+E II OS 3.10
Restores the whole jump buffer, except for r0 which is the return code anyway.
Performs rts to the saved value of pr, effectively jumping to the setjmp() call
site.
Discovered RAM memory:
0x880287e4 Temporary storage for the return code of longjmp()
<%ac9>
801e3e7c: d011 mov.l 0x880287e4, r0
801e3e7e: 2052 mov.l r5, @r0
801e3e80: 7434 add #52, r4
801e3e82: 5046 mov.l @(24,r4), r0
801e3e84: 401e ldc r0, gbr
801e3e86: 5045 mov.l @(20,r4), r0
801e3e88: 401a lds r0, macl
801e3e8a: 5044 mov.l @(16,r4), r0
801e3e8c: 400a lds r0, mach
801e3e8e: 5142 mov.l @(8,r4), r1
801e3e90: 5241 mov.l @(4,r4), r2
801e3e92: 6342 mov.l @r4, r3
801e3e94: 74cc add #-52, r4
801e3e96: 554b mov.l @(44,r4), r5
801e3e98: 564a mov.l @(40,r4), r6
801e3e9a: 5749 mov.l @(36,r4), r7
801e3e9c: 5848 mov.l @(32,r4), r8
801e3e9e: 5947 mov.l @(28,r4), r9
801e3ea0: 5a46 mov.l @(24,r4), r10
801e3ea2: 5b45 mov.l @(20,r4), r11
801e3ea4: 5c44 mov.l @(16,r4), r12
801e3ea6: 5d43 mov.l @(12,r4), r13
801e3ea8: 5e41 mov.l @(4,r4), r14
801e3eaa: 6043 mov r4, r0
801e3eac: 540c mov.l @(48,r0), r4
801e3eae: 6f02 mov.l @r0, r15
801e3eb0: 5002 mov.l @(8,r0), r0
801e3eb2: 402a lds r0, pr
801e3eb4: d003 mov.l 0x880287e4, r0
801e3eb6: 6002 mov.l @r0, r0
801e3eb8: 8800 cmp/eq #0, r0
801e3eba: 8b00 bf <801e3ebe>
801e3ebc: e001 mov #1, r0
801e3ebe: 000b rts
801e3ec0: 0009 nop

View File

@ -1,40 +0,0 @@
Syscall %aca setjmp() from Graph 35+E II OS 3.10
An implementation of setjmp() using an 80-byte CPU context buffer. The
corresponding longjump() function is %ac9.
Shape of the CPU context structure:
(+0) r15 r14 pr r13 r12 r11 r10 r9 r8 r7 r6 r5
(+48) r4 r3 r2 r1 r0 mach macl gbr
Total size: 80 bytes
<%aca>
801e3ec8: 24f2 mov.l r15, @r4
801e3eca: 14e1 mov.l r14, @(4,r4)
801e3ecc: 0e2a sts pr, r14
801e3ece: 14e2 mov.l r14, @(8,r4)
801e3ed0: 5e41 mov.l @(4,r4), r14
801e3ed2: 14d3 mov.l r13, @(12,r4)
801e3ed4: 14c4 mov.l r12, @(16,r4)
801e3ed6: 14b5 mov.l r11, @(20,r4)
801e3ed8: 14a6 mov.l r10, @(24,r4)
801e3eda: 1497 mov.l r9, @(28,r4)
801e3edc: 1488 mov.l r8, @(32,r4)
801e3ede: 1479 mov.l r7, @(36,r4)
801e3ee0: 146a mov.l r6, @(40,r4)
801e3ee2: 145b mov.l r5, @(44,r4)
801e3ee4: 144c mov.l r4, @(48,r4)
801e3ee6: 7430 add #48, r4
801e3ee8: 1431 mov.l r3, @(4,r4)
801e3eea: 1422 mov.l r2, @(8,r4)
801e3eec: 1413 mov.l r1, @(12,r4)
801e3eee: 1404 mov.l r0, @(16,r4)
801e3ef0: 000a sts mach, r0
801e3ef2: 1405 mov.l r0, @(20,r4)
801e3ef4: 001a sts macl, r0
801e3ef6: 1406 mov.l r0, @(24,r4)
801e3ef8: 0012 stc gbr, r0
801e3efa: 1407 mov.l r0, @(28,r4)
801e3efc: 6442 mov.l @r4, r4
801e3efe: 000b rts
801e3f00: e000 mov #0, r0

102
asm/fx@3.10/%03b.txt Normal file
View File

@ -0,0 +1,102 @@
Syscall %03b RTC_GetTicks() from Graph 35+E II OS 3.10
<%03b RTC_GetTicks>
Returns the number of 128-Hz ticks elapsed since midnight.
r0: Number of ticks (between 0 and 11059200)
80013c80: 2f86 mov.l r8, @-r15
80013c82: 2f96 mov.l r9, @-r15
80013c84: 2fa6 mov.l r10, @-r15
80013c86: 2fb6 mov.l r11, @-r15
80013c88: 2fc6 mov.l r12, @-r15
80013c8a: 2fd6 mov.l r13, @-r15
80013c8c: 4f12 sts.l macl, @-r15
# r9 is 128*60*60, ie. the number of ticks per hour
80013c8e: db79 mov.l 0xa413fedc RTC.RCR1, r11
80013c90: ecfc mov #-4, r12
80013c92: e807 mov #7, r8
80013c94: d978 mov.l 0x00070800, r9
80013c96: 6db3 mov r11, r13
80013c98: 7de4 add #-28, r13
# Clear the carry flag and carry interrupt in RCR1
80013c9a: 67b0 mov.b @r11, r7
80013c9c: 6073 mov r7, r0
80013c9e: c909 and #9, r0
80013ca0: 6a03 mov r0, r10
80013ca2: 2ba0 mov.b r10, @r11
# r5 = RSECCNT (binary) * 128 + R64CNT
80013ca4: 61d0 mov.b @r13, r1
80013ca6: 84d2 mov.b @(2,r13), r0
80013ca8: 631c extu.b r1, r3
80013caa: 6403 mov r0, r4
80013cac: c970 and #112, r0
80013cae: 40cc shad r12, r0
80013cb0: 6503 mov r0, r5
80013cb2: 4508 shll2 r5
80013cb4: 350c add r0, r5
80013cb6: 6043 mov r4, r0
80013cb8: 4500 shll r5
80013cba: c90f and #15, r0
80013cbc: 350c add r0, r5
80013cbe: 84d4 mov.b @(4,r13), r0
80013cc0: 458d shld r8, r5
80013cc2: 353c add r3, r5
# r6 = RMINCNT (binary)
80013cc4: 6603 mov r0, r6
80013cc6: 6203 mov r0, r2
80013cc8: 84d6 mov.b @(6,r13), r0
80013cca: 6103 mov r0, r1
80013ccc: 6063 mov r6, r0
80013cce: c970 and #112, r0
80013cd0: 40cc shad r12, r0
80013cd2: 6603 mov r0, r6
80013cd4: 4608 shll2 r6
80013cd6: 360c add r0, r6
80013cd8: 6023 mov r2, r0
80013cda: 4600 shll r6
80013cdc: c90f and #15, r0
80013cde: 360c add r0, r6
# r2 = RHRCNT (binary), r4 = r6 * (60*128)
80013ce0: 6013 mov r1, r0
80013ce2: c930 and #48, r0
80013ce4: 6463 mov r6, r4
80013ce6: 40cc shad r12, r0
80013ce8: 4408 shll2 r4
80013cea: 4408 shll2 r4
80013cec: 6203 mov r0, r2
80013cee: 3468 sub r6, r4
80013cf0: 4208 shll2 r2
80013cf2: 4418 shll8 r4
80013cf4: 320c add r0, r2
80013cf6: 6013 mov r1, r0
80013cf8: 4400 shll r4
80013cfa: 4200 shll r2
80013cfc: c90f and #15, r0
80013cfe: 320c add r0, r2
# Combine these together to form the number of ticks elapsed since midnight:
# r4 = 60*60*128*RHRCNT + 60*128*RMINCNT + 128*RSECCNT + R64CNT (binary)
# Restart if the carry is set.
80013d00: 60b0 mov.b @r11, r0
80013d02: 0927 mul.l r2, r9
80013d04: c880 tst #-128, r0
80013d06: 345c add r5, r4
80013d08: 051a sts macl, r5
80013d0a: 8fca bf.s <80013ca2>
80013d0c: 345c add r5, r4
80013d0e: 2b70 mov.b r7, @r11
80013d10: 6043 mov r4, r0
80013d12: 4f16 lds.l @r15+, macl
80013d14: 6df6 mov.l @r15+, r13
80013d16: 6cf6 mov.l @r15+, r12
80013d18: 6bf6 mov.l @r15+, r11
80013d1a: 6af6 mov.l @r15+, r10
80013d1c: 69f6 mov.l @r15+, r9
80013d1e: 000b rts
80013d20: 68f6 mov.l @r15+, r8

48
asm/fx@3.10/%ac9.txt Normal file
View File

@ -0,0 +1,48 @@
Syscall %ac9 longjmp() from Graph 35+E II OS 3.10
Restores the whole jump buffer, except for r0 which is the return code anyway.
Performs rts to the saved value of pr, effectively jumping to the setjmp() call
site.
Discovered RAM memory:
0x880287e4 Temporary storage for the return code of longjmp()
<%ac9 longjmp>
r4: Jump buffer
r5: Return value (cannot be 0 as it would confuse setjmp)
801e3e7c: d011 mov.l 0x880287e4, r0
801e3e7e: 2052 mov.l r5, @r0
801e3e80: 7434 add #52, r4
801e3e82: 5046 mov.l @(24,r4), r0
801e3e84: 401e ldc r0, gbr
801e3e86: 5045 mov.l @(20,r4), r0
801e3e88: 401a lds r0, macl
801e3e8a: 5044 mov.l @(16,r4), r0
801e3e8c: 400a lds r0, mach
801e3e8e: 5142 mov.l @(8,r4), r1
801e3e90: 5241 mov.l @(4,r4), r2
801e3e92: 6342 mov.l @r4, r3
801e3e94: 74cc add #-52, r4
801e3e96: 554b mov.l @(44,r4), r5
801e3e98: 564a mov.l @(40,r4), r6
801e3e9a: 5749 mov.l @(36,r4), r7
801e3e9c: 5848 mov.l @(32,r4), r8
801e3e9e: 5947 mov.l @(28,r4), r9
801e3ea0: 5a46 mov.l @(24,r4), r10
801e3ea2: 5b45 mov.l @(20,r4), r11
801e3ea4: 5c44 mov.l @(16,r4), r12
801e3ea6: 5d43 mov.l @(12,r4), r13
801e3ea8: 5e41 mov.l @(4,r4), r14
801e3eaa: 6043 mov r4, r0
801e3eac: 540c mov.l @(48,r0), r4
801e3eae: 6f02 mov.l @r0, r15
801e3eb0: 5002 mov.l @(8,r0), r0
801e3eb2: 402a lds r0, pr
801e3eb4: d003 mov.l 0x880287e4, r0
801e3eb6: 6002 mov.l @r0, r0
801e3eb8: 8800 cmp/eq #0, r0
801e3eba: 8b00 bf <801e3ebe>
801e3ebc: e001 mov #1, r0
801e3ebe: 000b rts
801e3ec0: 0009 nop

42
asm/fx@3.10/%aca.txt Normal file
View File

@ -0,0 +1,42 @@
Syscall %aca setjmp() from Graph 35+E II OS 3.10
An implementation of setjmp() using an 80-byte CPU context buffer. The
corresponding longjump() function is %ac9.
Shape of the CPU context structure:
(+0) r15 r14 pr r13 r12 r11 r10 r9 r8 r7 r6 r5
(+48) r4 r3 r2 r1 r0 mach macl gbr
Total size: 80 bytes
<%aca setjmp>
r4: Jump buffer
801e3ec8: 24f2 mov.l r15, @r4
801e3eca: 14e1 mov.l r14, @(4,r4)
801e3ecc: 0e2a sts pr, r14
801e3ece: 14e2 mov.l r14, @(8,r4)
801e3ed0: 5e41 mov.l @(4,r4), r14
801e3ed2: 14d3 mov.l r13, @(12,r4)
801e3ed4: 14c4 mov.l r12, @(16,r4)
801e3ed6: 14b5 mov.l r11, @(20,r4)
801e3ed8: 14a6 mov.l r10, @(24,r4)
801e3eda: 1497 mov.l r9, @(28,r4)
801e3edc: 1488 mov.l r8, @(32,r4)
801e3ede: 1479 mov.l r7, @(36,r4)
801e3ee0: 146a mov.l r6, @(40,r4)
801e3ee2: 145b mov.l r5, @(44,r4)
801e3ee4: 144c mov.l r4, @(48,r4)
801e3ee6: 7430 add #48, r4
801e3ee8: 1431 mov.l r3, @(4,r4)
801e3eea: 1422 mov.l r2, @(8,r4)
801e3eec: 1413 mov.l r1, @(12,r4)
801e3eee: 1404 mov.l r0, @(16,r4)
801e3ef0: 000a sts mach, r0
801e3ef2: 1405 mov.l r0, @(20,r4)
801e3ef4: 001a sts macl, r0
801e3ef6: 1406 mov.l r0, @(24,r4)
801e3ef8: 0012 stc gbr, r0
801e3efa: 1407 mov.l r0, @(28,r4)
801e3efc: 6442 mov.l @r4, r4
801e3efe: 000b rts
801e3f00: e000 mov #0, r0

View File

@ -1,108 +1,5 @@
RTC functions from Graph 35+E II OS 3.10
<%03b RTC_GetTicks>
Returns the number of 128-Hz ticks elapsed since midnight.
r0: Number of ticks (between 0 and 11059200)
80013c80: 2f86 mov.l r8, @-r15
80013c82: 2f96 mov.l r9, @-r15
80013c84: 2fa6 mov.l r10, @-r15
80013c86: 2fb6 mov.l r11, @-r15
80013c88: 2fc6 mov.l r12, @-r15
80013c8a: 2fd6 mov.l r13, @-r15
80013c8c: 4f12 sts.l macl, @-r15
# r9 is 128*60*60, ie. the number of ticks per hour
80013c8e: db79 mov.l 0xa413fedc RTC.RCR1, r11
80013c90: ecfc mov #-4, r12
80013c92: e807 mov #7, r8
80013c94: d978 mov.l 0x00070800, r9
80013c96: 6db3 mov r11, r13
80013c98: 7de4 add #-28, r13
# Clear the carry flag and carry interrupt in RCR1
80013c9a: 67b0 mov.b @r11, r7
80013c9c: 6073 mov r7, r0
80013c9e: c909 and #9, r0
80013ca0: 6a03 mov r0, r10
80013ca2: 2ba0 mov.b r10, @r11
# r5 = RSECCNT (binary) * 128 + R64CNT
80013ca4: 61d0 mov.b @r13, r1
80013ca6: 84d2 mov.b @(2,r13), r0
80013ca8: 631c extu.b r1, r3
80013caa: 6403 mov r0, r4
80013cac: c970 and #112, r0
80013cae: 40cc shad r12, r0
80013cb0: 6503 mov r0, r5
80013cb2: 4508 shll2 r5
80013cb4: 350c add r0, r5
80013cb6: 6043 mov r4, r0
80013cb8: 4500 shll r5
80013cba: c90f and #15, r0
80013cbc: 350c add r0, r5
80013cbe: 84d4 mov.b @(4,r13), r0
80013cc0: 458d shld r8, r5
80013cc2: 353c add r3, r5
# r6 = RMINCNT (binary)
80013cc4: 6603 mov r0, r6
80013cc6: 6203 mov r0, r2
80013cc8: 84d6 mov.b @(6,r13), r0
80013cca: 6103 mov r0, r1
80013ccc: 6063 mov r6, r0
80013cce: c970 and #112, r0
80013cd0: 40cc shad r12, r0
80013cd2: 6603 mov r0, r6
80013cd4: 4608 shll2 r6
80013cd6: 360c add r0, r6
80013cd8: 6023 mov r2, r0
80013cda: 4600 shll r6
80013cdc: c90f and #15, r0
80013cde: 360c add r0, r6
# r2 = RHRCNT (binary), r4 = r6 * (60*128)
80013ce0: 6013 mov r1, r0
80013ce2: c930 and #48, r0
80013ce4: 6463 mov r6, r4
80013ce6: 40cc shad r12, r0
80013ce8: 4408 shll2 r4
80013cea: 4408 shll2 r4
80013cec: 6203 mov r0, r2
80013cee: 3468 sub r6, r4
80013cf0: 4208 shll2 r2
80013cf2: 4418 shll8 r4
80013cf4: 320c add r0, r2
80013cf6: 6013 mov r1, r0
80013cf8: 4400 shll r4
80013cfa: 4200 shll r2
80013cfc: c90f and #15, r0
80013cfe: 320c add r0, r2
# Combine these together to form the number of ticks elapsed since midnight:
# r4 = 60*60*128*RHRCNT + 60*128*RMINCNT + 128*RSECCNT + R64CNT (binary)
# Restart if the carry is set.
80013d00: 60b0 mov.b @r11, r0
80013d02: 0927 mul.l r2, r9
80013d04: c880 tst #-128, r0
80013d06: 345c add r5, r4
80013d08: 051a sts macl, r5
80013d0a: 8fca bf.s <80013ca2>
80013d0c: 345c add r5, r4
80013d0e: 2b70 mov.b r7, @r11
80013d10: 6043 mov r4, r0
80013d12: 4f16 lds.l @r15+, macl
80013d14: 6df6 mov.l @r15+, r13
80013d16: 6cf6 mov.l @r15+, r12
80013d18: 6bf6 mov.l @r15+, r11
80013d1a: 6af6 mov.l @r15+, r10
80013d1c: 69f6 mov.l @r15+, r9
80013d1e: 000b rts
80013d20: 68f6 mov.l @r15+, r8
...
<80054456 RTC_GetRawTime>
Gets the time into a structure of the following form, where all objects are
written in BCD notation.

View File

@ -6,3 +6,6 @@ name: syscalls-lephe
%004 tlb_init
%025 t6k11_read_datareg
%3fc tlb_map
%ac9 longjmp
%aca setjmp