def doDEIMByte(byte): global DPC, DX, DY, DRSindex if byte & 0x80: # increment? prevDX = DX prevDY = DY if byte & 0x20: DX -= (byte & 0x18) >> 3 else: DX += (byte & 0x18) >> 3 if byte & 0x04: DY -= (byte & 0x03) else: DY += (byte & 0x03) # if byte & 0x40: # display.draw(0, prevDX, prevDY, DX, DY) else: # micro instructions if byte & 0x40: mode = MODE_NORMAL if byte & 0x20: # DRJM if DRSindex <= 0: Trace.comment('\nDRS stack underflow at display address %6.6o' % (DPC - 1)) illegal() DRSindex -= 1 DPC = DRS[DRSindex] if byte & 0x10: DX += 0x08 if byte & 0x08: DX &= 0xfff8 if byte & 0x02: DY += 0x10 if byte & 0x01: DY &= 0xfff0
def illegal(instruction=None): if instruction: Trace.comment('Illegal display instruction (%6.6o) at address %6.6o' % (instruction, (DPC - 1))) else: Trace.comment('Illegal display instruction at address %6.6o' % (DPC - 1)) sys.exit(0)
def i_DRJM(): global DPC, DRSindex if DRSindex <= 0: Trace.comment('DRS stack underflow at display address %6.6o' % (DPC - 1)) illegal() DRSindex -= 1 DPC = DRS[DRSindex] Trace.dtrace('DRJM')
def i_DJMS(address): global DPC, DRSindex, DIB if DRSindex >= 8: Trace.comment('DRS stack overflow at display address %6.6o' % (DPC - 1)) illegal() DRS[DRSindex] = DPC DRSindex += 1 DPC = MASK_MEM(address + (DIB << 12)) Trace.dtrace('DJMS', address) return 1