IC is started from the Unix shell by typing ic
at the prompt.
Some Unix systems (in particular, MIT Athena DECstations) have
an unrelated application named ic
. If this application is
first in the execution path, it will be invoked rather than the IC
compiler. This situation may be remedied by reordering the execution
path to include the path to the IC compiler first, or by using the
program name icc
, which will also invoke IC.
IC can be started with the name (or names) of a C file to compile.
When running and attached to a 6811 system, C expressions, function
calls, and IC commands may be typed at the "C>
" prompt.
All C expressions must be ended with a semicolon. For example, to
evaluate the arithmetic expression 1 + 2
, type the following:
C> 1 + 2;
When this expression is typed, it is compiled by the console computer and then downloaded to the 6811 system for evaluation. The 6811 then evaluates the compiled form and returns the result, which is printed on the console computer's screen.
To evaluate a series of expressions, create a C block by beginning with an
open curly brace { and ending with a close curly brace
}. The following example creates a local variable i
and
prints 10 (the sum of i + 7
) to the 6811's LCD screen:
C>{int i=3; printf("%d", i+7);}
IC responds to the following commands:
load filename
load filename
compiles and
loads the named file. The board must be attached for this to work. IC
looks first in the local directory and then in the IC library path for
files.
Several files may be loaded into IC at once, allowing programs to be
defined in multiple files.
unload filename
unload filename
unloads
the named file, and re-downloads remaining files.
list files
list files
displays the names of all files presently
loaded into IC.
list globals
list globals
displays the names of all currently
defined global variables.
list functions
list functions
displays the names of presently
defined C functions.
list defines
list defines
displays the names and values of all
currently defined preprocessor macros.
kill_all
kill_all
kills all
currently running processes.
ps
ps
prints the status
of currently running processes.
help
help
displays a help screen of IC
commands.
quit
quit
exits IC. ^c can
also be used.
IC has a built-in line editor and command history, allowing editing and re-use of previously typed statements and commands. The mnemonics for these functions are based on standard Emacs control key assignments.
To scan forward and backward in the command history, type ^p or uparrow for backward, and ^N or downarrow for forward.
An earlier line in the command history can be retrieved by typing the
exclamation point followed by the first few characters of the line to
retrieve, and then the space bar. For example, if you had previously
typed the command C> load foo.c
, then typing C>!lo
followed by a space would retrieve the line C> load foo
.
The following are the keystroke mappings understood by IC.
Keystroke | Function |
---|---|
del | backward-delete-char
|
ctrl-A | beginning-of-line
|
ctrl-b | backward-char
|
leftarrow | backward-char
|
ctrl-d | delete-char
|
ctrl-e | end-of-line
|
ctrl-f | forward-char
|
rightarrow | forward-char
|
ctrl-k | kill-line
|
ESC-d | kill-word
|
ESC-DEL | backward-kill-word
|
uparrow, ctrl-p | history-last
|
downarrow, ctrl-n | history-next
|
IC does parenthesis-balance-highlighting as expressions are typed.
After functions have been downloaded to the board, they can be invoked
from the IC prompt. If one of the functions is named main()
,
it will automatically be run when the board is reset.
To reset the board without running the main()
function
(for instance, when hooking the board back to the computer), hold down
the board's ESCAPE button while pressing reset. The board
will reset without running main()
.