@@ -196,12 +196,12 @@ def __init__(self, simulator, blocks, config):
196196 self .pause = config ['pause' ]
197197 self .in_min_addr = config ['in_min_addr' ]
198198 self .accelerators = config ['accelerators' ]
199- accel_dec_a = config ['accelerate_dec_a' ]
200- if hasattr (simulator , 'opcodes' ) and accel_dec_a :
201- dec_a_jr = accel_dec_a & 1
202- dec_a_jp = accel_dec_a & 2
199+ self . accel_dec_a = config ['accelerate_dec_a' ]
200+ if hasattr (simulator , 'opcodes' ) and self . accel_dec_a :
201+ dec_a_jr = self . accel_dec_a & 1
202+ dec_a_jp = self . accel_dec_a & 2
203203 simulator .opcodes [0x3D ] = partial (self .dec_a , dec_a_jr , dec_a_jp , simulator .registers , simulator .memory )
204- list_accelerators = config ['list_accelerators' ]
204+ self . list_accelerators = config ['list_accelerators' ]
205205 self .block_index = 0
206206 self .block_data_index = self .blocks [0 ].start
207207 self .max_index = len (self .edges ) - 1
@@ -221,11 +221,9 @@ def __init__(self, simulator, blocks, config):
221221 0 , # state[2]: end of tape reached
222222 self .blocks [0 ].end , # state[3]: index of final edge in current block
223223 0 , # state[4]: tape running
224- accel_dec_a , # state[5]
225- list_accelerators , # state[6]
226- 0 , # state[7]: custom loader detected
227- 0 , # state[8]: tape end time
228- 1 , # state[9]: data block not yet announced
224+ 0 , # state[5]: custom loader detected
225+ 0 , # state[6]: tape end time
226+ 1 , # state[7]: data block not yet announced
229227 ]
230228 if hasattr (simulator , 'load' ): # pragma: no cover
231229 self .edges = array .array ('Q' , self .edges )
@@ -335,15 +333,15 @@ def run(self, border, out7ffd, outfffd, ay, outfe):
335333 else :
336334 if state [2 ] and stop is None :
337335 # The tape has ended and no stop address is set
338- if state [7 ]:
336+ if state [5 ]:
339337 # Custom loader was detected
340338 stop_cond = 1
341339 break
342340 if pc > 0x3FFF :
343341 # PC in RAM
344342 stop_cond = 2
345343 break
346- if tstates - self .state [8 ] > 3500000 : # pragma: no cover
344+ if tstates - self .state [6 ] > 3500000 : # pragma: no cover
347345 # Tape ended 1 second ago
348346 stop_cond = 3
349347 break
@@ -403,10 +401,10 @@ def _read_port(self, state, accelerators, memory, registers, port):
403401 if port % 256 == 0xFE :
404402 pc = registers [24 ]
405403 if pc >= self .in_min_addr or (0x0562 <= pc <= 0x05F1 and self .out7ffd & 0x10 ):
406- state [7 ] = 1 # Signal: custom loader detected
404+ state [5 ] = 1 # Signal: custom loader detected
407405 index = state [1 ]
408- if state [9 ] and not state [2 ]:
409- state [9 ] = 0 # Signal: data block announced
406+ if state [7 ] and not state [2 ]:
407+ state [7 ] = 0 # Signal: data block announced
410408 state [4 ] = 1 # Signal: tape is running
411409 registers [T ] = self .edges [index ]
412410 length = len (self .blocks [self .block_index ].data )
@@ -479,14 +477,14 @@ def next_block(self, tstates):
479477 self .keys = block .keys
480478 self .state [3 ] = self .blocks [self .block_index ].end
481479 self .state [4 ] = int (not self .pause ) # Pause tape unless configured not to
482- self .state [9 ] = 1 # Signal: data block not yet announced
480+ self .state [7 ] = 1 # Signal: data block not yet announced
483481
484482 def stop_tape (self , tstates ):
485483 self .block_index = len (self .blocks )
486484 self .state [2 ] += 1 # Signal: end of tape reached
487485 if self .state [2 ] == 1 :
488486 write_line ('Tape finished' )
489- self .state [8 ] = tstates # Set tape end time
487+ self .state [6 ] = tstates # Set tape end time
490488 self .state [4 ] = 0 # Signal: tape is not running
491489
492490 def fast_load (self , simulator ):
@@ -574,5 +572,5 @@ def fast_load(self, simulator):
574572 registers [E ] = de & 0xFF
575573
576574 registers [PC ] = 0x05E2
577- self .state [9 ] = 0 # Signal: data block announced
575+ self .state [7 ] = 0 # Signal: data block announced
578576 return True
0 commit comments