Ok so this is part of what I have:
byte 1 byte 2 (optional)
bits [ 7 6 5 4 3 2 1 0 ] [ 7 6 5 4 3 2 1 0 ]
opcode - - -
mod -
operand1 - - - -
operand2 - - - - - - - -
And instructions:
opcode | instruction | operands (mod 0) | operands (mod 1)
-------+-------------+------------------+-----------------
0x00 | jmp | r1 | r2:r1
0x01 | movr | r1, r2 | rx, imm
0x02 | movm | r1, [ds:r2] | [ds:r1], r2
0x03 | add | r1, r2 | r1, imm
flags
cmp r1, r2 instruction results in:
r1 == r2 => fl = 0
r1 < r2 => fl = 0xff
r1 > r2 => fl = 1
jmpe r1
=> if (fl == 0) jmp r1
else nop
I am then given:
0x00 0x00 0x00 0x01 0x03 0x02 0x03 0x02 0x03 0x02
But pretty much like you said, I am in need of simulating a processor with given instructions.