OK, so i've worked out the sequence of code leading up to the $B966 instruction:
Code: Select all
1. ($b902-$b902) Disable interrupts
2. ($b903-$b905) Disable VIA interrupt
3. ($b906-$b90f) Store the address $0710 into $26b/26c
4. ($b910-$b914) $314 write:
- Disable microdisc ROM
- Enable ROM
- Set bit 2 (?)
5. ($b915-$b91b) Print the sedoric info (string at $b9ba)
6. ($b91c-$b920) Enable overlay RAM (romdis=1,eprom=0)
7. ($b921-$b92d) Copy 3 bytes from $ccfd to $ccf7
- First boot = 00 00 00
- Reset = 00 00 00
8. ($b92e-$b941) Calculate 8-byte checksum of $c980 to $ffff
- First boot = All zeros
- Reset = All zeros except "a5 d0" @ $fffe
9. ($b942-$b943) Load X with 4, transfer the checksum to Y
10. ($b944-$b945) If the checksum is zero, jump to $b94e
11. ($b946-$b949) Load A&Y with the contents of $b901
12. ($b94a-$b94b) If non-zero, jump to $b94e
13. ($b94c-$b94d) Load X with $3C
14. ($b94e-$b94f) Store Y at $0000
15. ($b950-$b959) Set the vector at $fffe to $b97b
16. ($b95a-$b95e) Set sector register to 5
17. ($b95f-$b963) Enable disk interrupts
18. ($b964-$b968) Send "read sector" command
19. ($b969-$b96b) Set Y to zero, enable interrupts
20. ($b96c-$b97a) Read all bytes that appear on the disk
data register until we're interrupted
It seems to me that it only works after a reset because before jumping into the sea of BRKs, it sets up the interrupt vector to point to $d0a5. Then, when you reset Oriculator, that vector changes the checksum calculated in step 8 to be non-zero, so on the second time through, steps 11, 12 & 13 are executed, and X contains $3C instead of $04, and a lot more sectors are therefore read from the disk.
So this raises three questions:
1. What is *supposed* to be @ $c980 to be checksummed?
2. Why isn't it there?
3. Why does anything at all being in overlay RAM make it read $3C sectors instead of $04?
And the only answers I have right now are "I don't know".
Edit: Could someone who knows their way around euphoric's debugger boot the toxic slime disk, break @ $b92e and dump the contents of $c980-$ffff ?