diff --git a/README.md b/README.md index e57317c..49b6993 100644 --- a/README.md +++ b/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, diff --git a/examples/jmp_to_address_in_acc.mima b/examples/jmp_to_address_in_acc.mima new file mode 100644 index 0000000..8af00f3 Binary files /dev/null and b/examples/jmp_to_address_in_acc.mima differ diff --git a/examples/jmp_to_address_in_acc.mimasm b/examples/jmp_to_address_in_acc.mimasm new file mode 100644 index 0000000..fcf6d50 --- /dev/null +++ b/examples/jmp_to_address_in_acc.mimasm @@ -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