Skip to content

Commit

Permalink
Make LoadTracer check which ROM is paged in when appropriate
Browse files Browse the repository at this point in the history
Specifically, before doing a fast load or acting on 'IN A,($FE)'.
  • Loading branch information
skoolkid committed Aug 28, 2023
1 parent 4f452e6 commit 4479578
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions skoolkit/loadtracer.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

from skoolkit import SkoolKitError, open_file, write, write_line
from skoolkit.basic import TextReader
from skoolkit.pagingtracer import PagingTracer
from skoolkit.pagingtracer import Memory, PagingTracer
from skoolkit.simulator import (A, F, B, C, D, E, H, L, IXh, IXl, IYh, IYl, SP, I, R,
xA, xF, xB, xC, xD, xE, xH, xL, PC, T, R1)
from skoolkit.traceutils import disassemble
Expand Down Expand Up @@ -204,7 +204,10 @@ def __init__(self, simulator, blocks, accelerators, pause, first_edge, polarity,
self.tape_end_time = 0
self.custom_loader = False
self.border = border
self.out7ffd = out7ffd
if isinstance(simulator.memory, Memory): # pragma: no cover
self.out7ffd = out7ffd # 128K ROM 0/1
else:
self.out7ffd = 0x10 # Signal: 48K ROM always
self.outfffd = outfffd
self.ay = ay
self.outfe = outfe
Expand Down Expand Up @@ -270,7 +273,7 @@ def run(self, stop, fast_load, timeout, trace, trace_line, prefix, byte_fmt, wor
write_line(f'Simulation stopped (PC at start address): PC={pc}')
break

if pc == 0x0556 and fast_load:
if pc == 0x0556 and self.out7ffd & 0x10 and fast_load:
self.fast_load(simulator)
self.index = self.block_max_index
if self.index == max_index:
Expand Down Expand Up @@ -485,7 +488,7 @@ def list_accelerators(self, registers, memory, accelerators, auto_method, opcode
def read_port(self, registers, port):
if port % 256 == 0xFE:
pc = registers[24]
if pc >= self.in_min_addr or 0x0562 <= pc <= 0x05F1: # pragma: no cover
if pc >= self.in_min_addr or (0x0562 <= pc <= 0x05F1 and self.out7ffd & 0x10): # pragma: no cover
self.custom_loader = True
index = self.index
if self.announce_data and not self.end_of_tape:
Expand Down

0 comments on commit 4479578

Please sign in to comment.