Technical information
Serial Solutions Aterm
Figure 8-7. Aterm Main Program.______________________________
;********************************************************************
;* *
;* Aterm main program. Sets up terminal (possibly using an *
;* external file of commands). Alternately polls keyb’d *
;* and RS-232 port and sends out and displays *
;* respectively any characters received. *
;* *
;********************************************************************
;
start proc far
;
;Initialise segment registers.
mov ax,data
mov ds,ax ;Initialise data segment register
assume ds:data
mov psp,es ;Save location of PSP-used elsewhere
mov es,ax ;Initialise extra segment register
;
assume es:data, ss:stack, cs:code
;
call exec_defaults ;Use terminal definition file
call open_com ;Open serial port
mainloop: ;Main program loop
call sendout ;Get characters/commands from keyboard
call readin ;Get characters from port
jmp short mainloop ;End of main loop
start endp
;
Exec_defaults checks for a command line parameter and
attempts to execute the file of commands to which it refers. If it
cannot find the file, or if no file is specified on the command
line then the file ’TERMDEF.TXT’ is tried. Open_com opens
the serial port, as discussed in the previous section. The program
then enters an infinite loop which alternately calls two
subroutines, switchout and readin.
Readin checks for characters at the serial port, calling the
function inxlat (that is input and translate), which in turn calls
inpstr, discussed in the previous section, and xlt, to translate the
Page 138 Chapter 8