Closed MarSoft closed 10 years ago
Instructions should be defined as follows: mask (opcode(s), operand types); proc. Proc gets operands as arguments and optionally also opcode, and returns either integer of (int, int) for twobyte instructions. Possible operand types are: Reg, Reg(Lo), Reg(Hi), Reg('SP')...; Int, Int(7 bytes), Int(0x29)...; Label; String (do we need it? if yes, then it will not be passed to proc, but only used as mask) Proc may be lambda calling some other proc with custom args.
Done.
Assembler structure: instructions are parsed to following: [ ['MOV', Reg('R0'), Int(0x102)], ['LDR, Reg('R4'), [Reg('SP'), Label('text')], ... ] Then each record is sequentially tested against all defined instructions