示例#1
0
def dobody(f, count):
    mymem = mem.Mem()

    numwords = count
    while True:
        ldaddr = readword(f)
        if ldaddr & 0x8000:
            break
        csum = 0
        while numwords > 0:
            word = readword(f)
            csum += word
            if csum > 0xffff:
                csum += 1
            csum = csum & 0xffff
            mymem.add(ldaddr, word)
            (op, fld) = disasmdata.disasmdata(word)
            mymem.putOp(ldaddr, op)
            mymem.putFld(ldaddr, fld)
            ldaddr += 1
            numwords -= 1
        checksum = readword(f)
        if csum != checksum:
            print "Checksum error"
            #sys.exit(20)
        numwords = skipzeros(f)
    return mymem
示例#2
0
def dobody(f, mymem, save):
    """Read all of file after block loader.

    f      input file handle
    mymem  the mem.Mem() dict to store data in
    save   True if body code is to be saved in 'mymem'

    Returns an updated mem.Mem() object containing the input code
    and a start address: (mem, start, ac).
    If a start address is not specified, 'start' and 'ac' are both None.

    If there was a checksum error, just return None.
    """

    if not save:
        return (mymem, None, None)

    start_address = None

    while True:
        # negative load address is end-of-file
        ldaddr = readword(f)
        if ldaddr & 0x8000:
            break

        # read data block, calculating checksum
        csum = ldaddr                           # start checksum with base address
        count = pyword(readword(f))
        neg_count = pyword(count)
        csum = (csum + count) & 0xffff          # add neg word count
        csum_word = readword(f)
        csum = (csum + csum_word) & 0xffff      # add checksum word
        while neg_count < 0:
            word = readword(f)
            csum = (csum + word) & 0xffff
            mymem.add(ldaddr, word)
            (op, fld) = disasmdata.disasmdata(word)
            mymem.putOp(ldaddr, op)
            mymem.putFld(ldaddr, fld)
            ldaddr += 1
            neg_count += 1
        csum &= 0xffff
        if csum != 0:
            wx.MessageBox('Checksum error, got %06o, expected 0' % csum, 'Warning', wx.OK | wx.ICON_WARNING)

    # check for real start address
    if ldaddr != 0177777:
        # actual start address
        ac = readword(f)
        return (mymem, ldaddr & 0x7ffff, ac)

    return (mymem, None, None)
示例#3
0
def process(mem, addr, cycle):
    code = mem.getCode(addr)
    (op, fld) = disasmdata.disasmdata(code)
    mem.putOp(addr, op)
    mem.putFld(addr, fld)
    mem.putCycle(addr, cycle)