stackdcpu-16

SET A, 0x1E vs SET A, 0x1F


This is my first attempt at dpcu, I'm checking machine code generated by dpcu-16 assembly

I am using this emulator : http://dcpu.ru/

I am trying to compare code generated by

SET A, 0x1E
SET A, 0x1F

code generated is as follow :

fc01 
7c01 001f 

I don't get why operand size changes between those two values


Solution

  • 0x1F (dec:31) is no longer a short literal (values -1 to 30), so it has to be read as a "next word" argument.

    The opcodes are thus:

    SET A, 0x1E
    SET =             00001
    A   =        00000
    1E  =  111111
    op  =  1111110000000001 = fc01
    
    
    SET A, 0x1F
    SET =             00001
    A   =        00000
    NW  =  011111
    op  =  0111110000000001 = 7c01 + 001f