Long ago monitors were common and often provided by the microprocessor manufacturers. When I had the urge to use one I looked around on the internet and found nothing smaller than uboot.
I found some code on the Fundamental Code website at http://fundamental-code.com/interp/ that had similar properties but a different focus. In the end I kept the register concept and wrote the rest from scratch.
Instead of using 'strtok' to pick apart the command line I tried 're2c'. It does a good job and adds flexibility without bloat. Unfortunately the documentation is very thin for what appears to be a powerful tool.
There is a lot of documentation built into the code. Check the Doxygen output for details on how it works and how to modify it.
Line Editing
Entering character a long a command perfectly is a pain. aMon buffers it's input and allows backspacing and re-typing over errors.Command History
Working with a command line frequently requires entering the same thing over and over. aMon saves the last three commands and allows using the up and down keys (or ctrl-u and ctrl-d) to recall those commands.Registers
There are currently eight registers named 'a' to 'h' that are available to store numbers and strings. Once registers were available I started looking for better ways to use them. The first idea was to use them to store frequently used constants like memory addresses, to support this I added the $ operator that inserts the value of a register in a command. The next idea was to use registers to store entire commands as strings. For this I added the ! operator that executes a string as a command and inserts the result in a command.Building the Program
The source is available on GitHub at https://github.com/alan-backlund/aMon/tree/master.
Building the code requires:
- re2c - "A tool for writing very fast and very flexible scanners." is available at 'http://re2c.org/'.
- unifdef - "A utility selectively processes conditional C preprocessor #if and #ifdef directives." is available at 'http://dotat.at/prog/unifdef/'.
No comments:
Post a Comment