## Min_InfMachine Exec
This is program to execute and debug the Minimalistic Infinite Machines (min_infmachine).
Typical usage of program is:
```
min_infmachine -M my_machine.toml -o memdump0
```
The command above runs machine from `my_machine.toml` and store final main memory dump to file.
To debug machine just can enter similar command:
```
min_infmachine -D -M my_machine.toml
```
This command loads machine from `my_machine.toml` and run interactive debugger.
Other command line options:
* -M, --machine machine.toml - loads machine from TOML file.
* -T, --table table - loads machine transition table from text file
(values of entries are numbers that can delimited by and other characters).
* -C, --circuit circuit - loads transition circuit from file (in the Gate System format).
* -m, --memory MEMORY - loads binary file to main memory of machine.
* -u, --memory-start START - start address where memory fille will be loaded.
* -D, --debug-mode - enables interactive debugger.
* -c, --cycles CYCLES - set maximal number of cycles to execute.
* -S, --cycles-per-step CYCLES - set cycles per step execution.
* -o, --memory-dump MEMORY - save final (after execution) main memory to file.
* -r, --memory-dump-start START - start address from memory will be saved.
* -O, --machine-dump DUMP - store machine after execution to file.
Rest of commands available in command help (enter command `min_infmachine --help`).
### Interactive debugger.
After run program in debugger mode, program just show prompt and waits for user commands.
It provides similar interface to Unix shell and it provides command history.
It possible to get help about commands by using `help` command.
Help for given command is available by command `help COMMAND` or `COMMAND --help` where
`COMMAND` is name of command.
Typical commands in debugger mode.
* `init` - initialize (clear) all memories of machine and its internal state.
* `init_state` - initialize internal state of machine.
* `initmem` - intialize main memory.
* `loadmem FILE [START]` - load content of file to main memory of machine. START is start address
of main memory.
* `savemem FILE [START] [END]` - save content main memory of machine to file.
START is start address of main memory.
* `loadtempbuf FILE` - load temp content of file to temp buffer.
* `savetempbuf FILE` - save temp buffer to file.
* `save FILE` - save current machine (whole state) to TOML file.
* `exec [CYCLES]` - execute machine. If CYCLES specified then execute only CYCLES cycles.
* `cycle` - execute single cycle.
* `exec_until EXPR [CYCLES]` - execute machine expression will be satisfied. If
CYCLES specified then execute only CYCLES cycles. Constant in expression must be
decimal form. Typical expression is `s0==NUMBER` or `s0==NUMBER&&s1==NUMBER`.
Operators `&&` or `||` are logical operators. See to `expression_engine` README.
* `mem [START] [END] [FORMAT]` - prints main memory from START to END if specified.
FORMAT can be `d4` (decimal 4-byte numbers), `x2` (hex 2-byte numbers).
* `memaddr [START] [END] [FORMAT]` - prints memory address from START to END if specified.
FORMAT can be `d4` (decimal 4-byte numbers), `x2` (hex 2-byte numbers).
* `tempbuf [START] [END] [FORMAT]` - prints temp buffer from START to END if specified.
FORMAT can be `d4` (decimal 4-byte numbers), `x2` (hex 2-byte numbers).
* `state [FORMAT]` - prints state.
FORMAT can be `d4` (decimal 4-byte numbers), `x2` (hex 2-byte numbers).
* `putmem START VALUE VALUE1 ...` - put values (4-byte values) to main memory from START address.
* `setmemaddr VALUE ....` - set memory address - content is 4-byte value list.
* `settempbuf VALUE ....` - set memory address - content is 4-byte value list.
* `revmemaddr` - get rev_memaddr.
* `toggle_revmemaddr` - toggle rev memaddr.
* `width WIDTH` - set terminal width for interactive debugger (for printing).
* `cycles_per_step CYCLES` - set cycles per step.
* `exit` - exits from debugger.
* `help` - prints help.
More informations about debugger commands in debugger help.