I am venturing into decoding instructions, for now on 80x86 16bit machines, I don't have many problems in decoding instructions that do not have an immediate value as their source operand, the problem arises when the source operand is no longer a register or a location memory but an immediate value. The following instruction I would decode it this way:
mov ax, 3
101110|11| |11|000|000| 00000011 -> 3 with sign expansion
| | | register AX
s = 1 | null
w = 1 |
the second operand is a register
Instead it is not fair. this is the right decoding:
mov ax, 3
10111000 00000011 0000000
Can someone explain to me how decoding works assuming the source operand is an immediate value?