A Look At The Sample Program - HP H8/3003 User Manual

Emulator terminal interface
Table of Contents

Advertisement

A Look at the
Sample Program
The sample program "COMMAND_READER" used in this chapter is
shown figure 2-1. The program emulates a primitive command
interpreter.
Data Declarations
Msg_A, Msg_B and Msg_I are the messages used by the program to
respond to various command inputs.
Initialization
The locations of stack and input area(Cmd_Input) are moved into
address registers for use by the program. Next, the CLEAR routine
clears the command byte(the first location pointed to by Cmd_Input -
0ff800 hex). Cmd_Input contains 00 hex for late use.
Scan
This routine continuously reads the byte at location of Cmd_Input until
it is something other than a null character (00 hex); when this occurs,
the Exe_Cmd routine is executed.
Exe_Cmd
Compares the input byte (now something other than a null) to the
possible command bytes of "A" (ASCII 41 hex) and "B" (ASCII 42
hex), then jumps to the appropriate set up routine for the command
message. If the input byte does not match either of these values, a
branch to a set up routine for an error message is executed.
Cmd_A, Cmd_B, Cmd_I
These routines set up the proper parameters for writing the output
message: the number of bytes in the message is moved to the R3L
register and the base address of the message in the data area is moved
to address register ER4.
Getting Started 2-3

Advertisement

Table of Contents
loading

Table of Contents