~luxferre/nrj-oisc

4ce53635c853b33af88a245a8ce1312c9f1201bd — Luxferre 4 months ago 24eaaab
Git rid of some hardcoding
1 files changed, 5 insertions(+), 5 deletions(-)

M nrjasm.py
M nrjasm.py => nrjasm.py +5 -5
@@ 171,18 171,18 @@ def start_assembly(srcfname, dstfname): # main assembly method
        elif line[0] == NRJDIR_SET: # handle .set
            addr = int(line[1], 16)
            val = line[2]
            if val == 'HLT':
            if val == NRJDIR_HLT:
                targetmem[addr] = ltoffset
            elif val != 'NXT':
            elif val != NRJDIR_NXT:
                targetmem[addr] = int(val, 16)
        else: # 3-value vector where HLT or NXT can be encountered
            # save current instruction in the lookup table
            targetmem[ltoffset + ltpos] = codepos
            ltpos += 1
            for v in line:
                if v == 'HLT':
                if v == NRJDIR_HLT:
                    targetmem[codepos] = ltoffset
                elif v == 'NXT':
                elif v == NRJDIR_NXT:
                    targetmem[codepos] = ltoffset + ltpos
                else:
                    targetmem[codepos] = int(v, 16)


@@ 196,7 196,7 @@ def start_assembly(srcfname, dstfname): # main assembly method
        elif line[0] == NRJDIR_SET: # handle .set
            addr = int(line[1], 16)
            val = line[2]
            if val == 'NXT':
            if val == NRJDIR_NXT:
                val = targetmem[ltoffset + ltpos]
                targetmem[addr] = val
        else: # 3-value vector where HLT or NXT can be encountered