![RCA CDPl8S693 Скачать руководство пользователя страница 13](http://html.mh-extra.com/html/rca/cdpl8s693/cdpl8s693_user-manual_334504013.webp)
1 2 ____ User Manual for Microboard Computer Development System CDP18S693 & CDP18S694
order to output a string of variable data characters
following a READ, given the timing restriction
mentioned earlier, it is most logical to call TYPED or
TYPE5D first, using an immediate “punctuation” byte
(i.e., non-data such as space, null, etc.) to get the
required initial delay and to follow either with repeated
calls on TYPE (with the output variable data
characters picked up from RF.l) or repeated calls on
TYPE5 using im m ediate data ch aracters. This
procedure permits a maximum output character rate.
Another routine,
OSTRNG,
can be used to output a
string of characters. OSTRNG picks up the character
string pointed to by R6 and tests each character for
zero. The characters should be already encoded in
ASClE If a zero is found (ASCII 'nulE), the program
terminates and returns control to the user via a SEP
R5. If the character is not a zero, it is typed out to the
terminal. The OSTRNG routine uses TYPED so that
it may be called at any time - even following a read.
Tables I and II summarize the functions and calling
sequences just described.
Examples of UT62 Usage
The following examples should help clarify how to
use the UT62 read and type subroutines. Most
examples use the standard subroutine linkage which
requires that R2 point at a free RAM location.
READ Routines
This sample program will read A SC II-hex
characters into register RD translating them from
ASCII to hex in the process. Reading will terminate
when a carriage return is entered. Entry of a non-hex
digit other than a carriage return will cause a branch to
an error program. This sample program as called by
use of the standard subroutine call and return linkage.
(# indicates hexadecimal notation)
READAH = #8l3B
LOOP: SEP R4; ,A (READAH) . .Call the hex
. .read program
BDF LOOP . .As long as ASCII hex
. .digits are entered
. .Read and shift in
. .Fall through if not hex
. .character
GHI RF
. .See what character was last
. .entered
XRI #0D
. .What is carriage return
BNZ ER R O R ..If not, BR to error
. .Characters entered are now
..in RD
The READ routine (at 8 l3E) could be used similarly
to enter characters; however, READ only enters them
one at a time into RF.l (and D) writing over the
previous entry. Note that, even though incoming data
is entered into D, the subroutine return program alters
D. Therefore, valid data will only be found in RF.l
(and RD when READAH is used) if the standard
subroutine call and return programs are used. An
alternative technique is to use R5 as the main program
counter (because all read and type routines terminate
with a SEP R5) and call the program with a SEP R3
(because all read and type routines use R3 as their
program counter). Example l below under TYPE
Routines illustrates this technique.
TYPE Routines
Three examples using the various type routines
follow.
Example 1:
This program outputs a single character
using the TYPE5 routine. It uses R5 as the program
counter.
LDI#81
. .Set R3 to TYPE5 routine
PHI R3
LDI#A0
PLO R3
LDI #FF . .Set R2 to free RAM location#3FFF
PLO R2
LDI #3 F
PHI R2
SEP R3
. .Call type
,T’R ’
. .An “R ” will be typed
yy
. .Next instruction
The TYPE5D routine is used in the same way.
Example 2:
This program outputs a character using
the TYPE6 routine. Note that R6 should be the
program counter for the program calling TYPE6 if the
character to be typed is an immediate byte because
TYPE6 must always be from M(R6). But, because
TYPE6 exits with SEP 5, TYPE6 must always be
called using standard subroutine linkage for typing an
immediate byte. An alternative is to use R5 as the main
program counter but point R6 at the memory location
containing the byte to be typed. This example uses
standard subroutine linkage.
SEP R4 . .Branch to call routine
,#81A2
. .Address of TYPE6
,T T
. .Byte to be typed out
yy
. .next instruction
Example 3:
The TYPE and TYPE2 routines pick up
the byte inRF.l for typing. TYPE simply outputs the
character, whereas TYPE2 considers RF. 1 a hex digit
pair which it encodes in ASCII before typing. This
example types out the hex digits ‘D5\ and uses
standard subroutine linkage.
LDI #D5 . .Load hex digits D5
PHI RF ..Into RF.l
SEP 4
. .Call TYPE2
,#81AE
yy
. .Next instruction
The TYPED routine is used the same way.
Note that all type routines, except TYPE2, expect
the character they pick up to be already encoded in
ASCII.