some input upgrades

This commit is contained in:
Luxferre
2022-08-17 21:30:09 +03:00
parent efb6b7a3d6
commit 991dff3eb1
2 changed files with 46 additions and 16 deletions
+2 -3
View File
@@ -134,10 +134,9 @@ See [FizzBuzz](examples/fizzbuzz.equi) for a more thorough example of how differ
Being a purely PC-oriented low-level runtime/programming environment, Equi has the reference implementation emulator/VM written in C (ANSI C89 standard), `equi.c`, compilable and runnable on all the systems supporting standard I/O. Note that, for portability reasons, this emulator:
- accepts the programs from standard input only,
- accepts the program from a single file at a time only,
- only implements four ports for `P` instruction: 0 as an echo port (returns passed parameters as corresponding result values), 1 as a random port (returns two random values in the results in the range between the two parameter values) 2 as a CRC16 calculation port for a given memory location and its length, and 3 for task control (see below), for any other port value it outputs its parameters to the standard error stream and puts three 0x0000 values back onto the stack,
- implements `s` command line parameter that runs the emulator in the silent mode without printing any welcome banners or interactive prompts,
- doesn't implement non-blocking key input (the `,` instruction is identical to blocking key input instruction `?`),
- sandboxes the `{` and `}` operations using the file with the name you supply on the compile time to the `PERSIST_FILE` constant. The file must already be created and accessible. If it doesn't exist, these operations will effectively do nothing except putting 0x0000 (success status) onto the stack.
Additionally, this emulator implements `m` command line parameter that means that, instead of execution, the VM shall output the current command buffer contents upon reaching the `Q` instruction. This is particularly useful to save minified versions of `.equi` files to further reuse them in more space-restricted environments. Note that minified and non-minified files load and run fully identically, but the size difference can be significant. I.e. for the current FizzBuzz example version, the source is 1544 bytes long but its actual application snapshot in the command buffer (which can be dumped with the `m` parameter as a minified variant) is just [180 bytes long](examples/fizzbuz.min.equi). The rest is comments and whitespace characters that are skipped while loading the program into the command buffer.
@@ -230,7 +229,7 @@ No, not at all. Although Equi was partially inspired by Uxn, it aims for a total
### I want to use Equi programs in a relatively modern POSIX environment as a part of a scripted process. Is this possible?
Totally! The Makefile for the reference implementation includes sensible default parameters for all targets. Just call `cat program.equi | /path/to/equi s | [other program]` in your scripts, where `s` parameter is used to suppress all banners and prompts and terminal initialization code from the standard output stream. Just make sure to place `PERS.DAT` file in the appropriate place if you need the persistence capabilities in your Equi-based scripts.
Totally! The Makefile for the reference implementation includes sensible default parameters for all targets. Just call `cat program.equi | /path/to/equi - s | [other program]` in your scripts, where `s` parameter is used to suppress all banners and prompts and terminal initialization code from the standard output stream. Just make sure to place `PERS.DAT` file in the appropriate place if you need the persistence capabilities in your Equi-based scripts, and not use input instructions in your programs if unsure what they will do with the streamed input. You can, of course, call Equi programs in a usual way just as well, with `/path/to/equi /path/to/program.equi s`, for instance.
### Too few core instructions! There still are lots of unused uppercase Latin letters, why not utilise them?