Add string input interrupt from STDIN
This commit is contained in:
31
README.md
31
README.md
@@ -89,22 +89,22 @@ There is currently no strict checking, so be careful.
|
||||
## Directives
|
||||
|
||||
- `DECLARE` declares the first label argument to equal the second, immediate
|
||||
value, argument and is used to declare a constant for the virtual machine.
|
||||
value, argument and is used to declare a constant for the virtual machine.
|
||||
|
||||
### Operands
|
||||
|
||||
- `addi` add the first to the second argument and store the result in the third
|
||||
argument
|
||||
argument
|
||||
- `subi` subtract the first from the second argument and store the result in
|
||||
the third argument
|
||||
the third argument
|
||||
- `divi` divide the first by the second argument and store the result in the
|
||||
third argument
|
||||
third argument
|
||||
- `muli` multiply the first by the second argument and store the result in the
|
||||
third argument
|
||||
third argument
|
||||
- `shli` shift left the first argument by the number of positions given by the
|
||||
second argument and store the result in the third argument
|
||||
second argument and store the result in the third argument
|
||||
- `shri` shift right the first argument by the number of positions given by the
|
||||
second argument and store the result in the third argument
|
||||
second argument and store the result in the third argument
|
||||
- `seti` set the first register argument to the second argument
|
||||
- `int` calls the interrupt specified by the first (integer) argument
|
||||
|
||||
@@ -112,15 +112,15 @@ second argument and store the result in the third argument
|
||||
|
||||
- `jmp` jump to the label given by the first argument
|
||||
- `call` put the next statement to execute on the stack and jump to the label
|
||||
given by the first argument
|
||||
given by the first argument
|
||||
- `ret` pop the the next statement to execute off the stack, e.g. returning to
|
||||
the next execution statement before calling `call`
|
||||
the next execution statement before calling `call`
|
||||
- `lti` execute next statement if argument 1 is less than argument 2 else skip
|
||||
the next statement
|
||||
the next statement
|
||||
- `gti` execute next statement if argument 1 is greater than argument 2 else
|
||||
skip the next statement
|
||||
skip the next statement
|
||||
- `eqi` execute the next statement if argument 1 is equal to argument 2 else
|
||||
skip the next statement
|
||||
skip the next statement
|
||||
|
||||
## Memory
|
||||
|
||||
@@ -137,5 +137,8 @@ the first argument
|
||||
- `2` put value of register A as hexadecimal integer on stdout
|
||||
- `3` put the string pointed at by register A for the amount of characters
|
||||
defined by register B on stdout
|
||||
- [4..4] Input from STDIN
|
||||
- `4` get a single ASCII character from STDIN and store it in register A
|
||||
- [4..5] Input from STDIN
|
||||
- `4` get a single ASCII character from STDIN and store it in register A
|
||||
- `5` get a string of a maximum length determined by register B and store it
|
||||
in the address specified by register A. After execution register B will
|
||||
contain the number of characters actually read.
|
||||
Reference in New Issue
Block a user