Technical information
Serial Solutions Pasterm
entered, is compared with zero. A zero byte indicates an
extended character code, used for the function keys, cursor and
edit keys and ALT key combinations. These are all taken to be
commands, and so the procedure MenuOut is called to deal with
them. All other keys are echoed (if echo to screen has been set),
and then passed on to OutXlat. OutXlat translates the characters
and uses OutStr to send them on to the serial port. Outstr is
examined in the section above.
MenuOut deals with the function keys and the ALT-C key.
It reads the second byte of the extended key code and interprets
it as a request to perform a certain action, calls CmdOut for
help, quit and commands, and SetUp for the setup option.
Cmdout decodes a character string as a command (whether the
string is from the keyboard, a file or a literal in the program
does not matter), calling one of the command execution routines
to do the actual work. SetUp presents the user with a group of
menus to set up the serial port. It gets options from the user and
calls the command execution routines to perform them.
Note the use of the procedure Screen throughout for output
to the screen. This function at this time simply calls Write and
Writeln, but is used so that future versions of Pasterm can easily
use separate windows or a marking scheme to separate the three
type of text that appear on the screen- characters from the serial
port (’Fromport’), echoed characters from the keyboard
(’Fromecho’), and control information from the program
(’Fromctrl’). The second parameter of Screen flags this. Figure
9-7 contains examples of this.
Figure 9-7. Screen Output Examples.________________________________
IF { Process normal character}
echos in echo { Echo to screen set}
THEN
Screen(c, Fromecho);
Buffer := InXlat; { Read from port, translate}
IF
Length( Buffer ) > 0
THEN
Screen(Buffer, Fromport); { If any read echo}
Page 150 Chapter 9