coketerm

coketerm started out as a simple program to read and write data to the serial port. It grew into something that could recognize symbols, upload resources, and interpret response packets. If you need to communicate directly with the controller board (if you're debugging a module, for example), this is the program to use.

Starting up

Simply type coketerm to enter the program. coketerm will look for a symbols.txt file, first in /usr/local/include/coke/ and then in the current directory. This file should be generated with dasm's -s option and define all symbols that you want to use. The assembler shell scripts such as reldasm and kerneldasm automatically take care of generating this file, so you normally don't have to worry about it. If coketerm can't find the file, you don't get to use any symbols.

Sending data

The basic idea behind a term program is simple. You type stuff in, and it is sent over the serial port. You can type in one-byte hex numbers (prefix with nothing or '$') or decimal numbers (prefix with '#'), ASCII strings (surround with double-quotes), or command symbols. Command symbols begin with CMD_ or EGFX_, although you don't actually type in the prefix. If the symbol contains an underscore, a STARTCMD character is sent first. Symbols are case-insensitive. Stuff can be on multiple lines, or on the same line separated with spaces. An example:

Gfx_ScrollCString "Hi!" 0

would send these characters: STARTCMD CMD_Gfx_ScrollCString 'H' 'i' '!' $00

Another example:

Egfx_ScriptInline CursorSet #10 10 Wipe 0

would send these characters: STARTCMD CMD_Egfx_ScriptInline EGFX_CursorSet $0a $10 EGFX_Wipe $00

You can use '!' to repeat the last line you typed, and '*' to send a reset sequence.

Receiving data

Data cannot be received while the terminal is waiting for you to type in a line. Therefore, you can only see responses immediately after you hit the Enter key. Normally this is not a problem because incoming data is usually a response to something you just typed. However, if you are waiting for an asynchronous event, such as a reset or a message, you need to hit Enter periodically to check if it has come in. Yes, I know it's annoying.

coketerm recognizes and parses the allowed response packets. Acks, naks, and resets are presented to you as such, messages and fails will display the message or error string as well as the number (if you have your symbols defined), and query responses will show you a byte value, word value, or text string, depending on the length of the response. If an unrecognized character comes in, coketerm will report it to you as a "response".

Resources

To upload a resource, enter '=' and a filename. The file will uploaded (cokedasm takes care of the checksum for you), and the resource ID will be reported as a query response. To upload a code module, enter '>' and the filename. The code will be uploaded as a resource and the relocation table will be uploaded with Coke_InitCodeResource.

Source

Source code for coketerm is on rutabaga somewhere.