Exemplo n.º 1
0
def process(mem, addrlist, newcycle):
    mode = "normal"
    for addr in addrlist:
        enqueDisp(addr)
    while len(dispQ) > 0:
        address = dequeDisp()
        while True:
            if mem.getCycle(address) == newcycle:   # seen it already
                break
            mem.putCycle(address, newcycle)
            code = mem.getCode(address)
            (op, fld) = disasmd.disasmd(code)
            mem.putOp(address, op)
            mem.putFld(address, fld)
            if mode == "deim":
                if isDEIMExit(code):
                    mode = "normal"
                if isDEIMReturn(code):
                    break
            else:
                if mem.getRef(address):
                    mem.decLab(getTargetAddress(code))
                if isDJMP(code):
                    memref = effAddress(address, getTargetAddress(code))
                    mem.setRef(address)
                    mem.incLab(memref)
                    enqueDisp(memref)
                    break
                elif isDRJM(code):
                    break
                elif isDJMS(code):
                    memref = effAddress(address, getTargetAddress(code))
                    mem.setRef(address)
                    mem.incLab(memref)
                    enqueDisp(memref)
                elif isDEIM(code):
                    mode = "deim"
                elif isDHLT(code):
                    break
            address = address + 1
Exemplo n.º 2
0
def process(mem, addrlist, newcycle):
    for addr in addrlist:
        enqueMain(addr)
    while len(mainQ) > 0:
        address = dequeMain()
        while True:
            if mem.getCycle(address) == newcycle:   # seen it already
                break
            mem.putCycle(address, newcycle)
            code = mem.getCode(address)
            if mem.getRef(address):
                mem.decLab(getTargetAddress(code))
            (op, fld) = disasmm.disasmm(code)
            mem.putOp(address, op)
            mem.putFld(address, fld)
            if isJMP(code):
                memref = effAddress(address, getTargetAddress(code))
                mem.setRef(address)
                mem.incLab(memref)
                enqueMain(memref)
                break
            elif isJMS(code):
                memref = effAddress(address, getTargetAddress(code))
                mem.setRef(address)
                mem.incLab(memref)
                enqueMain(memref+1)
            elif isISZ(code) or isSAM(code):
                memref = effAddress(address, getTargetAddress(code))
                mem.setRef(address)
                mem.incLab(memref)
                enqueMain(address+2)
            elif isMemRef(code):
                memref = effAddress(address, getTargetAddress(code))
                mem.setRef(address)
                mem.incLab(memref)
            elif isSkip(code):
                enqueMain(address+2)
            elif isHLT(code):
                break
            address = address + 1