Compile to bytecode
This commit is contained in:
23
README.md
23
README.md
@@ -22,14 +22,14 @@ afterwards can be a bit cryptic as to where it originated.
|
||||
## Notation
|
||||
|
||||
- `[operation][number type]`, e.g. `divi` for divide (div) integer
|
||||
- `%[register]` for addressing registers
|
||||
- `$[value]` for using immediate (literal) integer values
|
||||
- `'a'` for using immediate character values
|
||||
- `%[register]` for addressing registers, e.g. `%A`
|
||||
- `$[value]` for using immediate (literal) integer values, e.g. `$38`
|
||||
- `'[character]'` for using immediate character values, e.g. `'r'`
|
||||
- `;` for end of statement (mandatory)
|
||||
- `[label]:` for labels
|
||||
- `[label]:` for labels, e.g. `loop:`
|
||||
- `#[text]` for comments: any text is ignored till a newline (`\n`) is found
|
||||
- `[[%register|$value]]` for accessing memory
|
||||
- Elements must be separated by whitespace character
|
||||
- `[[%register|$value]]` for accessing memory, e.g. `[$104]`
|
||||
- Elements must be separated by whitespace character(s)
|
||||
- Good: `add $2 $5 %A;`
|
||||
- Bad: `add $2$5%A;`
|
||||
|
||||
@@ -103,7 +103,8 @@ directive is not supported therefore.
|
||||
|
||||
### Registers
|
||||
|
||||
All registers are 32 bits wide. The following 4 registers currently exist:
|
||||
All registers are 32 bits wide. The following 4 general purpose registers
|
||||
currently exist:
|
||||
|
||||
- A
|
||||
- B
|
||||
@@ -159,14 +160,14 @@ the first argument
|
||||
|
||||
## Interupts
|
||||
|
||||
- [0..3] Output to STDOUT
|
||||
- [0..9] Output to STDOUT
|
||||
- `0` put value of register A as ASCII character on stdout
|
||||
- `1` put value of register A as decimal integer on stdout
|
||||
- `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..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
|
||||
- [10..19] Input from STDIN
|
||||
- `10` get a single ASCII character from STDIN and store it in register A
|
||||
- `11` 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