I am trying to understand the specs, but fail to understand the first line of the example given:
SET A, 0x30 ; 7c01 0030
Here is what I understood from the specs:
SET a, b
So I understand the instruction as SET A, 0x3C
Can anyone advise where I go wrong?
Ah ok from the comments I finally got my answer.
You are missing the "Values" section from the spec, there it says:
Values:
....
0x1f: next word (literal)
So we have:
0x7c01 = 0111110000000001
0001 = SET
000000 = register A
011111 = 1F -> next word -> [PC++]
Next word is 0x0030
... voilà.
@cli_hlt is almost correct
dcpu documentation says:
In a basic instruction, the lower five bits of the first word of the instruction are the opcode, and the remaining eleven bits are split into a five bit value b and a six bit value a.
b is always handled by the processor after a, and is the lower five bits. In bits (in LSB-0 format), a basic instruction has the format: aaaaaabbbbbooooo
so the correct answer is:
0x7c01 = 0111110000000001
00001 = SET
00000 = register A
011111 = 1F -> next word -> [PC++]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With