RVController Built-in Monitor
=============================

RVController contains a built-in machine-code monitor accessible by connecting a keyboard
on channel "monitorkb" and a display on channel "monitordisp".

For best results, use the keyboard and CRT ("cathodic") monitor from the digiterms mod:
https://content.luanti.org/packages/mt-mods/digiterms/

After connecting these devices and programming the Luacontroller, the following should be displayed:

+--------------------+
|Reset: Cold         |
|                    |
|RVController Monitor|
|                    |
|Type 'help' for help|
|Ready               |
+--------------------+

Once you see this display, the monitor is ready to accept commands. The valid commands are:

peek <address>
Reads and displays the byte (8 bits) value from RAM at the specified address

poke <address> <data>
Writes the specified byte (8 bits) value to RAM at the specified address

peekw <address>
Reads and displays the word (32 bits) value from RAM starting at the specified address

pokew <address> <data>
Writes the specified word (32 bits) value to RAM starting at the specified address

getreg <register number or name>
Displays the current value of the specified register number (0-31)

setreg <register number or name> <value>
Sets the specified register (0-31) to the specified value

getpc
Displays the current value of the program counter

setpc <value>
Sets the program counter to the specified value

reset
Stops the CPU, resets all registers to zero, and clears all RAM

step
Allows the CPU to run for one instruction, then halts

run
Allows the CPU to run indefinitely

stop
Halts the CPU

setbreak <address>
Sets a breakpoint on the specified address.
Note that the breakpoint triggers just *before* the instruction fetch,
as in the instruction with the breakpoint on it will not have executed yet.
There can only be one breakpoint at a time. If one is already set, the new one will replace it.

clearbreak
Clears any set breakpoint. Note that an ebreak instruction will still cause a break.

help [command]
Shows information on a monitor command, or a list of commands if none is specified.
Use 'help 2' to see the second page

rdcsr <CSR address or name>
Displays the contents of the specified CSR

wrcsr <CSR address or name> <data>
Writes the specified data to the specified CSR, then reads back and displays the new value.
Note that the new value may not match the written value if any read-only or WARL fields were written to.

endian [big|little]
With no arguments, displays the current endianness.
With the argument "big" or "little", sets the current endianness to big-endian or little-endian respectively.
This can also be viewed or changed using the MBE bit in the mstatush CSR.
