Closed jscrane closed 4 months ago
The fix was to edit the input file from:
^M54^M41^M52^M54^M00^MFF^M.0705G0^ to ^M54^M41^M52^M54^M00^MFF^M.07005G^
I don't understand why this is!
more 9 read 46 more 8 read 48 more 7 read 55 read 48 more 5 read 53 more 4 read 71
It is clear that two consecutive reads
are issued, without an intervening call to more
. (more
is called from a read of the ACIA status register, read
is called from a read of the data register.)
The first read is obviously being lost, resulting in a transfer of control to 0075
, instead of 0705
.
This behaviour only happens with the monuk02
load
routine, not cegmon's
.
It looks as if this read is a spurious one:
03 02 00 f4 00110011 fe30 b1 read 0 30 02 00 f4 00110001 fe32 85
Instruction b1
is LDA (ind), Y
. The location indirected though is 0xfe. This instruction is processed twice more in this trace, without reading the ACIA.
I expect that this would have happened "in real life" too, but a character wouldn't have been available to have been read from the slow tape at this time, so it was a benign bug.
Turns out that this spurious read was reading from $f007 which would not have addressed the ACIA on a real UK101. Tightening up the ACIA read handler fixed this.
Nice bug!
Hangs on load:
Note the PC transfers to $0075 instead of $0705. It finally stops with an Illegal Instruction.