Skip to content

Commit 2592346

Browse files
committed
Disable acceleration of LDIR/LDDR/DJNZ in tap2sna.py
Previously acceleration was enabled only when tracing was disabled, which could lead to a pause between two tape blocks occurring either after an LDIR/LDDR/DJNZ instruction (when accelerated), or in the middle of one (when not accelerated). This inconsistency could in turn lead to differences in RAM contents or register values in the snapshot produced.
1 parent 5781812 commit 2592346

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

skoolkit/tap2sna.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,7 @@ def sim_load(blocks, options, config):
482482
warn(f'Unrecognised accelerator: {name}')
483483

484484
interrupted = False
485-
fast = not options.trace
486-
sim_cfg = {'fast_djnz': fast, 'fast_ldir': fast}
485+
sim_cfg = {'fast_djnz': False, 'fast_ldir': False}
487486
if options.machine == '128':
488487
if not options.load:
489488
options.load = 'ENTER'

tests/test_tap2sna.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3154,12 +3154,12 @@ def test_sim_load_config_parameters(self):
31543154
@patch.object(tap2sna, 'Simulator', MockSimulator)
31553155
@patch.object(tap2sna, 'LoadTracer', MockLoadTracer)
31563156
@patch.object(tap2sna, 'write_snapshot', mock_write_snapshot)
3157-
def test_sim_load_enables_fast_djnz_ldir(self):
3157+
def test_sim_load_disables_fast_djnz_ldir(self):
31583158
tapfile = self._write_tap([create_tap_data_block([0])])
31593159
output, error = self.run_tap2sna(tapfile)
31603160
self.assertEqual(error, '')
3161-
self.assertTrue(simulator.config.get('fast_djnz'))
3162-
self.assertTrue(simulator.config.get('fast_ldir'))
3161+
self.assertFalse(simulator.config.get('fast_djnz'))
3162+
self.assertFalse(simulator.config.get('fast_ldir'))
31633163

31643164
@patch.object(tap2sna, 'CSimulator', MockSimulator)
31653165
@patch.object(tap2sna, 'Simulator', MockSimulator)

0 commit comments

Comments
 (0)