Exemple #1
0
def execute_one_instruction():
    global DPC

    if not running:
        Trace.dtrace('')
        return 0

    instruction = Memory.get(DPC, 0)
    DPC = MASK_MEM(DPC + 1)

    if mode == MODE_DEIM:
        Trace.trace(DEIMdecode(instruction >> 8) + '\t')
        doDEIMByte(instruction >> 8)
        if mode == MODE_DEIM:
            Trace.trace(DEIMdecode(instruction & 0xff) + '\t')
            doDEIMByte(instruction & 0xff)
        else:
            Trace.trace('\t')
        return 1

    opcode = instruction >> 12
    address = instruction & 007777

    if   opcode == 000:	return page00(instruction)
    elif opcode == 001:     return i_DLXA(address)
    elif opcode == 002:     return i_DLYA(address)
    elif opcode == 003:     return i_DEIM(address)
    elif opcode == 004:     return i_DLVH(address)
    elif opcode == 005:     return i_DJMS(address)
    elif opcode == 006:     return i_DJMP(address)
    elif opcode == 007:     return illegal(instruction)
    else:                   illegal(instruction)
Exemple #2
0
def page00(instruction):
    if instruction == 000000:		# DHLT
        i_DHLT()
    elif instruction == 004000:		# DNOP
        Trace.dtrace('DNOP')
    elif instruction == 004004:		# DSTS 0
        i_DSTS(0)
    elif instruction == 004005:		# DSTS 1
        i_DSTS(1)
    elif instruction == 004006:		# DSTS 2
        i_DSTS(2)
    elif instruction == 004007:		# DSTS 3
        i_DSTS(3)
    elif instruction == 004010:		# DSTB 0
        i_DSTB(0)
    elif instruction == 004011:		# DSTB 1
        i_DSTB(1)
    elif instruction == 004040:		# DRJM
        i_DRJM()
    elif instruction == 004100:		# DDYM
        i_DDYM()
    elif instruction == 004200:		# DDXM
        i_DDXM()
    elif instruction == 004400:		# DIYM
        i_DIYM()
    elif instruction == 005000:		# DIXM
        i_DIXM()
    elif instruction == 006000:		# DHVC
        i_DHVC()
    else:
        illegal(instruction)
    return 1
Exemple #3
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')
Exemple #4
0
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
Exemple #5
0
def i_DSTS(scale):
    global Scale

    if scale == 0:
        Scale = 0.5
    elif scale == 1:
        Scale = 1.0
    elif scale == 2:
        Scale = 2.0
    elif scale == 3:
        Scale = 3.0
    else:
        illegal()
    Trace.dtrace('DSTS', scale)
Exemple #6
0
def i_DLVH(word1):
    global DPC, DX, DY

    word2 = Memory.get(DPC, 0)
    DPC = MASK_MEM(DPC + 1)
    word3 = Memory.get(DPC, 0)
    DPC = MASK_MEM(DPC + 1)

    dotted = word2 & 040000
    beamon = word2 & 020000
    negx = word3 & 040000
    negy = word3 & 020000
    ygtx = word3 & 010000

    M = word2 & 007777
    N = word3 & 007777

    prevDX = DX
    prevDY = DY

    if ygtx:		# M is y, N is x
        if negx:
            DX -= N
        else:
            DX += N
        if negy:
            DY -= M
        else:
            DY += M
    else:			# M is x, N is y
        if negx:
            DX -= M
        else:
            DX += M
        if negy:
            DY -= N
        else:
            DY += N

#        display.drawline(dotted, prevDX, prevDY, DX, DY)
    Trace.dtrace('DLVH')
    return 3
Exemple #7
0
def i_DSTB(block):
    global DIB

    DIB = block
    Trace.dtrace('DSTB\t%d' % block)
Exemple #8
0
def i_DLYA(address):
    global DY

    DY = address
    Trace.dtrace('DLYA', address)
    return 1
Exemple #9
0
def i_DLXA(address):
    global DX

    DX = address
    Trace.dtrace('DLXA', address)
    return 1
Exemple #10
0
def i_DIYM():
    global DY

    DY += 04000
    Trace.dtrace('DIYM')
Exemple #11
0
def i_DJMP(address):
    global DPC, DIB

    DPC = MASK_MEM(address + (DIB << 12))
    Trace.dtrace('DJMP', address)
    return 1
Exemple #12
0
def i_DIXM():
    global DX

    DX += 04000
    Trace.dtrace('DIXM')
Exemple #13
0
def i_DHVC():
    Trace.dtrace('DHVC')
Exemple #14
0
def i_DHLT():
    running = False
    Trace.dtrace('DHLT')
Exemple #15
0
def i_DDYM():
    global DY

    DY -= 040
    Trace.dtrace('DDYM')
Exemple #16
0
def i_DDXM():
    global DX

    DX -= 040
    Trace.dtrace('DDXM')