DEO rewording: value instead of byte
This commit is contained in:
parent
bada7e2370
commit
9f21c38e6c
|
@ -306,15 +306,15 @@ the second line has several things going on:
|
|||
* LIT : this appears twice, and is an uxn instruction with the following actions: it pushes the next byte in memory down onto the stack, and makes the program counter skip that byte.
|
||||
* 68 : an hexadecimal number, that corresponds to the ascii code of the character 'h'
|
||||
* 18 : an hexadecimal number, that corresponds to an i/o address: device 1 (console), address 8.
|
||||
* DEO : another uxn instruction, that we could define as the following: output the given byte into the given device address, both taken from the stack ( byte address -- )
|
||||
* DEO : another uxn instruction, that we could define as the following: output the given value (1 byte) into the given device address, both taken from the stack ( value address -- )
|
||||
|
||||
reading the program from left to right, we can see the following behavior:
|
||||
|
||||
* the LIT instruction pushes number 68 down onto the stack
|
||||
* the LIT instruction pushes number 18 down onto the stack
|
||||
* the DEO instruction takes the top element from the stack (18) and uses it as a device address
|
||||
* the DEO instruction takes the top element from the stack (68) and uses it as a byte to output
|
||||
* the DEO instruction outputs the byte to the device address, leaving the stack empty
|
||||
* the DEO instruction takes the top element from the stack (68) and uses it as a value to output
|
||||
* the DEO instruction outputs the value to the device address, leaving the stack empty
|
||||
|
||||
and what is the i/o device with address 18?
|
||||
|
||||
|
@ -588,7 +588,7 @@ these are the instructions we covered today:
|
|||
* ADD: take the top two elements from the stack, add them, and push down the result ( a b -- a+b )
|
||||
* SUB: take the top two elements from the stack, subtract them, and push down the result ( a b -- a-b )
|
||||
* LIT: push the next byte in memory down onto the stack
|
||||
* DEO: output the given byte into the given device address, both taken from the stack ( byte address -- )
|
||||
* DEO: output the given value into the given device address, both taken from the stack ( value address -- )
|
||||
|
||||
# day 2
|
||||
|
||||
|
|
Loading…
Reference in New Issue