Update readme and add example
This commit is contained in:
parent
6c7b47a18d
commit
2fd6aadc62
3 changed files with 46 additions and 2 deletions
20
README.md
20
README.md
|
|
@ -142,8 +142,6 @@ always be at least 15 bytes long (contains all register values).
|
|||
|
||||
This program can load and run `.mima` files.
|
||||
|
||||
It currently does not follow the specification above.
|
||||
|
||||
```
|
||||
$ mima-run --help
|
||||
Usage: mima-run INFILE [-n|--steps N] [-d|--dump OUTFILE] [-q|--quiet]
|
||||
|
|
@ -163,6 +161,24 @@ Available options:
|
|||
further actions
|
||||
```
|
||||
|
||||
### `mima-asm`
|
||||
|
||||
This program can parse `.mimasm` files and convert them to `.mima`
|
||||
files. More information and a specification of the `.mimasm` format
|
||||
may be coming soon. For example programs, look in the `examples/`
|
||||
folder.
|
||||
|
||||
```
|
||||
$ mima-asm --help
|
||||
Usage: mima-asm INFILE [-o|--out OUTFILE]
|
||||
|
||||
Available options:
|
||||
-h,--help Show this help text
|
||||
INFILE The .mimasm file to assemble
|
||||
-o,--out OUTFILE The .mima file to write the assembled result
|
||||
to (default: "out.mima")
|
||||
```
|
||||
|
||||
## Conventions
|
||||
|
||||
In the source code, the name MiMa is spelled `Mima`. When displayed,
|
||||
|
|
|
|||
BIN
examples/jmp_to_address_in_acc.mima
Normal file
BIN
examples/jmp_to_address_in_acc.mima
Normal file
Binary file not shown.
28
examples/jmp_to_address_in_acc.mimasm
Normal file
28
examples/jmp_to_address_in_acc.mimasm
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
IAR = technique-a
|
||||
|
||||
; This file demonstrates a few techniques for jumping to an address
|
||||
; stored in the ACC.
|
||||
|
||||
; A few variables
|
||||
jump-instruction: JMP 0
|
||||
tmp: LIT 0
|
||||
|
||||
; Jumping by setting the RA and then returning
|
||||
100:
|
||||
technique-a:
|
||||
LDC technique-b
|
||||
STRA
|
||||
RET
|
||||
|
||||
; Jumping by writing a JMP instruction to a memory location and then
|
||||
; jumping to that (aka. almost self-modifying code)
|
||||
200:
|
||||
technique-b:
|
||||
LDC end
|
||||
OR jump-instruction
|
||||
STV tmp
|
||||
JMP tmp
|
||||
|
||||
300:
|
||||
end:
|
||||
HALT
|
||||
Loading…
Add table
Add a link
Reference in a new issue