mirror of
https://github.com/pnx/m16vm
synced 2026-06-24 10:23:40 +02:00
README.md: document interrupts.
This commit is contained in:
parent
1088e4960e
commit
3db5f117d6
1 changed files with 23 additions and 1 deletions
24
README.md
24
README.md
|
|
@ -40,7 +40,7 @@ There are 16 different instructions.
|
||||||
| 1100 | - | - | Reserved |
|
| 1100 | - | - | Reserved |
|
||||||
| 1101 | - | - | Reserved |
|
| 1101 | - | - | Reserved |
|
||||||
| 1110 | - | - | Reserved |
|
| 1110 | - | - | Reserved |
|
||||||
| 1111 | wr | I | I/O Write |
|
| 1111 | int | I | Interrupt |
|
||||||
|
|
||||||
NOTE: Subtraction can be implemented via `add` and negative register values, so no
|
NOTE: Subtraction can be implemented via `add` and negative register values, so no
|
||||||
special opcode is needed.
|
special opcode is needed.
|
||||||
|
|
@ -73,6 +73,28 @@ Jump format (J):
|
||||||
|
|
||||||
opcode (4) | addr (signed 12)
|
opcode (4) | addr (signed 12)
|
||||||
|
|
||||||
|
## Interrupts
|
||||||
|
|
||||||
|
There can be a total of `16` Interrupts and the instruction uses the `I-format`.
|
||||||
|
|
||||||
|
The interrupt number is stored in `reg` (note that for interrupts this is a constant and not a register).
|
||||||
|
|
||||||
|
The `data` field can be used as an argument to the interrupt.
|
||||||
|
|
||||||
|
| Number | Name | data | Description |
|
||||||
|
| ---------: | -----------| ------ | -------------------------------------------------------- |
|
||||||
|
| 10 | I/O Write | format | Outputs a value to the screen, value are stored in `r15` |
|
||||||
|
|
||||||
|
### I/O Write - int 10
|
||||||
|
|
||||||
|
The formatting of the output can be controlled by the number in `data` as follows:
|
||||||
|
|
||||||
|
| Argument | Datatype |
|
||||||
|
| ------------ | ----------------------- |
|
||||||
|
| 0 | Integer (16 bit signed) |
|
||||||
|
| 1 | Integer (8 bit signed) |
|
||||||
|
| 2 | Character |
|
||||||
|
|
||||||
## Example programs.
|
## Example programs.
|
||||||
|
|
||||||
in the `programs` directory, there is some example programs to run.
|
in the `programs` directory, there is some example programs to run.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue