1990_Intel_Embedded_Applications_Handbook 1990 Intel Embedded Applications Handbook
User Manual: 1990_Intel_Embedded_Applications_Handbook
Open the PDF directly: View PDF .
Page Count: 1380
-
Intel the Microcomputer Company:
When Intel invented the microcomputer in 1971, it created the era of microcomputers. Whether
used in embedded applications such as automobifes or microwave ovens, or as the CPU in
personal computers or supercomputers, Intel's microcomputers have always offered leading-edge
technology. Intel continues to strive for the highest standards in memory, microcomputer
components, modules and systems to give its customers the best possible competitive advantages.
EMBEDDED APPLICATIONS
HANDBOOK
1990
-
Intel Corporation makes no warranty for the use of its products and assumes no responsibility for any errors which may
appear In this document nor does it make a commitment to update the information contained herein.
Intel retains the right to make changes to these specifications at any time, without notice.
Contact your local sales office to obtain the laiest specifications before placing your order.
The following are trademarks of Intel Corporation and may only be used to identify Intel pro~ucts:
376, 386, 387,486, 4-SITE, Above, ACE51, ACE96, ACE186, ACE196, ACE960,
BITBUS, COMMputer, CREDIT, Data Pipeline, DVI, ETOX, FaxBACK, Genius, i, t,
i486, i750, i860, ICE, iCEL, ICEVIEW, iCS, iDBP, iDIS, 12 1CE, iLBX, iMDDX, iMMX,
Inboard, h;site, Intel, intel, Intel386, intelBOS, Intel Certified, Intelevision, in!aligent
Identifier, inteligent Programming, Intellec, Intellink, iOSP, iPAT, iPDS, iPSC, iRMK,
iRMX, iSBC, iSBX, iSDM, iSXM, Ubrary Manager, MAPNET, MCS, Megachassis,
MICROMAINFRAME, MULTI BUS, MULTICHANNEL, MULTIMODULE, MultiSERVER,
ONCE, OpenNET, OTP, PR0750, PROMPT, Promware, QUEST, QueX, Quick-Erase,
Quick-Pulse Programming, Ripplemode, RMx/80, RUPI, Seamless, SLD,
SugarCube, ToolTALK, UPI, Visual Edge, VLSiCEL, and ZapCode, and the combination of ICE, iCS, iRMX, iSBC, iSBX, iSXM, MCS, or UPI and a numerical suffix.
MDS is an ordering code only and is not used as a product name or trademark. MDS® is a registered trademark of Mohawk
Data Sciences Corporation.
MULTI BUS is a patented Intel bus.
CHMOS and HMOS are patented processes of Intel Corp.
Intel Corporation and Intel's FASTPATH are not affiliated with Kinetics, a division of Excelan, Inc. or its FASTPATH trademark or products.
Additional copies of this manual or other Intel literature may be obtained from:
Intel Corporation
Literature Sales
P.O. Box 7641
Mt. Prospect, IL 60056-7641
©INTEL CORPORATION 1989
CG·l01789
.,..
CUSTOMER SUPPORT
INTEL'S COMPLETE SUPPORT SOLUTION WORLDWIDE
Customer Support is Intel's complete support serVice that provides Intel customers with hardware support,
software support, customer trainin(l, consulting services and network management services. For detailed information contact your local sales offIces.
After a customer purchases any system hardware or software product, service and support become major
factors in determining whether that product will continue to meet a customer's expectations. Such support
requires an international support organization and a breadth of programs to meet a variety of customer needs.
As you might expect, Intel's customer support is quite extensive. It can start with assistance during your
development effort to network management. 100 Intel sales and service offices are located worldwide-in the
U.S., Canada, Europe and the Far East. So wherever you're using Intel technology, our professional staff is
within close reach.
HARDWARE SUPPORT SERVICES
Intel's hardware maintenance service, starting with complete on-site installation will boost your productivity
from the start and keep you running at maximum efficiency. Support for system or board level products can be
tailored to match your needs, from complete on-site repair and maintenance support to economical carry-in or
mail-in factory service.
Intel can provide support service for not only Intel systems and emulators, but also support for equipment in
your development lab or provide service on your product to your end-user/customer.
SOFIWARE SUPPORT SERVICES
Software products are supported by our Technical Information Service (TIPS) that has a special toll free
number to provide you with direct, ready information on known, documented problems and deficiencies, as
well as work-arounds, patches and other solutions.
Intel's software support consists of two levels of contracts. Standard support includes TIPS (Technical Information Phone Service), updates and subscription service (product-specific troubleshootmg guides and;
COMMENTS Magazine). Basic support consists of updates and the subscription service. Contracts are sold in
environments,which represent product groupings (e.g., iRMX® environment).
CONSULTING SERVICES
Intel provides field system engineering consulting services for any phase of your development or application
effort. You can use our system engineers in a variety of ways ranging from assistance in using a new product,
developing an application, personalizing training and customizing an Intel product to providing technical and
management consulting. Systems Engineers are well yersed in technical' areas such as microcommunications,
real-time applications, embedded microcontrollers, and network services. You know your application needs;
we know our products. Working together we can help you get a successful product to market in the least
possible time.
CUSTOMER TRAINING
Intel offers a wide range of instructional programs covering various aspects of system design and implementation. InJ·ust three to ten days a limited number of individuals learn more in a single workshop than in weeks of
self-stu y. For optimum convenience; workshops are scheduled regularly at Training Centers worldwide or we
can take our workshops to you for on-site instruction. Covering a wide variety of topics, Intel's major course
categories include: architecture and assembly language, programming and operating systems, BITBUS and
LAN applications.
TN
NETWORK. MANAGEMENT SERVICES
Today's networking products are powerful and extremely flexible. The return they can provide on your investment via increased productivity and reduced costs can be very substantial.
Intel offers complete network support, from definition of your network's physical and functional design, to
implementation, installation and maintenance. Whether installing your first network or adding to an existing
one, Intel's Networking Specialists can optimize network performance for you.
CG/CUSTSUPP/100389
-
-.
Table of Contents
MCS®-48 FAMILY
Chapter 1
MCS®-48 APPLICATION NOTES
AP-24
AP-40
AP-49
AP-55A
AP-91
Application Techniques for the MCS®-48 Family.. .... ...... ....... .... ...... ...... ... ....
Keyboard/Display Scanning with Intel's MCS®-48 Microcomputers. .... .........
Serial I/O and Math Utilities for the 8049 Microcomputer .... ........................
A High-Speed Emulatorforthe Intel MCS®-48 Microcomputers ...................
Using the 8049 as an 80 Column Printer Controller .. ...... ....... ..... ..... .... ... ... ...
1-1
1-25
1-50
1-73
1-173
MCS®-S1 FAMILY
Chapter 2
MCS®-S1 APPLICATION NOTES & ARTICLE REilRINTS
AP-69
AP-70
AP-223
AB-38
AB-39
AB-40
AB-12
AP-252
AP-410
AB-41
AP-415
AP-425
AP-429
An Introduction to the Intel MCS®-51 Single-Chip Microcomputer ....... ..........
Using the Intel MCS®-51 Boolean Processing Capabilities ...........................
8051 Based CRT Terminal Controller ........................... :..............................
Interfacing the 82786 Graphic Coprocessor to the 8051 ...............................
Interfacing the Densitron LCD to the 8051 .............................. ,....................
32-Bit Math Routines for the 8051 ...............................................................
Designing a Mailbox Memory for Two 80C31 Microcontrollers Using EPLDs
Designing with the 80C51 BH .......................................................................
Enhanced Serial Port on the 83C51 FA .............. ;.........................................
Software Serial Port Implemented with the PCA ..... ... ....... ..... ... ..... ....... .......
83C51 FAlFB PCA Cookbook ......................................................... :............
Small DC Motor Control . ... .............. ... .......... ..... ... ............ ... ... ....... ...... ... .....
Application Techniques for the 83C 152 Global Serial Channel in.
CSMAlCD Mode .. ... ....... ... .... ...... ....... ............ ....... ....... ................. .... ..... .....
AR-517 Using the 8051 Microcontrollerwith ResonantTransducers .........................
AR-526 Analog/Digital Processing with Microcontrollers .... :......................................
Chapter 3
.
2-1
2-31
2-76
2-153
2-159
2-166
2-175
2-189
2-213
2-221'
2-244
2-287
2-301
2-369
2-374
.
ASIC FAMILY APPLICATION NOTE & ARTICLE REPRINT
AP-413 Using Intel's ASIC Core Cell to Expand the Capabilities of an 80C51
Based System ........................... :... .... ..... .... ..... ... .......... ..... ....... ... ..... ...........
AR-537 A Fast-Turnaround, Easily Testable ASIC Chip for Serial Bus Control..........
3-1
3-11
THE RUPITM FAMILY
Chapter 4
RUPITM APPLICATION NOTES
AP-281 UPI-452 Accelerates 80286 Bus Perlormance .............................................
AP-283 RUPITM/Flexibility in Frame Size with the 8044 ................................:...........
80186/80188 FAMILY
ChapterS
80186/188 APPLICATION NOTES
AP-186
AP-258
AP-286
AB-36
AB-37
AB-31
AB-35
4-1
4-21
.
Using the 80186/188/C186/C188 Microprocessor ........................................
High Speed Numerics with the 80186/80188 and 8087 ................................
80186/188 Interface to Intel Microcontrollers ...............................................
80186/80188 DMA Latency ................. ,.......................................................
80186/80188 EFI Drive and Oscillator Operation .. ........ ..... ...... ....................
The 80C186/80C188 Integrated Refresh Control Unit ..................................
DRAM Refresh/Control with the 80186/188 '" ..... ..... ..... ...............................
vii
5-1
5-83
'5-99
5-129
5-132
5-134
5-147
.
Table of Contents (Continued)
MCS®-96 FAMILY
Chapters
MCS®-96 APPLICATION NOTES & ARTICLE REPRINT
AP-248 Using the 8096 ... ;.,......................................................................................
AP-275 An FFT Algorithm with the MCS®-96 Products
.
Including Supporting Routines and Examples ........ .................... ...... ............
AB-32 Upgrade Path from 8096-90 to 8096BH to 80C196 ................ ~.....................
AB-33 Memory Expansion for the 8096 ............ ........ ............. ............ ........ .............
AB-34 Integer Square Root Routjne for the 8096 ........... :................................. ;......
AP-406 MCS®-96 Analog Acquisition Primer .... .................... ............ ...... ..................
AP-428 Distributed Motor Control Using the 80C 196KB ...........................................
AR-515 A Single-Chip Image Processor .......... :........................................................
Chapter 7
MCS®-96 Diagnostic Library ............................................................ .................. .......
Chapter 8
6-1
6-103
6-178
6-181
6-193
6-197
6-296
6-325
7-1
80960 ARTICLE REPRINTS
AB-42 80960KX Self-Test ...............................................:......................................
AR-541 Intel's 80960: An Architecture Optimized for Embedded Control ................ ,..
AR-551 Embedded Controllers Push Printer Performance ............................ ,...........
AR-557 A Programmer's View of the 80960 Architecture .................... ........ ...... ........
8-1
8-4
8-18
8-24
GENERAL MICROCONTROLLER
Chapter 9
APPLICATION NOTES
AP-125
AP-155
AP-318
AP-315
Designing Microcontroller Systems for Electrically N9isy Environments .......
Oscillators for Microcontrollers ..... :...............................................................
Intel's 87C75PF Port Expander Reduces System Size & Design Time .........
Latched EPROMs Simplify Microcontroller Designs .....................................
viii
9-1
9-23
9-55
9-80
-
MCS®-48 Application Notes
1
-
_
v
.inter
AP-24
APPLICATION
NOTE
.
© Intel Corporation, 1977
February 1977
98413A
1-1
AP-24
INTRODUCTION
The INTEL ® MCS-48™ family consists of a series
of seven parts, including three processors, which take
advantage of the latest advances in silicon technology to provide the system designer with an effective solution to a wide variety of design problems.
The significant contribution of the MCS-48 family
is that instead of consisting of integrated microcomputer components it consists of integrated
microcomputer systems. A single integrated circuit
contains the processor, RAM, ROM (or PROM), a
timer, and I/O.
This application note suggests a variety of application techniques which are useful with the MCS-48.
Rather than presenting the design of a complete
system it describes the implementation of "subsystems" which are common to many micropro-
cessor based systems. The subsystems described are
analog input and output, the use of tables for
function evaluation, receiving serial code, transmitting serial code, and parity generation. After an
overview of the MCS-48 family these areas are discussed in a more or less independent manner.
THE MCS-48™ FAMILY
The processors in the MCS-48 family all share an
identical architecture. The only significant difference is the type of on board program storage which
is provided. The 8748 (see Figure I) includes 1024
bytes of erasable, programmable, ROM (EPROM),
the 8048 replaces the EPROM with an equivalent
amount of mask programmed ROM, nd the 8035
provides the CPU function with no on board
program storage. All three of these processors
VOO
~PAOGRAMSUPPLY
POWER
SUPPLY
{
~
V
+5V (LOW POWER
STANDBYI
~GND
--
TEST 0
TEST 1
REGISTER
REGISTER
-
,NT
-,.-FLAG
a
TIMER FLAG
;>
3
REGISTER
4
REGISTER
5
REGISTER
6
REGISTER
7
8lEVEL STACK
(VARIABLE LENGTHI
OPTIONAL SECOND
REGISTER BANK
DATA STORE
REStDENT
RAM ARRAY
64 ~ 8
PROM
EXPANDER
CPU
MEMORY
STROBE
SEPARATE
MCS4s™ Internal Structure
1-2
AP-24
INSTRUCTION SET
S
~
:;
E
11
~
~
'5
~
~
g
~
c.
E
~
la:=
Bytes
Mnemonic
Description
ADD A.R
ADD A.@R
ADD A. =data
ADDC A. R
ADDC A.@R
ADDC A. =data
ANL A. R
ANL A.@R
ANL A. =data
DRL A. R
DRL A.@R
ORL A. =data
XRL A. R
XRL A.@R
XRL A, =data
INCA
DEC A
CLR A
CPL A
DAA
SWAP A
RL A
RLC A
RR A
RRCA
Add register to A
Add data memory to A
,,
,,
,
,
2
Add immediate to A
Add register with carry
Add data memory with carry
Add immediate with carry
And register· to A
And data memory to A
And immediate to A
Or register to A
Or data memory to A
Or immediate to A
Exclusive Or register to A
Exclusive or data memory to A
Exclusive or immediate to A
Increment A
Decrement A
Clear A
Complement A
Decimal Adjust A
Swap nibbles of A
Rotate A left
Rotate A left through carry
Rotate A right
Rotate A right through carry
IN A. P
OUTL p. A
ANL P. =data
ORL P, =data
INS A. BUS
OUTL BUS, A
ANL BUS, =data
OR L BUS, =data
MOVD A, P
MOVD P,A
ANlDP,A
ORlD P. A
And A to Expander port
Or A to Expander port
INC R
INC@R
DEC R
Increment register
Increment data memory
Decrement register
JMP add,
JMPP@A
DJNZ R, addr
JC add,
JNC addr
J Z add,
JNZ add,
JTO add'
JNTO addr
JTl add,
JNTl addr
JFO addr
JF' addr
JTF addr
JNI addr
JBb add,
Jump unconditional
Jump indirect
Decrement register and skip
Jump on Carry:::: 1
Jump an Carry:::: 0
Jump on A Zero
Jump on A not Zero
I nput port to A
Output A to port
And immediate to port
2
,,
,,
2
2
,
,
2
,,
,,
,,
,,
,,
2
2
,,
Or immediate to port
Input BUS to A
Output A to BUS
And immediate to BUS
Or immediate to BUS
Input Expander port to A
Output A to Expander port
Cycle
'S
2
.c
~
2
2
2
2
~
>
,
0
:;
~
,,
,
,
C
,
,
2
2
2
2
2
,,
,,
23c
~
0
,tJ
"';::
=
E
i=
,
, g
,
2
2
2
2
2
2
c
.c
~
c
~
III
Jump on TO
Jump on TO
=,
=0
Jump on T1 = 1
Jump on T'
Jump on FO
=0
=,
Jump on Fl = 1
Jump on timer flag
Jump on
iNT = 0
Jump on Accumulator Bit
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
Mnemonic
Description
CALL
RET
RETR
Jump to subroutine
Return
CLR C
CPL C
CLR FO
CPL FO
CLR F'
CPL F'
Clear Carry
Bytes
0
tJ
MDV A. R
MOV A.@R
MDV A. =dat~
MOV R, A
MDV@R,A
MOV R. =data
MOV@R, =data
MDV A, PSW
MDV PSW, A
XCH A, R
XCH A,@R
XCHD A,@R
MDVX A,@R
MDVX@R,A
MOVPA,@A
MDVP3A,@A
2
2
2
immediate to A
2
A to register
A to data memory
immediate to register
2
immediate to data memory 2
2
Complement Carry
Clear Flag 0
Complement Flag 0
Clear I'Ia9 ,
Complement Flag'
Move register to A
Move data memory to A
Move
Move
Move
Move
Move
Move PSW to A
Move A to PSW
,,,
, ,
, ,
, ,
,, ,,
,, ,,
,
,,
,
,
,,
2
2
,,,
,,
'2
2
2
2
,,
,,
,
,,
,,,
,,
,,
Enable external interrupt
Disable external interrupt
Select register bank 0
Select register bank 1
Select memory bank 0
Select memory bank 1
Enable Clock output on TO
,
,
,
,
,
,,
,,
,,,
,,
No Operation
,
,
Read Timer/Counter
Load Timer/Counter
Start Timer
Start Counter
Stop Timer/Counter
Enable Timer/Counter 'Interrupt
Disable Timer/Counter Interrupt
EN I
DIS I
SEL RBO
SEL RB'
SEL MBO
SEL MB'
ENTO CLK
NOP
2
2
Mnemonics copyright Intel Corporation 1976
1-3
,,
,
,
MOV A, T
MOV T,A
STRTT
STRT CNT
STDP TCNT
EN TCNTI
DIS TCNTI
Figure 2. 8048/8748/8035 Instruction Set
2
Exchange A and register
Exchange A and data memory
Exchange nibble of A and register 1
Move external data memory to A
Move A to external data memory
Move to A from current page
Move to A from Page 3
2
2
2,
2
2
2
2
2
Cycles
,
,
Return and restore status
III
,,,
2
2
~
e
,,
,, u::~
,,
,,
,,, .
2
2
2
2
2
2
2
,
.
,,
AP-24
operate from a single 5-volt power supply. The
8748 requires an additional 25-volt supply only
while the on board EPROM is.being programmed.
When installed in a system only' the 5-volt supply is
needed. Aside from program storage, these chips
include 64 bytes of data storage (RAM), an eight
bit timer which can also be used to count external
events, 27 programmable I/O pins and the processor
itself. The processor offers a wide range ofinstruction capability including many designed for bit,
nibble, and byte manipulation. The instruction set
is summarized in Figure 2.
Aside from the processors, the MCS48 family
includes 4 devices: one pure I/O device and 3 combination memory and I/O devices. The pure I/O
device is the 8243, a device which is connected to a
special 4 bit bus provided by the MCS48 processors
and which provides 16 I/O pins which can be programmatically controlled.
The combination memory and I/O devices consist
of the 8355, the 8755, and the 8155. The 8355
and the 8755 both provide 2,048 bytes of program
storage and two eight bit data ports. The only
difference between these devices is that the 8355
contains masked program ROM and the 8755 contains EPROM. The 8155 combines 256 bytes of
data storage (RAM), two eight bit data ports, a six
bit control port, and a 14 bit programmable timer.
[ ) Number of Available Timers
( ) Number of Available I/O Lines
1088
lK I8035
8048
8035
8355
8048
8355
2-8355
4·8155
4·8155
4-8155
4-8155
(101) [5)
(116) [5J
[5J
(116) [5J
(131)
832
768 r-'
8035
8048
8035
8355
8048
8355
2-8355
3-8155
,3·8155
3-8155
3·8155
(4)
(80) (4)
(95) (4)
(95) [4J
(110)
r8048
2-8155
[3)
(59)
8035
8048
8035
8355
8355
2·8355
2-8155
2-8155
2-8155
(3)
(74) (3)
(74) [3J
(89)
f8035
8048
8035
8048
8355
8355
2·8355
8155
8155
8155
8155
(38) (2)
(53) [2J
[2J
(53) [2J
(68)
64
8035
8048
8035
8048
8355
8355
2·8355
(1)
(24) [lL
(28) [lJ
(28) [lJ
(43)
lK
2K
3K
4K
PROGRAM MEMORY (ROM)
Figure 3 shows the various system configurations
which can be achieved using the MCS48 family of
parts. It should also be noted that eight of the processors' I/O lines have been configured as a bidirectional bus which can be used to interface to standard Intel peripheral parts such as the 8251 USART
(for serial I/O), the 8255A PPI (provides 24 I/O
lines) and the complete range of memory compo·nents.
. More detailed information concerning the MCS48·
family can be obtained from the "MCS48 Microcomputer User's Manual" which provides a complete description of the MCS48 family and its
.members. A general familiarity with this document
will make the application techniques which follow
easier to understand.
Figure 3. The Expanded MCS48 TM System
specifically designed to interface with microprocessors_
A block diagram oftheMP-IO is shown in Figure 4.
It consists of two eight bit digital to analog conver-
ters, two eight bit latches which are loaded from
the data bus, and address decoding logic to determine when the latches should be loaded. The 0/ A
converters each generate an analog output in the
range of 10 volts with an output impedance of In.
Accuracy is ±0.4% of full scale and the output is
stable 25~sec after the eight bit binary data is
loaded into the appropriate latch. The latches are
loaded by the write pulse (WR) whenever the
proper address is presented to the MP-IO. The
lower two addresses (AO and AI) are used internally by the device. Addresses A2 & A3 are compared with the address determination inputs B2
and B3. If their signals are found to be equal, and
if addresses A4-A 13 are all high, then the device
is selected and one of the latches will be loaded.
Address bit Al selects between output I and output 2. If address bit AO is set then the initialization channel of the DIA is selected. In order to
prepare for operation a data pattern of 80H must
ANALOG I/O
If analog I/O is required for a MCS48™ system
there are many alternatives available from the
makers of analog I/O modules. By searching through
their catalogs it is possible to find almost any combination of features which is technically feasible. Perhaps the best example of such modules are the MP10 and MP-20 hybrid modules recently introduced
by Burr-Brown Research Corporation. The MP-IO
provides two analog outputs and the MP-20 provides 16 analog inputs. Both of these units were
1-4,
AP-24
A,A,A,
.,.,
ADDRESS
LOGIC
AO
With no Rext (Rext = 00) thl! gain is two and the
input is 0-5 or ±5 volts full scale. Adding an I!xternal resistor results in higher gain so that low level
(±50mV) signals from thermocouples and strain
gauges can be accommodated. The output from
the amplifier is applied to the actual A/D converter which provides an eight bit output with
guaranteed monotonicity and an accuracy of ±0.4~
of full scale. Note that this accuracy is specitied
for the entire module, not just for the converter
itself. The control logic monitors address lines
A 15 through A4 to determine when the address of
the unit has been selected. An address that the unit
will respond to is determined by II address control
pins, labeled A4 through A 14. If one of these pins
is tied to a logic 0 then the corresponding address
pin must be high in order for the unit to be selected.
If the pin is tied to a logic I then the corresponding
address pin must be low. If the address of the
module is selected when MEMR pulse occurs, the
lower four addresses (A3-AO) are stored in a latch
which addresses the multiplexer. The coincidence
of the proper address and MEMR also initiates a
conversion and gates the output of the converter
on to the eight bit data bus.
w"R---Q
LOAD 2
DB 70'
REG 1
A'G'~
,
OA
ANALOG OUT
DA
ANALOG OUT
,
Figure 4. Mp·10 Block Diagram
be output to this channel folJowing the reset of the
device.
A block diagram of the MP-20 analog to digital
converter is shown in figure 5. This unit consists
of a 16 input analog multiplexer, an instrumentation amplifier, an eight bit successive approximation analog to digital converter, and control logic.
~he 16 inp~t multiplexer can be used to input
eIther 16 smgle ended or 8 differential inputs.
The output from the mUltiplexer is fed into the
instrumentation amplifier which is configured so
that it can easily be strapped for single ended 0-5
volt inputs, single ended ±5 volt inputs, or differential 0-5 volt signals. Provisions are made for an
external gain control resistor on the amplifier. The
gain control equation is:
The control logic of the MP-20 was designed to
operate directly with an MCS-80™ system. When a
MEMR occurs and a conversion is initiated the MP20 generates a READY signal which is used to
extend the cycle of the 8080A for the duration of
the conversion. READY is brought high after the
conversion is complete which allows the 8080A
to initiate a conversion and read the resulting data
in a single, albeit long, memory or I/O cycle. The
conversion time of the MP-20 depends on the gain
selected for the amplifier. With no external resistor
(R = 00) the gain is two and the conversion time is
35 Jlsec. For R = 5 IOn the gain is:
G = 2 + 50kn
Rext
EXTERNAL
GAIN CONTROL
A,.
A"
A15
G=2+ 50kn
.51kn -
RESISTER
100
A"
A"
A,O
A 9
A 8
A 7
A 6
A 5
and the conversion time becomes 100Jlsec. These
settling times are specified in the MP-20 data sheet
and range from 35 to 175 microseconds. The
READY timing is controlled by an external capacitor. For a gain of 2 no external capacitor is
required but if higher gains are selected a capacitor
is needed to extend .the timing.
A.
A,
A 2
A ,
A 0
A schematic showing both the MP-IO D/A and the
MP-20 A/D connected to the 8748 is shown in
Figure 6. This configuration, which consists of
only four major components, gives an excellent
example of what modern technology can do for
Figure 5. MP·20 Analog Subsystem
1-5
inter
AP-24
IK
-5V
I~ l:>llt;: l:gJ::d~ I:s: li;l I!: I~
~.J'J>~t!-!tlt
~
~r----!I'
Ai2 1!..
Ail ~
1L
..
A;O
'I~
••
~
lKH
·.V
~
cit
?OpF
ffi
XTAl2
cit
••
B
59
5B
57
~
~
~
~
~
TO
56
'55
T,
iNT
----E.
-----'!
"
'0
Mes 48"~
'B
,
,•
P"
p,.
~
P"
ALE
PROG
P"
"
r!L-
"
-a
~
~
StN/DIFF
IN,
MfM'R
IN6
DO
0,
IN,
0;
IN,
03
0,
IN,
~'
.
~l~ ~
06
-i
,
006
,~
01 3
01,
DO,
01,
DO,
DO,
15
14
4
9602
12
9'
~
»
I,,7l
17
•
6
4
~
~
~
tj ~ ~
~
06
OUT 1
05
D.
MP 10
0,
Do
OUT.2
~~J';gl;tt
,
.
MCS-48™ Based Analo9 Processor
1-6
1161
,!,-
,.
-
-
9602
~
ANA LOG
INPU TS
~ ~
rnJ'l",.!"J"l'J"
_
611
5
~
BS1
fJ~
£,., ~1a8~""
2.
~
OS>
RESET
1
~-
DO.
10
8212
DO,
0,
PSeN
Vss
EA
DO,
,
• 0,
VDD
SS
l>
"'"
~
a ~~
DO
~D7
,
):0
W
~l!l
[" ,
01 6
P"
Vee
):>
t.J
~
72
R
DIB
01,
01 5
01,
_
~
~
~
~
INO
0,
~
~
+0-
IN,
~'
~ PIO
5
IN9
INB
1>
P'17
P"
"
Qur LO
MUX ENAB2
MD
P"
P21
----2!.
---22
.
1N1O
lKH
e
'SV
INn
.5V
'6
----'.[
IA IN HI
MUX OUT HI
P"
~ P,o
~
~
--------B
IN 3
'
INT?
P"
P2S
~ P,.
----1!
IN'4
Mp·20
lAIN LO
05
54
~
P"
~
IN.
60
--1
IN , S
MUX
15
Rli
..
BPO
IA OUT
II~
-:f-f~ol1,~
, XTALI
CQMPIN
R'
6B
6 MHz
"
,.
JI
-"'-
As 1.!..As ~
OBIN
OUTPUT SELECT
65
20pF
Ajj
A,
'1·2
".I
CD
"l
--.j
"-I
co
I\J
(t)
-
~
~
~
~
0
-
~}
ANAL DG
QUTP UTS
121
~.
'K
-.
AP-24
be written to following a reset to initialize its
internal logic) all channels involve some form of
data transfer.
As was mentioned previously, the MP-:!o was
designed to use the READY line of the 8080A.
Obviously this presents a problem since the MeS48 does not support a READY line (with its
attendant requirement of entering WAIT state).
The necessity of a READY input can be overcome
by performing a read operation to set the channel
address, waiting the required delay (35 J.lsec for a
gain of two) and then performing a second read to
actually obtain the data. The second read will read
in the data from the channel selected by the first
read irrespective of the channel selected for the
second read. Thus it is possible to use the second
read to set up the channel for the third read. Each
read can read in the current channel and select the
next channel for conversion.
The MP-20 is shown in Figure 6 strapped to input
16 single ended ±5 volts signals. Programs which
were used to test this configuration are shown in
Figure 7. The first of these programs uses the D/ A
converter to generate sawtooth waveforms by
outputting an incrementing value to the D/ A
converters. The second program scans the analog
inputs and stores their digital values in a table
located in RAM.
the system designer. The four components provide:
a.
b.
c.
d.
e.
f.
g.
h.
i.
An eight bit microprocessor
64 bytes of RAM
1024 bytes of UV erasable PROM
A timer/event counter
16 digital I/O pins
2 testable input pins
An interrupt capability
16 eight bit analog inputs
2 eight bit analog outputs
The MCS48 communicates with the D/ A and AID
converters in a memory mapped mode (i.e., it treats
the devices as if they were external RAM). By setting an address in either RO or R I and then executing a MOVX the software can transfer data between
the accumulator' and the analog I/O. When the
MCS48 executes the MOVX instruction it first
sends the eight bit address out on the bus and
strobes it into the 82121atch with the ALE (Address
Latch Enable) signal. After the address is latched,
the MCS48 uses the same bus to transfer data to
or from the accumulator. If data is being sent out
(MOVX oRj, A) the WR strobe is used; if the data
is being moved into the accumulator (MOVX A,
oRj) the RD strobe is used. The one shots on the
WR line are used to delay the write strobe of the
MCS48 to meet the data set up specifications of
the MP-IO.
In order to provide reset capability for the analog
devices without dedicating an I/O pin from the
MCS48, special addresses are used as reset channels.
Executing any MOYXwith anaddressofOXXXXXXX
will reset the A/D module; a similar operation with
an address of X I XXXXXX will reset the D/ A; a
MOVX with an address of OIXXXXXX will reset
both devices. All data transfers are accomplished
with the upper two bits of the address field equal
to 10. A summary of the addressing of the analog
devices is shown in Table I. Notice that except for
an initialization channel for the D/A (which must
LaC
OBJ
2: •••.•. -----.-----------------3 ; TEST PROGRAM FOR AHALOG OUTPUT
"':
THIS PROGRAM OUTPUTS A SAWS;
TOOTH WAVEFORM BY C1UTPUTING
6;
AN IHCREM(NTIHG PATTERN.
. UBI
II'.
Reset AID
Reset D/A
INPUT
Read p,ID Channel
.
";
-------
7; -------.-----------.---.------
INPUT OR OUTPUT
nnnn
.
9 ; ------18 ; EQUATES
Table 1. Analog Interface Addresses
001 1
SOURCE STATEf'lEtH
•,
ilIB3
11181
OXXX XXXX
X1XX XXXX
SEQ
12
13 (HITCH
'''' INITDT
15 MTCH'
,.
IB3H
; D/A INITIALIZATION CHANNEL
EGU
BSH
IBIH
: D/A INITIALIZATION DATA
lOlA DATA CHANNEL
EGU
17; ------------19 ; START OF TEST
19 ; ------------21
ORG
l11H
"
Ilill 2391
11112 BBB3
III" 91
22 START:
23
24
2S
IllS BBBI
B11717
111B 9.
111192415
26 LOOP;
MOV
2.
"
2.
M!lVX
"
(HD
31
nnnn
EGU
/'IOV
MOV
.J!!IlVll
ONe
.....
; IHITIALIZE O/A
A,#IN/TOT
RI,ttIHITCH
@RO,A
I TEST lOOP-OUTPUT SAWTOOTH
RI. ItDATCH
A
@tRI.A
lOOP
; [HO or PROC.RAM
OUTPUT
1 01 1 0001
101 1 0000
101 1 0010
Initialize D/A
Write Channel 1
Write Channel 2
All mnemonics copyrighted © Intel Corporation 1976.
Figure7a. D/A Exercise Program
1-7
inter
LaC
OBJ
AP-24
SEQ
The above calculation, although conceptually
simple, would be time consuming and would
severely limit the possible output frequencies which
could be obtained. As an alternative to calculating
these values in real time, the values could be precalculated off line and stored in a table. Upon each
interrupt the MCS-48 would merely have to retrieve
the appropriate value from the table and output
it to the D/A converter. the MCS-48 provides a
special instruction which can be used to access
data in a table. If'the table is stored in the last 256
bytes of the first kilobyte of MCS-48 memory
then the table lookup can be performed by loading
the independent variable (time in this case) into
the accumulator and executing the instruction .
SOURe[ STATEJI£HT
•,
2
3
-------------------------------. ______ _
T[ST PROGRAM fOR ANAlOG IHPUT
TH"IS PROCiRAf'I SCAMS THE INPUT CHAtttElS
AHD STORtS THE R[ADINGS IN A TAkE
STARTltIG AT IU'f.
---------------------------------------
•
S
•
•
7
9 ; ------I' ; EQUATES
•• 2.
....
,,"5
.lIr
""
;
.------
138JF"f
14 P1AXCH
IS AIHCH
IS TlCIC
EOU
EOU
EOU
EOU
IBIH
i START OF 9JF'f[R
; HO or ANAl.OG I HPUTS
; BAst ADDRESS OF ANALOG INPUTS
S
; EXECUTION TlfIE
2 ••
IS
or
DJN2
"
18 ; -------------
"
..
1,lIlI92f
"'2 IB'f
"'48BBF"
"16 8.
..
..
19 ; START Of TEST
2' ; ------------23 START:
2S
26
27
.
.
20
"17 scla
"19 fet9
"'8 ca
",e 8.
'"0 AI
"IEG
".F SCI..
11il EC1'
1"3 [Bl8
IllS 2"'''
ORG
22
3t
31
32 LOOP:
33
3S
36
37
30
39
......
.....
.,
'"'"
"""
"'"
l11H
J 5[nP TO SCAN ANALOG UtPUTS
Ii 1 • "BlFr .I'IAXCH
R3,tlMAXCH
R,.#(AIHCH.I'!AX(;H)
; SEl.ECT CHAH/'IEL 'S
'"""
A,ORI
"'"
li!4, "",/TICK
DJItZ
DEC
; WAIT
••
'"""
A.OR'
"'"
.,
DEC
»". MICROSECOHDS
MOVP3 A,@A
Ii",$
;
~
SCAN AHALDGS
This instruction uses the initial contents of the
accumulator to index into page 3 of program
storage. The location pointed to is read and the
contents placed in the accumuhitor. If (as is often
the case) a table of fewer than 256 entries is
required, then the table can be located in any page
of program mel110ry and the instruction:
; GET OATA
; IOJE INTO 9JF'FER
ORI,A
j
D£CRtr:£HT BUF'fER PO I NT
; PAD 2. I'IJCROSEC
"'"
R4,#2'/TlCK
OJH2
R"',$
OJHZ
R3,LOOP
JI'P
START
! LOOP UNTIL DCIHE
! REPEAT TEST F'OREVER
; END
or
MOVPA,@A
PRQGRAI'I
EHI)
can be used to retrieve data from the table. This
instruction operates in the same manner as does
the previous instruction' except that the current
page of program storage is ass4med to contain
the table.
Figure 7b. AID Exercise Program
If it is possible to devote slightly more of the
microprocessor's time to tile table look up process,
then a much smaller table can often be utilized by
taking advantage of interpolation to determine
values of the function between values which are
actual entries in the table. As all example of this
TABLE lOOKUP TECHNIQUES
111 the previous section the interface between analog
I/O devices and the MCS-48™ was discussed. In
many applications involving analog I/O one quickly
finds that nature is inherently nonlinear, and the
mathematics involved in 'linearizing it' can tax the
cOJ11putational power of the microprocessor, particularly if it has other tasks to perform. Problems
of this nature are good candidates for the use of
tables.
FLOWMETER
As an example of how tables can be used as part of
an analog output scheme, consider a system which
requires an MCS-48 to output a variable frequency
sinusoidal waveform. One method of performing
this function would be to use the timer to generate
an interrupt at a fixed rate of 256 times the desired
output frequency. At each interrupt the appropriate
vahieof the sine function could be calculated from
the Maclaurin series:
----1
FLOWMETER
AD
----l
FLOWMETER
.
' x3
x5
x7
Sm x = x - 3! + 5! - 7T
MCS48
LJ
(_1)k x 2k +1
(2K + I)!
Where K is chosen to be large enough to provide
th~ required accuracy.
All mnemonics copyrighted
LJ
@ Intel Corporation 197ft
Figure 8. Flow Monitoring System
1-8
COFltTROL
PANEL
inter
AP-24
process consider the hypothetical system shown in
Figure 8. The purpose of this system is to measure
the flow through the three pipes, add them, and
display the total flow on the control panel. The
system consists of three flow meters which generate
a differential voltage which is some function of
flow, an A/D system with at least three differential
inputs, an MCS48, and a control panel. The
schematic sho\Vn in Figure 6 could easily become
part of this system, with the spare digital I/O of
the MCS48 used as an interface to the control
panel. The simplicity of this system is clouded by
the flow transducers, which are assumed to be not
only nonlinear but also to require individual calibration (this is not an unreasonable assumption for
a flow transducer). By usinga table look up process
and an 8748 the flow transducers can be calibrated
and the results of the calibration tests stored
directly in tables in the 8748. (The 8748 has a
PROM in place of the ROM of the 8048 and thus
makes such 'one off' programmin, oractical.)
The results which might be obtained from calibrating one of the flow meters is shown in Figure 9.
The results are plotted as gals/hour versus the
measured voltage generated by the transducer. The
voltage is shown in hexadecimal form so that it
corresponds directly to the digital output of the
analog to digital converter. The flow required to
generate seventeen evenly spaced voltages (OH-l bOH
in steps of 10H) has been measured and plotted.
This information is shown in tabular form in
Figure 10. It is necessary to generate a program
which will convert any measured input from OOH
to FFH into the flow in units which can be interpreted by a human operator. This can easily be
done by simple interpolation.
The eight bits of independent variable (voltage) can
be looked on as two four bit fields. The most significant four bits (7-4) will be used to retrieve one of
the table values. The lower four bits (3-0) will be
used to interpolate between this value and the
value retrieved from the next higher location in lhe
table. If the upper four bits are given the symbol I
and the lower four bits the symbol N, then lhe
interpolation can be expressed as:
F(x)
= F(I)
+
ii,
[F(I+I) - F(I)]
Where x is the measured voltage and F(x) is the
corresponding flow.
If, as an example, the transducer voltage was
measured as 48H then the flow (ref. Figure 10)
would be:
F
= 30
+
8
16
(34-30)
= 32
A subroutine which implements this caiculalJIIII is
shown in Figure II. Before it is called the indl·I"·1I
dent variable (V) is placed in the accumulator and
register R I is set to point at the first value in the
table. Aside from simple additions and subtractions
the only arithmetic required is to multiply two
values and then divide them by 16. The multiplication is handled via a subroutine which is also
shown in Figure II. The division by 16 can be performed by a four place right shift followed hy a
rounding operation. The routine shown will handle
a monotonic increasing function of a single independent variable. Fairly simple modifications are
required for nonmonotonic functions. Functions
of two variables can be handled by interpolating on
a plane rather than along a straight line. Although
this is more time consuming, requiring an interpolation for each of the independent variables and
a third to in terpola te the final answer, it still
provides a simple means of quickly calculating the
required function. The use of tables can offer a
powerful technique for function evaluation to the
designer.
60,------------------
'0
RECEIVING SERIAL CODE-BASIC
APPROACHES
Many microprocessor based systems require some
form of serial communication. Serial communication is extensively used because it allows two or
more pieces of equipment to exchange information
with a minimal number of interconnecting wires.
The minimization of interconnecting wires results
in simpler, cheaper, interconnects because fewer
(or smaller) cables and connectors are required.
Since the required number of drivers and receivers
required is reduced, it can become economically
feasible to provide much higher noise immunity
10
Figure 9. Flow Calibration Curve
TRANSDUCE R , . . - , - , - , - - , - , - , - , - , - - , . - - , . - - , . - - - - , - - - - - , - - , - - , - - - . - - .
VOLTAGE IHfX! 00 10
MEASURED FLOW
HHHH-I-I-I-I-I-+-+-+-+-+-+-+-1
IGA l HOURI '----''----''----'--'--'--'--'---'---'---'-----'-----'----'-----'-----'-----'-----'
Figure 10. Tabulated Flow Data
1-9
inter
Loe
OBJ
AP-24
. .0
SOURCE. STATEMENT
I
LaC
•••••••••.••••••••••••••••••••••••••••••••••
.•, ...........................................
OBJ
I"C 83
"10 BElie
,,,r
BAl.
9 1 EQUATES
'11'
...2
.113
'11'"
I I : ':'-----11
12 RXI
EOU
13 AXI
EOU
,,, AEX
EQU
15 COUNT
EOU
16 TEI'F
EOU
17
"21 97
R'
R'
R,
R3
R'
j POINTER I
I POINTER!
I E:xTENSIOH
or
A REGISTER
.,••
"22 1228
.,204 2A
112567
; COUNTER
.,26 2A
; IT"" STORAGE
112767
"28 EB22
112A 83
21; -------------
11,. IBI'"
1,.2 Bill
.,1431
IllS "17
111669
•,,7 A9
1118 E3
111929
IliA 17
111B E3
,tiC 37
111069
111E37
"282A
ORO
'3
2'1 APPROX: fI10V
'5
26
i'1OII
28
XCHD
",",P
29
.,
31
31
3•
33
3<
35
36
3'
.,
.....,
..,..
3B
II'H
112C 61
; POINT RXI AT TEI'F
RXI.#TEfIF
"2067
; TEI'P-N AND IfH
; A"P AHD IFH
@RXI,#I
A,ORXI
111B 69
••••
51
A,RXI
RXI,A
AIlD
CPl
A,OA
A,AXl
A
A,@A
A
A,AXl
A
CALL
'''IT
i'1OII
XCHD
SWAP
XCH
JB3
XCH
Rxt,#AEX
A.@iRXI
A
A,AEX
ADJUST
A,AEX
A,AEX
A
; A-A. TABLE(PJ
A,RXl
: AETURN
IHe
54
ADD
"'"
66 LOOPA:
CLA
68 LOOPB:
69
71
71
72
JB.
XCH
RRC
XCH
RRC
63 I>IUl.T:
f'IDV
",.
7S
DJN2
RET
77 ssli>1:
78
79
81
81
XCH
ADD
ARC
XCH
RRC
B3
DJNZ
RET
8.
.
8'
.,
; SET UP COUNT AND AEX
COUNT, #8
AEX.#I
; CLEAR CARRY
"1>1
; If MUlTIPLIER (I) () 1 THEN SflIFT PRODUCT
A,AEX
A
A,AEX
A
; LOOP UNTIL DONE
COUNT,LOOPB
; ELSE ADD f'>lJLTIPLIER AND SHIFT PRODUCT
A,AEX
A,@IU.
A
A,ArX
A
; LOOP' UNTIL DONE
COUNT,LOOPA
89 ; --------------------'
1381
; A-H-A/16
51 ADJUST: XCH
.5
87 I --------------------sa ; TABLE TO TEST PROGAAM
: A-TABLE (P.U-TABLECPJ
CPl
..,6'
8!i
; RX ,·TABlEIULTIPLY
61 ; --------
5
I ...
56
57
58
APPR[]X
AT ENTRY RI POIHTSAT TAkE
A HAS IHOCPEHOENT IIARIAB..E
8 I -------
SEO
1381 II
138t IA
1382 16
1383 lA
138'" lE
138522
1386 26
138728
1388 29
1399 2A
138A 2B
13aB 20
I38C 31
I3&D 31
I38E 35
l3Bf 38
1391 3F
91
ORG
93 TABl-E:
DB
94
DB
••
.,.
9S
DB
96
DB
DB
DB
DB
99
"'
"'
"'
113
".
1IS
'86
'87
"8
11.
'"
"'
DB
DB
DB
DB
DB
DB
DB
DB
DB
DB
.
38IH
; THIS TABlE: IS FROM FJG HI
11
••
26
31
.
34
38
.,
.,••
..
4S
.8
53
56
.3
EMD
Figure 11. Table Lookup With Interpolation
eighth data bit usually consists of even parity on
the remaining seven data bits; for the purposes of
this discussion the eighth bit will be considered
only as data. A m'inor variation of this fonnat
deletes one of the STOP bits. An algorithm which
might be used to sample serial data under software
control using a microprocessor is shown in Figure
13. Th~ basic intent of this algorithm is to minimize the effects of distortion and transmission rate
variations on the reliability of the communication
by sampling each data bit as close to its center as
possible. Upon entry to this routine the software
first samples the incoming data in a tight loop until
it is sensed as a MARK (logical one). As soon as a
MARK is detected, a second loop is entered during
which the software waits until the received data
goes to a SPACE (logical zero). The purpose of this
construction is to detect as accurately as possible
the leading edge of the START bit. This instant of
time will be used as a reference point for sampling
all of the following bits in the character. After
sensing the leading edge of the START bit a wait
of one half the expected bit time is implemented.
The period of the incoming signal is called P for
convenience. At the end of this wait the serial line
is tested-if it is MARK then the START bit was
with more sophisticated (and expensive) line
tenninators. The final, and usually most persuasive, argument in favor of serial communication
is that it may be the only method available to
accomplish the job. The obvious example of
this is telecommunications where it is necessary
to encode parallel infonnation into serial fonnat
in order to communicate via the telephone network. The intent of this section is to show how
the facilities of the MCS-48™ can be brought to
bear on the problem of serial communication.
Figure 12. Serial ASCII Code
Probably the most common form of serial communication is that used by the obiquitous Teletypeserial ASCII. This fonnat, shown in Figure 12, consists of a START bit (0 or SPACE) followed by
eight data bits which are in tum followed by two
STOP bits (I or MARK). In actual practice the
All mnemonics copyrighted © Intel Corporation 1976,
1-10
inter
AP-24
the processor will spend only a I OO~secs or so processing data and the rest of the 100 millisecs waiting to do the processing at the right time. This lack
of efficiency (approximately 0.1 %) in the utilization
of processing power is why devices such as the
8251 USART find broad application in microprocessor systems.
LOC
OSJ
5ClIRCE STATEMENT
5EO
";
, , ..............................
,,2 ,,,
SIf'FLE SERIAL II'IPUT
.THIS CODE ASSll'IES RltO IS
CONNECTED TO PIN TI
5 ,
6 ; ••••••••••••••••••••••••••••••
7
8; _______
'3 ; [QUATES
11:
"liZ
IU8
8182
I,M
lUI
"
-------
12 COUNT
13 BITHO
14 DlVH!
,.
15 DLYLD
"
,ou
,ou
,ou
'ou
OR.
"
8
IA4N
: LOOP, UNTIL IUD-MARl(
19 SEAIN: JNTI
; HOW LOOP UHTlL RXO-SPACE
20
.,123612
JTO
CALL
HBIT
a116 3611
"
"
25
26
JTO
SER(H
1118 BIllS
27
"~
"11'" 341C
'IIA 341C
.11C341C
22
23
28
29 LOOP:
""32
,.
,
.
: WAIT 112 BIT TIME
CALL
33
"IEEAIS
'11897
• ,11 3614
1,,3A7
811483
3S
37
38 EXIT:
DJHZ
CLR
JT.
CeL
R'T
.11597
"'62619
41 LOAD:
"18 A7
"1967
"
IliA 24'A
43 LLLA:
"0. The
USART requires a reset of approximately 6 CLK
periods so DELAY is chosen to be I which ensures
adequate reset timing. Note that for delays this
short, NOP instructions could also be used to time
the pulse.
19968
MH,
The data clocks required by the USART are provided by the modem if the USART is operated in
the synchronous mode. In the more common
asynchronous mode, however, these clocks must
be provided by circuitry associated with the 8251.
The 5.9904 MHz crystal was chosen because the
resulting 1.9968 MHz clock to the USART can be
evenly divided to provide transmit and receive
clocks to the USART. Assuming the USART is in
the x 16 mode (i.e. it requires data clocks 16 times
the baud rate) the 1.9968 MHz signal can be divided
by 13 to generate the proper clock rate for 9600
baud operation. This 9600 baud .clock can be
further divided to give 4800, 2400, 1200, 600, and
300 baud signals. The 1200 baud signal can be
divided by II to give a 109.1 baud signal which is
within I % of the 110 baud required by Teletypes.
'Install Jumper for 110 Baud OperatiOn (-111
Figure 15. MCS-48™ to 8251 Interface
necting the CLK signal of the USART to the TO
pin of the MCS-48. The TO pin of the MCS-48
can either be used as a directly testable input pin
or it can become, under program control, an out. put pin which oscillates at one third of the crystal
frequency. (Note that once this pin is designated
by the software to be ali output it will remain so
until the system is reset.) In Figure IS the crystal
frequency is 5.9904 MHz so the clock provided to
the 8251 is 1.9968 MHz, which conforms to its
specifications.
The initialization signal to the USART (RESET) is
provided ·programmatically by manipulation of bit
5 of port 2. It was-necessary to place the reset of
the 8251 under program control for two reasons.
The first reason is that the MCS-48 does not supply
a reset signal to other devices. The reason for this is
that it was felt to be more useful to provide another
pin of I/O function instead ofa RESET OUT signal
The MCS-48 communicates with the 8251 in a
memory mapped mode (i.e. as if the 8251 were
external RAM). The instructions available to do
this are MOVX aRj, A which stores the contents of
the accumulator at the external RAM location
addressed by Rj U=O or I), and its complement,
the MOVx' A, @ Rj instruction which moves data
from the external RAM into the accumulator.
Since the MCS-48 multiplexes addresses and data
on the same eight bit bus an external latch would
be required in order to address the USART with
1-12
AP-24
Lac
DIlJ
SEQ
to add the circuitry necessary to use RO or R I to
address the peripheral devices. The circuitry which
has to be added to Figure 15 in order to make use
of RO or RI to address the USART is shown in
Figure 17. Note that only the changes to Figure 15
are shown. The additional component required is
the 8212 eight bit latch. This latch is loaded, whenever a valid address is on the bus by the Address
Latch Enable (ALE) signal provided by the MCS48. During an ex ternal read or wri te cycle this
address is used to address the 8251 in a linear
select mode. In the circuit shown, the 8251 will be
.selected by any address with bit I a logical zero
(XXXXXXOX) and the selection of control or data
transfer (C/O) will be based on bit zero of the
address obtained from RO or R I. Figure 18 shows
the program of Figure 16 modified to utilize the
addressing inherent in the MOVX instructions.
SOURCE STATEMEMT
S[R[ALT[ST
TH[S
cooe:
ItHIALIZES TI1E USART
AND TRANSMITS AN IHCREMfNTlNG
PATTERN. HARr:wAR£ SH~ IF riG 15.
7; ---- __ _
8; EQUATES
9; -------
liZ'
ue,
UDF
UCE
1117F
11"
"Bf
"
11 MCLR
12
13
14
15
16
DLV
ueON
[au
[au
lilH
81H
[QU
[au
BeEH
; USAIH f'1JD(
eMD
STAT
[IlU
£QU
211,
; USART CMt)
7FH
(au
[au
; USAInSTATU5
; TEST VALUE
'SFH
; CHAt1VES eND TO DATA CHANNEL
ORO
lUSH
22
23 TEST;
Etne
eLK
24
ORL
2S
"""
P2,:tMCLR
R2,:tDLY
R2,LOOP
17 VAL
18 MASK
; TURHOHCLDCK
21
8187 9ADF
8119237F
81883A
S18el3eE
lilliE 98
IIUF2321
8111 9&
; USART RESET DELAY
; USART CONTROL ADDRESS
/'{JOE:
8188
8118 75
8!118AZI
ill13 BAil
illllSEAIS
; USART RESET ADDRESS
26 LOOP:
27
,.
; AHDR[SET USAIH
DJHZ
ANL
38
"
,.
P2,#(HOTMCLlU
; SELECTUSARTCOHTROL
A,#UCON
29
DUlL
32
33
MOVX
35
MOVX
3.
.
P2,A
SEND 1'l]D£ AND CCI'T'1AND
A,#MOD£
@RS,A; (CONTENTS OF Re UN[I'F'ORTANT)
A,#CMD
@RiI,A
; [)(] FOREVER
SELECT UsART STATUS
IF TXRDY-' THEN
3S
1112237f
1114 3A
042
043
0404 TLP;
045
046
lIlA 9AB(
....
""G
9'
8110 19
51
52
ill1s 88
111667
11117 [612
1119 F9
8"[2412
OUTPUT VALUE;
INCREMENT VALUE;
END;
P2,A
A,@RB
;
(CONTENTS OF RS UNII'F'ORTANT)
INC
53
JI'P
END
os,
'0
A
AHL
os,
13
22
'8
JHe
M!JVX
'I~
ALE ~-------"'l
A,#STAT
OUTl
"
55
'5V
END;
.,
"
WR~----------------------~
WR
R-a
00,
A,VAL
P2,#MASK
@RS,A
VAL
TLP
; END OF PROVRAM
16
U748
MO
00 8
DO,
I-
0'6
00 6
015
005
III-
00 4
I-
00 3
I-
~ DO,
------2
8212
0',
01 8
0'3
~3 00,
00,
DO, ~
DO, ~
8251
cs
c/o
D,~-+-t~+-~r+----------~ D.,
06~-+-r1-~~~-----------; 08 6
D5r---~1-~~~-----------; 08 5
D4~----~~~~-----------; 08 4
D3~------~~r+-----------; 08 3
D,r---------+-r+----------~ 08,
0, ~--------~~----------_1
Figure 16. 8251 Test Program
D.,
DO~----------~----------_1 0. 0
L..-_ _- '
RO or R I. In order to Immmize the circuitry in
Figure 15 an approach utilizing some of the I/O
pins of the MCS-48 to address the 8251 was chosen
instead. By connecting the chip select (CS) input
of the 8251 to bit 7 of port 2 (P27) and similarly
connecting the C/O address line of the 8251 to bit
6 of port 2 (P26) it is possible to address the 8251
without using RO or RI. The instruction sequence
to access the 8251 is to first reset P27 and set P26
to the appropriate state, use a MOVX instruction to
perform the appropriate operation, and then
finally set P27 to deselect the 8251. As a concrete
example of this addressing, Figure 16 shows the
code necessary to initialize the 8251 and output an
incrementing test pattern on a status driven basis.
If more than one 8251 were to be added to the
MCS-48, or if other types of peripheral circuitry
would be required (e.g. an 8253 timer to generate
the data clocks) it would probably become desirable
AU mnemonics copYrIghted © Intel Corporation 1976.
'-_ _- - '
Figure 17. Modified MCS48 to 8251 Interface
RECEIVING SERIAL CODE-A MORE
SOPHISTICATED ALGORITHM
Although the USART does an admirable job of
performing the serial I/O function for the MCS48™, there are some situations where it can not be
used. These situations may be caused by economic
factors, such as an extremely cost sensitive design,
or because the code which must be utilized cannot
be accommodated by the USART. An example of
of such a code will be discussed later. Recall that
the principal objection to the approach to serial
input shown in Figure 13 was that it consumes
much of the processor's power by merely spinning
in loops in order to wait preset time delays.
1-13
inter
LaC
AP-24
SEQ
OBJ
interrupt occurred. If the serial line has returned to
the MARK state, a status flag is set to indicate an
error and a return is made. On subsequent interrupt
detection, the data is sampled, the timer is reinitiated, and control is returned to the program which
was running when the interrupt occurred. When
the last (Le. STOP) bit is detected a completion
flag is set and a return is made to the program
running when the timer overflow occurred. By
periodically, checking the error and completion
flags the running program can determine when the
interrupt driven receive program has a character
assembled for it.
SOURCE STATEMENT
•........... __ ._----_._------------S[RIALT(ST
THIS CODE INTIALIZES THE USAAT
AND TRANSMITS AN INCREMENTiNG
"
PATTERN. HARDoIARE SHCIoIH IF FIG 17.
5
--------------------.--.----------6
7: ------8: EQUATES
9; -.-----
"
fl21
[DU
211'1
1 USART RESET ADDRESS
12 Dl..V
[QU
1183
liCE
1121
.111
13 UCON
14 I1JDE
[au
.,H
.3H
1 U5ART RESET DELAY
1 USAAT CONTROL ADDRESS
[DU
ICEH
; USART I'IDDE
IS Cf'ID
16 STAT
[QU
[OU
21H
13M
1111
1111
17 VAL
[DU
18 DATA
[OU
III
81
; USAATCfIID
; USART STATUS
I TEST VALUE
I USART DATA ADDRESS
21
ORO
1nM
EHTI
DRt.
eLK
"
''',
P'CLR
,.
1111
21
22,
23 TEST:
2<1
25
111. 7S
1111 8A21l
1113 BAI'
1115 EAtS
I TURN ON CLOCK
; AND RESET USART
1'IlII
26 LOOP
27
DJNZ
"17 SADF'
2.
11.92313
29
3'
1'IlII
31
32
1'IlII
11109'
1,.[ 2321
33
1'IlII
34
35
36
37
38
39
MOVX
.,ta2leE
"11 9,
AtiL
MOYX
"
""
1111 2313
111381
.,1467
'115 ES1'
'117 F'9
'118 BBl'
lilA 9.
",S 19
43 TLP:
44
45
46
MOV
MCJI.IX
RRC
JNC
.,
48
51
MQV
MOV
f'lQVx
INC
51
"'"
49
I"C 24"
52
53
P2,"MCLR
R2,#DLY
R2,LOOP
P2,It(NOTI'1CLR)
; SELECT USART CONTROL
A,ItUCON
; SEND !"ODE AND CCJ1'1AHD
A,#I'IJOE
ORI,A I (CONTENTS Of RI UNIMPORTANT)
A,ltCf'ID
@RI,A
; DO FORE\lER
SELECT USART STATUS
If TXRDY-1 mEN
!Xl;
OUTPUT VALUE;
INCR(II£HT VALUE;
END:
;
END:
A,#STAT
A,@RI : (COHTENTS OF RI UNIMPORTANT>
A
TIMER
OVERFLOW
TLP
A,VAL
RI,#DATA
ORI,A
VAL
TLP
; END Of PROGRAM
END
Figure 18. Modified 8251 Test Program
The timer resident on the MCS48 provides a solution to this problem. Instead of spinning in a loop
the program can set the timer for a given interval,
start it, and proceed to other tasks. When the timer,
overflows, an interrupt will be generated to notify
the software that the present time period has
elapsed. An e~tension of the algorithm of Figure
13 which uses the timer in this fashion in shown in
Figure 19. This algorithm is identical to the preceding one ,up until the detection of the leading edge
of the start bit. At this point the timer is set to one
half of the bit time (P) and a return is made to the
calling program which can start additional processing. At the completion of this time interval a
timer overflow interrupt is generated. When the
first interrupt is detected, the serial line is checked
to ensure that it is in a spacing condition (valid
START bit). If it is, the timer is set to P (to sample
the middle of the first data bit) and a return is
made to the program which was running when the,
All
mnemon~cs
copyrighted @ Intel Corporation 1976.
Figure 19. Improved Serial Input Routine
Using the timer to implement time delays as shown
in Figure 19 results in considerable savings in
processing time; two p,roblems remain, however,
which must be solved before an adequate software
solution to the problem ofreceiving serial code can
be found. The first problem is that even though the
delays between bit samples are implemented via
the timer rather than program loops the loop construction is still used to detect the leading edge of
1-14
AP-24
the START bit. Although this results in the waste
of processing power, the second problem is even
more serious. For longer messages the required
accuracy of the clocks becomes more and more
stringent. Using the sampling technique discussed
a cumulative error of one half a bit time in the
time at which a bit sample is taken will result in
erroneous reception. The maximum timing error
which can be tolerated and yet still allow proper
detection of an II bit ASCII character is then:
Both efficient detection of the start bit and increased timing accuracy can be obtained if the MCS48
can detect edges on the incoming received data
(RxD). A hardware construct which allows this
is shown in Figure 20.
The received data (RxD) is Exclusive NORed with
bit seven of port two and fed into the TEST (T I)
pin of the MCS48. By manipulating P27 the program can now cause TI to be either RxD or RxD.
(If P27 = I then TI = RxD; if P27 = 0 then TI =
RxD.) Note that not only can TI be tested directly
by the software but that it is the input which is
used when the MCS48 timer is in the event counter
mode. The significance of this will be discussed
later. The relationship between TI, P27, and RxD
is given by the Boolean expression:
O.SP
O.s*BIT TIME
Emax = CHARACTER TIME - TiP = 4.5%
where P is the period of single bit. The corresponding calculation for a 32 bit character yields:
Emax =
~i~
= 1.6%
TI
Since this calculation does not allow for distortion
on the signals, it is obvious that either extremely
stable clocks will be required or a more tolerant
algorithm must be devised. This problem is particularly serious at relatively high baud rates where
the resolution of the counter (80J.lsecs with a 6 MHz
crystal) becomes a significant percentage of the
period of the received signal. At the 110 baud rate
of the Teletype the 80J.lsec resolution of the clock
allows a maximum accuracy of 0.33%; at 2400
baud this figure is reduced to 3.8%.
PROG
T1
Figure 2 I flowcharts a means of utilizing this hardware construct to avoid the necessity of wasting
time in program loops to detect the leading edge of
the start bit. The receive operation is initialized
when the program desiring to receive serial data
calls the INIT subroutine (Figure 2Ia). Since INIT
is going to manipulate the timer the first action it
performs is to disable the timer overflow interrupt.
Its next step is to set P27 to a logical 1. Setting
P27 in this manner causes the TEST 1 input to the
MCS48 to follow RxD. By setting up the receive
circuitry in this manner a high to low transition
will occur on TEST 1 when the RxD goes from
the MARKING to SPACING state (Le. the START
WR
ALE
P17
P27
P26
P25
P24
P23
P21
P20
P16
P15
P14
P13
P12
Pll
PlO
TO
°7
06
Vcc
V OO
°5
04
03
ss
PSEN
°2
°1
DO
Vss
EA
-=
• RxD + P27 • RxD
AD
tNT
RxO
+5V
= P27
}~'"
},"
.::r::
Figure 20. Detecting RxD Edges
Figure 21a. Interrupt Driven Serial Receive Flowchart
1-15
intJ
AP-24
bit, occurs). By setting the timer to OFFH and
enabling it in the event count mode, the, .INIT
routine sets up the, MCS48 to generate a timer
overflow interrupt on the next MARK to SPACE
transition of RxD (the TEST I input doubles as
the event counter input). Before returning to the
calling program the INIT routine sets a flag (RDF)
which will be cleared by the receive program when
the requested receive operation is complete. INIT
also sets a value into a register called BCOUNT.
The receive program interprets BCOUNl as follows:
Number of bits remaining
to receive
If set indicates that the
ST A RT bit has not yet been
detected
NO
__2 -__________~~____~~
If set indicates that the
START bit has not yet bee'n '
verified
Figure 21 b. Interrupt Driven Serial Receive Flowchart
In order to request the reception of the II bit
ASCII code INIT would set BCOUNT to 1100101 lB.
The start bit has been neither verified nor detected
and II bits (lOIIB) are required.
After INIT is called the reception of the individual
serial data bits will proceed on an interrupt driven
basis until a complete character has been assemble~.
When this occurs the interrupt driven program will
set the RDF (Receive Done Flag) to a zero to indicate that it has completed the requested operation
and then terminate itself. The procedure which is
used to accomplish this is shown in Figures 21 b
and 21c.
Since all operations of this program are the result
of the occurence of a timer overflow interrupt, it
is necessary to briefly review the interrupt structure
of the MCS48, There are two sources of interrupt;
an external interrupt which is the result of a logical
zero signal applied to the INT pin of the MCS48,
and an internal interrupt which is caused by a
timer overflow condition. The timer overflow
occurs whenever the timer is incremented from
OFF H to zero whether it be in the timer or event
count mode, When one of these events occurs the
hardware in the MCS48 forces the execution of a
CALL. This CALL has a preset address of location
3 if it is due to the external interrupt and location
7 if it is due to a timer overflow. If both of these
Figure 21c. Interrupt Driven Serial Receive Flowchart
1-16
AP-24
RETR is executed. Note that since the state of
the flip flop which selects RB I is saved as part of
the PSW, the execution of RETR automatically
selects the register bank which was active when
the interrupt occurred.
events occur simultaneously the external interrupt
will take' precedence. The CALL automatically
saves the contents of the program counter for the
running program and its PSW (program status
word) on a stack the hardware maintains in RAM
locations 8-23. Although the hardware saves the
program counter and PSW, it remains the responsibility of any interrupt driven software to make
absolutely certain that it does not modify any
memory locations or registers which are being
used by the main program. The most convenient
way of ensuring this in the MCS48 is to dedicate
the second bank of registers (RB 1) to the interrupt
driven program. One of these registers has to be
used to save the accumulator (which is not part of
the register bank) but seven registers remain;
including two which can be used as pointers to the
rest of the RAM (RO and R I). Note that if this
approach is taken then these registers have to be
allocated between the program which services the
external interrupt and the one which services the
timer overflow. This problem is somewhat alleviated
by a hardware lockout which prevents the timer
overflow interrupt from interrupting the external
interrupt service routine and vice versa. This is
implemented by locking out new interrupts between
the time an interrupt is recognized and the time a
RETR instruction is executed. The RETR instruction is like a normal RET (return from subroutine)
except that the PSW as well as the program counter
is restored. The RETR instruction can be very
much thought of as a return from interrupt instruction in the MCS48.
If BCOUNT [7] is still set when it is tested, control is passed to START (Figure 21c) where bit 6
is tested to determine if the START has been
detected yet. If BCOUNT [6] is set it indicates
that this is the first occurrence of a timer overflow
since the receive process was initialized by the
INIT subroutine. If this is so, the program assumes
that the START bit has just started and therefore
it sets the timer to one-half of a bit time (1/2 P),
starts the timer in the timer mode, and clears
BCOUNT [6] to indicate that the START bit has
been detected. The next overflow will again result
in the execution of the program in Figure 21 band
again BCOUNT [7] will be found to be set. This
time, however, BCOUNT [6] will be reset and the
program will know that it should test the START
bit to ensure that it is still a SPACE. This test is
performed and if successful the timer is set for a
bit period P and BCOUNT [7] is reset so that on
the next occurrence of a timer overflow the program will know that it should start assembling
serial bits into a character. If the test is unsuccessful, the subroutine INIT is used to reinitialize the
receive program. In either case control is passed to
EXIT where a return from interrupt mode occurs.
This receive program, listings of which appear in
Figure 22, allows the reception of serial characters
transparently to the main running software. After
INIT is called the main program has only to check
RDF periodically to find out if there is data in the
buffer for it. It would be fairly easy to 'double
buffer' this operation by providing a buffer which
the receive program uses to deserialize the incoming code and a second buffer to store the assembled
character. If the program would reinitialize itself
upon completion, the reception of a string of
characters could proceed in much the same way as
it would if a status driven USART were being used.
The receive program under discussion uses register
bank I in the manner described. Whenever a timer
overflow occurs (e.g. on the next MARK to SPACE
transition of RxD after INIT is called), control is
passed (by the hardware generated CALL) to the
point labled TIMER OFLO in Figure 21 b. This
program segment immediately selects register bank
I (RB I) and then saves the accumulator (A) in a
location called ATEMP which is actually R7 of
RB I. The program then tests bit seven of BCOUNT
(R6 of RB 1) to find out if a START bit has been
verified (Le. the edge of the START bit has first
been detected and then verified to still be a SPACE
one-half a bit time later. If BCOUNT [7] is a zero
the START has been verified and the program proceeds to set the timer to P (the period of the serial
bit), get the current serial data into the carry bit,
and then shift the carry bit into a buffer. After
saving the data the program decrements BCOUNT
and tests it for zero. If BCOUNT is zero the receive
operation is complete so the program sets RDF to
a zero and disables timer overflow interrupts.
Whether or not BCOUNT is zero, control is passed
to EXIT where A is loaded with ATEMP and a
Although this program solves the first problem of
software controlled reception (lack of efficiency)
the second problem-sensitivity to frequency
variations-remains. An example of a code which
would be susceptible to this problem is the 3 I ,26
BCH code commonly used in supervisory control
systems. (A supervisory control system is, in
essence, a remote control system which allows a
human or computer operator the control of a
system via a serial communications link.) The BCH
codes are used because of their error detection
capabilities and are a class of cyclical redundancy
1-17
inter
,'DC
OBJ
Ap·24
SOURCE 5TAT£I'£HT
. .0
•• 23 FE
"2~ 0237
........................................
SERiAl INPUT U5IHG,TH[ I'ICS-48
THIS CDtlE ASS\K.S HARtIoIARE
•
7
........................................
"
1128 2307
11
112A G2
1128 S5
112t SA7F
•• 2£ IS
13 ; EQUATES
II.,
'.'6
,.,2
....
""
,.2.
Ie COUNT
19 RItI
21 BITHO
1129
2'
22
2.
2<
2S
26
27
. .24
...,
p
SERElJF
RIll'
,ou
'ou
,au
'au
[QU
,au
.117 DS
1118 Af
31 II'IV£C: SEL
•2
33
...e 2307
.'IE 62
1.11'
ss
"" F7
III
1111
"'2661S
1114 A7
DOG
"'"
MOIl
J87
36
37
38
39
"'"
", St.L8:
<2
"••
21"
2<"
"'867
"1921
. . ,AEElF
,,2' 3S
,.21 '43F"
.7
.,
; SAflPlE PUIOD
",F AI
6S
.
66
69,
7t
.13723EC
A,BCOUHT
813962
113A 55
1138 FE
113e 53BF
START
'"3E AE
; IF BCOUMT(7)·' THEM
A,a-p
1131' fF
T,A
114' 93
START TJI'£R
.'
ENI
BCOUHl(7)·,;
END:
"'"
"'"
.
.,.
OS
STRT
AN'
'N
AN,
"'"
.....
"'"
'BB
.'..
......7
A,#-P
T,A
T
P2,#7FH
I
A,ElCOUtiT
A,#7FH
seOUl'll,A
SElin
ELSE
DO,
CAlL,INIT:
EHD;
9G SLlD:
CALL IHIT
ELSE
DO,
TIM[A~P/2;
STAAT TIMER;
BCOUHT[SJ"I;
'"
"
,os
'"
".
.
END;
1135LLC:
MOIl
AN'
"""
".
.'",
111 S£XlT:I'CV
RETR
A,#-(P/2)
T,A
T
A,BCOUHT
A, "IBFH
BCOUNT ,A
1 £1'40:
; /4[XiT INT[RUPT MODE·,
II,IIT["'"
----------------------------
...
TJ!iRD
,
"'
'"
HUT:
PROCEDURE;
'2'
'"SHIfT CAI5!V INTO BJFf"ER·'
RX'-SERBUF;
,
"'""""
STAT
"S
115 ; INTJALJzt ROlITIHESTARTS RECEIV£ PROCESS
116 ;
It ? ~ - - - - - - - - - - - - - - - - - - - - - - - - - - - -
C
CD,
123
DISABLE INTERRUPTS.
P27·';
RX',#S[fmUf
A,ORXI
A
'"
,,.
START [VENT COUNT:
RQF-,;
A,ORI'
127
'22
RSHrT MEf'IHUI);
,
TiMER Ow 1;
"S
BCOUHT-SCOUNT-l ;
IF BCDUNT-' THEN
BCOut4T,S(K1T
,
....
P27".;
••
••••
.7
114 ;
A,P2
A
114135
DO,
l'1l\I
ecR
l'1l\I
DIS
START TlI'IER;
113
'''CARRY-RIO'll
CARRY ..P27 XHOR T[ST1:
JT'
TJI'£R"P;
7.
112
58
62
1135''''41
'TOT
CP,
DO,
os
I SERIAL BUFFeR
; REtE I'VE DOH£. FLAG
Tlf'£R-P;
IN
OLC
SLLD
71
92
93
; HLl'l8ER OF' BITS
OB'
ATEf'F,A
S'
IflC 882"
litE 27
1133 .43f
1 POI"TER
; 00;
I'II\I
SI
51 TISR'D: I'lOl/
52 SLOOP: xeM
RRC
S'
.S<
'C"
SS
56
DJHZ
"
••
••••
,132 AS
17H
••
"'5882'
1117 2'
1131 537F
; ,"ENTER INTERRUPT MODE·'
'S
os
R2
R'
•..
; STORAGE FOR A DURIHG IMTtRUf'T
; COHTAINS HtJIIBER or BITS IN MSG
1 UTILITY COUNTER
; -------------------------.----------------
28
29
31
..
.
..
..
R7
112F FE
; CDHTAOL. PASSED HERE IofoI[H TIMER ORO OCCURS
; ------------------------------------------
,
'119-FE
IliA 1'223
.
IF' T[5T1-' THEN
J"
82
12 ; ------'4; ------'S
16 ATEJII' 'OU
17 BCOUHT [QU
DO,
7<
7S
7.
,.
SJDIoI IN FIG 2 •• TO USE
THIS ROUTIHE,CALl INIT.
IrI£N Ror·, THE ASSEI'Il.ED
CHARACTER WILL BE IN SERBUF
S
A,SCOUl'tT
SLLC
13
1126 563S
•
••
71 START: IIIDY
72
JB6
111"'2 BABI
RI)F'-';
11"'4231'".
DISAIl.E EX INT:
l1li4662
EtlDI
'1"745
RltI,#RDf
A
1148882<1
OIUI.A
18"C 881t
TCtITI
"<1£
8.4A Bill
Its.
; [fOlD;
sice
25
US183
SEX IT
I ELSE
; 00;
".".
BCOUHT·IC,H OR BITHO
END;
END HilT;
l!~iT:
DIS
TeNTl
'"
133
DO,
MIIV
MDV
Pl,#8I1H
"S
51R1
MOIl
131
...
,.
...'"
,....
132
142
14'
IF BCDUHTl6J-' Tf£N
Mav
MOIl
MOV
'N
RET
A,It-1
T,A
eNT
IU',#RDf
@lRXI,#B1H
; POI NT AT BCOUHT
RXIJ."'[H
@RU.#UCIH OR BITMO}
TCNTT
; EHD
or
PROGRAM
'NO
Figure 22. Interrupt Driven Serial Receive Program
codes such as those used in synchronous data communications (e.g. BISYNC or SDLC). BCH codes,
named for their originators Bose, Chaudhuri, and
Hocquenghem, are characterized by having a length
of n=2m-l, The number of redundant check bits
can be mt where t is a positive integer (clearly mt
';;;;n), The 31,26 code fits this format with m=5 and
and t= I. The length of each message is n=2 5-1 =31
with 5* I redundant bits, leaving 26 bits available
for. data transmission, With an appropriate polyAll mnemonics copyrighted @ Intel Corporation 1976.
nominal BCH codes can detect all errors consisting
of 2t error bits and all burst errors of mt or fewer
bits. The 31,26 BCH code will therefore detect any
erroneous messages with I or i errors or bursts of
errors of less th~n 5 bits, The 31,26 format (shown
in Figure 23) requires the reception of a start bit
followed by 31 infonnation bits, clearly beyond
the cap;:tbility of the USART but perhaps within
reach of a program controlled approach using the
MCS-48 itself.
'
.
1-18
inter
AP-24
Figure 23. 31,26 BCH Code
A concept which reduces sensitivity to frequency
deviations and thus allows the reception of longer
codes is shown pictorially in Figure 24. The first
line of this timing chart shows an alternative ones
and zeros pattern on the RxD with a period of S
milliseconds. The second line shows that by
sampling at a period of exactly S milliseconds the
data can be properly interpreted. The third and
fourth lines show the effects of sampling with a
period of six and four milliseconds respectively. In
either case, an error occurs at the third sample
where both periods result in sampling on an edge
of the RxD signal. The third line of Figure 24
shows a hybrid sampling scheme which, based on
some additional information, switches sampling
periods between the two values. As can be seen in
Figure 24, the data is sampled with a 4 milli~econd
period until the sampling begins to fall behmd the
data; at this point the sampling period is increased
to six milliseconds and the sampling first catches
up and then passes the center point of the data. As
soon as this happens, the sampling period reverts
to the 4 millisecond period and the cycle repeats.
It can be seen that this scheme sets up a pattern
which repeats indefinitely and the data can be
successfully sampled. Note that the sampling pattern
established is alternating periods of four and six
milliseconds. The average period of this pattern, as
might be expected, is Smsec. Line 5 of Figure 24
shows the effect of a change in transmission speed
to a period of S.5 msec with no change in the
sampling time. The sampling is again successful but
the new sampling pattern is 4-6-6-6; 4-6-6-6, etc.
Note that the average sample is again equal to the
period of the received data (S .S). While this scheme
1
does seem to work, the question of what additional
information is needed remains.
The MSC48 must somehow decide when it is drifting out of synchronization and take corrective
action. By referring back to Figure 24 it can be
seen that if the MCS48 could determine where the
edges of RxD occurred with respect to its sampling
times then the additional information would be
available. As can be seen in the figure the choice of.
sampling period can be based on the following rule:
If an edge on the RxD line occurs during the
first half of the current sampling period, then
use the short period for the next sample. If an
edge occurs during the second halfof the period,
then use the long sampling period for the next
sample.
If the data on the RxD line does not change, of
course, the MCS-48 will drift out of synchronization
just as the original algorithum did. As long as edges
occur on TxD, however, synchronization· can be
maintained. To maximize the allowable time
between edges, the following addition could be
made to the above rule:'
If no edge occurs on the RxD line during a
sample, then change sampling period from short
to long or vice versa.
Note that this addition to the rule will result in
using an average of the two sampling periods when
no edge occurs for several bit times.
The edges of RxD can be easily detected by the use
of the same structure (the Exclusive - NOR gate)
which was added to the MCS48 in Figure 20. This
gate, which .is used to detect the edge on RxD
which begins the START bit, can naturally be used
to detect any edge. Since the timer is being used to
time the bit period, however, the event count input
(T I) is not useful during the receive itself. By connecting the output of this gate, however, to the
00 input to the MCS48 (see Figure 2S)' it is
possible to detect edges on RxD with the event
counter when the program is trying to detect the
START bit and by the external interrupt when the
program is using the timer to control the sampling
times.
Smsec PERIOD
5msecSAMPLE
2. 5msecPERIOD
6msecSAMPLE
3
Smsee PERIOD
4msecSAMPLE
4
5msecPERIOD
HYBRID SAMPLE
-l~~~--1.-'..J.....!!....I...'-'-.!C.J..::..J..--"-J...::..J-"-...I..
5. 55msecPERIOO
HYB RIO SAMPLE
-l..:...J..cc...L...::...L."--'-"'::""'.L...::....L.:-'....::....J....::....J'--'.....L..'--'-;-
Figure 24. Various Sampling Alternatives
1-19
inter
AP-24
Because of this edge detection it is important to
condition RxD with hardware filters to ensure that
the edges of RxD are clean. Any ringing will cause
repeated CALLs to XISR and probable erroneous
operation. The changes to the START process
(Figure 26c) are two-fold; first the TIMER is set to
one half the average of the two sample periods
when the START bit is first detected (BCOUNT
[6) = I), and second the processing of the edge
information, is initialized by presetting SNAP and
clearing P27 .
SNAP is preset so that when the reception of data
actually begins (Figure 26b BCOUNT [7) = 0), the
decision block which tests SNAP against LIMIT
will be initialized. This block actually compares the
value in SNAP with a LIMIT value which is used to
determine if the sampling point is ahead or behind
the actual midpoint of the serial' data. If the
sampling is ahead then the timer is set for TMIN;
if the sampling is behind then the timer is set for
0
x,
x,
AD
'NT
R,O
D
T,
WR
PAOG
ALE
P"
P'B
P'5
P"
P'B
P'5
p,.
p,.
P"
P"
P"
P,O
P"
P"
P,o
0,
DB
05
D.
03
0,
0,
00
TO
'5V
·V ee
Voo
ss
PSEN
Vss
EA
}.~
}..
RESET
Figure 25. Modified Edge Detection
A modification to the program of Figure 21 which
implements this new sampling algorithm is shown
in Figure 26. The first deviation from the original
program is the addition of a routine (XISR, Figure
26a which is called when an external interrupt
occurs (Le. when an edge occurs on RxD). This
routine saves the status of the running program and
then stores the current value of the timer register
in a location called SNAP (R5 of RB I). After
doing these operations the program complements
bit 7 of port 2. Manipulating P27 in this manner
will cause the Exclusive NOR gate to turn off the
'external 'interrupt' and will set it up to generate
another interrupt when the RxD line changes again
(has another edge).
NO
-L__________- L__~~.
Hybrid Sampling Flowchart
Hybrid Sampling Flowchart
1-20
AP-24
lOC
OBJ
SOURCE STATEMENT
SEQ
SERIAL INPUT USIHG MCS-48
THIS CODE ASSlA'IES HARDoIARE
SH[WoI IN fie. 25. PROGRAI'I
IS SIMILAR TO PREVIOUS
ONE. A I'IIJRE S(J'HISTICATED
SAI'f'L INC, AL(iDRITI-t'I IS USED
YES
,.
11
NOTE;
A PLII'I II KE LANGUAGE WAS USED
TO CD"I'IEt'lT THIS LISTING AND
SEVERAL OTHERS '1'4 THIS NOTE. NO
C(J'f'ILER EXISTS fOR THE MCS-48.
12
13
14
THE CIl1'lENTS WERE 'HAtm
IS
CiM'ILEO' 11'410 ASSEMBLY COD[
16
17
••••••••••••••••••••••••••••••••••••••
I.
19 : ------21 ; EQUATES
....
,117
1115
"12
nla
liZ'
11'<11
"05
"09
frEe
IIZI
1124
21 : ----.-22
23 ATE/'P
[OU
2"
25
2G
27
28
[au
BCOUHT
SNAP
COUNT
R.IIO
SITNO
[QU
[OU
[OU
EOU
29 liMIT
EOU
31
31
32
33
3<11
[OU
[OU
EOU
[OU
EOU
mAX
TMIN
HALF
SER9Jr
RDr
.7
os
; STQRA(;( FOR A DUR I HG I NT(RUPT
j CONTAINS NlJfII9ER Of BiTS IN M5G
.5
; TAICES TlI'ER SNAP SHOT ON IUD EDGE
.2
21
;
;
;
;
·43
; MAX SAl'PLE PERIOD
-39
; MIN!,.."... SAl'PLE PERIOD
; HALF HOI'IIHAL PERIOD
••
32
-21
21H
2OTQN[: MOV
"
A,caWH
10'-'
A,PTOS
,
A, :tellH
PTOS,A
COI..INT
CL'
MIlV
.3
""
; SET TXD TO CARRV
, .--------------------------_.--
"
MOV
M()V
MOV
A,CHAR'AV
GOTOHE
e
A,Burr
PTOS,A
COUNT,tlU
CHARAV, liB
'ET
; END Of PROGRAM
,"0
AP-24
CONCLUSION
This Application Note has presented a very small
sampling of the application techniques possible
with the MCS-4S™ family. The application of this
new single chip computer system to tasks which
have not yet yielded to the power of the micro:processor Will present a fascinating challenge to the
system designer.
GENERATING PARITY
Many communications schemes require the generation and checking of parity. If a USART is used
it can be programmed to automatically generate
and check parity. If the communications is handled
by software within the MCS-4S™ then the program
must perform parity calculations. Calculating
parity is easy if one remembers what parity really
means. A character has even parity if the number
of one bits in it is even. A character has odd parity
if it has an odd number of ones. The program segment shown in Figure 29 can be caused to calculate
parity. It starts by setting a loop count to eight and
lOC
OBJ
SEQ
SOURCE STATEI"£I'IT
2 ; ••••••••••••••
3 :
.tIj
;
.
PARITY
5 1
THIS PROGRAM GENERATES PARITY
6;
ON THE ACCLnllATOR
7 1
CARRY WILL BE SET IF A HAS ODD PARITY
:
'3 \ ••••••••••••••
""
12 ; .-----13 : EQUATES
'"; ._-----
IS
1112
111.
.'81 BAIB
111297·
16 COUttT
17
Ie PAR:
"22"
[QU
OR.
MOIl
CL.
. ..
11tH
COUHT I # 8
C
21
1183 77
.'."'217
"16 A7
23 LOOP:
J.t
25
27
2.
ePl
•
: SET LOOP COUNT
; INITIALIZE CARRY
: fOR EACH ZERO BIT IN A
; CQrlFLEf'llENT THE CARRY FLAG
OVER
e
; £I'ID OF PROGRAM
'""
Figure 29. Parity Generation
clearing the CARRY flag. After this initialization a
loop is executed eight times. During each execution
the accumulator is rotated and the least significant
bit is tested. If the bit is a zero the CARRY flag is
complemented, if the bit is a one no further action
is taken. Since an even number of zeros implies an
even number of ones for an eight bit character,
after all eight loops have been accomplished the
CARRY bit will be set if an odd number of ones
were encountered; it will be reset if the number
were even. Since the RR instruction does not
involve CARRY the net result of executing this
program loop is to set CARRY if parity is odd
without effecting the character in the accumulator.
All mnemonics copyrighted @ Intel Corporation 1976.
1-24
-
-
inter
APPLICATION
NOTE
Ap·40
June 1978
• Intel Corporation, 1978
1·25
9800755
intJ
AP·40
INTRODUCTION
This application notes presents a software package for
,interfacing members of Intel's MCS-48™ family of
single-chip microcomputers with keyboards and displays using a minimum of external components. Because of the similarity of the architectures of the various members of the family (the 8035, 8048, 8748, 8039,
8049,8021, and 8022 microcomputers; also the 8041 and
8741 universal peripheral interfaces in the UPI-41'"
family), the code included here could run with minor
modifications on any member of the family.
Since keyboard and display logic can be just one of
several functions handled by a microprocessor, the
added cost of including these functions in a system is
minimal. In fact, considering the extremely low cost of
standard X-V matrix keyboards and integrated displays,
their use is often more cost effective than even a handful of discrete switches and indicators. Thus, the additional flexibility of keyboard input and display output
can be added to inexpensive consumer products (such
as games, clocks, thermostats, tape recorders, etc.),
while producing a net savings in system cost.
In traditional digital system deSign, various hardware
registers or counters were used to hold binary or BCD
values which had to be conveyed to the user. The standard way of presenting this information was by connecting each register to a seven-segment encoder (such as
the 7447) driving a single display character, as represented by Figure 1. Thus, two ICs, seven current limiting
resistors, and about 45 solder joints were required for
each digit of output. Consider how traditional techniques might be (mis-)applied in designing a microprocessor system: the designer c )uld add a latch, encoder,
and reSistors for each digit of the display. Still another
latch and decoder could be used to turn on one of the
decimal points (if used). The characiers displayed could
only be a sequence of decimal digits. In the same vein, a
large matrix of key switches could be read by installing
an MSI TTL priority encoder read by an additional input
port. Not only would all this use a lot of extra I/O ports
and increase the system price and part count drastically, but the flexibility and reliability of the system
would be greatly reduced.
+V
Since each potential application will have its own
unique combination of keys and display characters, the
program is written so that very little modification is
needed to interface it with a wide variety of hadware
configurations. In general, the only changes required
are within the set of initial EQUates at the beginning of
the program.
a
Along with the basic software for driving a multiplexed
display andlor scanning and debouncing an X-V matrix
of key switches, a collection of utility subroutines is
also included for implementing the most commonly
used keyboard and display utility functions, such as
copying simple messages onto the display or determining the encoded value of each key in the key matrix. As a
result of the versatile architecture and applications"
oriented instruction set of the MCS-48 family, the entire
package fits into about 250 bytes of internal program
ROM or EPROM, leaving the rest of the ROM space for
the program to cook the perfect piece of toast, or whatever. By tailoring the software to match a known hardware configuration, or by selecting only those functions
needed for a given application, the' program size could
be even further reduced.
Since what is being presented in this application note is
a software package, rather than the usual hardwarel
software system deSign, the format of this note is somewhat different from most - it conSists primarily of a
long program listing reproduced in the following pag,es.
For the most part, the listing is self-explanatory, with
comments introducing each subroutine and major code
segment. Some parts of this introduction are repro, duced in the program listing itself, explaining the configuration of the prototype system. However, an additional bit of explanation would make the listing easier to
understand, especially for those readers unfamiliar with
the concept of multiplexed displays and keyboards.
CIRCUIT REPEATED FOR EVERY DIGIT OF DISPLAY
(DOTS USED TO INDICATE SOLDER JOINTS)
, Figure 1. Wrong Way 10 Design Multiple Digil Displays lor
Microcomputer Systems
1-26
AP·40
Instead, a scheme of time·multiplexing the display can
be used to decrease costs, part count, and interconnec·
tions, while allowing a wider range of character types to
be used on the display. The techniques used here are
fairly typical of today's integrated subsystems designed
especially for controlling keyboards and displays (such
as in calculators or the Intel@> 4269,8278, and 8279 Key·
boardlDisplay Controller Devices).
to be displayed, and turns on the appropriate segments.
With the next character now turned on, the processor
may now resume whatever it had been doing before. The
whole display updating task consumes only a small frac·
tion of the processor's time.
In a multiplexed display, all the segments of all the
characters are interconnected in a regular two·dimen·
sional array. One terminal of each ,segment is in com·
man with the other segments of the same character; the
other terminal is connected with the same segments of
the other characters. This is represented schematically
in Figure 2. A digit driver or segment driver is needed for
each of these common lines.
1SEGMENT
J DRIVERS
_m __ __ __ __
__
w
_
~
~
~
~
SEGMENTS SEGMENTSSEGMEflHSSEGMENT5 SEGMENTS SEGMENTS
D~T_
~!!...
~c!!...
~~
_D~T
_~IT
1DIGIT
I "a" SEGMENTS OF
J All
J DRIVERS
DIGITS
~;-t-"",-:+-"",-:+-"",-:+~-:+~d-l"b"sEGMENTSOF
J ALL
DIOlrs
~;-,-t~;-,-t~rl-~t-"-'"t-""""-+- !"C"SECMENTSOF
J ALlDIGLTS
CURRENT
SOURCED
"
Figure 3. Segment and Digit Drivers used with 6·Posltlon, 7.Segment
LED Display
-'<":'""r--'C':""r--=-t-"'C:"-+-""'"-+-"""+- 1"d"SEQMENTSDF
J ALL DIGITS
SEGMENT
DRIVERS
~-::.rl~-::.rl~c1-,-""!-","+---=+- j ..... SEGMENTSOF
JOIGITS
-rir--,--1r--=-r--"'"'"+-"'"+-"""+-I"'''SEGMENTSOF
I DIGITS
-~!-~f-'-""!-"""+-""O':-+-~+-l "g"SEGMENTSOF
J ALLOIOITS
-ri-rir--;;:-:-r--"'"'"t-"'"'"+-",,-"+-
I
DECIMAL POINTS
, ALL DIGITS
OF
Moreover, since the computer rather than a standard
decoder circuit is used to turn the segments off and on,
patterns for characters other than decimal digits may be
included in the display. Hexadecimal characters, spe·
cial symbols, and many letters of the alphabet are pas·
sible. With sufficient imagination this feature can be ex·
plaited for some applications, as suggested by the
examples in Figure 4.
CURRENT SUNK BY
DIGIT DRIVERS
Figure 2. Schematic Representation 016·01gll, 7·Segment
Common·Cathod LED Multiplexed Display
,L"-'
,'- '- '-, '-,,-,
The various characters of the display are not all on at
once; rather, only one character at a time is energized.
As each character is enabled, some combination of seg·
ment drivers is turned on, with the result that a digit
appears on the enabled character. (For example, In Fig·
ure 3, if segment drivers 'a', 'b', and 'c' were on when
character position #6 was enabled, the digit '7' would
appear in the left·most place.) Each character is enabled
in this way, in 'sequence, at a rate fast enough to ensure
that the display characters seem to be on constantly,
with no appearance of flashing or flickering.
'I
L
, L'L
'I I I
,-, L/Il ,
In the system presented here, these rapid mOdifications
to the display are all made under the control of the MeS·
48™ microcomputer. At periodic intervals the com·
puter quickly turns off all display segments, disables
the character now being displayed and enables the next,
looks up the pattern of segments for the next character
,-,-, , 'I
'
'-'-'-, ___ -
/,- 1,/,
d=
III
Figure 4. Examples '01 Typical Messages ,Possible with Simple
7·Segment Displays
1-27
AP·40
As each character of the display is turned on, the same
signal may be used to enable one row of the key matrix.
Any keys in that row which are being pressed at the time
will then pass the Signal on to one of several "return
lines", one corresponding to each column of the matrix.
(Sell Figure 5.) By reading the state of these control
lines, and knowing which row is enabled, it is possible
to compute which (if any) of the keys are down. Note
that the keys need not be physically arranged in a rectangular array; Figure 5 is merely a schematic.
COLUMN 1 COLUMN 2 COLUMN 3 COLUMN 4
REtURN
RETURN
RETURN
RETURN
LINE
LINE
LINE
LINE
TO SWITCHES
ON ADDITIONAL
RETURN LINES
FROM SWITCHES ON
ADDITIONAL SCAN LINES
machine cycles. :One machine cycle occurs every 30
crystal oscillations for the 8021 and 8022, or every 15
oscillations for all other members of the family.) A more
detailed explanation of these variables is included in the
listing.
Port assignment is also at the discretion of the user all port references' in the listing are "logical" rather than
physical port names. The port used to specify which
character is enabled is referred to as "PDIGIT". The output segment pattern is written 1-0 "PSGMNT" and the
keyboard return lines are read by "PINPUT". These
logical port names may be assigned to whichever ports
the user pleases.
By way of example, the breadboard used to develop and
debug' this software used a matrix of 16 Single-pole
push buttons and an 8·character common-cathode LED
display with right·hand decimal point. No decoders external to the 8748 microcomputer were used; all logic
was handled through software. PDIGIT was the 8-bit
DUS, PSGMNT was port 1, and PINPUT was port 2. The
drivers used were 75491 and 75492 logically noninverting buffers: high level inputs were used to turn a
segment or character on. Pull-up resistors were used on
the 8748.output lines to source the current levels
needed by the buffers. The 8748 was socketed on the
breadboard, and was driven with an inexpensive 3.59
MHz television crystal. The short test program included
in this listing was used to echo key depressions as they
were detected, and ·to invoke four demonstration subroutines. A summary of the subroutines included in this
listing with a short explanation of the function of each is
included in Figure 6; Figure 7 shows how the various
utilities interact.
Figure 5. Schema'ic of X- Y Ma'rix Mulliplexed Keyboard
KBDIN
Since each character Is on for only a small fraction of
the total display cycle, its segments must be driven with
a proportionately higher current so that their brightness
averages out over time. This requires character and seg·
ment drivers which can handle higher than normal levels
of current. Various types of drivers can be used, ranging
from specially designed circuits to integrated or dis·
crete transistor arrays. The selection depends on
several factors, including the type of display being used
(LED, vacuum flourescent, neon, etc.), its size, the
number of characters, and the polarity of the individual
segments. Some drivers have'active high inputs, some
active low. Some invert their input logic levels, some do
not. Some require insignificant input currents, some
present a considerable load. Some systems use externallogic to enable one of N characters or to produce the
appropriate segment pattern for a given digit, some systems implement these functions through software.
CLEAR
ENCACC
WDISP
RENTRY
PRINT
FILL
ECHO
RDPADD
HDLD
Because of these and the other variables which make
each application unique, provisions are made in the first
page of symbol EQUates to allow the user to specify
such things as the number of characters In the display
or the polarity of the drivers used, and the program will
be assembled accordingly. The display is refreshed on
each timer interrupt, which occurs every 32 x (TICK)
DELAY
Keyboard Input. WBits until one keystroke input has been received
from the keyboard. determmes the meaning or legend 01 that key and
returns with the encoc:led value In the accumulator.
Blank out the display
Encode accumulator with bit pallern corresponding to the segment
pattern needed by the dIsplay to represent that symbol or character.
Uses the value of the accumulator when called to access a table can·
talnlng the patterns for all legal mput values.
Write into Display. Writes the bit paltern In the accumulator mto the
next character pOSition of the display Maintains a character position
counter so thaI repeated calls Will automatically write characters inlo
seQuenttal pOSItions
Righl·hand Entry. Siores the accumulator segment pattern In the
display In the rlghl·most character position. ShIfts all other characters
to the lell one place
Print a siring of arbItrary characters onlo the display. Useful for pro·
mpt.ng messages warnings. etc Uses a lable 01 segment patterns In
ROM. so thaI messages Will not be restncted to numbers. letters. elc.
Fill the display With the character pattern In the accumulator. Useful
lor writing dashes. segment test patterns. etc .• IOta all character posi·
tlOns
Walt for a key to be pressed by the operator and wrile that key onlo
the display Used for providing feedback to the operator when enter·
Ing numeric data. etc
Adds or deletes a deCimal POint to the character at the tlght·hand Side
of the display. lor entering lIoating pOint numbers
Called when a key IS known to be down Does not return until all keys
have been released. Used lor organ· type keyboards. or when some ac·
I.on should not be Inlflated unltl the key invoking that acllon has been
released
PrOVides a crude real·tlme delay corresponding to the value of the ac·
cumulator when called. Can be used 10 cause d.splay characters 10
blink. to momentarily flash Information. to enable a buzzer. elc Could
also be used by the program when delays are needed. such as to slow
down the computer reaction rate while playing a g:ame againsl the
human operator.
Figure 6. U'lII'y Subroutine Deflnilions
1-28
AP·40
MAIN BACKGROUND PROGRAM
I
CLEAR
I
FILL
I
I
.J+
I
PRINT
ECHO
RDPADD
KBDIN
ENCACC
RENTRY
DELAY
HOLD
Figure 7. Subroutine Interrelationships
I
2"[,lsf,otJ
•
•
J~
~CC VDO
75491
.13
"
f"F
~
."d" . .,..I.,... j"d'P."j
F'E'ElPr'F'F'r'l
=1. -'. _. ~. ~. ='. !:i. ='.
."S"
_"b'
"~"
_lEF!:~,?~!
'------'
I.
~
~
15492
0@@J:
@@}@D
I I
II
ALE
3<
! ! 1
"
pli
"
"
"
I.
I.
"·~"(E
I.
~
~::~:
N.C.~
.!!
N.C •
~
I
P20
P21
EXPAN~g: ,~ P••
13
75492
8748
13
II
II.
•
':: I!-
33
I'
P••
35
38
I
3'
38
--"~-""-
l~
Flgu"; 8 Prototype System Schematic
1-29
~~fN.C.
:::~
31
32
~
CD@@JD
T1
iNT
30
"
I~\\'::A~~:~
TO
211
;5491
55
2'
20
---'
N.C.-:
N.C..2
0®®=
-=
j
-l1l.!.\,J,J
"e'
h~~ T' 'y....
AP·40
1515-11 H(;S-48/1j;"1-41
MAC~J >\SSEf1lllE~,
'.12 [J
ANfJ lNfEl 11(5-48 fH'BllftFL'tl5F'LH" Hl'PLl(AllOll NC,TE APPElt',!,:
LOC iJBJ
1 SHAU'oF I LE ~\~'EF
2 nITLE' 'AF'40, WTEL
M(~:-48 I:E~Bl;HflD,'['ISPLH"
HPF'LII)ITIOtI NOTE APPENDIX",
4 ,THE FOLLi.MING SOFTIoiAPE P~iClAGE PP.O,,'WE5 fI 51:VEN SEliI1ENT [,ISF'Lfili
5 ,INrEP.F~Cr. Hili mC~~(lCO~1FIJTER~ iN THE lNTtl ;n-4S Fflt'!IL'y'
,; ,THE CODE IS WP.I HEN SO THAT VAl<' lOLlS HHFfll4APE
7 ,CI.lltFIGIJF.'fl1 IONS CAN f>E Al);.)t10(!ATE.[' 8'T' F.E[l£I' !t.JIIIj [HE HlI lIill "'~:IABLES
8 , IN MOS r 5ITUftTiONS, THE ~E','80Aj;'t'/IiL5FLH1' lUTERFFtCE WILL BE ~'W.lIRE[\ '\G
9 ,iMF'lHIEln MO.E. SOPfHSTIGfiTE[; ,:INGLE-CHiP Sl'5IEMS (c.~LL'lJuno~':;:, ,fflLE.S, CLUI.'f..5,
19 ,!:.Te, ), WITH SE('T!()NS OF THE FGLLl.lWINb un 3E'LECTEIJ AND i'liHF!E[> AS NECESSAfI"
11 ,FO~' mCH tlPPLl CATION
1<: '
~: ,A SINGLE SUflPWllNE «(fUEi) f;UJ.'SH! IS CISEu TO IMf'WlENi BOTH THE DISf-'Lkl'
14 ,joJIJLTIPLD:INlj AN[, ~E'y'BOftRt' SC,lUN1Nlj. 1J<,1N(' THE SRt11: ~j(jNAl BorH TO EIlABLe
15 ,ONE CHfiI?AClt~' OF THE DISFLA',' F1f4\ ,0 STROBE ONf ;;'0101 OF ,fit i(-Y ~'E'" tlffTPlt!
16 ,IHE SUIWOUTIPlE MI.I5T BE CfiLl,£[; ';lIFf'l,:mHL,' 0HEU 11) HISIJIlF. rH~ vISI'Lfl'i
r' ,CHf1F:AC1E~':, riO NOT FLlCKH'- Ai LEAS T 5.,1 tt)I1F'LETE DISPl.A" SefiPlS PER ~.ECONv
1:3 ,TO Hl(Wl0[JATE SWITCHES (If Aj;'t>lTRH~Y CflEFtPNESS, [HE DElMJNCE TIME GAP! BE
19 ,sn T,) BE ANI' [>tSIPED NI.lMBER or CONFUTE SlANS
28 ,THUS THE llEBi)IJNCE THfE IS H FUUCTION OF 80TH ,HE SCHN kFilE AND ,HE VALlJ!:.
i1 .,0F CtJNS rANT 'VEBNCE'
2i .'
~~ ; It! THIS Ll~T1NG, THE INTE~NAL ilME~' IS I)SE~TQ IjEt;EPAIE INTERRLlP'I5 THAT
24 ,SERVE AS A TIME BASE FOR THE PEFP[SH 5UBPOllTltlE
<:5 ,ALTERNATE mlE BASES MIGHT BE fiN EXTEPNAL u';CILLAi..w q)~I'JWI.l THE It-llERI TlRET
]0, mINT ~ElURN) GOIJl[, STilL BE I,;SE[1 TO ::;AVE AND "ESlOPE A(CtiMULflTOt.' CONTENTS
}1, THE INTEPFUF'l SEF.'\'ICIN(; flOI)TINE SELECTS J.'EGlSTE.' BANK 1
n ,FOP 1HE NEEVEli REGISTERS
2.3 '
A',
0:5 "Wi"lTWI I::Y JOHN WHfIRTUN, INTEL SIIl(;LE-CHIP COt'lf'UTER ftPPLlCATIOr4S
]6 '
'j,i !EmT
All mnemonics copyrighted @ Intel Corporation 1976.
1·30
AP-40
ISIS-II r1(,s-48.'UPI-41 i'fHCPO flSSEMBLER, V';: B
INTEl MCS-48 KEYBOAl1[,/IiISPLfi',' RPPLlCAflON,NOTE APPENIiIX
flP48
LO(' CIB]
SEO
SOUIICE STATEMENT
s8 ,IN iHIS Ii1PLEMEtHtil WN 'jF THE [015PUI'~ SCAN. IT 15 ASSUMED "iHfH THEilE WILL
:;9 "BE I"El.AlI','EL" L1TTl.E 1/0 OTHEII THAN ~,)", THE KE'r'BOfW[i/[OISf'LA',
4e ; IF HHS 15 THE CASE. THEtl THERE I~ NO NEED FOil FI.l~ RN'" AWIiIONAL EXtEPNAL
41 ,LOGIC (SUCH f6 ONE-of-ElGH1 DEW[OEI"S 011 :;E'~EN-SEGt1Hn ENCODERS), THOUGH
4~ ,THE~'E
43
44
45
46
47
48
49
5e
51
52
5~
:,4
55
16
'i,
58
59
6@
61
62
6,
64
65
66
WILL STILL BE A HEEl) FO~' CU~'REN1 OR VOLTAGE Dl HAT!,:!,', WEIi:E tlECTi<'ICftLL',' OPGANI:;ED
92 '
IN A 2:<8 ARRAY, ONLY TWO RETURN L1tlES Wt)IU BE NEEDED.
93 ;
i1N THis CASE, PEPHAPS Tii it,ll" 11 COllLD BE I)sE[J FOR INF1JT BIT::' "
94,
95 ,PULL -uP I<'ESISTfJRS ON THE
IIETI~N
LINES I'IIGHT BE III ORDEI< IF
THE~f
15 AN"
96, POSSIBILITY Of A HIGH-li'1PEDENtE CONDUCTIVE PHTH THRW(,H THE SWITCH WHEN
9, ,IT 15 SlIPF'OSED TO BE 'OPEPI'.
98 ,(THIS PHEHOI'1ENON HAS ACTlIALL'1 BE!:N (.BSERVEL· ;.
99 ;
10!:l , THE r~I"'ER5 USED IN THE pFiOTOlYPE HEf.'E ALL NON- INVERTING IN THAT
1~1 ; A HIGH LEVEL ON tlN WTPUT lINE b USED TO TIJRN Ii CHflRRCTEfi OP SEGMENT ON
192 . THERE ARE A TOTAl. OF SEVEN 1/9 LINES LEn (lVE~
1tl?
104
195
106
;
.
• THE ALOORlTHII FOIi: Llff'ECTl VEL ~'J
122 ,
123 ; THE K~YBOAR(l SCANNING ALGORITHM SHOWN HERE REQUIRES fl ~EY BE DOWN FOR
124 ; SOlE NlIHBER OF CO/1PLETE DISPLAY SCAN::' m BE ACKNOIoILEGED. SINCE IT IS
125 ; INTENDEv FOR '()£-F INGEll' OPERATIVN, Two-KEi' ROLLOI/ER/N-KEi' LOCKOUT HAS
126 ; BEEN IIIPLEMENTED HOIoIEVEFI, MOOIF (CATIONS IoIOll.D BE POSSIBLE Til ALLOW. FOR
127 ,EXAI1PLE, ONE KEY IN THE MATR1:, TO BE USID AS A SHIFT KEi' OR CONTROL KEY
128 • TO BE HELl) DOWN IoiiILE ANOTHE~ KEi' IN THE MATRI~ 15 PRES5Ev (SEE HuTE WITHIN
1~9, THE BOO',' OF THE LISTING, )
130;
131 SEJECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-32
inter
AP·40
~~
PAGE
INTEL I'IC5-48 KE't'EOAFDlvI5PLAY APPLICi1TION NOTE APPENDiX
ISIS-II I'1CS-48/UPI-41 MACRO ASSEtlBm', '<'2
AP49
Loe OSJ
SEQ
4
SOIJRCE STATEt1EIlT
122 ; (BE flWARE THAT NO t'10~:E THAll TWO fl',':; CAN ~VEP BE D(j,IN UNlESS (,lODES
13:; ,ARE !'LACEr' IN SEkIES WITH ALL OF THE ~WITCHE5- CERTiHNl\' NOT THE CASE FOR EL
134 ,CHEAPO I\E't'BOARDS- BECAUSE SOME C,IMBINATIONS OF THREE KEYS ['oWN WILL RESULT
135 ; IN A 'PHAtHIJI'I FOURTH m' BEING p~RCm,'f.[,
136 ,THE PHANTOM rE',' I~OIJlD BE THE FOURTH CORNH" WHeN I HPEE KE'iS FORrmlG
E7 ,A "'ECTANGIJLftP PATIERN I IN THE ;':-'i ~E'r' /-IATRIX', ARE IXlWN \
E8 ,IF (HOOES H!<'E PLACE!: III THE SCrilllllNG MRRA'i, CONSiDERATIONS MUST BE NAvE
139 ,AfiOliT HOW THE DIODE VOL TAGE D~:OF' WILL fiFFEcr lHf'UT LOGIC LEVELS
140,
141 ; WHEN f, [iEBOIJNCEI> tH 15 DETECTE(', THE NUMBER 01' ITS POSITION IN THE f'El'
14~ ,MATRIX (lEFT-TO-I1IGHT., Bonurl-TO-TOP, STARTING FROM ell) IS PLACED INTO
143 ,PAM LOCATION '~B['I!IJF' AN INPUT SlJB~OIJTlNE THeN NEED ONL ... READ THIS LOCATION
144 ,I"EPEATE[I\. ... TO ~lERMINE WHEN H f:E',' HAS BEEN PIIESSED WHEN A ~El' IS DETECTE[,·
145 ,A SPECIAL COOE BYTE ~HOULD BE WRITTEN BAC~ TO INTO 'KBDBlIF' TO PI/EVENT
146 ; REf'EftrEf' fHE(! IONS OF THE SAt1£.KEI'
147 ; THE "'OUTINE 'KBDIN' DEf'lOI15TP.fliE A Tl'PICFt!. INPlIl F'ROlOCOL. ALONG WITH f1 METH(I[I
148 ,FOR TRANSLATINu A KEY posmON fO ITS ASSOCIA1ED SIGNIFICfiNCE SI' AC(b~,INJ.j
149 ; TABLE 'LEGN(;S' HI P.Ol'1.
150 '
151 SEJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-33
inter
Ap·40
ISIS-II l'lCS-4~/UPHl MACIIO ASSEt·1EUR, 112. tI
PIIIjE
flP4/3' INTtL 1'1(5-48 kEI'BOAPMHSI'Lft\' APPLICATION NOTE APPENIH:\
Lor liBJ
ae10
eOOB
0009
SOIJPCE STATEtlENT
SEQ
152 ,*'U HA ."'...'" ~ 1*"'*... ·H.t<*.j<****~***.**.t**********"'************** .
!'5} •
1'54, ' - INITIAL EQUATES TO DEFINE SYSTB'I CONFIGURATION
155 .
156 ; ******H"..t***.t<*",,,,**.t<**.********.t<*** .., ,..********************
157 ;
158 PD!GIT W)
; USED TO ENABLE CHARACTERS ANI) STROBE ROWS OF KE'IBOARD
BUS
159 P5Gt1NT EOli
,USED TO TURN ON SEGHENTS OF CURRENTLY ENABLED DIGIT
F1
1613 PINPUT WJ
P2
,PQF:T USED TO SCAN FOR KEY CLOSURES
; (NOTE THAT THIS POIIT ALLOCAllON USES THE HIGHER
161
; CURRENT SOIJRCING ABILlT'r' OF THE BUS TO SWITCH ON THE
162
; DIGIT DR I '/ER5, AND LEAVES P23-P20 FkEE FOR USING
163
• AN 8243 PORT EXPAN\)E~' I H !HE S'~STEt1. )
164
165 ;
166 POSLOG tOU
167 NEfiUXi EllIJ
168 .
POSLOG ; DEFINES WHETHER OUTPUT LINES ARE ACTIVE HI OR LOW
E9 CH~FfJL. Ef,iIJ
1iO SEGPOl . COl)
POSLOfj ,\FOR [:'RI','lNG CHAIIACTERS fIN!) SEG1'IENT PATlERIIS
0HII-i
,ru INES 8lT5 IJSED AS INPUT
171 INPHSK Erill
1('2
I
1n CHARNO EOIJ
~0F
5
174
flllO~1S
175
176
1;7
178
1,9
188
181
182
183
184
185
1-lC~LS
6
E"QU
.
TICK
WJ
['EBNf..E b)lI
8LAttr. WU
;
ENCI'l5k EW
.
SEJECT
; NUt1BEI1 OF (llGllS IN OISf'LA't'
t'F KEYS ,LESS THffN OR EQUAL TO CHARNQ)
,LE5SEf' DHiENSION OF KEYBffiRD MATRIX
,~·ows
E,tU
-1SH
4
00"l
• [:ETEliI'1lt1ES INTERRUPT INTERVAL
. NUMBER OF SUCESSIVE SCANS BEFORE KEY CLOSURE ACCEPTED
.' CODE TO BLANI<' 0I SPLAY CHARACTERS.
. (lo!WlD BE 20H IF ASCII DECODING ROO USED OR flFH IF
.7447-WPE SEVEN-SEGMENT DEC1JDER EXTERNAL TO 8748)
0FH
,SELECTS WHICH BITS ARE RELEVANT TO ENGACC SUBROUTINE
All mnemonics copyrighted © Intel Corporation 1976.
1-34
-Ap·40
I SIS-II HCS-48/l1P I -41 t1IlCRO ASSEMBLER, V2. e
PAGE
AP49: INTEL HCS-48 KE'r'BOARD/DISPLAY ftPPLICAfIGN NOTE APPENDIX
LOC OBJ
SEQ
6
SOURC,E STATEMENT
186 ,~**********,,***********.j 39
299
HOII
ftOD
MOil
291
MOY
A, ISEGMfif'
A.• CURDI(j
PNTR1. A
fl, @PNTk1
292
293 ,
OIJTL
P5Gt1NT, it
288
289
; LOAf) Ace 101/ NEXT SEGMENT PATTERN
,ENABLE APPROPRIATE SEGtlENTS
294 ; *******.~********,.***************~~**********~**~********~*
295 ;
296 ;
297 ;
901£ B821
002a 9A
THE NEXT CHARACTER IS NOW BEING DISPLAYED.
THE KEYBOARD SCAN R(JIJTINE IS INTEGliHTED INTO lHE DISPLAY SCAN.
WITH THE CURRENT ROW ENERGIZED. CHECK IF THERE AilE ANY INPU1S
298 ; **************************************~***.j<***.j<.j<***********
299.:
309 SCAN.
MOY
PNTRe, tKEYLOC ,SET POINTER FOR SEVERAL KE'r'l.OC REFEIIENCES
391
IN
/1, PINPUT
; LOAD ANY SWITCH CLOSURES
302 ;
303 ; ..................................................#...................... .
304 ; III
THIS BLOCK (IF CODE IS NOT NEEDED 8Y THE KE ....BOApr' SCAN LOGIC
•••
305 .'"
HOWEVEfI, ITS INCLIJ5ION WOULD SPEED THINGS UP A Bll BY
...
3lJ6 ,II
SKIPPING OVER ROWS IN WHICH NO KEYS AilE DOWN.
II.
397 ;..
IT WAS OMITTED HERE TO CONSERVE ROH SPACE, BUT 11lGHl BE
...
30a ,..
RESTORED IF IIEIIY LARGE KEYBOARDS (ESPECIRLL'r THOSE WITH EIGHl
•••
309 ,..
KEYS PER ROW) ARE TO BE USED WITH THIS ALGORITHM
•••
31B: ........................................................... tItI.............
311 ;..
eft
A
; ANY CLOSURES [.oI::TECTED ARE 1m'", ONE 81 T5 tI..
312 ,.11
ANL
A, • I NPMSK
•••
313 ; ttl
JHZ
SCAN!; -IF A K~Y HI THE CURRENTL"r ENABLED ROW IS DOWN •••
314 ,it;
NO KEY 15 NOW OOWN SO THE KE'~LOr COIJNT l'tA',' BE IJPDAIED DIRECTLY ...
:1l5 ;..
~lOV
A. @PHTR0
...
316 ;..
ROO
A, .NCOLS
•••
:m ; it
MOil
@PNTRl!, A
III
318 :..
.IMP
SCAN6
Ill.
319 ; ........................................tItI••••• tll •••••m .................
329 ;..
IF THIS (;ODE IS USED, SUBSTITUTE THE ; Je SCANS' FuUR LINES
...
321: ••
HENCE WITH 'JNC SCANS· TO A(;COI1ODATE THE I HI/ERTED POL~ 1T'r'
•••
322 : ..........................................................................
323 sEJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-37
inter
Ap·40
ISIS-II IICS-48/UPI-41 I1ACRO ASSEt1BLER, 112.8
PAGE
9
ff49. INTEL IICS-48 KEYBOARD/DISPLAY APPLICATION NOTE APPENDIX
LOC OSJ
SEQ
SOORCE STATEI1ENT
.*"'*"'*"'***************************."'***********************
ROTATE BITS THWl/I'JH THE CY WHILE INCREMENTING KEVlOC
326 .; .**********************************************************
327 ,
324 i
325 ;
8921 8004
8923 F7
0924 AC
0025 F63F
328 SCANt: 1101/
329 NXTLOC: RLC
I10V
338
JC
m
ROTt.'NT, IINCOLS
A
I"OTPAT, A
SCANS
; SET UP FOR (NCOLS) LO(fS THFOUGH 'NXTLOC'
SAllE SHIFTED BIT PATTEI1N
; ONE BIT IN CY INDICATES KEY NOT DOWN
i
:>32;
313 ,***************************-1<****************************"'**
334 ;
335 ;
HT THIS POINT IT HftS JUST BEEN DETERMINED THAT THE VALUE
336 ;
OF KEYLOC IS THE POSITION OF A KEY WHICH IS NOW DOWN
I~;' ;
THE FOLLOWING CODE DEBOUNCES THE KE'r', ETC.
33S ,
IF MODIFICATIONS TO THE KlYBOARl> LOGIC, l. E. THE INCLUSION
:m ;
Of A SHIFT, CONTI"OL.. OR MODE KEY Itl THE KEY HATRIX ITSELF)
349 ;
ARE DESIRED, THEY SHOllD BE MADE AT THIS POINT, BEFORE
341 ';
THE DEBOUNCE LOGIC BEGINS. FOI" EXAI1PLb AT THIS POINT
342 .;
KEI'LOC COULD BE COMPARED AGAINST THE POSITION OF THE. I100E
343 ;
KEY, AND IF THEY MATCH SET SOME FLAG BIT AI{) JUMP TO
344 ;
LABEL 'SCANS'. OR, BY COI'fPftRING KEYLOC AGAINST THE LAST
345 i
KEt' DEBOUNCED, IHMIODIATE TWO-KE',' ROLLOVER COULD BE
346 i
IIIPLEl'fENTED.
347 .;
9027 AS
0028 B5
348
349
350
351
,*****************>t-**************************.fc**************
i
(;LR
(''PL
; MARK THAT AT LEAST ONE KEY WAS DETECTED
; \ III THE CURRENT SCAN
F1
.Fi
352 ;
353
i
3S4 ;
355 i
0029 F9
002A 2E
002B DE
002C ·8820
002E C634
*******01<***************************************************
A KEYSTROKE WAS DETECTE!> FOR THE CURRENT COLIJIN. ITS
POSITION IS IN REGIS1ER KEI'LOC.
SEE If SAME I787
!le38 AiJ
0039 963F
8938 FE
893C 8822
003E A9
378
379 ;
389 SCAN~.
381
382
383
384
385
366
387
110Y
JZ
DEC
I10V
JHZ
11011
HOY
1'101/
A,~NTR8
SCANS
A
@f'NTRIl.A
SCANS
A, LflSTl'Y
PNTR9, *VB£i8iJF
@PNTRll,A
388 ;
003F 8821
904118
9tf42 Fe
!.III43 ED2:;
9945 EFS7
389 SCANS.
:;90
:m
1'1011
392
393 .
394 ;
395 SCAN6.
DJNZ
PNTRI.!. IKEYLOC
@PNTR0
fI, ~OTPAT
ROTCUT, NXTLOC
D.JNZ
CURD I 1], SCAN3
1'10','
INC
;96 ;
397 fEJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-39
; I F AL~EAO't' ZE~O
• INDICATE ONE tl()~E
SUCr.ESI~'E
'H liUECTlON
dF DECREMENT DOES NOT RESULT IN
; TO MARK NEW KE.Y
CLOSIJ~'E
;::E~'O
Ap·40
ISIS-II MCS-48/UPI -41 t1ACRO ASSEMBlER, ',12. (I
PAGE' 11
RP4(1: INTEL HCS-48 KE'r'BOARD/DISPLfl'r' flPF'lICRTIONNOTE flPPENDnl
LOC OBJ
SEQ
SOURCE STATEI'1t:.1l7
398 ;
399 ; *************"'***********"*";**********'~*******"'*"'**********
490 ;
THE FOLLOWING CODE SEGI'lENT IS USED BV THE KE'r'BOAR[! SCANNING f"OIJTlNE
401'
IT I 5 EXECUTED ONLV AFTER A REFRESH SEQUENCE OF ALL
492 ;
THE CHAFACTERS IN THE DISPLAY IS COMPLETED
493 :
404 ;
0047
8049
0048
004D
904F
BFOO
8900
764F
BEFF
A5
0050 B923
0052 Fl
0053 COS7
9955 97
9056 Ai
495
496
497
408
409
410
411
412
413
414
415
416
417
418
419
****************************'1<*********"'''''1-*'''***'''****'''***.''''1<''
MOil
MOV
JF1
MOV
SCANS: CLR
CURDIG,IICHflRNO
,PNTR0 STILL CONTAINS IIk'E~'LOC
@PNTR0·110
; JUMP IF ANV KEVS WERE DETECT!:.D
SCAN8
,CHANGE (LASTK'f) WHEN NO KEYS ARE DOWN
LASTK'r' .lI0FFH
F1
;
.' **********************"'*********t**************************
.:
THE NE~:r CODE SEGMENT IS THE INTERRUPT-DRIVEN PORTION OF THE 'DELA'T"
.:
UTILlW IT DECREMENTS RAM LOCATION "RDELAV' ONCE PER OI5PLAY SCAN
.:
IF 'RDELAY' IS NOT ALREADY ZERO
,; *******~**************************U,~~***'I<*"'***"**********"
•
PNTR1,IIRDELfI't'
MOil
, MOV
A.@PNTR1
SCAN9
JZ
[lEC
A
429
@PNTR1,A
MOV
421
422 ;
9957 83
423 SCAN9' RET
424 .
425 ; *"'**i:**************,....**,.+·'H*·"i·t·I~:i~·*j:~*"'i<** ..*t**..***ot,***..
**
426 ;
0057
0058 01
0059 '.1~
f.ju5A 04
0(l5E! 08
B0se 1(1
(U)5!i 2('
flf:!:oE 40
1:01<: CHRPOl)
c'
-i-JI
,'I;.
,(10003<110[: :~i)f. CHRPOL J
,Oeljc.l01tXlE· xO!': !~HRPOL)
r..1;
4:1
tIE
1300:)10000 mR CHRPOL)
.tJ2
J?:"f:
,0l3li100€JOB XOR CHRPOU
!)f:
4:?4
13(11000000 XOR CHRPOU
<010000008 ~)R CHRPOL)
41'5
r'8
f'f:
(100090996 XOR CHRP(JL)
4:6
437
438 fETECT
All mnemonics copyrighted @ Intel Corporation 1976.
1·40
intJ
Ap·40
ISI5-1i HCS-48.!UF'I-41 IW:~'O ~<:~,Et4BLE~, V2 Q
PAGE
AP40' INTEL I'ICS-48 l'fYBOIlPM\ISPLfI\I APPLICATION NOTE APPENtoIX
LOC OB)
SEt)
SOIJRCE STATEHENT
0(160 D5
m ,Hm
44q INlT
O~q BF08
006;: B:322
442
0065 BOFF
J4}
441
'313,,7
B~21
4~4
0069
BO~t0
4d 5
44t
447
448
(t06B 23Ht
3fl
9(t6E C5
006F 149E
,*161)
(tIm A5
0072 2,F(t
00?4 62
(1075 ~5
0Et76 25
12
INITlilL 12E5 PF.CiCE5S0.' REGiSTERS
SEL
RBi
~IOV
CI.IRD1G,ICHAPNO
i10V
PNTR~qWB[ oBUF
t,to'.!
@F'tm:o, 1I0FF H
1'10','
F'NTF:e, IltEYLOC
i'lO'!
@p~m.B,
t1CIV
'.I IJTL
ft, UNPI1SK
"INPUT. R
SEl
RBO
449
CALL
450
451
452
451
CL~
~10\1
CLEAA
fl
R., niCK
1. A
STF.'l
T
Ell
Term
r~ov
454
455 '
10
,SET BWIRECT IONAL INPUl LINES
,OTlLIT'r' FO", SETTING INITIAl.. DISPLAY REGISTERS.
; LOAD INTEFRIJPT RATE VALUE
; ENABLE lIMER INTERRUPTS
456 ;
457
458
459
46\1
461
,**~.* <*I *.•*~** .~*." ~*"'*.foH****"'***.fo**"***"'*******************
:
; ECHO
'
;
cllm.
FOF.' AN\' NEW KI::YSTROKES DETECTED
TRANSLATE EACH KEYSTROKE INTO ft SEGMENT PATTERN
HN[.' WPlTE IT INTO THE APPI"OPRIATE DISPLA'r' REGISTER
46} . .u t ~ ~ ..***~**-t.***'*~·******H********·~*********""'**.'.*"'*.*
4';4 ;
*
0077 148:;
"'*
007D 14DB
007F 0477
469
470
471
CALL
KBD IN
.' GE.T NEXT KE~'5TROKE
.JB5
F~E~'
'JUMP IF rEI' IN RIGHTHANI) COLUMN.
SINCE THE ACG IS USE~ !:ill ENrACe AND RENTR~', ns CONTENT 5 MUST
BE PROCESSED OR SAVEv E:EFORE ENCAGC 15 CflLLED
CALL
ENeAce
,FORt'1 APPROPRlftTE SEGMENT PATTERN
CALL
RENTP't'
: WIi (~'ATHER THAN ITS POSITION IN SWITCH MATRIX) IS
.lS9 .
FHiJRNED Ttl lHE AGCUt1IJLAlGF.' .
11011
PNT!?!' lWBDBl.f
~90 KBDIN
494
flDC,
f1 . lIBftli
'1. 1!F'NTR1
KBDIN
fl.. lIlEGNDS
I'{,
~95
110VP
A.I~A
008D ·9]
496
RET
491
111),.1
. 0987 21
@tl88 .28:
4~'"
;-·:CfI
4"'~
.JE·~
008A €G8E
ewe
; KBDSUF WILL BE MARKED AS CLEAR
,LOAe BUFFER
~ALUE
,ADD BASE OF KEY ENCODING TABLE
: OBTAIN BYTE REPRESENTING KEY SIGNIFIUlNCE
437 .
4?a ;
49, : WiNDS IS THE BflSE FOR TABLE SHOWING !:.E',' MATRIX SIGNIFICANCE
5€1A .
FOP THE V.El'BOA~·D lISED IN THE f'ROTOTT'PE.
501:
IT~ LA't'OIJT 15 AS SHOWN TO THE RIGHT.
50~
501
!~OTE
~;04
~05
5(i€;
TIiAT BIT ti-B!T4 MAY BE USED TO ENCODE KEY TYPE. IN THIS CASE:
BI14 INDICATES REGULAR DECIMAL DIGITS,
lIlT5 :NulCA7ES RIGHT-COLUI1N FUNCTION KE'iS,
8m INfoiCATES PUNCTUATION HARKS ( * AND I ),
507
t1138E
B08E 4F
0Q8F 11?
'13€19tl 4E
~€1~1
01392
28
17
0139:': 18
~B94 19
OO~5 24
f.l0~6
14
~B97 15
0€198 16
tt099 22
fitl9A 11
~09B 12
£1139( :1.3
01cl9D 21
508 LEGNDS
.$ AND eFFH\
5139
5113
4FH
Hlli
4EH
2SH
17Ii
1SH
19H
24H
14H
511
512
51:;
514
515
516
517
518
15H
519
5213
521
[is
22H
[.f;
522
vB
llH
12H
5~'~
DB
DB
~;24
.' USE LOW ORDER BITS .AS TABLE INDEX
PL>IGIT4==}
1
f'DIGlT5==)
4
PDIGIT6==)
7
8
PDIG\T7=)
.f
9
16H
2
(3)
•
(4)
II
V
Y
V
PINP1JT7 f'INPIJT6 PINPUT5 PlNPIJT4
EH
21H
525 $LTECi
All mnemonics copyrighted © Intel Corporation 1976.
1-42
AP·40
ISIS-II I1CS-48 J UPH1 ~IH(FO flSSEMBLER, 112. iii
AN0 INTEL ~ICS-4S r:E'T'BOft~:[);DISPLAY HPPllUHlON NOTE
LOC Of.J
PAGE
14
RPPEN[JI:~
SOIJRCE SlATEfiENT
c .... '7
.•
'~;
f.it!9E 2:'131;1
013140 B938
@13142 BF(tS
OOft4 A1
~1(IA5 19
B0A6 EFfl4
00A8 BF€t8
€tORFi 8:;
BORS F8
~OFIC A3
00AD C6B4
fJ0AF 14D9
00Bl 18
0@B2 fJ4AB
0€184 83
52B ;CUfiR WRITES 'BLANr:' CHARACTERS INTO ALL DISPLAY REGI5TEI79
5ee
581
582
583
584
585
586
MOvi>
4F
66
6D
7D
97
7F
587
61'
OOCA 77
593
geCB 7C
OO(,C 39
oocr. 5E
99CE 79
OOCF 71
588
589
590
591
592
1l,IOOPIHS
ft, @R
~'H
,C'Gf'ATS IS THE ~ASE FOR THE TABLE OF SEGMENT PATTERNS FOR THE BASIC
. DIGITS HERE '!HE FULL HEX SET (0-Fi IS lIlCLUDED.
; F& MANY USE", f;Pt'L1CATIOIIS, THE CHARflCTl£.' SET MAY BE AMEIIDED OR AUGJ1E,.TED
,TO !NCLlJDE AOOlTlOtIAL SPEClft PURPOSE PATTEPNS.
; FORMAT IS
PUFEDCBA
IN STAIIDARD SEVEN-SEGMENT ENCOOHIG CONVENTION
;
WHE~'E P ",EPRESENT~ THE DECIMAL POINT
DGPATS EQIJ
J AND flFf'H
DB
00111111B XOR 5EIJPOL
DB
000001108 '3!91:l1113B :~OR SEGPOL
011:1.1001B ;:OR SEGPOL
01110001B XOR SEGPOL
601 ; ********i:,f<:lo*1o:l<+..***i<**+************************************
602 ;
603 ;!{llSP WP.!TES BIT PATTERN NOW IN ACe INTO NEXT CHARACTEI? POSITION
604 ;
OF THE DISPLAY (NEf.TPLI.. ADJUSTS NEXTPL POINTEr? VALUE.
605 ;
IJ0D0 A9
OOD1 FF
OOD2
e:m
. OOD4 29
eros Ai
00D6 EFDA
8!ID8 BF98
OODA 83
IIESlllS IN DISPLAY BEING FILLED LEFT TO RIGHT. THEN RESTARTING
606 WDISP' 110...
60,
HOY
ROO
698
XCH
699
PNTRl, A
A, NEXTPL
A, IISEGMAP
A, PHTR!
610
MOil
~lR1.A
611
DJN~
NEXTPL/ WISP1
NEXTPL, .CHARNO
1'1(1\1
612
6B WDISPl RET
614 .:
615 $EJECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-44
inter
AP·40
ISIS-II I'lCS-4S,'I.IFH! l'lAC:~1) AS5EHBlE~', V2. II
PAGE
Af'40 INTEL M(:5-43 I;E'r'BOAliD/DI5PLAY Af'PlICATION NOTE APPENDIX
LOC OB.T
5I)IJRCf
SEQ
16
STATE~1ENT
"'*..
616 ,*~~*~**~",****~*~' "'* ~***",.~>t-***'" ••.t***t**.t<*************>t-**",
617 '
61~ RErITR'r' SIJBROOTIlJE TO ENTER ACC CONTENTS INTO THE RWHTHOST uIGIT
619 .
qt.jD SHIFT EYE[(YTHING ELSE ONE PLftCE TO THE LEFT
629 ~'ENTj;"I' '10','
f'lITR1, JSEGI1AP+1
00DB B938
OO[l[l BFEtS
621
MOV
NE'~TPL.
a0DF 2i
622 RENm
:~tH
A. I!PtlTPl
e~a
62:
iii':
624
D.1HZ
62'5
MOV
RET
P'lTII1
NElITf'L .IIENTR1
NEnFL, ICHARNO ; POINT TO LEFTI'10Sr CHARftCTER
19
00E1 EFDF
00E3 BF9S
fJ0E5 83
f..26
627 '
ICHARNO
628 ; ~t l<.U "'.",fIB••'" •t"'***1"'''' .*~u ~~ io.H**",*'.*******,.",*********>t-•.t<
6~~ ;
630 ,f,'UPtIDD TOGGLE uEC!MAL poI'lT HI LAST CHAPACTER DISPLAY CHARACTER
6}1 • [)PR[l[l TOGGLES [>EC!l'IfIl. POINT IN THE CHARACTER POINTED TO ElY THE ACe
6::2 .
6?5 PDPAUD I'lIJ\'
634 UPA[l[" ADD
MOil
6J5
M!jV
6:;'"
ooE6 2391
00E8 0337
0aEf1 ft9
~J0EB F1
00EC D,81J
OOEE Ai
tll3EF ,n
:'l;oL
MO'l
637
638
6,9
640 .
,SET INDEX TO j;'IGHTllOST POSITION
; ACCESS DISPLA'r' REGISTER FOR [)£SI~ED PLACE
fl.i91H
A, iSEIjMAP
PNTR1, "I
tI,!!/'NTR1
11,IS0H
@PNTR1,1i
RE~
••••**.j<**********.**.*******.**"**
00ff3
641 . '*·H~. '~*."***************
•. 42 .
64~ ; HOl[l
SlJSl(OUTlNE CALLED WHEN KEY IS KNOWN TO BE DOWN.
644 ;
WilL NOT I1ETURN UNTIL KEl' IS RELEASED.
64S HOLD' SEL
R~t
f10li
FI, LASTK'r'
; {LASTKY)=0FFH IFF NO KEYS DOWN
646
647
SEL
IIEIB
64B
CPL
A
649
IN<:
HOLD
[is
001'1 FE
OOF2 C5
OOF3 37
0~F4
96F13
RET
"~9
OOF6 83
6'51 .
652 ;
653.;
*'" ~***************"'*************.*****************.j:********
654 . DELAl' SIJBROiJTlNE HANGS iJP FOIl THE NiJMBER OF COHPLETE DISPLAY SCANS EQUAL
655 ;
TO THE CONTENTS OF THE ACr:oHllATO~ WHEN CALLED.
656 DELAY' HOV
PNTR1, IRDELfll'
00F7 8923
657
1'1011
658 DELAY1. 110\1
659
JNZ
€.r50
IlET
00f9 At
90FA F1
OOFB 96FA
0ltFD 83
@PNTR1. fl
fl. @PNTlll
(lfLA'r'l
661 tEJECT
All mnemonics copyrighted
@
Intel Corporation 1976.
1-45
Ap·40
1515-II MC!'-481lIPl-41 Mi'lCRO "SSEMBlEI"· V2 f.i
PAGE
AP40. INTEL I'1CS-41'i I:EYBOAIMDI5PLflY APPLICATION tl01E APPEtlHX
LOC OBI
0100
17
SOURCE STATEMENT
5E(1
662 O~'1j
661 .
l00H
6£,4 . l·t~·''f<*.*~*·~H*~**t~**~.**t***'t*'f<*.t*~*****'"*,******'''********
665 ;'
666 ; TilE CODE ON THIS PAGE IS FOP. [;EMONSTFATlON PURPOSES ONLY667 . I T~UEL Y DOUBT iJHE THH Rl'N END IJSEPS HOIJLD LI KE TO SEE A NAtlE
66S ,POPPING 1.If· ON TIiEll" CAU).lLATOP SCl1EENS
6~9 .; HOWEvER. TIiE CODE SIl(~lN HEj;l DOES INDICATE HOW THE UTILITY SUBROIJTINES
';713 ; ItIfU.lDE[· IiEPE C(IIJLfo E:E FtCCESSED
67i . THE Io'OIJTItIES T'lEMSELI,IES ftF.:E CALLED WHEN ONE OF THE FOUR BUTTONS
Eo;'2 . 01/ Of H~ ~ IGIiT -Hfl"I£; 5I[IE OF THE PPOl (in'PE KEVBORI'D IS PFESSE(),
6(":
I
•. 74 ; *~ H·****.H:t **tt .***..t*··~ .****·*********t~.'t<"'* u"'.*'" ** ***.***'"
0100 1212
81iJ2 320E
0104 528A
010614H
fJ108 04,7
675
676
677
678
679
6813
681
682
683
684
WIA 342E
010e 9477
685
f,86
'
.•UN':TN PO'JTlNE TO 1I1PlEI'lENT OllE 0'" "'OUR DEi'll) UTILI TIES, ACCORDING
•
TO W~I(:H OF 'l'HE FOLl" FI.~f(TION KE~'S WAS P~E55EI)
FIJNCfN:JB0.
FIJNCTl
.)81
. FIJNCT2
FIJNen
.
JB2
'
FUIlCR (ALL
RDPADD
ECHO
JI>1P
.
FUNCB CHLL
TES13
Jt1P
ECHO
687 ;
Etl8E 3424
911B 94;7
688 FIJNCT2: CALL
JI1P
68~
1E5T2
ECHO
690 ;
TESTl
691 FllNCT1' CALL
JI1P
ECHO
693 ;
694 ; **~****.****.********~******"'****.j<~t****~***********.*****'*
0112 3416
0114 0477
692
9116 BF98
695,
696; 1E511 CODE SEGMENT TO FILL DISPLAY PfGlS1EI02
703
1'11)\1
MOI/
CRLl
CALL
[)..TN2
/'101/
RET
PNTR0,IICHARNO; SET FOR EIGHT LOOP REPETI1 IONS
f\. NEXTPL
ENCRce
W[lISP
PNTR0, Tsm
NElI'TPL IICHARNO
705 •
786 SEJELT
All mnemonics copyrighted @ Intel Corporation 1976.
1-46
; COP~I NEXT DIGIT INTO DISPLAY REGISTERS
inter
Ap·40
ISIS-II I'1('S-48.'UP1-41 HAC~O ASSEMBLER. Y2. (I
PAGE
AP48: INTEL MG5-48 m'BOAAD/D ISF'LA'r' APPLICATION NOTE APPEl'll) I X
SEQ
LOC OSJ
SOURCE STATEMENT
737 ,**~*****,~'io**~**~*******.j<*********.f<************"'**",*********
70S·
7~9 : TE5T2 WRITES THE SEGMENT PATTERN FOR 'JOHN' ONTO THE DISPLA',I.
719 ;
IdfiITS FOR ~ WHILE, AIID THEN CLEAPS THE DISPLAY
711 TE5T2: HOII
PNTR0, i,JOHN
CALL
PPINT
712
MOV
A.1100 , SCAN DISPLAV FOR 19a CYCLES
713
;'14
GALL
DELAY
,JI1P
GLEAP
m
716 '
717 : ~*·ft *~*.t*~1'*·~*"'Y*~**~*~***~'*-~* *****************************
718 •
';'19 ,: lESE ~JJB~'OlJTINE TO -ILL DISPLfiY WIlH DASHES
72(1 ;
JI.IMf'5 INTO SUBROUTINE 'CLEAR'
721 '
I1S SOON AS 1HE KE,' IS RELEflSED.
722 TESE mv
fl. ~91ee00e0B :~OR 5EGPOI. ; PATTE~N FOR '-'
72:;
CALL
FILL
;'24
CALL
HOLf'
l25
JMP
CLEAR
72f ;
0124 B8B5
0126 HAB
0123 2364
012A 14F7
012C 049E
012E 2340
ano
18
HAB
BE214F0
0134049E
727 ,.' I< ~*,.*** .•*·*:t .j<****~****:j.*********************.j<**************
728 '
729 END
LlSER S'T'MBOlS
ASFIYE 0902
DEBNCE 0004
FILL !JeRe
INn 8960
HCOlS 0004
PNTR0 0000
I"EFPl eel?
S(;AN~
01.134
TE5T2 0124
BLAN¥.
liE LA','
Fm'
lHPMSK
HEGlOG
PNTR1
REFRSH
SCAtl5
TESE
ASSEMBL Y COI'1PLETE,
9000
00F?
131381
00FB
00FF
0001
CHARNO
DELAY1
FIJHCT1
JOHN
NE>:TPl
POSLOG
0008
0eFF!
13112
0005
0007
0000
0010
~ENTI?1 00DF
003F ' SCAN6 131345
012E
TICK
FFF0
CHRPOL
DGPATS
FIJII(;T2
V-BDBUF
NREPT5
PliiNT
RENT,,"Y
SCANS
mNT
0000
BOCa
lUBE
0022
002'"
9BAB
130LlB
004F
0007
NO ERRORS
All mnemonics copyrighted © Intel Corporation 1976.
1-47
CHRS1B
DPADD
FUNCB
KBDIN
HROWS
PRNTi
ROTeNT
SCAN9
T1RET
0057
00E8
€110ft
a083
9004
0084
0005
0057
fJOOE
ClEAP.
ECHO
FLINCH
KEYlOC
NXTLOC
PSGl'INT
ROTPAT
SEGl'IAP
TST11
099E
mm
0106
0921
0023
0008
00134
0037
911A
ClRl
ENCAce
FUNC1N
LASTKY
PIHGlT
RDELAY
SCAN
SEGPOl
WISP
9BA4
BBBA
9100
0806
0919
0023
00lE
0000
001)0
CURDIG
ENCMSK
HOlD
LEGHOS
PII/PUT
8007
800F
OOFC
008E
9009
R()f'fl()D 119E6
SCAN1 0021
TEST1 9116
WDlSPl OODA
intJ
AP·40
1515-II RsSEf1BlE~ S'r'1tBOl. (:~s REFEm/CE, ..,2 8
ASA\IE
BlAtl<
292.
179.
CHARNO In.
CHFPOL 169.
CHRSTB 282
CLEAI1 449
5:'>4l1
CIJRDIG 286.
DEaNeE 178.
[)flAY 656.
[.oELR'.'l 658.
[IGPAiS· 574
CL~l
DPflOC'
ECHO
ENCAce
ENC/'ISK
FILL
FKEY
HOLD
532.
723
4731
6911
6881
68511
466
679
688
682.
47:.>
645.
465
2m
205.
494
175.
1671
2121
174.
329.
158.
1681
1911
549
1921
POSLOO 1661
~NTl
PSGtlNT
I1DELA'r'
RDPAOO
REFill
REFRSH
RElITRl
REIfTR'r'
441
431
715
725
289
683
405
5n
432
537
433
395
485
441
686
689
692
612
434
621
435
625
436
697
698
783
5491
551
15911
2161
633.
2821
268
622.
470
700
573
678#
649
448.
724
446
711
386
499.
300
359
508.
328
1m 533
623
PRINT
430
714
659
5831
471
573J
562.
JOHN
KBDBlJF 214.
PNTR1
269
531
:m
465.
469
lSs'
236
INIT
INPHSK 171.
KBDUI
KE'r'LOC
LRSTKV
LEONeIS
NCOL5
NEGLOG
NEXTPL
NFEPTS
NFOWS
NXTLOC
PDIGIT
PINPUT
PNTRIl
1
534.
FUNCl1 678
PJNCT2
FIJNCT3
FIJNCT4
FIJNenl
249
288
228
429
4281
5311
536
283
PAGE
442
493
389
368
499
444
365
486
646
536
537
697
611
612
621
624
625
697
699
783
361
379
711
418
656
388
383
386
367
389
399
486
442
443
444
445
421
657
499
658
492
532
534
535
696
689
619
628
622
361
392
285
381
309
554
299
635
169
555
5561
281
417
682
447
356
698
291
636
170
712
m
417
636
292
656
288.
624
620.
All mnemonics copyrighted © Intel Corporation 1976.
1·48
inter
Ap·40
ISIS-I I ASSEHBLER SYMBOL CROSS
2l'!411
328
R01Pfli 293.
StfiN
300.
:;30
392
391
380.
371
]131
~OTCNT
SCAN1
SCANs
SCANS
SCAN6
SCANS
SCftN9
SEGflAP
5E~OL
rEST1
TEST2
TESE
TICK
328.
362
331
395.
497
395
220.
17911
593
691
688
685
177.
T!lHT
TlRET
T5TH
W['lSf'
WDISP1
269.
699.
552
611
CROSS
REFE~ENCE
409.
419
REFE~ENCE.
384
389.
629
564
597
V2 fJ
PfiGE
423.
2&8
m
280
594
697.
m
698
563
595
596
634
565
598
566
599
584
722
7111
722.
250
451
248'
792
606.
2
,(11
6131
COMI'Lf.TE
All mnemonics copyrighted @ Intel Corporation 1976.
1-49
585
586
587
588
589
590
591
!l92
--
inter
APPLICATION
NOTE
Ap·49
January 1979
9800904
© Intel Corporation 1979
1-50'
AP·49
INTRODUCTION
however, is more economic than technical; these same
peripheral chips which are such a bargain when coupled
to a microprocessor such as the MCS-85 or 86, have a
significant cost impact on a single chip microcomputer
based system. The high speed of the 8049, however,
makes it feasible to implement a serial link under software control with no hardware requirements beyond two
of the I/O pins already resident on the microcomputer.
The Intel'" MCS-48 family of microcomputers marked
the first time an eight bit computer with program
storage, data storage, and I/O facilities was available on
a single LSI chip. The performance of the initial
processors in the family (the 8748 and the 8048) has
been shown to.meet or exceed the requirements of most
current applications of microcomputers. A new member
of the family, however, has been recently introduced
which promises to allow the use of the single chip
microcomputer in many application areas which have
previously required a multlchip solution. The Intel'" 8049 virtually doubles ·processing power available
to the systems designer. Program storage has been increased from 1K bytes to :ilK. bytes, data storage has
been increased from 64 bytes to 128 bytes, and processing speed has been increased by over 80%. (The 2.5
microsecond instruction cycle of the first members of
the family has been reduced to 1.36 microseconds.)
There are many techniques for implementing serial I/O
under software control. The application note "Application Techniques for the MCS-48 Family" describes
several alternatives suitable for half duplex operation.
Full duplex operation is more difficult, however, since it
requires the receive and transmit processes to operate
concurrently. This difficulty is made more severe if it is
necessary for some other process to also operate while
serial communication is occurring. Scanning a keyboard
and display, for example, is a common operation of
single chip microcomputer based system which might
have to occur concurrently with the serial receive/transmit process. The next section will describe an algorithm
which implements full duplex serial communication to
occur concurrently with other tasks. The deSign goal
was to allow 2400 baud, full duplex, serial communication while utilizing no more than 50% of the available
processing power of the high speed 8049 microcomputer.
The format used for most asynchronous communication,
is shown in Figure 1. It consists of eight data bits with a
leading 'START' bit and one or more trailing 'STOP' bits.
The START bit is used to establish synchronization between the receiver and transmitter. The STOP bits ensure that the receiver will be ready to synchronize itself
when the next start bit occurs. Two stop bits are normally used for 110 baud communication and one stop
bit for higher rates.
It is obvious that this Increase in performance Is going
to result in far more ambitious programs being written
for execution in a Single chip microcomputer. This article will show how several program modules can be
designed using the 804g. These modules were chosen
to illustrate the capability of the 8049 In frequently encountered design situations. The modules included are
full duplex sarialllO, binary multiply and divide routines,
binary to BCD conversions, and BCD to binary conversion. It should be noted that since the 8049 is totally
software compatible with the 8748 and 8048 these
routines will also be useful directly on these processors. In addition the algorithms for these programs
are expressed in a program design language format
which should allow them to be easily understood and
extended to suit individual applications with minimal
problems.
FULL DUPLEX SERIAL
COMMUNICATIONS
I
Serial communications have always been an important
facet in the application of microprocessors. Although
this has been partially due to the necessity of connecting a terminal to the microprocessor based system
for program generation and debug, the main impetus
has been the simple fact that a large share of microprocessors find their way into end products (such as inteliigent terminals) which themselves depend on serial
communication. When it is necessary to add a serial link
to a microprocessor such as the Intel'" MCS-85 or 86 the
solution is easy; the Intel'" 8251A USART or 8273 SOLC
chip can easily be added to provide the necessary protocol. When It is necessary to do the same thing to a
single chip microcomputer, however, the situation
becomes more difficult.
BIT
01
02
03
04
05
06
07
08
BIT
Figure 1.
The algorithm used for reception of the serial data is
shown in Figure 2. It uses the on board timer of the 8049
to establish a sampling period of four times the desired
baud rates. For 2400 baud operation a crystal frequency
of 9.216 M Hz was chosen after the following calculation:
f = 480N(2400)(4)
where 480 is the factor by which the crystal frequency is divided within the processor
to get the basic interrupt rate
2400 is the desired baud rate
4 is the required number of samples per
bit time
N is the value loaded into the MCS-48
timer when it overflows
Some microcomputers, such as the Intel 8048 and 8049
have a complete bus interface built into them which
aliows the Simple connection of a USART to the processor chip. Most other Single chip microcomputers,
although lacking such a bus, can be connected to a
USART with various artificial hardware and software
constructs. The difficulty with using these chips,
00670A
STOP
START
1·51
AP·49
The value N was chosen to be two (resulting in f = 9.216
MHz) so that the operating frequency of the 8049 could
be as high as possible without exceeding the maximum
frequency specification of the 8049 (11 MHz).
I
STIRT IF RECEIVE ROOTII£
11 IF RECEIVE FlOO=e ll£N
;2
IF SERIAL Itf'IJT=SPfn ll£N
13
RECEIVE FlAG:=1
13
BYTE FINISI£)) FlAG:=8
12
OOIF
I 1 ELSE
SINCE RECEIVE FlAG=1 ll£N
:2
IF SVI«: FlOO=e TI£N
;3
IF SERIAL 11f'UT=SPfn ll£N
14
SVI«: FI.J1G:=1
;4
DATA: =88H
;4
SffIPLE CNTR:=4
;3
;4
ELSE
SINCE SERIAL 1If'UT=ItfRK l"1£N
RECEIVE FlOO:=8
;3
OOIF
; 2 ELSE
SINCE SVI«: FLAG=1 ll£N
SRlf>LE ro.M£II: =SRIf>LE CtlWTER-1
;3
;3
IF SRlf>LE ro.M£II=8 ll£N
SRlf>LE COUNTER: =4
:4
;4
IF BYTE FINISIED FlOO=e ll£N
;5
CARRY: =SERIAL IIf'UT
;5
SHIFT DATA RIGHT WITH CARRY
:5
IF CAR!1Y=1 ll£N
:6
(J(DfITA: =DATA
:6
IF DATA REf¥)\' FlOO=e THEN
;7
ME FINISI£)) FLAG=1
16
ELSE
;7
BYTE FINISNED FLAG:=1
;7
OYEl/Rlll FlAG: =1
;6
OOIF
15
OOIF
14
ELSE
slta ME FINISNED FlAG=1 ll£N
15
IF SERIAL 1If'UT=IIfIRK ll£N
,6
DATA REf¥)\' FlAG: =1
;5
ELS!:
SINCE SERIAL IIf'UT=SPACE TI£N
;6
ERROR FlAG: =1
15
OOIF
15
RECEIVE FLRG:=8
:5
SYNC FlAG: =8
;4
OOIF
:3
ENOIF
12
ENOIF
; 1 ENOIF
Once the meaning of these flags are understood the
operation of the algorithm should be clear. The Rece/lfe
Flag is set whenever the program is hi the process of
receiving a character. The Synch Flag is set when the
center of the start bit has been checked and found to be
a SPACE (if a MARK is detected at this point the receiver
process has been triggered by a noise pulse so the program clear!. the Receilfe Flag and returns to the idle
state). When the program detects synchronization it
loads the variable DATA with 80H and starts sampling
the serial line every four counts. As the data is received
it is right shifted into variable DATA; after eight bits
have been received the initial one set into DATA will
result in a carry out and the program knows that it has
received all eight bits. At this point it will transfer all
eight bits to the variable OKDATA and set the Byte
Finished Flag so that on the nextsample it will test for a
valid stop bit instead of shifting in data. If this test Is
successful the Data Ready Flag will be set to indicate
that the data is available to the main process. If the test
is unsuccessful the Error Flag will be set.
The transmit algorithm is shown in Figure 3. It is executed immediately following the receive process. It is a
simple prograr:n which divides the free running clock
down and transmits a bit every fourth clock. The variable
TICK COUNTER is used to do the division. The Transmitting Flag indicates when a character transmission is in
progress and is also used to determine when the START
bit should be sent. The TICK COUNTER is used to determine when to send the next bit (TICK COUNTER MODULO 4
0) and also when the STOP bits should be sent
(TICK COUNTER = 9 4). After the transmit routine completes any other timer baseq routines, such as a keyboard/dispJ'ay scanner or a real time clock, can be
executed.
=
; STfRT IF TRIIISIIIT ROOTII£
11
; 1 TIC!( CIXM'ER:=T1CK CIXM'ER+1
; 1 IF TICK ro.M£II IQ) 4=8 THEN
;2
IF TRIIISIIITIlt«l FlAG=1 ll£N
;3
IF TICK CWITEA=88 1818 88 BINfRY ll£N
;4
TRANSJ1IlTlt«l FlAG: =41
I3
ELSE
IF TICK CWITEA=88 1981 88 BINfRY THEN
;4
SEll> 00 IR!K
I oj
TRIIISIIITIlt«l FlAG: =8
I3
ELSE
SINCE TICK ClXM'EROTHE fIIOYE COUNT 'll£N
14
SEll> NEXT BIT
;3
OOIF
; 2 ELSE
SINCE TRANSJ11TT1t«l FlOO=e THEN
I3
IF TRIIISIIIT REIllEST FlAG-"1 THEN
;4
XIITBVT: =NXTBYT
;4
TRANSIIIT REUST FlAG: =8
;4
TRANSJ1ITTlt«l FlAG: =1
I 4
TICK COUNTER: =8
; oj
SEll> SYNC BIT (SPACE)
13
ENOIF
;2
ENOIF
;100IF
Figure 2
The timer interrupt service routine always loads the
timer with a constant value. In effect the timer Is used to
generate an independent time base of four times the reo
quired baud rate. This time base. is free running and is
never modified by either the receive or transmit programs, thus allowing both of them to use the same
timer. Routines which do other time dependent tasks
(such as scanning keyboards) can also be called periodically at some fixed multiple of this basic time unit.
The algorithm shown in Figure 2 uses this basic clock
plus a handful of flags to process the serial input data.
Figure 3
All mnemonics copyrighted CO Intel Corporation 1979.
1-52
inter
Ap·49
the 8049. Also included in Fig. 4 is a short routine which
was used to test the algorithm.
Figure 4 shows the complete receive and transmit pro·
grams as they are implemented in the instruction set of
ISIS-ll P1C5-48.'IJPH1 "AeF:) ASSEMBLER, Y2.
lOC OBJ
SEg
SOURCE
e
STATE~lEm
-l<
THIS f'ROORAtl TESTS THE FUlL l~JPLE;, COMMIJIHCATIOI-I :,UFTWARE
*
*
5 .; *****-t<**·t,..**tt*·H*-t<**$** .. **·~t**tt*·~*·~i4~·*-t"t********:t***-t<**·!:.f<:l>*******-t<**'i'****-t:*
6.
7 $INCLur'E( :F1.UPTEST PDl)
8 ;
9 ;
11) i
START OF '1 EST POUT! HE
====================
11.
12 .
13 '
14 ;
15 .
16 ,1 ERROR COLINT =8
G
18
19
20
21
91300
0000 C5
0001 2400
;1 REPEAT
;2
PATTERN Al
:2
lNHlALIZE TIMER
.2
CLEAFI FLAGB'm
,2
FLAG1 =t1AP.r.
22:2
REPEAT
23 ; 3
IF TRflNS~lIT REQUEST FLAG=9 THEN
24 ; 4
rmB'T'TE: =PATTERN
2~. ,4
rPAN5M n REQUEST FLAG=1
26 ; 7
ENDIF
27 : ~
IF DATA READ'" FLAG=1 THEN
28 ,4
PATTERN. =O¥l)ATA
29 ; 4
[*ITA FIEADI' FLAG =0
J0 ; 3
E"'[lJF
31. 2
UNTIL ERPOR FLAG OR OVERRUN FLAG
32 ; ~
mCPEMENT ERROR COUNT
n, 1 I),.,TIL FOREVEF!
34 . EOF
:>5 tEJECT
36
ORG
0
37 .1 SELECT REGISTER BAt,'K B
33
SEL
IiS9
:>9 ; 1 OOTO TEST
40
.IMP
TEST
41 $
INCLU(JE<.F1·UAIITI
42.
4:1 ,
44 ;
A5'ltlCHRONOU5 FIECEIIiE/TRANSMIT ROUlINE
45 ;
===================================
46 ;
THIS ROIJTINE RECEIVES SH:IflL COOE USING PIN TO AS R;,1)
47,
AND CONCIJRREtllLY TRANSMITS USING PIN P27
48;
NOTE.
49 ;
THIS ROUTINE USES FLAG 1 TO BUFFER THE TRANSMITTED
Figure 4
All mnemonics copyrighted © Intel Corporation 1979.
1-53
inter
LOC OSJ .
Ap·49
SEQ
SOURCE STRTEItENT
59 ; 1 [lATA LINE. THIS flIlHNflTE5 THE JITTER THAT
51 ,1 WIll.D BE CRUSEll BY YAFIATlOIIS IN THE RECEIVE
= 52 ,1 T1I'1ING. NO OTHER Pf,'1BA14 11AY USE FLfIf.i 1 WHILE
53 ,1 THE TIMEii' IrITERPUPT IS ENABLED
54 ;
55 ;
56;
'57 '
58,
59 .
60 i
61
PfGlSTEP. ASSIGllIft:.NTS-8Alt:l
=============__T~_==
i
0007
0006
= 62;
= 63 ATEMP EQIJ
= 64 FLGBYl EQU
9005
0004
0000
65
66
67 SAl4CTI1 EOU
= 68 TCKCTF EOU
=. 69 REGe Eoo
R7
116
f;'S,
114
R0
;
;
;
;
;
;
;
USED TO SAllE Af..ctJ'IULA' ~ CONtENTS WRiNG INTERRII'T
CONTAINS YfII;lOUS FLAGS 1.&0 10 COIITRQ.
f(£CEI'fi
AlID TAAIl5t11T Pf.:Qr.£SS. SEE CON5TANT DtflNITIOOS FOR
THE I1EfIIHNG OF EACH BIT
SAl'lf'LE CtlJlTEI1 F~ THE RECIEYE f'ROCES!:I
SAl'lf'LE CtlJNTEP FOIl THE TRANSI'IIT PROU:S!i
USEr, ~ POINTER Rl:G1STER
;
.'
,
;
I1EcmE RETlJINS Yf1L1D MTA IN THIS BYIE
RECEIIri ACctll1llATES DATA IN THIS BYTE
CONTAINS BYTE llElMjTRANSI1JlTED
COIlTAIt.'5 Tit: NEXT BVTE TO BE TRANSI1ITlED
'1£
70 ;
0029
0021
9022
9923
=
=
=
=
=
71 ;
Ii'A14 ASSIGltlENTS
72 ;
======:========
n;
74 I'IOt::DAT EQlJ
?S I'II)ftTA Eoo
76 IIXI1TBY EQlJ
77 ItI'..lTBY EOO
= 78 $EJECT
201i
21H
22H
23H
= 79 :
=
=
=
=
80;
81 ;
S2:
83 :
= 84 .;
0091
0002
Il904
0098
0019
0029
0049
0089
=
=
=
=
85;
86;
CONSTANTS
=======
THE FOLLOWING COOSTANTS ARE USED TO ACCESS THE FLAG BIlS CONTItINED
IN REGISTER FLGM
RCYFLG EQlJ
91H
SYNFLG EQIJ
92H
B't'FIfL EQlJ
94H
ctJu
08H
95 ERRFLG EOIJ
96
= 97 TRRQFL EQU
= 98
99
llJH
87
88
89
= 99
91
= 92
93
94
DRlWFL
= 199 .
= 191 TRNGFL EQU
= 102
= 19l OYRUN EOU
= 104
29H
40H
:
:
;
;
;
;
;
;
i
;
,
;
;
;
i
I
80H
;
;
5I:T WI£N START Bll IS FIIIST OETEm.D
RESET WHEN RECEIVE PROCESS IS COI1Pl.ETE
SET IoIHEN STAPT flIT 15 IIERIFIED
RESET WHEN RECEIVE PROCESS IS COI'IPLETE
RESET IlfEN STA.~T fjIT IS FIRST DETECTED
SET HN THE EIGHT !!ATA BIlS IfIYE fU BEEN kECEIVED
SHOULD BE RESET BY I'IfIIN PR~API WHEN DATA IS Att;EPTED
SET BY RECEIVE PROCESS WHEN STOP 8IHS) ARE VERIFIED
SHOULD BE RESET BV I1IIN I'ROORAPI WHEN SRIIPLEIJ
SET BY RECEIVE PIWI'.£SS IF A ~RAtlII«l Ekkill IS DETECTED
TESTED BY tIfliN PROCiRRI'I TO DETERftH£ I~ Rl:Ill>Y 10
TAANsI'IIT A rlEW BYTE-SET TO INDICATE 1HAT NXTBYT
HAS BEEN LOADED
I1ESET BY TRANSI1IT PROCESS IHN BYTE IS ACCEPTED
SET WHEN TRANSI!ISSION OF A BYTE STARTS
RESET WHEN STOP fjlT IS TRANSIItnED
SET BY RECEIVE PROCESS WHEN OYERUN OCCURRS
SHOULD BE RESET BY PlAIN PliOORAl'! IIIlN SAlRE:D
Figure 4 (continued)
All mnemonics copyrighted Intel Corporation 1979.
1·54
inter
AP·49
LOC 08.1
90S9
FF7F
9900
SEQ
= 105
= 106
= 107
= 198
= 199
= 119
= 111
= 112
= 113
= 114
SOIJRCE STATEMENT
i
;
;
GENERRL COrlSTANTS
=================
i
E(lU
MARK
SPACE EQlJ
STPBTS EQlJ
80H
USED TO GENEFATED A !'lARK
NOT OOH ; lISED TO GENERATE A SPACE
9
COtlTROLS lHE NUMBER OF SWP BITS
9 GENERRTI;S ONE STOP BII
1 GEUERATES TI.'O SlOP BITS
i
= 115 $EJECT
= 116 ;
0097
0997 160A
0009 93
eallA 1)5
0fI0Il AF
000c 23FE
000E 62
= If?
= 118
= 119
= 129
= 121
= 122
= 123
= 124
= 125
;
;
;
ORO
9911 9A7F
9013 0417
9015 BAS0
0017 FE
0018 1224
001F1 3664
00lC FE
9010 4301
00lF 53FB
0021 AE
8022 13464
0I:l07H
i1
ENTER I NTERRUPT MODE
JTF
UART
RETR
UART: SEL
RB1
= 126 ; 1 SAYE ACCUMl.lATOR CONTENTS
= 127
1'101'
ATEtlP, A
= 128 ; 1 RELOAD TIMER
TI SR .
= 129
= 130
= 131 ;
1'1011
A, ITIHCNl
MOIl
T,11
= 132
OUTPUT Txt> BUFFER (Fl) TO TXD 110 LINE (P27)
=================================
;
= 133.,
ooeF 7615
START OF RECEIVE/TRANSMIT INTERRUPT SERVICE ROUTINE
= 134 ;
= 135
= 136
= 137
= 138
= 139
= 140
= 141
JF1
OMARK
OSPACE' ANL
P2, tlSPACE
JI1P
RCYOO0
O~1ARf(
ORL
P2, IHARK
;
;
START OF RECE lYE ROUTINE
=================
;
= 142
i
= 143
= 144
= 145
= 146
= 147
= 148
= 149
= 150
= 151
= 152
= 153
= 154
; 1 IF RECEIVE FLAG=0 THEN
RCVOO0: ItOIi
A, FLGBYT
JB9
RCV~19
;2
IF SEFI AL IIlPUT=SPACE THEN
JTfl
XMIT
;3
RECEII/E FLAG:=!
MOV
A, FlGBYT
ORL
A. tlRCIIFLG
.' 3
BYTE FINISHED FLAG: =8
AIIL
A,
BYFNFL
;2
ENDIF
MOl!
FLGB'r'T. A
.,m
= iSS
= 156
= 157
= 158
= 159
JMP
XMIT
; 1 1:15£
SINCE RECEIVE FLAG=1 THEN
;2
IF SYNC FLAG=8 THEN
RCW310. JB1
RCV939
d
IF SEFIAL INPUT=SPACE 1HEN
Figure 4 (continued)
All mnemonics copyrighted © Intel Corporation 1979.
1·55
inter
Ap·49
Loe OSJ
0026 3633
S()I.P.CE STATEMENT
SEQ
JTe
= 160
= 161 ; 4
RCI/029
5YOC FLAG' =1
m.
802F 0094
:: 162
= 163
= 164 . 4
= 165
= 166
= 167 ; 4
= 168
00?1 0464
= 169
JMf'
ELSE
0028 4302
oo2A HE
0028 8821
002D B0S0
= 170 .:,
0033 53FE
0035 AI:
0036 0464
00313 ED64
903A 8004
003(' 5259
903E 97
903F
0041
0042
9044
2642
A7
BS21
Fe
0045 67
0046 AO.
0947 E664
SlKTIi', 14
~y
XI1 IT
SINCE SERIftL INPUT=I'1ARK THEN
k,[CEI~'E FLfI(i.=0
= 171; 4
. = 172 Ii'CI/029'
ANL
AdlNOT RCYFU;
ENOIF
1'101,'
FLGf:I'L A
= 17'5
JMf'
XI1lT
= 176; 2 ELSE
SINGE SYNC ~LAG=l THEN
= 177 .3
SAMPLE COlINTEIi' =SAf1PLE COUNTEP.-l
= 178 I1CI/030 DJNZ
SAt1CTR, >''1'1 IT
= 179 ,3
IF SP.llPLE (,OlINl Er;:=e frifN
= 189 ; 4
SAI'lPLE COUNTER: =4
SAI1CTR,14
HOV
= 181
= ~82 ;4
I F B~'TE FItll SHED FLAG=0 THEN
RCI/950
= 183
= 184
CLR
!.'\
= 185 ; 5
CARR'T" =SERlftL INP/Jl
JNTO
I?CI/040
= 186
CPL
C
= 187
R0, .HDATA
= 188 I1C\l940 I'IOV
= 173 ;].
= 174
m:;:
= IS9
= 199 ; 5
= 191
= 192
= 193 ; 5
PlOY
RRC
!'lOY
.INC
=194
= 195
!6
0049 BS29
9048 A0
=196
= 19(
1'I0V
004C FE
004D 7254
= 199
= 200
I'IOV·
JB3
=201.,
= 202
= 203
OK
904F 4304
9951 AE
0052 0464
A, lIS'ltflG
FLGBYT. R
DATR: =80H
MOl,'
Re, OOATA
PlOY
@R0 ••8011
SAI'IPLE CNTR' =4
19)'.,'
=1913 ,;6
= 2134
= 295 ;6
I'IOV
A,~Re
SHIFT DATA "'1(jBT WI1H CARR..'
A
@F0,A
IF CARRI'=1 THEil
;':MIT
(}KOATA . =DATO
110.II'1OKDAT
~RO, A
IF [lATA RElICI,'
1'I0V
1MP
= 209
= 210
=211
Bt'lE FINISHED FLRG=1
A,tBYFNFL
FLGBYT, A
xrm
ELSE
BYTE FINISHED FLfiG: =1
OVERRIJN FLAG, =1
; 1'1(1','
ORL
I'IOY
= 212 ; 6
=213.;5
0057 9464
= 214
JI1P
A, FLGBYT
A, «(Bl'FNFL OR Ol/RUN)
FLGBYT,A
ENDIF
ENDIF
XMIT
. Figura 4 (conllnued)
All mnemonics copyrighted © Intel Corporation 1979.
lHEf'
[lCV045
=296;1'
= 207 ; 7
= 298 RC1I045:
0054 4384
0056 AE
FLAG=~
A.. FLGBYT
1-56
inter
AP·49
LOG OBJ
0059 26SF
0058 4308
eosl) 0461
0961 53FC
0963 AE
SEQ
= 215
= 216
= 217
= 218
SOLIRCE STATEI'1ENT
;4
;5
elSE,
SINCE BYTE FINISHED FLAG=1 THEN
IF SERIAL IHPUT=MARK THEN
RCY!I50: JNT0
RCV060
DATA READ',' FLAU: =1
A;'DRD'T'FL
= 219
OPL
ReVEl70
= 229
.IMP
ELSE
SINCE SERIAL INPUT=5PACE THEN
=221;5
eRROR FLAG. =1
=222;6
A••ERRFLG
= 223 Rel/a60: ORL
ENDIF
= 224 ,;5
= 225 ; 5
RECEI','\: ~LAG. =9
= 226 ; 5
5'r'NC FLOO:=!!
= 227 ReVEl7e. AHL
A.llroT(SVNFLG OR Rel/FLG)
= 228
MOV
FLGB'n. A
= 229 ; 4
END IF
= 2~9 ;:?
ENDIF
= 231 ; 2 EIIDIF
= 232 ,1 ENDIF
= 2:£3 rEJECT
= 234 ;
= 235 ;
STAin OF TRANSM IT POUTI NE
;6
= 236 ;
= 237 ;
=======================::
= 238 ; 1
0064 1C
006S 2303
0867 SC
0068 9697
006A FE
006B 37
006C 0286
006E 2324
0070 ric
0071 96;'B
ean
A5
0074 8'5
= 239
; TRANSMITTER OUTPUT BIT IS P2-7
= 240 ; 1 TICK COUNTER. =TICK COUHTER+1
= 241 XMIT: INC
TCKCTR
= ~42 ;1 IF TICK (;QUNTER "00 4=0 THEN
= 243
tolOV
A, .03H
= 244
ANL
A. TCKCTR
= 245
JNZ
RETURN
= 246 ; 2
IF TRRNSI'1ITTING FLOO=l THEN
= 247
MOV
A. FLGB'r'T
= 248
CPL
A
= 249
JB6
XI'1T040
= 259
IF STPBTS EQ 1
= 251 ; 3
IF TICK COUNTER=09 1910 00 BINARY lHEN
= 252
"011
A••28H
; CONDITIONAL ASSEMBL I'
= 253
XRL
A. TCKCTk
= 254
.JNZ
XI'ITB19
= 255 ; 4
TRANSMlTIING FLAG: =0
= 256
MO\I
A. FLGBYT
= 257
AHL
A. tNOT TRNGfL
= 258
1'1011
FLGBYT. A
= 2'59
JMP
RETURN
= 269
ENDIF
= 261 ,3
ELSE
IF TICK COUNTER=OO 1001 00 BINARY THEN
= 262 Xl'fT910: MOY
A••24M
= 263
XRL
A. TCKCTR
= 264
1HZ
('I'IT020
= 265 ,4
SEND 00 MARK
= 266
CLR
F1
; SET FLAGl TO MARK
= 267
CPL
F1
= 268
IF STPBTS EQ 9
= 269 ; 4
TRANSMITTING FLAG:=0
Figure 4 (continued)
All mnemonics copyrighled
e Inlel Corporation 1979.
1-57
intJ
Ap·49
LOC OB'!
9075 FE
9076538F
8878 AE
8879 9497
SEQ
SOORCE STATEI'IENT
= 270'
= 271
= 272
007D F0
907E 67
907F All
!l080 AS
0881 E697
0883 B5
0084 9497
=2?3
= 274
~TURN
ENDIF
ELSE
sna
TICK COOO'ER C)THE ABOI/E COUNT THEN
CLR
F1
JtIC
CPL
RETURN ; GO TO
JMP
RETURN
8823
-= 284
= 285
-= 286
= 287
= 288
-= 289
-= 290
F0
-= 291
BS22
A0
0097 FF
0098 93
F1
ENDIF
ELSE
SIt«:E TRANSMITTING H.AG=0 THEN
;3
IF TR~IS11I! REQUEST FlAG=l THEN
X1'1T940: JB5
R E T U R N ' FLAG BYTE THERE
,4
XIITBYT :=NXTBVT
= 292
MOil
1'10\1
1'1011
R0, IIIIIXTBY
A, @RO
RIl.• I/'IXIITlW
-=
MOY
@RIl,A
m
-= 296
0094 BC00
; FLltO 1 Will BE USED TO BlfFER 00
Rm~N PO nIT IF TXD=SI'I1CE (9)
; ELSE COMPLEI1EIIT FlAG 1 TO A tlARK
;:1
;2
= 294 ; 4
= 295
0091 4340
8893 fIE
= 297
= 298
= 299
= 390
-= 391
= 392
= 393
= 394
= 305
,4
.
. TRAIlSI1IT REQl(ST FLAG: =0
I'IOY
A, FUlBYT
Ali.
A, fNOT TRRQFl
TI"ANSl'IITTIIIG FlA(;: =1
ORL
A,ITRtIGFl
I'l0\l. FlGBYT, A
,4
TI CK COUNTER' =0
TCKCTR,1I0
;4
SEN!) S~'NC BIT (SPftCE) .
Cll!
F1
; SET FLAG 1 TO CAUSE A SPACI:
;~
ENDIF
;2
ENDIF
=396 ; 1 ENDIF
= 307 I1ETURN:
-= 308 ; 1 RESTORE ACCut1I.lATOR
= 399
t1O\I .' .A, ATEI'If'
= 310
RETR
311 $EJECT
P'.oy
]12 ;
9190
FFFE
901E
00lD
OO1C
0007
0006
; CONDITIONAL ASSEI'IBlY
= 276 ,4
SEND NEXT BIT
= 277 00920: i'KlY . RIl,II'IXItTBY
= 278
i'KlY .
A,fRO
= 279
~RC
A
@RIl,A
= 280
MOIl
= 281
= 282
= 283
00S6 8297
0988
008R
008B
. 9900
JI'I'
Ali.
= 275 ;3
8878 8822
I10V
A, FLGB'r'T
A, IINlT TRNGFL
FlGB'r'T, A .
f'tOY
3B;
START OF TEST ROUTINE
314 ;
315 '
316
m T1MCNT
318 HFLGBY
319 115A11CT
=============
320
321
322
323
324
ORG
EQIJ
EOO
EQIJ
"TCKCT EQIJ
;
ERRCNT EQU
PAn
EQU
;
019011
:-2
lEH
100
lCH
R7
R6
Figure 4 (continued)
All mnemonics copyrighted <0 Intel Corporation 1979.
1·58
Ap·49
LOt OBJ
9199 BFOO
91!12 BEOO
9194 23FE
01% 62
9107 55
9100 25
9199 881E
9UIB
aeee
8190 A5
911lE 85
81eF 881E
8111 Fe
9112 8224
0114 B923
9116 FE
8117 Al
SfJJRCE STATEI1ENT
SEQ
325
326
327
328
329
;
;
,; 1 ERR~ COONT: =9
TEST: I10Y
ERRCNT, III
; 1 REPEAT
339 TLOP
331 ; 2
PATTERN: =9
332
I10Y
PAn, .90
333 ; 2
INITIALIZE T!IIER
334
MO\I
A, ITlIDT
335
f1O\I
T, A
336
5TRT
T
:m
EN
TCNT!
:na .: 2 CLEAR FLAGBYTE
339
f'IOI,'
1/0, .HFLGBY
349
341 ,,2
242
343
I'IOV
~e,
III
FLAG1=MARK
CLF.'
F1
CPL
Fl
REPEAT
344 .: 2
345 TILOf':
346 ;3
IF TRAHSI1IT REQUEST FLAG--9 THEN
110\1
R8, WLGBY
347
f1O\I
ft @118
348
349
J85
TREC
350 ;4
NXTBYTE : =PATTERN
351
352
353
354.:4
355
356
357
358
359
360
HOY
I'lO\l
MO\l
Rl, II'tNXTBY
A,PAn
0128 8920
@R1.A
TRANSI1 IT REQUEST FLAG=l
DIS
TCNT!; LOCK OUT TIPlER INTERRUPT
; SO THAT MUTUAL EXCLUSION IS I'IAINTftINC.D WHILE
.: 'IHE FLAG B\'TE IS BEING MODIFIED
I'IOY
R,@R!j
ORL
A, tTRRQFL
@R!j,A
MOil
361
EN
TCNT!
TES1A
362
JTF
JriP
TREC
363
364 TESTA: CALL
IJART
.: CALL IJART BECAUSE TIMER OVERFLOWED Dl.JRIN(j LOCKOUl
365 ;3
ENDIF
366 ;3
IF DATA READ.,. FLAG=l THEN
367 TREC:
HOY
A,@R0
368
369
CPL
A
370
JBJ
TRECE
371 .:4
PATTERN: =OKDATA
J1O\I
R1, lMOKDAT
372
912A Fl
373
374
MOY
I'IOY
A,@Rl
912B AE
9118 35
0119 Fe
911A 4329
el1C A9
811D 25
011El622
(1120 2424
0122 149A
9124 F9
9125 37
9126 7238
812C 35
012D Fe
375 ;4
376
377
378
PATT, A
DATA READY FLAG: =II
DIS
TCNT!.: LOCK OUT TIMER INTERRUPT
; so THAT ItJTlR. EXCLUSION 15 MAINTIANED WHILE
; THE FLAG B't'TE IS BEING I'IOOIFIED
379
MOY
Figura 4 (continued)
All mnemonics copyrighted Intel Corporation 1979,
1-59
AP"49
LOC OOJ
~
SEQ
912E 53F7
All.
0139 A9
I'IO't'
EN
9131 25
9132 1636
flB42438
9B6 149A
383
JTF
384
JMP
CRlL
385 TESTS:
J86 TRECE:
3117 ;]
388 ; 2
A, lOOT DRDYFl
@F1l.II
TeNT!
TESTB
TRECE '
UAIIT
; CALL UART IF T!MER OVERFLOWED DURING LOCKOllT
ENDIF
UNTIL ERROR FLAG OR OVERRUN FLRG
389
390
391
392 ; 2
/'10'.'
R,@R9
RNl
A.I(O't'RUN OR ERRFLG)
J2
llLOP
INCREMENT EIIROR COUNT
:m
INC
E~CNT
394 i 1 UNTIL FOREVER
913S F9
9139 5:>'99
913B C69F
0131) 1F
913E 2402
USER S'r'/'IBOlS
ATEI1/' 9997
If'LGBY 991E'
OVRUN 00S0
P.C\1050 9059
STPBTS 0099
TJ5R 9997
iiMTB11j fl06E
SlRTEl'ENT
395
Jt4P
396 iEOF
397
END
BI'Flfl
I1NXTBY
PATT
RC\1960
SVNFLG
TLOP
iiI'IT020
A55EMBlV COI1l'lETE,
0094
9023
0096
OO'5F
0002
0192
9978
JlOP
DRDI'FL
HOKDRT
RCI/900
RCV070
TCKCTR
TREC
XKT940
0098
9020
0017
0061
0004
9124
ERRCHT 0007
/'ISAI1CT 0011>
kl.'V010 9924
RCVFLG 0001
TEST 9100
TRECE91J8
ERRFLG
MTCKCT
RCY020
REG0
TESTA
TRNGfl
0010
091(;
0033
9899
9122
994IJ
FLGBI'T 901j6
HXI'ITB't' 9rra
RCY030 .9038
RETURN 999i'
lESTB 1j136
TRRIlFL 0020
MARK
OJ1ARK
RCY040
SAMCTk
llLOP
UART
0000
r1()RTA 9921
0015
OSPACE 9911
9942
kCII945
SPACE
1I11CNT
Xl'll)
0005
0191'
99IjA
0954
FF7F
mE
0064
0086
NO ERRORS
Figure 4 (continued)
All mnemonics copyrighted © Intel Corporation 1979.
MULTIPLY ALGORITHMS
Most microcomputer programmers have at one time or
another I'mplemented a multiply routine as part of a
larger program. The usual procedure is to find an algorithm that works and modify it to work on the machine
being used. There is nothing wrong with this approach.
If engineers felt that they had to reinvent the wheel
every time a new design is undertaken, that's probably
what most of us would be doing-designing wheels. If
the efficiency of the multiply algorithm, either in terms
+
of code size or execution time is Important, however, it
is necessary to be reasonably familiar with the multiplication process so that appropriate optimizations for the
machine being used can be made.
To understand how multiplication operates in the binary
number system, consider the multiplication of two four
bit operands A and B. The "ones and zeros" in A and B
represent the coefficients of two polynomials. The
operation A x B can be represented as the following
multiplication of polynomials:
BOA3*~
B1A3*24 + B1A2*~.
+ B2A2*24 + B2A1*23 +
B3A 1*~ + B3AO*23'
+
+
+ B3A3*26
+
B2A3*25
B3A2*25 +
1·60
BOA2"22
B1A 1*22 +
B2AO*22
+
+
+
BOA1"2 1
B1AO*2'
+
BOAO"2°
AP·49
The sum of all these terms represents the product of A
and B. The simplest multiply algorithm factors the
above terms as follows:
A * B = BO*(A)*20 + B1 *(A)*21 + B2*(A)*22 + B3*(A)*2 3
Since the coefficients of B (Le., BO, B1, B2, and B3) can
only take on the binary values of 1 or 0, the sum of the
products can be formed by a series of simple adds and
multiplications by two. The simplest implementation of
this would be:
MULTIPLY:
PRODUCT = 0
IF BO= 1 THEN
IF B1 = 1 THEN
IF B2= 1 THEN
IF B3 = 1 THEN
END MULTIPLY
PRODUCT: = PRODUCT + A
PRODUCT: = PRODUCT + 2* A
PRODUCT:=PRODUCT+4*A
PRODUCT: = PRODUCT + 8* A
In order to conserve memory, the above straight line
code is normally converted to the following loop:
MULTIPLY:
PRODUCT:=O
COUNT:=4
REPEAT
IF B[O] = 1 THEN PRODUCT: = PRODUCT + A ENDIF
A:=2*A
B:= B/2
COUNT: = COUNT-1
UNTIL COUNT:= 0
END MULTIPLY
The repeated multiplication of A by two (which can be
performed by a simple left shift) forms the terms 2* A,
4 * A, and 8* A .. The variable B is divided by two (performed by a simple right shift) so that the least significant bit can always be used to determine whether the
addition should be executed during each pass through
the loop. It is from these shifting and addition opera-
ISIS- II
~IC5-48/UPI-41
lOC 08.J
tions that the "shift and add" algorithm takes Its com·
mon name.
The "shift and add" algorithm shown above has two
areas where efficiency will be lost if implemented in the
manner shown. The first problem is that the addition to
the partial product is double precision relative to the
two operands. The other problem, which is also related
to double precision operations, is that the A operand is
double precision and that it must be left shifted and
then the B operand must be right shifted. An examina·
tion of the "longhand" polynomial multir Ication will
reveal that, although the partial product is Indeed dou·
ble precision, each addition performed is only single
precision. It would be desirable to be able to shift the
partial product as it is formed so that only single preci·
sion additions are performed. This would be especially
true if the partial product could be shifted into the "B"
operand since one bit of the partial product is formed
during each pass through the loop and (happily) one bit
of the "B" operand is vacated. To do this, however, it is
necessary to modify the algorithm so that both of the
shifts that occur are of the same type.
To see how this can be done one can take the basic
multiplication equation already presented:
and factoring 24 from the right side:
A*B=24[BO*(A*2- 4)+ B1*(A*2- 3 )
. + B2*(A*2- 2)+B3*CA*2- 1)]
This operation has resulted in a term (within the
brackets) which can be formed by right shifts and adds
and then multiplied by 24 to get the final result. The
resulting algorithm, expanded to form an eight by eight
multiplication, is shown in figure 5. Note that although
the result is a full sixteen bits, the algorithm only performs eight bit additions and that only a single sixteen
bit shift operation is involved. This has the effect of
reducing both the code space and the execution time
for the routine.
t1fICRO ASSEMBLER, V2. Il
SEQ
SOURCE STAmalT
1 $MACROFIlE
2 $INClUDKF1.t1Pi'S. Hm
j .:
***************************************"**************************************,.
4.:*
5 .: '"
HPY8X8
'"
i ; *==========--================--============*'"
B i*
,.*
THIS UTllITI' PROVIDES AN 8 BI' a UNSIGNED MULTlPLI'
9 i*
AT ENTR... :
10 i*
*
A = lOWER EIGHT BITS OF DESTINIITION OPERAND
11 i*
.'"
XA= DON'T CARE
12 i*
R1= POINTER TO SOURCE OPERAND (t'IUI.. TIPLIER) IN IN1ERNIII. MEMEORI'
13 .:*
*
Figura 5
All mnemonics copyrighted © Intel Corporation 1979.
1-61
inter
AP·49
SOURCE STATEl£NT
LOC 08.1
= 14;*
=
AT EXIT,
15 i*
16 i*'
17
18 ;*
19 i*
,i.
29 ;
A = LOWER EIGHT BITS OF RESllT
XA= UPPER EIGHT EIlTS OF RESUL r
C = SET IF OVERFLOW ELSE CLEARED
24 ; 1 MP'r'8X3,
25 ,1 I'IULTiFLICAND[ 15-8 J =0
: 26 .·1 CLiUNT. =8
27 i 1 REPEAT
23 i 2
IF I'lULTIPLICANV[0J=0 THai BEGIN
29 .:>
MULTIPLlCAND,=MULTIPlICANro/Z
i;1
:11 d
32,:
]} ,; 2
ELSE
MlILTlPLICRND[ 15-8], =t1ll T1PLItAN{)[15-S J+PlUL TIPLIER
MULTIPLlOINr':=I'1ULTIPLICAND/2
ENDIF
f4 i 2
~OOtlT =COIJNT-1
]5 ; 1 UNTIL COUIIT=0
~s ,lEN£, MP'J3XS
:·7 :
?8 EQIJATES
J9 i
4B ;
41 XA
EQIJ
9002
000?
9004
EQU
42 COuNT
R2
R3
R4
43lOIT
EQIJ
44 ;
45 OII3PR EQlJ
3
46 ;
47 $EJECT
48 $INCLlIDE<: F1: MP'r'8)
49 ; 1 MP'r'8X8'
9003
50 MP~'8l<:B:
51 ,.1 t1llTIPLIC.ANI)[15-81:=9
52
I10V
53 ; 1 COONT:=S
54
I'IOV
0000 BA00
0092 B!l9B
XA, 100
COUNT, tIS
55 ;1 REPEAT
56 I'IPYSLP.
9004 120E
=
9096 2A
aile?
9"1
Il008 67
OO~
2A
000A 67
0098 E894
900D 83
*
*".
**************••******.**********"'***~*******"'**"'**t******.t***••",...**********
21 ;
22 ;
23 $INCLUDE( :F1:t'lPVS POL)
:10
*
57 i 2
IF MlILTJPLlCAND[llJ=9 THEN BEGIN
58
59 i 3
JB0
I'1f'YSA
MIJL TIPLl CAND : =MIJL TIPLICAND/2
69
61
XCH
CLR
A, XA
C
62
63
RRC
XCH
154
RIle
A
A. XA
fI
65
orNZ
COUNT. MP'r'8LP
66
6;' ,;2
RET
ELSE
Figure 5 (contlnuad)
All mnemonics copyrighted © Intel Corporation 1979.
1-62
AP·49
LOC· OBJ
SEQ
SOURCE STATEMENT
68 I'lP'r'BA:
69 ,3
= 70
71
72
ewE 2A
000F 61
0018 67
13011 2A
0012 67
ADD
73
74
7!;
76
i7 ; 1
78 ,2
79 ; 2
0013 EB94
0015 83
sa .: 1
~~1
82
USER S'l't'1BOLS
COUNT iJ!.lO?
MIJLTlPLICAND[15-SJ:=I1IJLTlPLICI-lU(){15-S]+I'IULTlPLIER
XCH
A~ XA
;1
E~[i
DlGPP 0003
A5SEI1BL't' COMPLETE.
A, @111
RfiC
A
XCH
A, XA
Rr;'C
A
DJNZ
COUNT, HP't'8LP
RET
MIJL TIPLICANI): =I'IIJL TIPLICANI)/2
ENDIF
COUNT· =COUNT-1
UNTIL COUNT=0
END 11P~'3:<3
leNT
9004
MP'~SA
00iJE
MF'~8LP
0004
MPV8X8 !lOO!l
XA
tlO EJIRORS
All mnemonics copyrighted © Intel Corporation 1979.
DIVIDE ALGORITHMS
In order to understand binary division a four bit operation will again be used as an example. The following
algorithm will perform a four by four division:
DIVIDE:
IF 16*DIVISOR>= DIVIDEND THEN
SET OVERFLOW ERROR FLAG
ELSE
IF 8*DIVISOR>= DIVIDEND THEN
QUOTlENT[3]:= 1
DIVIDEND: = DIVIDEND - 8* DIVISOR
ELSE
QUOTlENT[3]: = 0
ENDIF
IF 4*DIVISOR>= DIVIDEND THEN
QUOTlENT[2]: = 1
DIVIDEND: = DIVIDEND- 4*DIVISOR
ELSE
QUOTlENT[2]: = 0
ENDIF
IF 2* DIVISOR> = DIVIDEND THEN
QUOTIENT[1]: = 1
DIVIDEND: = DIVIDEND - 2*DIVISOR
ELSE
QUOTIENT[1]: = 0
ENDIF
IF 1 *DIVISOR> = DIVIDEND THEN
QUOTIENT[O]: = 1
DIVIDEND: = DIVIDEND - 1 *DIVISOR
ELSE
QUOTIENT[O]: = 0
ENDIF
ENDIF
END DIVIDE
The algorithm is easy to understand. The first test asks
if the division will fit into the dividend Sixteen times. If it
will, the quotient cannot be expressed in only four bits
so an overflow error flag is set and the divide algorithm
ends. The algorithm then proceeds to determine if eight
times the divisor fits, four times, etc. After each test It
either sets or clears the appropriate quotient bit and
modifies the dividend. To see this algorithm in action,
consider the division of 15 by 5:
00001111
- 01010000
(15)
(16*5)
00001111
- 00101000
(15)
Doesn't fit-no overflow
(8*~)
Doesn't lit-Q[3] = 0
00001111
- 00010100
·(15)
(4*5)
00001111
- 00001010
(15)
(2*5)
Doesn't lit-Q[2]=0
00000101
00000101
- 00000101
00000000
Fits-Q[1] = 1
(15-2*5)
(1 *5)
Fits-Q[O] = 1
The result is ci = 0011 which is the binary equivalent 01
3-the correct answer. Clearly this algorithm can (and
has been) converted to a loop and used to perlorm divisions. An examination 01 the procedure, however, will
show that it has the same problems as the original multiply algorithm.
1·63
Ap·49
The first problem is that double precision operations are
involved with both the comparison of the division with
the dividend and the conditional subtraction. The
second problem is that as the quotient bits are derived
they must be shifted into a register. In order to reduce
the register requirements, it would be desirable to shift
them into the divisor register as they are generated
since the divisor register gets shifted anyway. Unfortunately the quotient bits are derived most significant
bits first so doing this will form a mirror image of the
quotient-not very useful.
When this algorithm is implemented on a computer
which does not have a direct compare instruction the
comparison is done by subtraction and the inner loop of
t,he algorithm is modified as follows:
REPEAT
DIVIDEND:= DIVIDEND*2
QUOTIENT: = QUOTIENT*2
DIVIDEND: = DIVIDEND - DIVISOR
IF BORROW=O THEN
QUOTIENT: = QUOTIENT + 1
ELSE
DIVIDEND: = DIVIDEND + DIVISOR
ENDIF
COUNT: = COUNT - 1
UNTIL COUNT = 0
Both of these problems can be solved by observing that
the algorithm presented for divide will still work if both
sides of all the "equations" involving the dividend are
divided by sixteen. The looping algorithm then would
proceed as follows:
DIVIDE:
QUOTIENT: = 0
COUNT:=4
DIVIDEND: = DIVIDEND/16
IF DIVISOR>=DIVIDEND THEN
OVERFLOW FLAG: = 1
ELSE
REPEAT
DIVIDEND:= DIVIDEND*2
QUOTIENT: = QUOTIENT*2
IF DIVISOR> = DIVIDEND THEN
QUOTIENT: = QUOTIENT + 1/*SET QUOTIENTIO]*/
.
DIVIDEND:= DIVIDEND- DIVISOR
ENDIF
COUNT: = COUNT - 1
UNTIL COUNT = 0
ENDIF
END DIVIDE
An implementation of this algorithm using the 8049 instruction set is shown in figure 6. This routine does an
unsigned divide of a 16 bit quantity by an eight bit quantity. Since the multiply algorithm of figure 5 generates a
16 bit result from the multiplication of two eight bit
operands, these two routines complement each other
and can be used as part of more complex computations.
ISiS- II HC5-4B/UPHl t1ACFO ASSEMBlER, Y2. 9
Lor 08,]
S(NJRCf STATEMENT
SEQ
1 tl'lACROFILE
;: tINCUJ[lE{ :F1·[lIII16. HED)
:: ,.~*~",,,,**.*~*******************************************. .************************
i*
*
:*
DIV1b
*
.*
,.
4
'5
6
7
S
9
19
11
12
13'
.14
1'5
16
17
.: *==============================================?========*
>I<
;*
,..
THIS UTILITY PRO\IIDES' AN 16 BY S UNSIGNED DIVIDe
;*
>I<
;*
AT ENTRY:
p~
A = LOWER ElGtH BITS OF DESTINATION OPERAND
*>I<
XA= UPPEI1 EIGHT BIT5 Of DIVIDEND
.
;*
R1= POIllTER TO DIVISOR IN INTERNAL MEMORY
>I<
; '"
AT EXIT:
:*
*
;*
A = LOWER EIGHT BITS· OF RESUL1
...
;*
XA= JlEt1AINDER
*
'"
*
Figure 6
All mnemonics copyrighled (0 Inlel Corporalion 1979.
1-64
inter
LOC OBJ
Ap·49
SEQ
SOURCE STATEMENT
C = SET IF OVERFLOW ELSE CLEARED
,.
'"
29 .' **~***** N .**~~ _* H~ '~*.j.*~·*f··.*******,H*****",*******.I<*********"'***~**"'*~,*******
21 ,
22 ;
2,
24
25
26
27
28
29
tINCLUDE(F1:DIV16 PDLl
; 1 [\11116
; 1 rOUrn·=3
; 1 ['JVJ[lEN~[15-8J=[JJVJDEN[U~H3H)lVI50~'
; 1 IF BORROIol=0 THEN l* IT FITS.:,'
;2
SET OVERFlOIJ "LAO
; 1 ELSE
30 ; ~
~ESTO~E
31
12
13
34
35
?6
PEPEAT
DIVlDEND:=DIVIDENU*2
OIJOTJENT =QIJOTIENT*2
;2
,3
;?
;:;
.: 1.
;4
:7 ; 3
38 :4
19 .:,.
0002
000:5
!lael BB0e.
0903 37
0004 61 .
8905 37
0996 F60B
m~e8 117
<1!llJ9 0424
0008 61
[Il'JlDENll
[;!V!I)END[15-8J:=~IV!l)END[1~-SHIVISOP
BOR~OH=l THEN
RESTORE DIVIDEND
ELSE
IF
;}UOTJENf[0] =1
ENDIF
411 ; -,
t:ourn . =COUNT-1
41 ;"2
IJPHIL COIJNT=0
42 .: 2
CLEAR OVERFLOW FLAG
4:5 ; 1 END:F
44 :1·ENDDmDE
45 ;
45 . EQUATES
47 .'
43 "
49 >:11
EGIJ
R2
f(!
59 COUNT EGU
51 ;
52 $EJECT
53 sJNCLlIDE< :F1:I!IV16)
54 ,1 DIVi6.
55DIVlt:. XCH
A,XA
,,"OOTlNE WORKS MOSTLY WITH BIl5 15-8
=.56 ;1 COllIIT:=8
57
t10V
COONT, #~o
58 ·1 DIVIDEN[I[1S-8l:=DIVIDEN[H5-SJ-DIVISOR
59
CF'L
A
60
ADf'
A. @R1
61
CPL
A
" 62; 1 IF BORROH=ll THEN /* IT m 5"'/
6"1
Ie
[)I VIA
64 ; 2
SET OVERFLOW FLAG
65
CPL
C
JMP
DIVIS
66
67 ; 1. ELSE
61'1 [)I','lft:
69 ·2
IJ=l THEN
90
,"'Ie
Dlvre
-. 91 ,4
PE5TOI3
0019
00lA
0018
;<(,H
110V
'55
O(l!:l5 8100
eaec
1'10'1
eCD' =BCD*2tC~R\'
~Ol
H.R9
R1.A
HOII
XCH
A.R9
11011
ICNT.IDIGPR
TEMP!. Ii
MOil
MOY
f100C
A·@R1
[lfl
MOil
A
@j;'LA
INC
Rl
~.@Rl
leNT. BCDOC
>31
MOY
A. TEMP1
82 .2 . IF CARRY FPCit'! BC[lACC GOTO ERROR EXIT
83
Je
BCOCOD
84 .' 2 couln .=COIJNT-1
85 ; 1 UNTIL GOUNT=!!
06
r, JNZ COUNT. BCOCOB
091F F624
0021 EBOC
8823 97
DJN2
G7
CLR
C
88 ; 1 END CONVERT-TO_BCD
89 ewcOD RET
90 END
0024 83
USER SYMBOLS
BWCOA il005
BCDCOI3 OOOC
TEMPi 0(,'.0'5
l:A
M55EMBL',' cot-RETE.
BC[JCOD 0024
; CLEAR CARRY TO ltIDICATE NORMAl.. TERHINftTlOtl
BCDOC 0017CNBC[1 0000
0W2
/10 ERI"OR5
Figure 7 (conllnuld)
All mnemonics copyrighted Intel Corporation 1979.
1-68
COUNT 0003
DI (jPR e003
1(;NT
9004
intJ
Ap·49
The conversion of a BCD value to binary is essentially
the same process as converting a binary value to BCD.
CONVERT_TO..BINARY
BIN:=O
COUNT:= DIGNO
REPEAT
BCDACCUM: = BCDACCUM • 10
BIN:= 10· BIN + CARRY DIGIT
COUNT: = COUNT - 1
UNTIL COUNT=O
END CONVERLTO_BINARY
The only complexity is the two multiplications by ten.
The BCDACCUM can be multiplied by ten by shifting it
left four places (one digit). The variable BIN could be
multiplied using the multiply algorithm already dis·
cussed, but it is usually more efficient to do this by mak·
ing the following substitution:
BIN=10· BIN=(2)· (5)· (BIN)=2· (2·2+1)· BIN
This implies that the value 10 • BIN can be generated by
saving the value of BIN and then shifting BIN two places
left. After this the original value of BIN can be added to
the new value of BIN (forming 5 • BIN) and then BIN can
be multiplied by two. It is often possible to implement
the multiplication of a value by a constant by using such
techniques. Figure 8 shows an 8049 routine which con·
verts BCD values to binary. This routine differs slightly
from the algorithm above in that the BCD digits are read,
and converted to binary, two digits at a time. Protection
has also been added to detect BCD operands which, if
converted, would yield binary values beyond the range
of the result.
151:-!! I1CS-4:3!IJPI -41 MACI"O ASSEMBLEP, \(2. 0
lOC OBJ
SEQ
501JRCE: STATEMENT
1 Si'1HCROFILE
2 >INCLUDE( F1:CONIlIN. Hm)
] .: *************_.****-1<****** ~.~*.~*********************",***************.*******",*~,*
4 ;t
5.*
'"
CONBIN
'"
'"
7 ; *==================================================================*
B .:t
,..
THIS UIILlW CON'/EIHS A 6 DIGIT BCD '~ALUE TO B1NARI'
9 :*
10,.
11 :.~
12 :j<
13 j t
14.:*
1~
:*
16 :*
AT ENT,..... ·
RO= POINTER TO II PACKED BCD STFING
AT EXIT:
H = LOWER EHiHf BITS OF THE BINARY RESULl
l\f:= tiPPER EIGHT BITS OF THE BINARY RESIJl T
C = SET IF OVERFLOJ,l ELSE CLEARED
'"
'"
'"
'"
'"
'"
'"
'"
V.:*
'"
18 : ************"'i·'f<*~**.~*,'·t-*'f<**~*****""*"'***"'**t.j<************"'*"'***********"'*******
19.:
29 :
21 $INClUDE( ·F1:CONBW. POl)
22 ;
23.
24 .: 1 1.:ot·WERLTO_BINAR'r'
25 .: 1 POINTER0:=POHlTER0+DIGITPAIR-i
26 : 1 COlIIIT: =DIGITPAIR
27 ; 1 BIN:=~
23 : 1 REPEAT
29 : 2
BIN: =BIN"'W
:m:2 BIN:=BIN+MEM(RM7-4J
31:2
BIN:=8IN*10
12 .: 2
BIN. =BIN+r1EWR0)D-01
All mnemonics copyrighted © Intel Corporation t 979.
1·69
intJ
AP·49
lOC 08J
soo;:CE STRTEIENT
SEQ
3J ; 2
34.2
POJtIT~
=POINTER8-1
COUNT:=COUNT-l
~5 •1 UNTIL WUtH =~
36 ; 1 EN!) CON"'Ej;'L TO_BlNAI?Y
33 . EOIJRTES
39 .
40.:
41 XA
42 COUNT
43 leNT
44 ;
45 DIGPR
9003
EQIJ
EQU
EQU
R2
R3
R4
EQU
3
46;
47 fEJECT
43 $INCLUDE ( 'F1. CONBIN)
49 .
59 TEMPi
51 TEMP~
SET
SET
R5
R6
52 ;
9000 Fa
8001 11302
9003
~8
8W4 BSIl3
0006 27
8W7 AA
0008 142B
009A F62A
ttOOC AD
BOOD
000E
OOBF
0011
; 1 COt/VERLTO_BINARY
COIlBIN:
; i POINTER0:=POINTER0+DIGITPAIR-l
1'10'./
A, RIl
ROO
A,I01GPR-i
t'f()V
RB.• A
; 1 COllNT:=DIGITPAIR
69
1'1
6D
74
;'5
76
77
78
79 ;2
80
81
82 :2
0015 2Fl
0016 F62A
0018 142B
001A F62A
AD
Fe
72
73
3?
84
5~0F
as
61)
B6
37
2A
All mnemonics copyrighted CO Intel Corporation 1979.
MOV
COI.JNT, If) IGPR
61 .,1 BIN =0
62
elF:
A
E::
MOil
i(il, A
64 . i REPEAT
65 CGNBlP:
66,2
BIN:=BIN*10
67
CALL
CONB10
68
.Ie
CONSER
69 ,2
BIN. =BIN+MEM(R0)[ 7-41
79
MO\!
TEMP1, A
F9
47
530F
. 0012 2A
0013 1399
901C
0010
001E
B020
9021
53
54
55
56
57
58
59
!1OV
R, @RO
SWAP
A
A,#iJFH
ANl
AI)[>
Fl, TEI1Pi
A, XA
XCH
A,too
AOOC
;':CH
A. XA
K
CONBER
~IN =BItM0
CALL
CONB10
JC
CONBER
BIN =B IN+t1EH (RBi[ HlJ
MOV
TEt1Pl, A
A..@RQ
MOV
ANL
A,10FH
AOO
A, TEMPi
A, XA
XCH
1·70
intJ
Ap·49
LOC 00)
SOURCE STATEI'IENT
SEQ
88
89
0022 BOO
0024 2A
1l1l2'3 ~62R
AOOC
XCH
90
91 ; 2
92
0027 CS
A, 100
ft,XA
JC
COIISEII
POI'lTER9. =POINTER0-1
DEC
R0
93 ,2
COUlIT :=COUNT-l
94 ; 1 UN1IL COIJllT=e
95
002S EBBS
D.JNZ
CO'JIlT, CONBLP
96 ; 1 END CONVERLTO_BIHAR'I
97 COIl8ER: !lET
9S SEJECT
99
002A 83
=100 ;
= 101
= 102
= HIS ;
= 104 CONBl9. MO~'
= 105
XCH
002B All
902C 21'1
= 106
= 197
= 10S
= 109
= 119
= 111
= 112
= 113
= 114
= 115
= 116
= 117
= 118
902D AE
002E 2A
00'5 97
003B F7
0031 2A
0032 F7
0033 2A
00:14 F646
9036
00:?7
0038
0039
UTILI T'1' TO I'IIJLTIPL.,.. BIN BI' 10
CARR~' WILL BE SET IF OVERFLOW OCCURS
F7
2A
F7
2fl
I1(IV
TEMPi. A , SAVE A
A, XA
!>AVE XA
TEl'lnA
XCH
A,XA
CLR
PLC
C
XCH
RlC
A
A.Xft
JC
CONBIE ; ERROR 011 OVERFLOW,
RLC
A
A.XA
XCH
RLC
803ft F646
003C 6D
903& 2ft
883E lE
= 121
= 122
= 123
= 124
ADDe
=125
XCH
= 126
= 127
JC
= 128
RLt
XCH
2A
0040F646
0042
9043
9044
9045
F7
2A
F7
2A
0046 83
USER SYMBOLS
CONB10 0028
TEl1Pl 0095
CONBIE 0046
TEt1P2 0006
ASSEMBLV COMPLETE,
NO
; BIN: =BIIO*4
ft
XCH
A,XA
.Ie
CONBIE ; ERROR ON OVERrLOW
AI.lO
XCH
= 129
= 130
= H1
= B2 ;
= 133 CONalE:
= 134
= 135
136 ~N!)
; BIN: =BIN*2
;{r)l
= 119
= 120
OO~F
A
RLC
XCH
A. IDtf'1 ; BIN:=BIN*S
A, l(A
A, TEMP2
A. XA
COIIBIE ; ERROR ON OVERFLOW
A
; BIN: =8110*10
A. XA
A
A.XA
RET
CONSER 902A
i:A
0902
COIIBIN 0000
CONBLP 0008
E~:ROR5
All mnemonics copyrighted © Intel Corporation 1979.
1-71
COUNT 9003
DIGPR 0003
ICNT
0004
inter
Ap·49
CONCLUSION
The design goals of the full duplex serial communIcations software were realized; if transmission and reception are occurring concurrently, only 42 percent of the
real time available to the 8049 will be consumed by the
serial link. This Implies that an 8049 running full duplex
serial I/O will still outperform earlier members of the
family running without the serial I/O requirement. It is
also possible to run this program in an 8048 or 8748 at
1200 baud with the same 42 percent CPU utilization.
the highest performance microcomputer available to
date, the performance advantage of the 8049 should
allow the cost benefits of a single chip microcomputer
',to be realized in many applications which up until now
have required too much "computer power" for a'single
chip approach.
EXEC!JTION TIME
(MICROSECONDS)
The execution times for the other routines that have
been discussed have been summarized in Table 1. All of
these routines were written to maintain maximu'm useability rather than minimum code size or execution time.
The resulting execution times and code size are therefore what the user can expect to see in a real application. The results that were obtained clearly show the efficiency and speed of the 8049. The equivalent times for
the 8048 are also shown. It is clear that the 8049 represents a substantial performance advantage over the
8048. Considering, in most applications, that the 8048 is
BYTES
8049
8048
MPY8
21
109
200
DIV 16
37
183,MIN
204 MAX
335 MIN
375 MAX
CON BCD
36
733
1348
CONBIN
70
388
713
Table 1. Program Performance
1·72
intJ
APPLICATION
NOTE
AP·55A
August 1979
INTEL CORPORATION ASSUMES NO RESPONSIBILITY FOR THE USE OF ANY CIRCUITRY OTHER THAN CIRCUITRY EII80DIED IN AN INTEl PRODUCT. NO OTHER CIRCUIT PATE.n utENSES ARE IMPLIED.
©INTELCDRPORATlDN.1979
1-73
9801007-<)1
AP·55A
I. PURPOSE AND SCOPE
• Breaks may be triggered by either program or external data RAM accesses;
This Application Note presents a description of the
design and operation of a high·speed emulator for the
Intel'" MCS·48™ family of single chip microcomputers.
The HSE·49™ emulator provides a simple and inexpen·
sive means for executing and debugging 8049 programs
which require the full 11·MHz operating speed of the
part.
• Any number of breakpoints may be used in any
combination;
• "Auto-Step" operation causes the current program
counter and Accumulator contents to be printed on
the display for a short time on every instruction
cycle;
Section II of this Application Note describes some of
the features of this development tool and how it may be '
used. Section III briefly discusses the hardware used to
implement these features, while Section IV describes
the manner in which program execution status is made
available to the operator.
• "Auto-Break" provides the above display only when
a break flag is encountered, with real time operation otherwise;
• While running in non-break mode, a TTL-level pulse
is generated whenever a break flag is encoun'tered.
This signal may be used to trigger an oscilloscope
or Logic Analyzer to assist in hardware and software debug.
A detailed description of all of the operator commands,
is presented in Section V of this note, along with the
modifiers and options which may be specified for each
command. Known restrictions and limitations of the
HSE·49 system are listed and explained in Section VI.
Section VII shows how the basic circuit may be
modified to provide options on memory organization, I/O
configurations, etc.
Full schematics of the system hardware, as well as
monitor software listings, are presented in Appendices
: A and B, respectively. A short summary of the command
syntax is presented in Appendix C,. Appendix D ex·
plains the error message codes which may appear duro
ing use.
It is assumed that the reader is already familiar with the
operation of the 8048 or 8049 microcomputers. Some
knowledge of the 8048 architecture is needed to under·
stand sections of the command and modifier descrip·
tions. Most users will already have this background.
Other readers are referred to the MCS·48 Microcom·
puter User's Manua/, Intel publication number 9800270.
• While running in any mode, the keyboard and
display are "alive". Execution may be suspended or
terminated by commands from the keyboard.
Intent of this Note
While the HSE-49 emulator can assist a new microcomputer user in becoming familiar with the 8048 and 8049
microcomputers, its inherent debug capabilities will
also prove helpful to design engineers. The design'
could be used for new system development and verification or adapted for prototype production.
The main concern in designing the HSE-49 emulator was
to keep the basic design simple, while maximizing the
system's flexibility. The design allows the use of
jumpers, hardware and software switches, etc. to allow
the user to reconfigure the system according to the way
he dedicates chip-select pins, 110, etc. The emulator can
be changed to fit each user's unique needs, rather than
forcing the user to alter his needs to what is provided ..
The primary intent of note is to provide the reader with
the information needed to reconstruct and make full use
of the HSE-49 emulator. Less emphasis is placed on
describing how the hardware operates or how the commands are implemented. This information may be found
in the schematic diagrams and software listings inCluded in the Appendices.
II. THE HSE·49 DEVELOPMENT TOOL
In essence, the HSE-49 emulator provides the user a
means for executing an MCS-48 program located in ex·
ternal RAM rather than internal ROM or EPROM. This
allows programs being debugged to be modified easily
and quickly during the debug cycle. A user's program
. may be entered into system RAM either manually or via
a serial link from a host computer such as an In·
tellec'" Microcomputer Development System. Once
loaded, the program can be modified using an on-board
keyboard and display, and executed in real-time in a
. number of breakpoint modes. The internal state of the
processor, including RAM,:accumulator, timer/counter,
and status register contents, can also be read and
modified through the keyboard.
'
Breakpoinf and 'debug facilities are extremely fl,exible.
The following execution modes are provided.
• Programs may be run in full (11 MHz) real time;
• Programs may be single-stepped;
• In break mode, programs run in full real time until
break occurs;
III. GENERAL HARDWARE OVERVIEW
User Program Emulation
The actual emulation of the user's program is done
using an 8039 microcomputer (IC29 on the schematics
in Appendix A) executing a program stored in external
RAM. The basic minimum configuration includes the
8039 microcomputer, an 8282 address latch (IC19), and
2K bytes of 2114 RAM to use for program development
and real-time,execution (ICs B1, C1, B2, and C2). Additional RAM may be added to allow the user to expand
his program and data memory to 4K each. (If an 11-MHz
crystal is used with the microcomputer, tYPE! 2114-3
RAMs must be used.)
1-74
intJ
AP·S5A
System Supervision
familiar with the PROMPT-48™ debug tool for the 8048
will find that 25 of the HSE-49 emulator keys are identical in function and layout to the PROMPT-48 keyboard,
and use the PROMPT-48 command syntax. The eight additional keys are used to generalize and augment the
PROMPT·48 capabilities, as described in Section V.
A second microcomputer - another 8039 (IC25) with an
8282 address latch (ICI6) and off-chip program memory
in a 2716 EPROM (iCI5) - is used to scan the on-board
keyboard and display, interpret and implement commands, drive serial interfaces, etc. In general, the
master processor is used to interface the execution
processor's memory spaces with the outside world and
control the operation of the execution processor. In this
note the two processors will be abbreviated "MP" and
"EP", respectively. Figure 1 shows how the two processors interrelate with the rest of the system.
system.
The eight-character seven-segment display (DS1-DS8)
is used for displaying addresses, data, and pseudoalphanumeric messages_ The display responses printed
in Section V and throughout this note use a mix of upper
and lower case letters to indicate what seven-segment
patterns appear. An 8243 (IC9) and eight DIP packages
(resistor packs, current buffers, etc_) are used for
multiplexing the display and scanning the keyboard_
Keyboard/Display
Breakpoint Detection
The 33-key keyboard shown in Figure 2 includes a 16-key
hexidecimal keypad and 17 special function keys for
specifying commands and modifiers. Readers already
Breakpoints are specified and detected using a 2102A
lK x 8 RAM corresponding to each pair of 21145 (ICs AI
USER
SYSTEM
PROTOTYPE
HOST
COMPUTER
SYSTEM
(INTELLEC)
DODOOE/e/D
O.O.O.c.I.D.C .Ll.O
C
D
E
F
CRT
A B
4
5
6
7
o
1
2
3
Figure 1. HSE49™ Emulator Signal Flow Diagram
B I
GO/RESET
I
I II
UPLOAD
SYS RST
DNLOAD
IG
I
I
I
EXAM/CHA
I
CLR/PREV
B I
HARD REG
IB
B
DDD0
DDDD
I DDD0
DODD
I
Figure 2. HSE_49™ Emulator Command Keyboard Organization
1-75
AP·55A
and A2). In effect, each program or data address accesses a 9-bit word. Eight bits are used normally for
code or data storage. The ninth bit, accessed in parallel
with the other eight, is used to indicate if a breakpoint
has been set for that address. This output, when
asserted, is latched {IC27 and IC36) and used to halt the
execution processor via the single-step input. (In other
modes, the break logic can be reconfigured to set the
break requested flip-flop on any EP machine cycle or
any EP "MOVX" instruction.)
baud from the on-board keybad. Blocks of data may be
transmitted to a CRT or printer and displayed in a
tabular format.
IV. INTERPROCESSOR COMMUNICATION
Program Break Sequence
When the MP detects that the EP has been halted by the
breakpoint hardware, or when the operator presses a
key while the program Is executing, the program break
sequence is initiated. The low-order 23. bytes of user program memory is read into a buffer within' the internal
RAM of the MP. A short program for reading and
transmitting internal EP status is written over the loworder program memory. (This is one of several "minimonitors" overlayed over the user program area.) The
link register is mapped logically over the user program
memory, and loaded with the 8049 machine code for a
"CALL" instruction to the mini-monitor program area
The EP is then allowed to fetch Ii single instruction fro~
the link, i.e., the "CALL" to the mini-monitor is forced
onto the EP data bus.
Link Register
An 8212 8-bit latch (IC18) is used to communicate data
and commands between the master and control processors. Under control of the MP, this register, called the
"Link" register, may be logically mapped into either the
program or data RAM address spaces. When this is
done, the 2114s in the respective memory space are
disabled and the link responds to all accesses.regardless of address. The link will be discussed in
greater detail in Section IV.
Control Logic
From this point on, the EP elfecutes code contained in
the mini-monitor. The link is logically mapped over the
data RAM address. space (whether or not any 2114 data
RAMs are present). A block diagram of the system at
this point is shown in Figure 3. The break logic is reconfigured so that any "MOVX" (RD or WR) operation executed by ttie EP will cause it to halt.
In addition to the devices mentioned above the
minimum configuration requires about 10 addition~IICs
for bus arbitration, system control, and breakpoint and
single-step logic; Additional parts may be optionally
added for serial port interfacing, I/O reconstruction, etc.
MP Monitor
For example, after entering the first mini-monitor, the
EP executes a "MOVX @RO,A" Instruction. This writes
the contents of the accumulator prior to the execution
termination into the link, and causes the EP to halt. The
MP may then read and retain the link contents to determine the EP accumulator value. The EP timer/counter
and PSW are preserved in the same manner.
The monitor program executed by the MP includes commands for filling, reading, or writing the various memory
spaces, including the execution processor's program
RAM, external ("MOVX") data RAM, accumulator, PSW,
PC, timer/counter, working registers, and internal RAM;
to execute the user's program from arbitrary addresses
in various debugging modes; and to upload or download
object or data files from diskettes using an Intellec@ development system. No special software is
needed for the Intellec@ other than ISIS Version 3.4 or
later. The data format is compatible with the standard
Intel hex file format produced by ASM-4; the baud rate
may be altered from 110 baud (default state) up to 2400
Accessing EP Internal RAM
After reading and saving EP internal status, the MP
loads a different mini-monitor into the same RAM area.
This monitor allows the internal RAM of the EP to be
read and written by the MP by passing address and data
EXECUTION"
PROCESSOR
MASTER
PROCESSOR
Figure 3. Communication between EP • MP
All mnemonics copyrlghled© Inlel Corporation 1976.
1-76
inter
AP·55A
values between the two processors using the link
register.
This is needed for two reasons. First, the EP program
counter prior to the forced "CALL" instruction may be
derived from the EP stack contents, and may be
modified to cause the EP to resume execution at any
desired address. Secondly, the internal RAM of the EP
may then be accessed and modified in the process of
executing a number of the monitor commands.
Resuming User Program Execution
In order to resume user program execution, a statusrestoration mini-monitor is overlayed. This restores the
EP internal status using a scheme analogous to the one
in which the status was originally saved. The final step
of the last mini-monitor is an "RETR" instruction, after
which the EP is again halted. The low-order program
memory saved earlier is rewritten into the appropriate
area, the break logic is reconfigured for the desired execution mode, and the EP is released to run at full speed
until the next break situation is encountered.
Note that all commands are implemented using
"logical" rather than "physical" addressing. Thus the
operator need not be concerned with the intricacies of
the system design. For example, when any monitor command refers to low-order user program memory, the appropriate byte of storage within the MP internal RAM is
accessed instead. If the location is altered, the internal
RAM is modified appropriately. When program memory
is reloaded prior to resuming user program execution,
the modified version of the user program will be the one
loaded.
low order part of a parameter; i.e., a command incorporating a data byte (such as [FILL]) will use only the
low-order 8 bits of the corresponding parameter; Internal RAM and hardware register addr,essing uses only
seven. In each case, higher order bits are ignored.
A command string is terminated and the command invoked by pressing the [END/.] key. The command will
also be invoked by pressing the [NEXT/,] key when no additional parameters are allowed. A command string may
be aborted at any point before the command is invoked
by pressing the [CLEAR/PREV] key, and the sign-on
message will appear.
Errors
An illegal command string, command terminator, or
hardware failure will cause an error message and error
code number to appear on the display (e.g., "Error-.3").
When this occurs, the monitor can be returned to command mode by preSSing the [CLEAR] or [END/.] keys. An
explanation of the various error codes is given in Appendix D.
Command Classes
Commands for the HSE-49 emulator are divided into
general classes, where all commands in each class have
the same choice of options or modifiers. A brief description of each command, followed by a description of the
allowed options, is presented below by class.
Data Manipulation/Control Command Group
Commands:
[EXAM/CHA]
Baud
HR06
HR07
110
150
300
600
1200
2400
93H
96H
45H
9DH
44H
1AH
04H
03H
02H
01H
01H
01H
Display Response Function -
Causes the memory address specified to be read
and presented on the display. New data may be
entered (if desired) from the hexidecimal keypad.
New data is verified before appearing on the
display. Subsequent or previous locations may be
read by pressing the [NEXT/,] or [PREY] keys,
respectively. Command terminated with [END/.]
key.
Table 1. Serial Interface Data Rate Parameters
v.
"ECh."
Examine/change memory location.
HSE-49 COMMAND DESCRIPTION
Whenever the characters "HSE-49" are present on the
system display, a command string may tie entered by
the operator. In general, all command strings consist of
a basic command initiator, an optional command
modifier or type-designator, and a number of parameters
or delimiters entered as hexidecimal digits. A command
is executed, or a command in progress terminated, by
pressing the [END/.] key. Logical default values are
assumed for the modifier and parameters if either (or
both) are omitted. A defualt parameter assumed for the
command modifier will be presented on the display
when the first parameter is entered.
[FILL]
Display Response -
"FIL."
Function - Fill range of memory addresses with a
single data value.
Fill the appropriate memory space between the addresses specified by the first two parameters with
the low-order byte of the third parameter. If second
parameter less than first, only the location
specified by the first is affected. IT third parameter
omitted, zero is assumed. If second and third
parameters omitted, individual address specified is
cleared. Command is useful for setting a large
range of breakpoints; e.g., all of page 3 may be
enabled for break with the command:.
Each parameter is a string of up to three hexidecimal
digits. If more than three digits are entered, only the
most recent three are considered. This allows an erroneous digit to be corrected without respecifying the
entire command. A parameter is completed by pressing
the [NEXT/,] key. Some commands may only need. the
[FILL][PROG BRK]<300>[,]<3FF>[,]<1>[.]
All mnemonics copyrighted©lntel Corporation 1976.
1-77
AP·55A
Function -
[LIST]
Display Response -
Register memory and RAM.
Internal RAM of execution processor. Locations
0-7 are working register bank 0; 18-1F are working
register bank 1. Only the low·order 7 bits of an ad·
dress are considered.
"LSI."
Function - List memory to output device through
HSE·49 serial port.
Display the contents of a range of addresses given
by two parameters to a, teletype or CRT screen.
Data,is formatted, 16 separated bytes per line, with
the starting address of each ,line printed. If used
with an Intellec'" system, the operator first uses
ISIS·II to transfer the TIY input to the CRT output
("COpy :TI: TO :CO:") then invokes this command
from the keypad. Alternatively, any ISIS device or
disk file name(:TO:, :LP:, :F1:HRDREG.SAV, etc.)
may be used as the destination.
[DATA MEM]
Display Response Function -
"dA."
External data memory (if installed).
Memory accessed by execution processor "MOVX
A;@Rr" or "MOVX @Rr,A" instructions. High·order
4 bits rr,ay or may not be relevant, depending on
jumpering option selected (explained in Section VII
of this note).
[DNLOAD]
Display Response -
[HARD REG]
"dnL."
Display Response -
Function - Download' memory through HSE·49 serial
port
Function -
"Hr."
Hardware registers.
Load data in hex file format through the serial input
port. If used with Intellec'" system, the operator
first invokes this command from the keypad, then
uses ISIS·II to transfer a disk file to the teletype
port ("COPY: Fn:file.HEX TO :TO:").
The execution processor (EP) hardware registers
(accumulator, timer/counter, etc.), as well as
several parameters for controlling HSE·49 system
status, are accessible through this catch·all
memory space. Addresses are as follows:
The use of the checksum field for the download
command is expanded slightly ,over the Intel hex
file format standard. If the first character of the
checksum field ,is a question mark ("?"), the
checksum for that record will not be verified. This
allows large object files produced by the assembler
to be patched using the ISIS text editor without the
necessity of manually recomputing the checksum
value.
00 -
EP accumulator.
01 -
EP PSW.
Bits correspond to 8049 PSW except that bit
3 (unused in the 8049) is u,sed to monitor and
alter the state of F1. Bits 2-0 correspond to
the stack pointer value after the EP executes
a CALL to the mini·monitor; i.e., one greater
than when EP was running the user's pro·
gram.
02 -
EP timer/counter.
03 -
EP internal RAM location 00.
(This value is also accessible through
[REGISTER] space.)
04 -
EP program counter (low byte).
05 -
EP program
[UPLOAD]
Display Response Function port.
"UPL."
Upload memory through HSE·49 serial
Output the contents of a range of addresses
specified by the two. parameters through the
HSE·49 serial port in standard Intel hex file format.
If used with Intellec'" system, the operator first
uses ISIS·II to transfer the TTY input to a disk file
("COPY :TI: TO :Fn:file.HEX"), then invokes this
command from the keypad.
HSE·49 automatic sequencing rate
parameter. Used in [GO][AUTO STP] and
[GO][AUTO BRK] execution commands. 00 fastest; FF - slowest. Defaults to 20H; ap·
proximately two steps per second.
09 -
Monitor version/release number (packed
BCD).
[PROG MEM]
Function -
"Pr."
User program memory.
Memory used to develop and execute user program.
Addresses 000 through 7FF are the execution proc·
essor's memory bank 0; 800 through FFF are
memory bank 1.
(lA-OF - Currently unused by the monitor program.
10-7F - Variables used by master processor (MP)
monitor. Should not be altered by operator.
[REGISTER]
Display Response -
(high nibble).
08 -
Data types allowed:
Display Response -
\~ounter
06-07 - HSE·49 serial interface baud rate paramo
eters. Defaults to 110 baud; other rates may
be selected by loading the values listed in
Table 1.
[PROG BRK]
"rG."
Display Response -
All mnemonics copyrighted© Intel Corporation 1976.
1-78
"Pb."
Ap·55A
Function -
Function - Go from reset state.
User program breakpoint memory.
Memory space used to indicate points where program execution should halt when running in a mode
with breakpoints enabled ([GO][W/ SRK) and
[GO][AUTOSRK)). Break will occur if enabled byte is
read as the first or last byte of a 2·byte instruction,
or read in executing a MOVP, MOVP3, or JMPP instruction. Memory is only 1 bit per location; 00 in·
dicates continue, 01 causes a hal!. Addresses 000
through 7FF are the execution processor's memory
bank 0; 800 through FFF are memory bank 1.
EP is hardware· reset and released to execute the
user's program from location OOOH. No parameters
are allowed. FO, F1, PSW, stack printer, memory
bank flip-flop, etc., are cleared.
Note that this command does not require the use of
mini·monitors to initiate program execution. As the
last phase of the program development cycle, the
2114 program RAMs and address decoder may be
removed and replaced by a ROM or EPROM part
(not shown in schematics). This command may be
used to start execution when the program RAM has
been removed. No interrogation of EP status or internal RAM may be done, nor are break or single·
step modes allowed in this case, though the 2102A
breakpoint RAM outputs may still be used to trigger
a logic analyzer.
[DATA SRK)
Display Response Function -
"db."
External data RAM breakpoint memory.
Memory space used to indicate points where data
accesses should halt when running in a mode with
breakpoints enabled ([GO)[W/ BRK) and
[GO][AUTOBRK)). Memory is only 1 bit per location;
00 indicates continue, 01 causes a hal!. High·order
4 bits of breakpoint address mayor may not be rele·
vant, dependent on jumpering option selected for
the corresponding data RAM (explained in Section
VII of this note).
Execution modes allowed:
[NO BRK]
Display Response Function -
Full-speed execution without breakpoints enabled.
Does not affect the state of the breakpoint
memories.
User Program Execution Control Group
[SING STP)
Commands:
Display Response -
[GO)
Display Response Function -
"nb."
Without breakpoints.
"Go."
Function -
"SSt."
Single Step.
Step through program one instruction at a time.
After each instruction is executed, execution halts
with the current value of the Execution Processor
Program Counter and Accumulator appearing on
the display in the form "PC.234-56". System status
is saved in the appropriate Hardware Registers. At
the pOint, [NEXT/,) will cause the program to ex·
ecute one more instruction, or any other command
may be invoked by pressing the appropriate com·
mand string. Does not affect the state of the Breakpoint Memories.
Begin execution.
If a parameter is given as part of the command
string, execution will begin at that address. Other·
wise, the EP program counter (hardware registers
04 and 05) will be used. These will contain the pro·
gram counter from an earlier program execution
break unless they have since been explicitly
modified by the operator.
If command is terminated by [END/.), the EP's F1,
PSW and stack pointer will be cleared. If command
string is terminated by [NEXT/,), PSW will be taken
from the EP PSW contents (hardware register 01).
[W/BRK]
Display Response - "br."
While running the' user's program, the characters
"-run-." are written on the display. Execution may
be halted and another command initiated by press·
ing the appropriate command key. Execution may
be suspended at any time in any mode by pressing
the [END/.) key. This will cause the current value of
'the execution processor program counter and accumulator to appear on the display in the form
"PC.234·56". System status is saved in the
appropriate hardware registers. At this point, or
when an enabled breakpoint is encountered, press·
ing the [NEXT/,) key will cause the program to con·
tinue in the same mode as before. Any other command may be invoked by pressing the appropriate
command string.
Function - With breakpoints.
Full·speed execution with breakpoints enabled.
When a breakpoint is encountered, execution halts
with the current value of the execution processor
program counter and accumulator appearing on the
display in the form "PC.234-56". System status is
saved in the appropriate hardware registers. At this
point, [NEXT.,) will cause the program to continue
until the next breakpoint is reached, or any other
command may be invoked by pressing the ap·
propriate command string.
[AUTO STP)
Display Response - "AS!'''
[GO/RESET)
Display Response -
Function - Automatically sequence through a series
of instructions.
"Gr."
All mnemonics copyrighted© Intel Corporation 1976.
1-79
AP·55A
Step through program one inst~uction at a time.
After each instruction is executed, execution halts
with the current value of the execution processor
program counter and accumulator appearing on the
display in the form "PC.234-56". System status is
saved in the appropriate hardware registers. Execution resumes after a time determined by contents
of hardware register 08. Does not affect the state of
the breakpoint memories.
System Control Command Group
Command:
[SYS RSn
Display Response Function -
Reset both the MP and EP and clear all preakpoints
(requires approximately one second). CAUTION If reset while EP is executing the user's program,
the low order,section of program memory (about 23
bytes) will be altered.
[AUTOBRK)
Display Response - "Abr."
Function points.
Automatically sequence between breakVI. SYSTEM LIMITATIONS
Execute a series ,of instructions in real time
between breakpoints. When breakpoint is en·
countered, halt EP temporarily while program
counter and accumulator contents are displayed,
then continue. Display is sustained after execution
resumes. Does not affect the state of the break·
point memories.
Breakpoint Control Command Group
Commands:
[B)
Display Response Function -
"Stb."
Breakpoint set.
Set breakpoint for the address given. Multiple
breakpoints may be set by entering additional addresses, separated by the [NEXT/,) key. Command
terminated by pressing [END/.). Action taken is to
fill the appropriate breakpoint memory locations
with logical ones.
[C)
Display Response -
"CLb."
Function - Clear breakpoint.
Clear breakpoint for the address given. Multiple
breakpoints may be cleared by entering additional
addresses, separated by the '[NEXT/;) key. Command terminated by pressing [END/.). Action taken
is to fill the appropriate breakpoint memory locations with logical zeroes.
Data types allowed:
[PROG MEM)
Display Res'ponse Function -
"Pr."
Break on program memory fetch.
Applies command to the program breakpoint
memory space.
[DATA MEM)
Display Response Function -
"HSE-49."
System reset.
"dA."
Break on data memory access.
Applies command to the external data breakpoint
memory space.
In designing the HSE-49 emulator, certain compromises
were made in an attempt to maximize the usefulness of
the'emulator while keeping the circuitry simple and inexpensive. As a result, the following limitations exist
and must be taken into account when using the system.
1. As explained in Section IV, user program execution
is terminated (by Single-stepping, breakpoints, press·
ing the [END/.) key, etc.) by forcing the execution
processor to execute a "CALL" instruction to the
mini-monitor. This uses one level of the EP
subroutine stack. The EP PSW reflects the value of
the stack pointer after processing this CALL. As a
result, the value indicated for stack depth ,by examining the EP PSW (hardware register 01) is one greater
than the depth when the break was initiated. The user
program must not be using all eight levels of stack
when a break is initiated or the bottom level will be
destroyed.
2. User program is initiated (by the [GO) command or
when resuming execution after a breakpoint, singlestepping, etc.) by forcing the EP to execute an
"RETR" instruction. This will clear the EP interruptin-progress flip-flop. If the user program allows both
external and timer interrupts to be enabled at the
same time, care must be taken to avoid causing a
break while the EP is within an interrupt servicing
routine. No limitation is placed on breakpoints or
Single-stepping in the background program because
of this.
'
3. When the user program execution is terminated (by a
break, single-stepping, etc.) and later resumed, the
EP timer/counter is restored to its value when the
break occurred (unless modified by the user)_ The
prescaler, however, will have changed. Thus, up to 31
machine cycles may be "lost" or "gained" if a break
occurs while the timer is running.
4. Timer interrupts occurring at the same time as an EP
break may be ignored if the timer overflow occurs
afler breaking user program execution be(orEl the
timer value is saved.
5. The 8049 "RET" and "RETR" instructions are each
1·byte, 2-cycle instructions. During the second cycle
the byte following the return instruction is fetched
and ignored. If a program breakpoint is set for a loca·
tion fe>lIowing a "RET" or "RETR" instruction, a break'
will be initiated when the return is executed ..
All mnemonics copyriQhted© Intel Corporation 1976.
1-80
Ap·55A
6. Breakpoints should not be placed in the last 3 bytes
of an EP memory bank (locations 7FDH-7FFH and
OFFDH-OFFFH). User program should not be single·
stepped or auto·stepped through these locations.
current·loop or RS·232C current buffers, but not both at
one time.
Standard Operating Configuration
(Minimum system configurations - up to 4K program
RAM; no data RAM; no serial interfaces; no execution
processor 110 reconstruction.)
7. Since 110 configuration is determined by external
hardware rather than software, 110 modes may not be
altered while a program is executing. (See Section VII
for further details.)
A. Basic 2K monitor from Appendix B:
8. The "ANL BUS,#nn" and "ORL BUS,#nn" instruc·
tions may not be used in the user program, as exter·
nal hardware cannot properly restore these func·
tions.
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
Install
9. The memory bank select flag is not affected by the
user program break sequence. Upon resuming execu·
tion with the [GO) command this flag will remain in
the same state as before the preceding break. The
flag may be cleared only by executing the
[GOIRESET) or [SYS RST] commands.
VII. HARDWARE CONFIGURATIONS
A number of control and status lines are available to the
user. All are low·power Schottky TTL·compatible
signals.
TP1 -
Unused MP input.
TP2 - Unused MP output.
TP3 - User program suspended. Low when EP run·
ning user code. High when halted or running mini·
monitors.
B. Expansion 2K monitor:
Install IC14
Remove jumper 17
TP4 - Breakpoint encountered. Normally low. High·
level pulse generated when breakpoint passed. Useful
for triggering logic analyzers, oscilloscopes, etc.
Serial Interface Buffer Selection
TP5 & TP6 - Memory matrix mode control. Select
program vs. data RAM, link mapping configuration,
etc. (See Appendix B for details.)
A. Current loop serial interfaces (4N46s) installed for
use with full Intellec'" Model 800 development
system TTY port.
TP7 - Bus control. Low when MP controls common
memory buses. High when EP controls memory
buses.
Install IC21-IC22
Install resistor R1-R3
Install jumpers 4-9
(Remove RS·232 jumpers)
The HSE·49 emulator hardware is designed to allow the
user to reconfigure the system for a wide variety of dif·
ferent applications by installing or removing jumper
wires or additional components. The schematics in Ap·
pendix A show the components needed for a variety of
different configurations. In general, not all of the
devices are required (or allowed) for anyone configura·
tion. The devices which are required are included in the
following description.
B. RS·232C serial interfaces (MC1488 and MC1489) in·
stalled for use with CRT as output device for data
dumps:
Install IC23-IC24
Install jumpers 1-3
Install jumpers 10-11
(Remove current·loop jumpers)
The types of options allowed are divided below into
several general classes and subdivided into mutually·
independent features. Within some of these features
there are numbered, mutually exclusive configurations;
i.e., the serial interface (if desired) may use either
All mnemonics copyrighted © Intel Corporation 1976.
resistors R4-R6
transistor Q1
crystals Y1-Y2
capacitors C5-C38
switches S1-S33
displays DS1-DS8
IC1-IC2
RP3-RP5
IC6-IC7
RP8
IC9
IC15-IC20
IC25-IC30
IC34
IC36-IC38
A1-A2
B1-B2
C1·C3
jumpers 13-15
jumpers 17-18
jumper 20
External Data RAM Address Decoding Scheme for Ex·
ecution Processor
A. Up to 16 pages of on·board external data RAM in·
stalled for execution processor (addresses 0 through
1·81
AP·55A
=
OFFFH 4K bytes); port 2 used for addressing pages
. 0 through 15:
Install
Install
Install
Install
Install
Reconstructing 110 for Execution Processor
A. Application of port 2, pins P23-P20:
jumpers 21-25
jumper 27
A5-A8
B5-B8
C5-C8
(1) Using P23-P20 for latched output data (used with
"OUTL P2,A", "ANL P2,#data", and "ORL
P2,#data" instructions):
Install IC31
B. One page of on·board external data RAM installed
for execution processor (addresses 0 through OFFH);
port 2 not used for data addressing:
(2) Using P23-P20 for interfacing to an 8243 in user's
prototype:
Install jumper 26
Install jumper 28
Install A5
Install B5
Install C5
Connect the outputs of IC20 .. pins 7, 9, 10, & 11 to
the inputs of a 74LS21 AND gate (not shown). Connect the output to CE and CS inputs of A5-C5.
(Note: these signals are all present at jumpers
21-24 on the schematics.)
All mnemonics copyrighted @ Intel Corporation 1976.
Connect 03-00 pins on IC31 socket to corresponding 03-00 pins.
B. Application of execution processor BUS:
(1) Use of BUS as latched output port ("OUTL
BUS,A"):
InstalllC32
1-82
AP·55A
':/: g",
.~ ~~i
~
~.
~QlO
~OTO
~OTO
~
~
II __
010
~OTO
;010
~OTO
010
~OTO
~OTO
a010
SOlO
~oro
~OTO
~OTO
~OTO
~
oro
,oro
~OTO
~
010
.010
~OTO
~OTO
.010
~OTO
~OTO
~OTO
.010
~
010
,010
~OTO
~
~
I
~Ii
Cl~N-~- -r:-.J
IIr---1G
I
I
I
I
I
I,
I.
10
,.
I.
"'~
~I~
~~
J
..
to 2 ::
.
., .
So~s~sg,s~s
" gf
~
"
• - ,
~i
m ~
.
"Eco
0
III
= ".
'r- --':! ---:-1
"~
>co
Q.
is
~(
010
~f-i"
nn
"~ ~
.1
.,
I
~'~
'- _______ J
1·83
..
>-
:.:
inter
AP·55A
1·84
AP·55A
:;
.
OJ
u
e
D.
~C
..
U
1·85
Ap·55A
flSI143 I1SE49 LNii PRINTl. LU
lSlS' I I MCS-4i)/UPHl MRCRO AS$01l1lER, Vl 0
H5E-49(TM~
LQC GBJ
EMlJlATOF MONITCF VER$IOtl 2. 5
SOliP.C.( 5Tf1EMENl
:"ill::: .
1 $Mf'.crorILE IlOOEN NOCOND XREF
2
$TmE('I~SE'4;lifl1)
El'IUlI1Tur. MONITOR VERSION
2.~')
************_********
4 ; *'·"'*1"4·~.·t.**'*4,*,~~~'I*****~*·~**·~lj.*M*>l-t>j:*********"'''',,:.',:c.
'5,
f1<:Ofil~. 1~·4S(TM)
C'
'~[RS
? .
lMULJITOR MONIrOR
2. o(ril9
(j,
COP'r'I!u[HF',' r'ROGRflr.S IN PROGRAM f-:AIt,
fiLTE~ ~1r,T1. SPIG~l·sm· ~Et:TJtti$ Dt A PROGRflI'1, flIi) EXECU1E. PROORRI1S
F:T SPE[~·S 'jf IJf' 70 l~ 14HZ. urn: OH IHTliOU1 ,;REfll(POINTS E.NnKED.
lJlE [Io1IJIJllor: l:~ [}[SCRW£[' W GrEflm: ~ErTH IN INTEL'S APPLlCATION NOTE
np-~,'5 'Po flIGI+ SPEED [Mtl8TOR rOI? INIEL MCS-4S(TM) MICflOCOf'lPIJ)[RS.•
PI COMMIlHD rA~5ER liND ASSOClRTED TASLE~;
!t1rlr!'lp~mm"'S or THE rRll'lflR't' C0I'II1ANDS,
c'flTR nCmSHlG '.I rlUTY ~·lif}:OUTJNI.:; US£[) nIROUGfIOOT;
rfl'BORi,f' ~:~11NNING rtllD [J1Si~.fW [)F:I'IINlj JROUlINE;
Inl)C'fll,:, fiND :,ISPLf:'! iNT(RFI1CING IJTlLITIES;
('QUWIES : TO flCTUfILLI'
~5 ; E~'ECUTE rilE IJ~,[P"S PROGRflI1 U'IDER THE. CONTROL Of HIE FII<~T.
56 ; TIIESl Pf.!OCESSOf"S i1RE RErERRED TO
57.: TlIROIJGI·IOIJT THIS rRor.lo~AM AS mE MA::iTE1<: PROCESSOR (1'11') AND EXEWIION
':is : P~OCE5Sor ([I') !:,[:·PECTlVEL'r'.
59 .
50 ; T:1E I'IiOGRilM IN TKIS LISTING IS EXECIJIElI I:N 11:[ Mfl5TER PROCE~SOk.
61 . RT Till Etlf' OF TIllS LISTING ~E SlVERflL ~IOI1T "MINH10NIlOR OVERLfl'I'S·
6~., wmCH ~I[ EXWJTJI)tJ PROCESSOR EXECIJTES IUN INTEI'5 is 1l[c[5Sfi~'r'
64 ;
6~"
HilS PROGRml 14RS !4I1ITTEN USING R NlJI'1E!ER or· MHCRtY.. TO HflNOlE 1111. ALLOCAT ION
6(: : (JF Mf'!J P.E501Jr.ct:S (IIIJRKlNG REGISTERS, INTERNfiL RAM, fiND r1P MONI'fOR ROM
67 ; rOf' COr.E roND CilIA 510f/IlGr::, nlESE MACRO DEI INn ION~ /WE INCLUDE.D IN A FILE.
6il ; Nfli'IED "ALLec. Me. " ANI) t1RE f'lInnED IN mE LISTiN!i fOR F[I1:RENCE.
(:9 ' RNOTIIER SET OF MACrlOS IS lISED TO SIHftII-'I THE r;CCES~ING OF VARIOOLES
/13 ' STI)RED IN INTERNAL "'HM (p.s f)rpO~ED TO I.oIOFKING REG1!:.TEI<.'S) bOY USING 1':1 TO
71 ; INDIRCCTL';' f:DDF:ESS THE flPPRorRiriTE RfiM LOCATIOO WHEN NEClSSARY.
72 ' lI!t~E MACROS APE INCUJOCD IN "J'l0PC0fI. MflC", flN() fIRE nLSO PRINT~D 1£kE.. .
,'3 ; COMPLETE IJNDIJ~SmfjDHlG or- THESE MRCIIO:; IS 'lOT REQUIRED TO lJNIIE.RSTRND THE
;'4 , MOIHTOF f'RCPEI1. PoLL LINES WIHtll ACTIJALL\' PRQl)Uc£' OBJECT 1,;0I.lE APPEAR IN
75 ' TH[ LISTING mELF.. INDENTED TWO SPRCES rl<:Ol'l THE NORl'If'ol. TfillULAlI~ COLtftlS.
;'6 ; lfIE q('lIJAL MONr,'OR PROfJR.!1M FOr. THE E:.I'1IJLtllQR 3EGIN5 nr t'J'F'ROXli'lA1ELI'
77 ; SOURCE Ll NE NUMElER 509.
(8;
; LIIlE5 GHIErnTCD 13'" MfICRO E)(PIlNSJON fiRE fLRGGCO CI' II PLUS SIGN ("+")
; IMMlDIOm', FOLLOWIt-!G THE SOURCE LINE NlJI'tIiER.
131 ; A NUMBCR or LINES FROM HiE Vf~IOU~ i'IfICRO DEFINITIONS IoII1lCH 00 NOT
32; PPO[lIJCE fltf,' 08'][CT CODE ARE PRO(:E!;SEO BV HIE ASSEi'lBLER
8] . f(, TI-lE5E mepos mE EXPf'.NDW. WHEN TIllS IS nIL CASE, lHESE LINES RRE
S4 .: 9JPprE5SED FROI'I TflE LIST rILE. !'is fl RE~U'I, 'IIE LINE NUI1IlERS AI(E
.G5 ; NO] nliolR'J'S CONSECIJTIVE WHfFE fl MACRO IS BEING INVOKW.
8(, ;
8i' ' NOTE:
88 ;
39.: ·~O\.lRr.:[-LINE" REFERS TO THl DEWlft NIJIf;£RS m T OF 1:J'l(;H INSTRUCTION.
~; RT mE END or TIll LISTING IS RN nsSEI1£lL\' C~OSS-R£FERENCE TAllLE. INDICm ING
!11 ; lliE SEQLUITlflL !.-OIJRCE-UNE NUMBEf< OF RLL INSTANCES WHI:RE:. AN'r' VARIflBLE
92; IS vEFINED OR REFEr;'ENCED. )HIS WILL BE:. or CRUlT fl5S15'IRNCE IN
93 ; LOC.fll ING SPECIFI C SliSROIJTIN[j, ETC. IN TflE LISTING.
~9
~0
~)4
;
95; I'INEI'IONICS COP','RIGHT ,C) 1976 INTEL CORPORflTION
96 i
97 $EJECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-87
inter
lOC OOJ
Ap·55A
SOO::CE STATfI'lENT
LINE
98f.
f:t90IJ
~
?Ill
INClIJOC( -r:O.P.t.lOC. Me)
SET
0
9000
= 100 i
= 101 'IRSB
EQU
0001
=-102 "'P01
EQU
= tlj3
?RflM
EOU
" 1114
= 195
= 106
" 197
= 1118
= 109
' CON':.iT (QIJ
3
[00
?fl
4
; RCCUtUJlTOI< YFlR IfflU rvrE
;
, TIlE rOllOWI,.,. INIlIRLIZES TIlE LINKE!.> LIST POIN1ERS ror<
; lHE REGISTER RLlOCATIOtI At(l DEALlOCflTIOtI ROUTINES.
8002
0893
9094
0093
11004
0085
0006
0087
0008
0982
SET
?fJ8R3
= 112 "BIlR4
= 113 ?OOPS
= 114 ?B0P6
SET
=i1!
2
Srt
3
4
5
SET
SI:.T
(,
58
C
?B0PNT SET
2
= 115 ?B1lR7
= 116 •
9093
= 11f.) ;
= 119 ?BIR2
!1004
0085
= 128 ?aiR::!
= 121 ?B1F4
91.!86
9087
OOIlS
=122 ?D1R5
9982
" 1;:6 ?BIPNT
8898
1
i
= 118 ?OOR2
=117
a
= 12J ,1l1RG
=124 ?(J11t?
=125 ;
=127 ;
=128 ORGPGIJ
7
SET
l
4
SET
5
SET
6
7
$1:1
SET
SET
S
SET
2
SET
'.!'1OO
= 138 OR61'G2 SET
000H
100II
2Wl1
8300
= H1 ORGI'G3 SlT
.s08I1
8400
0500
Sl:T
400H
50911
0100
0688
8700
All
mnemonic~
= 129 ORGPG1 SET
=132 ORGrG4
= n~ ORGPG5 SIOl
=134 ORGPG6
SET
= 135 ORGPG7 SET
= 1](.;
= 137 $EJECl
b8IlH
:'0911
copyrighled © Inlel Corporalion 1976.
1·88
intJ
LOC
!)~:J
AP·SSA
SOUf'CE
LINC
:: 1:l3
= 139
= 140
= 141
,·t*'~.l"****•. *****.,**j,.,**,,,*******~**********,~**.-***********'1'***
= 142
= 143
= 144
= 145
= 146
= 147
= 141)
.' '.*~***********"****>I'*********h***,,"**-I<*"'******"to***.*********
;
?RSfNE MntRO ~.\'M£l()L, BANI(, PNTl/lll
f 'NT't'llL ~I} 8
IF
:
;
= 152
START OF fllLOr...flTlON MACROS
;
[RROR
~
E~ITM
ErJDIF
:: 149 f.
= 150
= 151 f
002!l
~TATEI1lNl
5IlVE GEH
~SMOOL
SET R'PNTVr,L
RESTORE
?(l.~l:flNK&P'JT
= 15:?
[NOM
= 154 ;
= 155 i
= ISC ',I'IINDX SET
Sll
?B&eANK&R&f'NTVAL
21lfl
:: 157 ;
:: 1SS ?MSflVE Mr.CRO SYMEOL, LENGTIl, RDDR
SAVE liEN
= 159 $
:: WI
SYMBOL EQIJ flODR
:: 161 $
RE!:TORE
?M INOXl LENGTH
:: 162 ?I'IINDX SET
:: IE;3 [NOM
= 1(;.4 .
= 16'5 nocl( MACRO S'Il'IEOL, LENGTfI
EGO 3
= IG6 ?&~""MIlOL
:: 167
?MSflVE S\'l'llJOL, LENGTH, ??i'lINDX
= 168 ENDI'I
:: 169 ;
= 170 [)[CLfl~E MOCRO S'r'MBOL, TYPE.
= 171 ?&S'r'MDOL
SET
?&WPE
:: 172 Ir
?&TVI'E EQ 2
:: 1n
'111511','E S'r'MCOl., 1, ??I1INDX
:: 1(4
EXITt1
:: 175 [NDIF
')&TW[ EQ 9
:: 17C IF
?RSfW( S'r'I'IBOL, 9, ??WPNl
= 177
= 171]
EXITH
= 179 ENDIF
?&n'p[ EQ 1
:: 100 IF
?RSAVE !:\'l'tS0L, 1, ??1l1PNT
= IS1
:: 1iJ2
= 183 ENOlr
= 134
= 1('.5,
= 186 $
Em"
EJEn
All mnemonics copyrighted © Intel Corporation 1976.
1-89
Ap·55A
Lot
LINE
(is,}
SOORCE STATEI1ENT
= 187 -'
= lDe -' P.l:QRG MACRO TO RESET THE INS1 RltTION LOCRTION COIJlT[R
= 11Y.) i
TO THE nr.:ST rllE[ LOCATION ON TIE FIRST PAGE IIODUI.E WILL
FIT WilHItI.
=190 -'
= 191 R[ORG PlACRO LOCHTION
= 192 $5AYE GEN
= 193
ORe
LOCATION
= ,194 tl\'ESTORE
= 19'5
ENDII
= 196 ,
= 197 ; rOOCDU(
"AeRO TO rIt(l fI PFIOC OF ROI'I
= 198 ;
IflICII TIllS BLOCK or CODE WILL fI1 WITHIN
= 199 COOCDLK I'IfICRO
LENGTIl
= 20e '-'lENGTH 5['1
L[NGTfI
= 201 IF
IIIGHll
= 243 ,l1f'TABLK
= 244
= 245
= 246
= 247
= 248
= 249
INSERTS ONTO PAGE 3
DflTflBlK IVlCm
Loon I
?LENGTH SET
lENGl H
IF
fIIG1HORGI"G3ilEOOTH-1l EQ 3
REORfi i'~GJ
'STAPT 5ET
E:mM
$
:: 25@ [NI)IF
= 251
ERROO 0
i t~ INSlfFlCIENT SPACE F!J: DIlTR BlOCK ON m£
= ~2
ENDfI
= ~:l i ?SIZE PRINTS A LINE TO lIlE SOURCE riLE (jIYIOO E!LOCK SIZE.
= 254 ;
AM) (fOOTE!; APPROPRIATE ORGI'GI
= 255 ?SIZE MACRO BLK. rGE
:s -
= 256 t5flYE (lEN
= 25;'
SIZE SET
BlK
= 253 ;
= 25:) i *~,.~~**.j<*'*************************~,******.***********-**
= 260 IF "lENGTII l T SIZE
= 261
:: 262
= 2(.3
= 264
= 265
= 266
= 26('
=26e
" 2(,9
ERROR
9
;
*** SIZE EXC£1:tY.i Sf'flCE Cf[!;K(I) FOI< BY COO[E!LK 11OCk'O
ENDIF
IF
IIIGH($-1)
ERROl\"
N[
IIIGJl(?START!
9
;
SET
$
*** COOl: OR DATA I:JLOCK ROLLED OYI:R F1lGE BrufIf1R'1' *n
EIII) II:
$RESTOR[
ORGl'GM'GE
ENDM
; SIZECIIK
SIZEClIK MflCRO
?SIZE
= 270
= 271
[M)l'I
= 272
= 273 ;
= 274 .;
= 275 i RSOURCE
CHECKS SIZE OF I'RECEDII¥.i BLOCK, PRINTS SIZE 10 . lS'1 FIll
r.($··?START>., f.fIIGI·I(?!'IART>
CODE SP1lCE ALLOCATION
= 276 RSOURCE MACRO
=277 $SAliE LIST GEN
:: 27()
PGSIZE SET ~.iI'Ci0-800\1
= 279
PCi5IZE SET OR(,'PG1-100H
PGSIZE !..ET 0I\'GPG2'-209f1
= 2ee
ORGPG3- 300H
PGSIZE SEl
= 2e1
f'GSIZE 5E.T ORGPG4"·480H
=282
1'65121:. SET ORGPG5- 500H
= 283
PGSIZE SET ORGPG6--600H
=284
PGSIZE 5[1 ORGPGi" 709H
=2S5
= 2S6 $EJECT
=207 $RESTORE
= 283
ENDM
= 2fJ9 $l:.JECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-91
stm1R\' STBTEl'UIT
; oms
; L'YTES
; 1,".'TES
i BYTES
; EVTES
; !:lYlES
. i B't'Tb
; O't'TES
U~D
ON
ON
ON
ON
ON
lI'->ED ON
USED ON
USED ON
USED
UC-lD
UC'-lD
USEII
PAGE
NlGE
PA6E
PAGE
PAGE
PAG!:.
I1lGE.
PI:GE
9
1
2
3
4
:5
(,
7
Ap·55A
Lo(; OCJ
LINE
298
291
= 292
= 293
=294
= 2'J5
= 2%
= 297
= 298
i
$
; ?fORI'I1 MACRO
FOR GEI£RAl..IZII«l (I'COOE INSTRUCfIC*
i
?F0RM1 1'IAf'..RO 0f'C00[, Slit
?&sRC [0 2
IF
$
~GEN
$
.OI'CODE
RESTORE
EXITM
I10Y
=299
= JOO
It«:lUOC<:FI.I:I'IOPCtJI).ItlC)
i
.. 301
R1, I<"..RC
fI, @R1
= 3tr.I ENDIF
= 3~D IF
=304 $
.. 305
= J06
$
=307
?&Sk'C Ell 0 OR ?&SRC EO 1
SAVE GEN
OI'COOE
f1, 5RC
RESTORE
EXITM
= 30S [NDIF
= 309 IF
=310 $
=311
= 312
$
=313
?&SRC EO
SflIIE GEN
OPCODE
RESTORE
EXIlI'I
:s
A, ISRC
= 314 ENDIf
= :U5
ERROR
1
= 316 EhWI
= 317 ;
=318 i ?HJRI'I2 If1CRO
= 319?F0RI12
=:528 IF
= 321 $
= J22
= 323
= 324
$
=l25
=326 ENDIF
=327 IF
= :rolS
$
=::~30
$
=32S
FOR GENERAlIZII«l IIOYES H~OI'I THE ACe 10 A YARIAllL.C
DES)
?&DEST EQ 2
SA\I[ GEN
Rj.,ID£ST
I10Y
@RLA
I10Y
IftCk(J
~'ESTORE
[XITI'I
?&DEST E.Q
!;AYE GO!
1.1
OR ?&DEST EQ 1
MOY
= 331
= 332 CNDIF
1\,[5101"£
EXITI'I
=III
=334 [NDM
= 335 ;
FOR GENERAlIZING I10YES FI..'OI'I TIE oct TO A YflRIAIlLE
WIlEN IT IS KIQoJN THAT R1 Re' INSTROCTIIM
11ACR0 SkC
?&5RC Ell 2
~A\lE GEN
MOY
R1, ~~IC
MO'~
A, @R1
FrS] WE
EXilM
?&SRC EQ 9 OR ?&SRC Ell 1
SAVE GEN
1'10','
n,5Rt
= 3G7 $
= :S6C
= 3G9 [NDIF
= ]70 Ir
= ~71 $
= 372
= 373 t
[!ESTORE
eXITM
= 174
EXITi'I
= 315 ENI>U·
= 376
ERROR
?&$If ORM!
lOR (iCNERAlIZING flOO INSTRUCl ION
vEST, SRC
'iB INOP BDD, DEST, SRC
MACRO
I'IftCRO
FOR GENERALIZING AOOC INSTRucnON
OCST, Sk'C
?lJINOP flOOC, IJI:ST, SRC
ENDM
MACl?O FOR GENERP.lIZING ANI. INSTRUClION
MftCRO !lEST, ~RC
?IJ INOP flN!.. DeST, :;RC
ENDM
;
;MORl
MORl
Mf\(;I?O FOR OCNERALIZING OR\. INSTk'UCTION
MACRll DEST, SRC
"SINOr ORL DEST, 5RC
EtIDM
,
,MXr.L
I'IXRL
MfIC"'O FOR GENERAlIZING XRl INSTRUCTION
!'IAeRO DEST, ~
'iBINOr XRl, Dm, SRC
[tID!'1
;
.' MXCH
I'IACIIO
lOR GENERALIZING xt:H INSTRUCTION
All mnemoniCS copyrighted @ Intel Corporation 1976.
1-94
inter
lOC OIlJ
Ap·55A
LINE
SOURCE
= 455 MXCH I'fRCRO
'1S1f()P
= 456
=457
END"
=451) ;
=459 ':'UNflR't' MACRO
~"'RTEIt:.1ll
[lEST.5RC
)(CH, DEST, SRC
OPCOOE,DE$T
'?FORMi MOV,DEST
= 460
= 461 $SAllE (lEN
=462
OPCODE
A
= 46] fR[STORE
?FORMl DEST
=464
= 46.'5
ENDIt
= 466';
=46'1 MINC IlACRO DEST
= 468
?I..IIflRY INC,IET
[ND/'!
= 469
=479 ;
= 471 II[l[C I'IACRO OCSl
?UNIlRY DEC,DEST
= 472
= 473
OOM
= 474 ;
= 475 MDJNZ I'IfICRO DEST, AllOR
= 476
?UNAR't' DEC,DEST
= 477 $SAllE GEN
=478
.JNZ
ADDR
= 479 :m:STORE
END/,!
=489
= 481 ;
PlfiCRO I>E5T
= #'.02 I'IRl
?UIflRY Rl,DEST
= 4m
ENDM
= 484
= 485
= 4~ MRF
=43'1
,i
= 4!l8
=489 ;
= 49IJ MFRC
=491
=492
!'IRCRO
DEST
?lHlR't' RR, !)EST
END"
MACf.'O DEST
')UNARY RRC,DES'I
ENDM
= 493 ;
= 494 MRlC
IIflCRO DlST
= 495
?UNARY RlC, Dl:ST
= 496
ENOM
= 497 ;
= 498 $EJECT
All mnemonics copyrighted @ Intel Corporation t976,
1-95
intJ
LOC 08J
AP·55A
LINE
SOURCE STATEI£NI
499 .:
508 ; ================-------:;--::-:::-====
~
-------
; ===--===========================--==
582 :
. BEGINNING or· PROGRff'I PROPEr< .
583 ;====--=====,,======='
584 ; ===========--=====:--=--====--==
5e5 ;
~,
587 ; *************,.,ot************************c:___-*****.
588 :
589 ;
Il.LOCATION or It' 110 PORTS:
5111 ;
*********",***-*",-******************
511 ,********-**~:*. .
512 ;
51$ .:
BUS
M4,
1'1
. 5~5 ,
P2
516,
P7
517 f'l>IGIT EQU
51S rSEGHI mu
1'6
519 PSEGLO WU
P5
528 rINPUl EQlI
1'4
!l21 ;
5<12 i
!l23,
524 ;
JND IVIDUAL PINS
,USED FOR IlIDIF.ECTHM Al'a:m AN) DIITA lRfl6ERS
; USED AS INDIVIDUflL CONTROL OUTr1JTS fN) BREAK LOGIC
; IHIJIHJRDER ADDRE~S AND ADDReSS SPP.CE SELE(;lION
,U$[D TO ENABLE CHARflCTERS flN) m'OBE ROWS or f(~
; USED TO TURN ON III stGllENlS OF ClJ:REN1LY ENAb'LED Dl6n
; PORT rOR LOIoIJI FOUR SEGMENTS
; rORT USED 10 SCAN rOIl KEY CLOSMS
****.**_****_***"'***********.**4<__,**************
OF
~T
1 USED AS FOLLOWS:
~;
526
,*************************--**********-**-****.****
';27 :
528 I:.MJRflI'I EQIJ
529 ENBLNK lQlJ
090008811)
00II00819l1
5:se
531
532EPSSTP [00
090001001l
m
0018
8828
5j4 CLRElfF [00
535
t>36 EPRSET EQU
537 I'IODOUT EQU
88OO1.9OOC
08011188eB
li!II1e811ooe
538
539 lTYOUT EQU
549
541 ;
01900000B
; r10 - III ENABLES BREfl{ ON BkERK RAIl OUTPI.Il SIIHl.
,P11 .' HI ENflBLES BIED
542 $EJE.CT
All mnemonics copyrighted @ Intel Corporation 1976.
1-96
inter
LOC OS]
AP·55A
LINE
sourCE S1nTEMENT
~043 "**j';'****'i-***~,,t**l'**'·**;'*~***.**********"''''*.t<~,*.j<******~",~~,**
'544 ,
'54~
.'
INDIVIDUAL PINS (IF PORT ~ USED f)~ FOlLOWS
,
.' ,~**~,~****~~,,,,*,.+**~,*..**,,,****,t*'.~*,;*,I'******"***.,*************
;
:
; AOR11-r.Dk'S f- OR r.etESS I NG f'k'UGRflII OR I>A1n RAM ARkflY
~59
'
545
'546
547
54G
0010
0029
0040
551 Me
LOU
552 I'll
f:.QU
0OO100001:s
130100900B
01000000B
553 Mf'USEL [()I.I
554
555 [xrOON [QIJ
556
55;' .'
100009008
,P24 .. I'1EI'IORY MflTPIX CONTROL PIN a
,P;:5 - MEl'IOI"<~' MATRIX COlfll\tt PIN 1
.' P'c!6 - HIGH WlIEII Mf' IN CON1fARD I'ION 11 (If<,
KfJIlTHIG HN E~'Pfllj~1011 MONilOR PRESENT
~.'
55!1 .' WilEN Mf' IN CONTROL or i'lEl'1OI<'\' MATRIX 1'11-1'10 USED ns rOLLOWS
~!3;
~061
;
I'll M0
I'IODe
f'ROGRflM ROM ARRAY ENAELED FOR R[AO & WR ITE
DAlii RnM f-IRRAY eNABLED rOR ~lP,D & WF.: HE
5£;2 '
0
563'
13 1
1. X LlNl( R[GISRR r:NI1BLlD FOR READ, f.:MII ,*RIW!) DISfIEllD.
(NOTE' LIN/( R[GISTE~ fILwr.YS ENft'llD FOR !'IP WRm~)
5£;4 ,
565 .'
1.1
,566 '
567 ; WHEN EP IN CONTROL or MATRIX Ml-MB IJSE:) f1S FOLLOWS:
5(..(l ;
569 ;
'570 ,
5il"
572,
573 ;
574 ,
toll M0
13 X
1 11
1 1
MODE
lP f'SfoN rUCilES FROI'I WI( RfGIJ TER (USED 10 f'ORCE OftOOES)
EP f'SEN FETCHES rROM f'ROGRfII'I RAI': nRRflY,
Er RD & WR CONTROL [lf1TA RAM ilRRAI'
Er rSEN rETCHES FR01'1 rROGRflM Rfil'f fIRRnV,
rc & Wi" CONTROL LIN!( ,Rt:GISTEiI,
,75 ,
576 $[J::cr
Ali mnemonics copyrighted © Intel Corporation t976.
1-97
AP·55A
Lor OBJ
SO'JPCE 5Tr.TEMEt11
c '7
,J'I
'
5;'(\ . ~~'**'.~ ~,**~t~'*"'*~'**~*"I'******Mt**~ ******~,*~"*****************
57~
:
~8e
.
~\'ST[M
CONSTANT
DErJNlTION~'
5el ,
':>82 • **+,"~, HI ,,"',~~~, j'''*.''*~~"1 ***********~~'******~'*.*>I-"'***~'*****>I-
583 .
~,r.4 D[ru~rE
\
CHflrtIO. CON~T
,NIJt1CEF'
~9~:
CHARNO EvlJ,'
:~
;
Cl.!0 DEGLflPE NCOL~, CONST
614
NeelS EQU
or
DIGllS IN I)I5I'Lfl'r' liND ROWS Of
K[','~
5~9
,Ll~SE'·
m·
61(, l)ECU1I1E DEr.tI('E. CONST
[;[[lNCE [QIJ
@)
DIMENSION or KE\'BOAm MATRIX
4
; NlJleEli
8
or
5IJCE551','[ SCflNS BHORI: Kl\' CLOSUR[ ACCEPTED
C:<1 .
(.32 rHLARt
aa17
0010
O\,~,IZ[.
CONS)
(;4('
[VIS I ZE E(l1)
(;47 .
1.48 OCCLARE r.urLEN. CO~IST
662
BlIFL[N EtlU
(;C~
; ~.IZt. UI' LnRGES', MINI-MONl1fW MRLA\' rOF 1:.1'
2~
. LENGTII OF HEX FORMAT ;1-
665 .
fC6 .
UTIlITY CONSTnNT DECLARATIONS
6(:7.
668 . ***i,~*'f'~t****"",u"t"*.t~***"'*l,*****~******~'*******~***~,*t****
6(,9 .
0000
0001
0003
6'10 D(ClA~ <:ERO.I;ON5T
6l)4 m'o
ml'
0
(.9':0 OCCLARE PltISL CONsr
f.9:l !'lUS1 EIlIJ
1
,'013 I)[CLi~r[ PLU53. CONSl
;'14 PL~~ lQU
:>
;'15
HFI"
f,ECUlF'E II[G1.. CONST
.'29 NEG1
m
[QU
.. 1
fE.lECT
A~I mnemoniCS, copYrighted © Intel Corporation 1976.
1·98
intJ
Lo( 00.1
Ap·55A
LIN[
9JURC[ :;TflTEI1ENT
;'32 .
,'I~ ,; ***~**:~i:~'*l:*':**;:*~*~*****'*"'********************.**********
7]4 ;
(3') ;
BANI( 0
REGI~T[rl
ALLOCm ION,
I3G ;
73? ,l'*~, 't.*~,*~'~*****-I'*',*;,*",****:j.********~*********;:****""********
738;
;'39 lULARE LDATn.IC:*>t*";'****"';'*********************;:*.'******
341;
844
845
846
847
0002
0003
0004
0006
,:
[:fINI( 1 REGI~TER flLLOCI1TION
"
: *~,** ~****t.*~.**~.****** ~.,***********:~******************",***~
:
; USE.D TO HOLD INPUT I'flTTERN BUNG I\'OTATW THkruGH t~'
B48 DEClfl!:'E ROTPilT. RBi
065+
ROl PAT SET f.:2
; COUNTS 1lR'Irn:l< Of !l ITS ROl AltD THROUGH C\'
86~ DECLA~:E POTeNT,·1I1l1
066+
ROTCNT SET R]
S90 DECLBRE UlSW.".IIB1
; HOLDS KEY POSITION or LAST KEV DEPRESSION DUEtTED
907·1
lf15TK." SET R4
911 OCCLIlRE CURDIG. RIl1
; HOLD!> "OSITION or NCXl CHAARCTER "iO BE DI~'LAYED
928+
WRDIG SET R5
n2 DECLtlRE m'rLG,f~B1
;FU1G TO DrlECT WIlEN AlL Kl."S f1RE. f~[UFlSE[l
949+
m'FLG SET R6
:153
; (k'EGI:;1~ ? NOT USED I'Ok Pkli'lflR't' MONITOR)
9S4 ;
95S ,; ******,~***:~****************;,**t******~,*********************
956 tEJ[CT
All mnemonics copyrighted @ Intel Corporation 1976.
1·99
Ap·55A
LOC OOJ
LINE
SOI.Jl<'C€ S1 ATEIOT
957 ;
958 ,*1-***.*i:*******.****.*~:*~'*******~.*
0920
80'.:1
0922
11023
0024
9025
0E!2G
0027
9II'.IS
0929
902A
002Il
002C
002D
802[
0021·
0030
9831
0032
0033
0034
0935
1l03G
00:>7
963 ;
YA DECLfft: [PAce, Rrd'l
; !:ltJ'flfJl IN 111' FOIl EF' f1l;CUl'lULf1TOr.
EQU 32
969+
~I'ACC
973 DECUiRE EPf'SW, ~'AM
; STORAGE IN Mr rOR EI' PROGRflM STATUS WORD
97(:+
[PPSW mu '13
932 DECLARE EPm!!?, ~RI1
; SlomOE IN MF' rOf.: [f' T1I'1EI"ICOUNU:I< RlGIS1ER
907+
[F'Tl~
E(lt)
:>4
991 DEcu:rE EPRS,~:FlI'I
' SlORfiGE IN Mr rOR EP FlEG 15Ttl1 0 OF BRNK {j
E.(JU 35
996.
El'\':0
1000 DECLARE EPI'CLO, (.'fl!'1
; S1OI1FlGE IN 111' rOR LOW VI'l ( or EP rROGRAtI WOOER
ErpCLO EOO 36
1005+
109~ I)[CLA~ EF'PCfII. FAM
'STOIIfli.lE IN 1If' FOR HIGH NIBBLE OF EP I-'~OORfII'1 COUNT!:./.:
[/'PCllI mll :)('
1914.
. rRROMETER 1 FOR <,;EPIAL LlN~ Df11A RflTl G[NERnTOR
1018 DECLfIFlE' HBITLO, Ff1'"
1023+
HBITLO E'.l1J 38
,PMllM[TEI1 2 rOF 5E.RIAL Ll~ DMA RATE GENERA10R
1021' DECLflRE flS ITIi I ,PAl'!
1032·.
f:CITHI EQU '.'
; rfWflf'l T[P f Of.' AUTo-STI;P flN(l AUl 0- BREflK SlQUENCIt«i wnn:
1936 ~CLfw.C DSPTlti, rAM
DSPTII'I [QU 4ij
184H
1845 DECLARE IlERSNQ, RAM
' MON ITOr;' '.'EP~·I ON NUI1BEJ<
YE~SNO [QU 41
t05~+
(UNUSED)
1054 OECLME I-IREGA, RnM
. f:REGil EW 42
1{!5~+
(uPUSED)
1063 OCCLn~'[ IIREGD, RAM
196(a
. IlREGC EQlJ 43
(lJNI.)<'.1:D)
;
107<: llECLAr;'E flREGC,lIfl1'1
i07?·}
HREGC EQIJ 44
(1HY'.1:D) .
1981 OCCLfif HREGD, RrlM
1986-1
BREGD EGU 45
(UNUSED)
1090 DlCLflJ;'l 11RE1lE, FAM
i
1095.
flREGE [00 46
(UNIJ<~D)
11!99 DECLARE 1fREGF. RAM
110H
HREGF EQU 47
,f'Rll'IAR~'. ComlND Slr~TINGI'IE.t1OR'" HOOR135 (L~ INTE)
1100 DECLf1RE SHRLO, Rrd'l
-•.
.
111J+
SI'IflLU
EQU
1117 DECLARE SIflHI, RAM
1122'~
SMAIl! EOO
1126 DECLflRE EI'IflLO, RAil
1131+
lIRO HllJ
1135 DECLAI1E· EI'IAI-Il.. RAI'I
1148+
EI'IflHI [QIJ
1144 DlCLARE I1El'II..O, RAM
I1EIILO EW
114'+
115:1 DECLARE MEltl!, RM
115tH
MEIIIII EPU
1162 DlCLARE ElCODE. Rf1I'I
l1G'?+
BCODE £:QIJ
1171 DECLARE TYPE, RflI'I
EQU
TI'PE
1176+
48
; PRllf'oRY ComlNl>
~TARIWO
MEIU\' flOOK'l!>S (HIGI: BYlE)
49
; PI"IMflk".' C.IJMIIANI) ENt'IN(;
I'IE~\'
ADDRES::; (LOW al'TE)
50
; PRIMAt;",' COMMANI) ENDING MEI'IOR\' ADDRE.S!:> (HIGH BYlD
51
; UIIRD PWSlI? PRRAMETER & HEX RECORD ADDRESS (LOW)
S2
; TIII~D PfP.SER PflRAMEW:': 8 HLX RECOOD AOORESS (HIGH)
53
; PI1II'1flR't' COMMAND NUMBER FROM rff;:5[R HlBLES (lHJ)
~
; f'RIMfIRY COi'II'IAND I'IODlrIER/OF'lION (0-5)
55
All mnemonics copyrighted © Intel Corporation 1976.
1-100
inter
LOC OBJ
9939
9931l
993B
993C
993l)
993E
OO4Il
0041
1l!l42
9843
994[
Ap·55A
LINE
5tUICE 5TATB1[NT
111l1l DECLARE /lJI'tON, ~'flI'I
1185+
NlKOO [QU
11e9 DI:(.tflRE OPT! ON. RflI!
1194l
OPTION EP.U
1198 OCCLR~E r£XTPL, RAM
1293+
IEXTPL EQIJ
12117 DECLflRE KBOEUF, RAM
1212+
KOOIllf EOO
1216 DECLRRE KEYLOC, RAM
1221+
KE\'LOC EQU
12'~S I!lCLARE ~PTS, RAM
1230+
NREPTS lQU
1234 DECL~ fI<"•..IWL Rf1I'I
1239;·
flSflY[
EQU
1243 D[CLAPE RDELRI', R!iM
124fB
RDELfll' [QlJ
1252 DEGlfiRE STFTMP, mM
1~7+
STRTI'IP EQI)
1261 DECLflRE BlfrNl, RAM
12(,(:+
BlfCNT EDIJ
1270 DECLRR[ RECTI,!" RAM
1275+
R£CTYP EQI)
1279 OCCLARE B, RAM
; IR<. IM'IOCR or PflRMTERS PUOWI:D FOR SELI;(;TED CO/I'IAN)
56
; II«X f'OIN'IER lJS[D IN S£mCllIN6 rARSER TABlES
57
; ClfARACTER
f"~ITION
rOR DISPLRI' UTiLlHES TO WRITE Pl.Xl
58
.; rtlSIl ION or 1((\' OCBOlllCED BY SCAlflING stfJRWTIPl.
~9
; IM:R[tlEN1ED
ns
; KEEPS TRACK
or SUCCESSIVE REnDS or SAI'IE I([I'STROKE
69
SlJCCE!>SIYE KEY LOCATIONS SCANlED
(;1
; HOlDS OCtltU.ATOR WIUJE DlJFINIi SERVICE RotJl INE.
62
; (.'(UfiER DECRDlENTED WIIlN flUTO'SlEP OlLfl'l' IN F'I\'tG.'ESS
(;3
; IPllEX POINTER FIJ<:
DI~LfiY
GflflRftCm: STRIN!i ACCESSING
64
,COUNl or llt1TA BmS IN llEX FORI'IflT RECORO BUFFU:
65
; lYrE OF flEX FORI'Ifll RECORD (9 OR 1)
E.6
;!llT COUNlER FOR flSCIl !>ERIP.L 110 UTILIW SlllROUlIPES
B
EQIJ 6r
; CHARriCTER BEING SHIH[J) DURING SERIAL 110 rROCESS
1288 DECLARE REGe, Rfil'l
1293+
REGC
[til) C8
; COUNTER IN SorTWfft: DELn'I DAm RATE GENERATOR
1297 DECLARE H, RAM
[00 G9
1392~
H
1306 ;
1284·~
B97 MBlOCK
1311i
1314 ;
1315 MOCK
1319+
1322;
1323 MBLOCK
1327+
1330 ;
1331 SEJECT
:.EGI1flP, ClIflRNO ; REGISTER flRRfI'I FOR DISPLf''t' PfllTERNS
5[GMflP [00 79
O\IIJUF,OVSIZE
; LOIHIFDlR IJSER PROGRAII DURING PHNHIONITOR OVERl/lYS
OYBlf /:.QIJ fS
HEXBIJF, BlfLEN ; ALLOCATE BLOCK or RAM I·OR lJ<.A: AS HEX
liEXBIJF EQIJ 191
All mnemonic. copyrighted © Intel Corporation 1976.
1-101
REC~D
btfFER
intJ
lOC Oil)
0300
0300 00
0301 00
0:;02 00
AP·55A
LINE
S(lIJ!CE STRTEI'[IIT
1332
13:>71
1341 ; INVf1LS
1142,
134:$,
1344.'
1345 ,
1346 INVfll5:
DATflJlK 4'1
1347
ORG
INITIAL VliLlIt
====== .:::.==
DB
00H
9393 a3
9394 00
1350
0:ros 00
B51
00
DB
00
00
DI:!
!J31l(; 00
0307 01
0308 00
0309 00
0300 00
031:10 00
030C 93
9500 04
B39E 20
039F 25
0310 00
0311 00
0312 00
0313 00
8314 00
0315 00
13316 00
0317 00
0318 rF
9319 OF
031A 00
031B 00
1352
DB
1353
1354
00
~!31C
~l31D
031E
031F
0329
13321
13]22
3023
8023
00
04
01
00
a3
IT
00
1348
1349
DB
1355
Of;
1356
DB
1357
135f.)
DB
DB
1S59
1369
1361
1362
1363
1364
1360
DC
DEl
DB
DB
DB
Oil
DB
DB
DB
DB
DB
00
DB
DB
DB
00
DB
DB
DB
00
DIl
08
1366
1367
1368
1369
1370
1371
1372
1373
13i'4
1315
1376
1377
1378
768
Tfll)lE OF CON::;Tf1NT~ 10 BE LOAOCD INTO ~ INTERIR. f RAI1 LOCATIONS "10 DEFIlED Yfl.OCS.
INIT: SlL
ROO
Xl'COO[' 19
i'IOY
Xl'TEST
CALL
A
CLR
lIO\II)
PSE(llO, fl
PSEGlII, R
IUID
RI!, 11AH ; START AT 1/01 (REG2) = RflII LOC lA1I
i'IOY
R1, ILOW NOVRLS
lIlY
R2, ILOW INYfl.5
i'IOY
A,R2
INITLP: i'IOY
=1497
=1498
=1499
=1410
=1411
=1412
=14B
=1414
=1415
=1416
=1417
=141B
=1419
I'IOYPJ A,~
@R9,1I
=1429
I10Y
=1421
INC
R9
=1422
INC
k2
1d.,INIlLP
=1423
DJNZ
=1424
STRT
"I
=1425
CALL
EPI.:RK
R9, ILOW(OV1BAS+QYSIZE)
=1426
i'IOY
=1427
Cf1Ll.
OYlOAD
=1428
CALl
COI'IFIl
R1,ITI'PE
=1429
MOV
@R1
=1439
INC
=1431
CftLl
INCSI'IA
=1432
au COIf'll
PL 1lflERJ
; WIlTR I'EPIORI' I100IFIERl
; [ (;LCflR/PREVIOOS 1
; [IJ'LOAD C!1II1AND J
;[AU10S11P I1OOIFIER]
; [PROGRAI1 I'(~I' MQ() IHER J
;[REGISTER ME.~' rfJDUIERJ
; [FORI'IfITTED DATIl OUTPUT COI1IflHI) J
; [GO FRm REstT STATe t'atlAN»
, [GO COItlRNri J
; [~XflI'lINE/I'IOOIF',' COI'IIfN) J
; [SET BIlEff(POINT COI'II'IflM) J
; [CLEAR IlREAKPOINT COI1IflN() J
EQlJ
(QU
1911
151-1
1111
100
WI
tr.H
;[f'ROORRI'I BREflKf'OINT 11E~' I'IODIFIERJ
.; [DATA BR£AKPOINT MEI1OR'r' I100IFlER 1
; [IIARDWARE REGiS1ER I'IEI1ORI' MODlFIER]
;[lmllOUT CREAKf'OlNTS I'IOOlrIER]
; [WITH ERl:AKPOINTS ENRIlLEI> 11OO1f1ER]
;(SmGLE STEP I'IOOIf lERl
(00
Eoo
EQU
EOO
EQU
EQlJ
EtlU
EQU
Eoo
EOO
EOO
(00
EQU
EQU
[00
EQU
mu
[00
EQlJ
EQU
All mnemonics copyrighted @ Intel Corporation 1976.
1-105
Ap·55A
LOC OOJ
9929 111"01
ll02B "(401
Il020 2381
8Il2r 3400
001114EC
!Jell f'B
11834 DJ13
11836 eG2S
11838 EC23
118311 B936
1183C B1111l
1IIl3E B937
9840B1lt11
9842 FC
11843, EJ
11844 B28C
11846 00
1184i' C652
11849 Fe
1184ft 0303
!I04C RC
B936
II84F 11
l1li58 11442
11841)
0952
11854
0055
11857
B936
F1
011D
3482
LItE
!am STRTDENT
=1526
COOEBLK 168
=1531+
ORG
41
:1535 ;lIAIN OUTPUTJtE5Sf&:(C(MN)~T)
CfLL IIf'ULIJVTE(KEY)
=1536 ;
=1537 ;1Ifl1N2 IF THE KEV=lND GO TO IfllN.
=1518 ;
=1539 f1flIN: IIOV
XPCOOE.11
=1540
CflL
:0
ICTRE EXHlIUSTEDI
=1552 ;
IF CTAIl< ITIf')=KEY GOTO IfIIIIl ICOItIflND lNTRY f'Wt> IN CTAB!
=1553 ;
ELSE
lllf':=lTIIP+COltIRIlUNlR'l'..sm
=1554 ;
BCOOE: =!lCOOE+1
=1555 ;
ENDIfIILE
=1556 ;
GOTO !»'OF
=1557
lIlY
1111', ICTIlIl
=1558
ItIOY
1lCODE, ZlRO .
=1569+
IIOY
Ri, ISCOOE
=1570~
=1574
=1585+
=1586+
=15911 FINDOf'.
=1591
=1592
=1593
=1594
=1595
=1596
=1597
=159S
=1599
, =1699
=1601 ;
=16112 ;
=1(;03 i
=1604 ;
lIlY
lIllY
IlO\l
lIlY
lIlY
1IOYI'3
JaS
XRI.
J't:
lIlY
fI)()
IIOV
lIlY
(IR1, lZERO
TYPE, Z[RO
rd., ITYf'[
IW,'O
FI, ITW
A, @fI
I£RROR
A, KEY
IfIllfI
A, 1TIIP
ft,lCOllSIZ
ITIt', A
R1, IBCOOE
@Rj"
It«:
@R1
.mP
FlNlOP
OOTI"ULI[SSOOE(5TRCOI'I«(;(;oo(»
I: =H1
OPTION:::IEII(I>
=1605 ;
I :=['~1
=1696 ;
NO_(J'J'ARAI'IETERS: =IEIf( I)
=1607 i
1:=3
=1608;
fl,BCOOl
=1689 I'IAINfl:
Ri,IIlCOOE
=16113'1
fI,@R1
=1619+
n,15TRCOI'I
=1623
=1624
OOTCLR
All mnemonics copyrighled
@
Inlel Corporalion 1976.
1-106
I*fmf'T FOR
T~ C~£NT
UJI/IFII)*I
infel'
LOC 00,]
9959 lC
0Il5A F(;
0058 E3
905C 1i939
005E fl1
W5f 1C
0060 rc
OOC1 D
9062 89313
9064 R1
0965
0067
0069
006B
006C
006E
B9BC
fl8:?0
0000
18
E96!1
14EC
9079 8939
0072 1"1
0073 nc
00;>41C
0015
0076
0077
0078
rc
E3
97
F7
0079 77
89lA Dr,
0078 C693
0071) r687
0071 LOS37
0W1 H
OOG2 17
0083 A1
9984 1C
0085.0475
0087 B937
.0B89 B100
AP·55A
LINE
~CE
=1625
=1626
=1627
=1628
=1641+
=1642+
=1646
=1647
=1648
=1649
=1662t
=1663+
=1667 ;
=1668 ;
=1669 ;
=1670
=1671
=1672 I1fllNB:
=1673
=1674
=1675
=1676 ;
=1677 .
=1673 ..
=1679 ;
=1680 ;
=1681 "
=16B2
=1(91)+
=1699'1
=1i'12+
=1715
=1f1C MAl NC1'
=1732~
=173(;
=17S7
=1f38
=1739
=1749
=1741
=1742
=1743
=1748+
=1749+
=1?S3+
=1?S8l
=1761
=1762
=1763 ..
=1764 i
=1765 "
=1766 MAI1ID1
=177(-1
=1778+
=1782
INC
I'lO\l
I'IOIJF'J
!II1OV
!'IOV
rov
STflTEMENT
ITttP
R, 1lI1f'
R,@fl
INC
mil'
I'lO\l
A,11111'
fI,@A
MOVr3
MI'IOV
/'fOIl
MOV
; GEl OPTI ON PO INrrR
OPTION, A
R1, IOPTION
@R1.A
OCT NO OF f'fiRfll'lETtRS
NltICQN, A
R1, lNUl'lCON
~R1, n
rnr.rn;TER_EtHER(9=)5). =9
MOil
r1,1t;
/'IOV
/'IOV
RII,ISMALO
~'0, .99H
INC
OJNZ
CALL
R9
1<1.I1flINE
i E.ACH I'fiRAI'I IS 2 INl ES
; START (f PARflI'I E'.tJfFERS
INPKEY
WlIILE KEYOMEM(OPTHRliTI'P[)[ 6-9] DO
IF t1El'f(OPTlON+T'IF,[)[ 7]=1 GOTO MAlND1
TYPE .=TI'I'E +1
ENDIoIIHLE
I1I'IOY
MOIl
MQI}
MOY
INC
MI'IOV
MOIl
I1OW3
(;LR
f.'L(;
RR
XRL
J2
JC
MINe
MOY
I'lO\l
INC
/'lOY
INC
JI'/f'
ITMP, OPTION
Ri, 1I000TI ON
A,@R1
ITMI"A
Imp
A, ITI'IP
A,ITMP
A,@A
C
A
R
fl, KEI'
''lUND
. STRIP BIT SEVEN INTO CAF.'k1'
1'Ifl1M>1
TI'PE
1,:1, '1i'P~
A,@Rl
A
@Rl,A
ITI'IP
/'tIlINC1
MODIfIER NOT FOUNO so RESET TlfE INOEX TO DEf'AUlT CASE. (ZERO),
MMOV
MOIl
MOV
MI'IOV
1\'P[,ZERO
R1.ITi'PE
flOR1,IZERO
A,OPTION
All mnemonics copyrighted © Intel Corporation 1976
1-107
inter
LOC (J)J
I!8SB
~39
Fl
908£ B
800F 3494
0091 049E
998()
!lII93 8939
999S Fl
999(; B
8897 8937
9899 61
889R3484
989C '14EC
Il99E 0C0II
0000 2330
00A2 6C
llIIfl36C
88fI4 AS
IlIIA5 14C9
9IIfl7 FGBlI
Il0fl9 1C
09RA 8938
9IIRC F1
9IlAI)
87
80RE R1
818· C68ft
8IlB1 FB
0002 D313
9084 CGBf1
88B6 14EC
8IlB8 84fl8
09BC Bfl01
8IlBE 249A
8897
AP·55A
LINE
SOI.RCE STRTEllENl
=1791+
I'm Rl,IOf'T1~
A,@Rj,
=1792+
ItOY
=17%
ItJ\IP3 fl,flIfl
=1797
CALL
OUTIISG
=1798
Jt1P
I'tRIN80
=1799 :
=18911 i
CfU OOTPUT..I£SSOOHImIFIl'R)
A, OPTI(Jj
=1881 /ifill{) ItKJY
R1, 'Of'TI(Jj
=181IH
IIOV
1101,1
A, I!Rl
=1811+
=1815
IIOYf'J A,@fl
R, TYPE
=1816
~
=1822·t
Ri, .TYPE
IIOV
=1823+
fl, 8:1
flOO
CAlL
=1827
OOTIISG
=1828
CIlLL
1If'KE\'
=1!l29i
ITl'IP,10
=1830 I'IAIN£lII: MO\I
A, ISIIILO
=1831 ml1NB1: ItOV
A,ITI1P
=1832
ADD
A,ITI1P
=1833
roo
R8,R
=1834
\'lII/
IIffl)F:
CAlL
=1835
JC
Cl'lDINT
=1836
=1837
Illf'
INC
=1638
1m
RL INlJII:ON
A,~1
=1839
ItOV
=1840
R
DEC
1R1, A
=1841
IIOV
=1842
JZ
CllDINT
/{I\I
A,KE\'
=1843
A,IKE\'END
=1844
XRL
Cll[)INT
=1845
12
=1846
CALL
INPKE\'
=1847
JIll'
KAINBl
=1848 i
=1649 i CllDINT ENTER TI£ ctM1N) PROCESSOR WITIl:
=1S511 .:
BfISLCOOf.=TfE KAIN rotIfIN) noPE
=1851 i
WF'E"'SUBCOIII'IAND TYPE
=1852 ;
PARRl'lETER(1)=rIRST I'IDDIIESS
=11.'53 ;
PRRfI'IETEI!(2)=SECOND flOORESS
=1854 i
PAm'ETERO>=DATA
=1855 CIID INT: JIt'
lIf'LE"
=1856 i
=18~7 i 1'l"RROR [~ ENCOUNTERED IN /lAIN PfJ.SINl kOlITINE.
.=1858 IlERROR: 1m
LOOTA, 11 .
=1859
JII'
PERROR
=1860
SIZECHK
=1863+ SIZE SET 151
.=11l64t:
=1L'65ti*-"'-*----*******"''*****---**
=1S74 '$EJECT
All mnemonics copyrighted @) Intel Corporation 1976.
1-108
inter
LOC
OOJ
8323
AP·55A
LINE
5ru!C(STnTEtENT
=1875
=1889+
=1884 ;
DATfllLK 59
ORG
SIB
=1885 ;
=1886;
=1887 ;
=1!J88 ;
9923
0093
8323 if
0324 ~F
8325 91
8J2G 1E
11327 49
832tl 91
8329 18
1132A :sf
832B 83
932C 1C
8J21) 3F
832E 92
832F 18
8:n83F
8:m 92
11332 14
8m 3F
8334 Il8
8335 lIE)
11336 46
8337 91
8lla OC
8m 46
9331\ 01
83Jl1 11>
113~ 49
SJID Iil8
833E IT
*****_****************************>I-"*****l,*****************
TflBlES
F~
PAR'.1.R
=1SC9 ; *****.~********-****-_*_***********************.*
=1fJ90;
=1091 ;
TIE C1AB TABLE CONTAINS (C1JISIz) EN1RIE5 FOR EflCll COI1I'IflND. TIl: PlANING
=1C92 ;
or THE Eimms IS flS FOLLOWS:
=1C93 ;
=1894 ;
ENTR'l' 8 COI9IftND KC'I' TO INITIATE
=1895 ;
ENTR'l' 1. POINTER TO HIE LIST or OPTlCtlS APPLICAELE 10 THIS COittANO
=1896;
ENTRY 2. NUMB[R OF NUI1ERIC f'ftRlllETERS I~QtJIRED "'..,. 1Hl rowHl
=1C97 ;
$ AN) BFFH
EQU
=1&'98 CTAB
=1899 COMSll [QU
1
=1989 ;
K(:\'i'IOI), LOW OPTAB1,1
; EXAI!
=1991
00
.=1992
DB
KEYOO, LOW 01'1003, 1
;GO
=1983
DB
KEYFIL, LOll (J'1A1l1.3
; fILL
=1984
OB
KEYL5T, LOll (FTAB1,2
;iXJI'IP
=1985
l>B
KC'I'REC, LOll OPTAEL 2
; RECORD
=1986
=
DB
KEI'REL, LOW OPTflB1. 8
; kE.l.UAD
=1987
OB
i8
991B
9119
Il11A
9118
811C
991D
9110
911E
911f
9129
9121
9122
9123
9124
912S
31
37
3E
44
46
49
48
4E
51
54
57
SA
so
9926
9126 SF
9127 61
912!l 63
=199lH
=1$'94 PRNT2:
=2004i
=2Il98
=29119
=2919
=2911
=2916+
=2917+
=2921i
=2926+
=29'.!9
=2939 PRNT1:
=2931 i
=2932 STRUTL
=2933
=2934
=2935
=2936
='.!037 STRmt
=2931)
=2939
=2949
=2841
=2942
=2943
=2944
=2945
=2946
COOEBLK 139
ORG
2:!6
OOlPUT (If: (f' F~ UTILlW DISPLA'/ PRM'TS (LEFT JUSlIFILD)
fl.'C(RDII«l TO ACC ctIlTENTS (8-3).
CLEff( DISPLAY All) OOIPUT CIflRACTER SlRIIIl STAATII«l
AT Tl-E flOORESS POINTED TO I:IY BYTE itT roDRE.SS IN flCUJU.RT~.
~IIf. TO COP\' n STRIIIl (f OIl f'ATTI:RNS Fm! ROt! TO Tff.
DISPLAY R[GI!.TERS.
5TRIIIl SIl.ECTED IS DETEF.IIII£D 8\' nee raN cnw.D.
ON ENTERIIil OOTIf'..G, ACe CONTENTS lIRE USED TO ADDRESS A Il\'TE IN A
LOOKlf TABLE ON TIlE ru:RENT PflOC IlllCiI CONTAINS
f~SS OF
A STRING IF SEGl'lENT PATTERN llflTA 8\'1 ES TO DE PRINlED ONIO Til.
DISftAl'.
TIE END OF TIlE STRING IS IN>ICHTED IfIEH 0I17 =1
CALLS SlIBROUTII£ 'IG)ISP'
TO flCTlRLY EFFECT WRITING INTO Tl-E DI5PLAY REGISTERS.
ft, 1STRU1L
ADD
CLEAR
CALL
A,@fl
i'IOYf'
5TRTIf', A
III'IOV
R1, ISTRTI'IP
I10Y
@R1,A
MOV
; LOll) NEXT CIIRRflCIIR LOCATI ON
A, STRTII'
I'KJY
Ri, ISTRTI1P
ItOY
A,@R1
i'IOY
A,@A
i LOAD BIT PAllERN IN>IRl::CT
KOVP
JB7
PRNT1
; OUTPUT TO NEXT CllARflClER POSITION
CALL
II>ISP
STRTI1P
; I~X POINTER
I'IINC
R1, ISTRTIIP
MOY
fL@Ri
I10Y
A
INC
@R1,A
I'KlV
JIf'
PRNT2
II>ISP
JII'
iDONE
n:I,
EQU
1>8
DB
DB
DB
EQU
DfJ
DB
DB
DB
00
DB
DB
00
DE;
=2947 STRME" EQU
DB
=2848
=2tI49
DB
=2959
DB
LOW $
LOW(DERRQR)
LOW(~)
LOII(DRUIO
LOW(DBPNl)
LOll $
UJII(DIIOI)
LOW(OOO)
LOW(DF1LL>
LOW(DLST)
LOW(DREC)
LOW(DREL)
LOW(DSB)
LOW(OCS)
LOW(OOR)
LOll $
LOW(DPRfllt>
LOW (DDAI'IEI'I)
LOW(IJRI1)
All mnemonics copyrighted © Intel Corporation 1976.
i UTILITY
;U1ILlW
; UTILIW
i UTILl T\'
I'ESSAGE
I1E5SAGE
I£SgJOE
I£SSIU:
9
1
2
3
ADDRESS
AI.JI)R[SS
roDRESS
ADDRESS
i I:flSIC COI'II'fAN)
9 RESPONSE fIOORI:SS
; !!ASIC COI'IIflN) 1 RESPOOSE ADDRESS
; BASIC COI'IIfH) 2 RESPONSE ADDRESS
i ElASIC cat1AND 3 RESPONSE fIOORESS
i BASIC CO/II'ffl) 4 RE!.PONSE ROORESS
i BASIC COItIAM) 5 RESPONSE flIlORESS
; BASIC COIfIAN) 6 RESI'ONSI: flD£*.tSS
; BASIC COI'\I'IIlN) .( RESPONSE ADDRESS
.; IlfISIC COI'IIfH) 8 RESPONSE RlIlRESS
; DATA T't'I'E IIlDIFIt:R 9 RESPIWSE flDI)RESS
; DlfTA n'PE IQ>IFIER 1 Rt:SPOOSE roDRESS
; DATA lYrE IIODIFlt:R 2 RESPONSE AOORESS
1-111
inter
AP·55A
LOC (.(jJ
LINE
11129 69
=2051
=2952
=295J
=2Il54
=2855
=21!56
=2857
=2858
=2859
812A 65
912f) 67
9II2C
ei2ca:
11121> 60
II12E
E}"
1112f" 72
11139 75
!lOURCE STRTEI1ENl
DB
DB
DB
s) RGOC
1;00
DB
DB
DB
00
D8
L~(DINTRG)
L~(DPRIJRK)
LIII(OOlll'lJ:IO
LIII $
L~(DI«lIRK)
L~(DWBIIKt
LOII(DSS)
!:0II«()Pf\)
LOW(DTR)
; DATA TVf'l IU>IFIER 3 RESPOlSE fWRESS
; DRTA TYPE IUlIFIEk 4 RESPONSE ROORESS
; llfiTR TYPE IUlIFlER ~ RESPONSE ftIDRlSS
;EXECUnOO ~ IIOOIFII:R
; EXECUTION ~ IUlIFIER
; EXECUTION IG)E 1IOO1fIER
.: lXIDJTION I'IODE IUlIFIER
; fXCUTION I100E IU)IFIER
=2868 .:
0131
0132
0133
0134
0135
01JG
79
50
50
5C
50
C0
1I1J7
013S
01J9
II1JR
00
76
GD
79
8flB 40
1113C 66
!lB!> E7
1113E !l0
!l1Jt 41!
0148 50
01411C
11142 54
11143 (,'0
8144 7J
0145 B9
=2061 ;
=2062 ;
=21163 DEf(R(JR:
=21164
=2065
=2066
=21167
=2968 .
=2069
=21170 DSGNON:
=2071
=2072
=2073
=2074
=2075
=2076
=2077
=2078 DRUN:
=2079
=20C9
=2081
=2982
=2003
=2084
=2085 OOfm:
=2086
=2007
UTILITV OUTPUT I'ItSSFlGES
00
00
DB
DB
00
DB
00
00
DB
00
DB
DB
DB
DB
00
8111101118
1I101110ilefJ
111010000[1
010111001)
0101001l1l8
11001111008
i
'R'
j
'0'
;
;
......
.~.
.
00000008B
011101198
01101101B
011110111[1
01000000B
011001100
111001118
;'
~
,." "
00
1110001l1.10B
1I1010001l1l
01101118
010181!l11E
111l1l01100B
DB
DB
11111811118
101111101B
DB
00
00
; IE'
; 'R'
.i
"H"
; '5'
; IE"
ii_"
; 14"
; "9. "<1")
; I.'
; IR'
i 'U'
; fiN'
; I .. •
;ara
; ·C.•
=2088 mECT
All mnemonics copyrighted @ Intel Corporation 1976. '
1-112
II
1
2
3
4
infel'
LOC OI)J
9146 ·,9
0147 J9
0148 F4
8149 31)
914A De
1l14E 71
814C :l0
014D IlS
014E. 38
1!14f 60
9158 Fa
9151 3E
0152 7J
915J Be
0154 5E
9155 ~4
9156 sa
0157 6D
0158 78
9159 Fe
91SA 39
015E J8
915C FC
01SD JD
915E 00
AP·55A
LINE
SOURCE STATEIf:NT
=2089 ;
=2990 ;
=~1 ;
=2092 DMOO:
=2093
PF:11'flRY
C~
[Jf;
911110018, 001119918, 11110190IJ
, "EClt •
=2094 000·
=2095
DB
801111818, 110111888
; -GO.
00
011108918, 081191.!1!0E), 10111000B
; 'HL.'
=2098 DLST:
=2099
DB
00111000B, 911011818, 11111988B
; 'LST. •
=2190 DF:EC:
=2191
00
901111100, 91119811E, 101111l09B
j
=2102 DREL:
=210:1
/.l£I
010111100, 9191919011, 19111000B
; aDNl.
=2194 DS&.
=2105
OB
0111l11018, 011110Il00, 11111100£:
; "SIB.•
=2106 DeC:
=210,
D8
0811111011), 00111900B, l1111100E
; 0ClO.
=2108 DGR:
=2109
OIl
1l0111191B, 11919001lE
i
=20% Df"ILL:
=21197
=
RESPONSE STRING f'RTTERN$
=2119 $EJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-113
u
HlPL.•
RGR.
II
II
II
Ap·55A
lOC OBJ'
8151' 73
0168 00
8161 5[
0162 F7
916:> 50
8164 00
9165 73
9166 rc
81e? 5E
9W) FC'
-8169 76
8161l 00
816B 54
816C Fe
01GD lC
81GE 00 .
91er
ro
LINE
~
51RTEI'IENT
=2111 ;
=2112 .;
OOR',' srACE IU)IFIER OPTION
=2113,
=2114 DF'RI1EM'
=2115
01119811[1, 119100e00
=2116 OOAI'IE.M:
=2111'
~5PONSE
STRINGS'
,"PR'
910111100, 11110111B
.' -Dn. ..
8191I!BB0B, 10111101B
,'RG.•
91111!9118, 11111100B
j
DB
019111198, 111111008
i.OO
=2124 DI NTRG .
=2125
00
911191100, 119100WB
()[;
=2111: DRI'I:
=2119
'00
=
=2120 DF'RBI':K'
=2121
DB
=2122
=2123
=2126
=2127
=2121:
=2129
=2139
IPr:! .•
~I~'
;
RESPOI6E MESSAGES rOR GO CONI) ITI ON MOO I FJ t~.
;
;
DNOIlRI(:
; 1m
019191000, 111111900
I>B
II
-
M
=2131 IIIIIlRK:
=2132
DB
911111008, 1111199008
; "BR •
=2133 D!;S:
=2134
DB
011911918, 91191101[;, 11111000B
; 'SS1 •
=2135 DPA:
=2136
DB
01110111[l, 01111190E, 1101B0II0IJ'
, "flBR. "
=2B70TR:
=2138
00
01110111B, 011011!!1El, 11111B90B
; "AST.•
9170 E;[)
8171 Fe
0172 77
9173 7C
9174 00
9175 77
9176 GI>
11177 F8
9978
=2B9 ;
=2140
SIZECIi<
=214J+ SIZE SET 120
=2144+;
******************************-***************************
=2145+;
=2154 $EJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-114
AP·55A
LOC OOJ
1IOC9 97
9OC1 R;'
99C2 B9JS
89C4 rt
90C5 C6D7
911C7 FB
99C892D7
99Cfl 29
89CEJ 47
OOCC 20
9OCO 39
09CE 1S
OOCF 39
9IlD9 3478
99D214EC
99D4 97
991)5 94C7
.0007 FEJ
eros 1>312
000Il C6E!i
900C Fa
9000 1)313
09I)f'
Cf1:5
·9OC1 BAIl2
99E3 24911
99[5 EJ846
9I!E7 8993
00E9 B4f5
99ED fJ3
992C
LII£
sotJ/C(
STATEI'ENT
=2155
Coom.K 45
=21G0+
1]10
192
=2164 ; INI'fIDR 1tf'UT DATIl INTO TI/O"BYTE PARlKTER IlIFFER ItlllCATED BY RB.
=2165 ;
RECEIYl lUDIC KEYS rRCfl KE'I'BOfWW !mIL '.' OR '. '.
=2166 ;
SHIH INTO I€lDRES!; B\.rFEI";
=2167 ;
RE-WRnE I)ISPlfl'r'.
=2168 ;
IF I01BCR OF CONSTIIlTS 1£[1)[1) IS ZERO. t«J 1£1/ I'AfIfft:1U:S ff1E fUM!).
=2169 ;
=2178 IIf'ADR: CLR
C
=2171
Cf'I..
C
=2172
!mY
A.NIKON
=2181+
I'm
Ri. I/lftXlN
=2182j·
I'IOV
1I.@R1
=2186
12
ELSIrt
=2187 1NPAD1: I'IOV
A.KEY
=2100
J84
EL!:.IF1
=21t.'9
XCH
A. @R8
=2199
SIIlP
A
=2191
XCH
A.i!R9
=2192
)(011)
ILI!R8
=219:l
INC
R9
=2194
XCHD
lURe
lI'Dfl)R
=2195
Cfll
=2196
Cfl.L
INPKEY
=2197
CU:
G
Itf'fI)1
=2198
JI'IP
=2199 ;
=2290 ; El!.If1 IF KEY='. I ~ '. I TI£N RE'fmN.
=2291 ;
='~a12 lLSIf1: I'IOV
A..KE\'
A.II(EYNXT
=2293
XRI.
=2294
12
ELSIF2
=2295
I'IOV
ILKE\'
=2206
XRl
A.IKEYOI>
=2207
J2 .
illlF2
=2298 ;
=2299 ;
EL!.E GOI0 PERROR.
=2219 ;
=2'dl
!lOY
LDATA.'2
=2212·
Jl'I'
PERROR
=2213 ELSIF2: PlOY
R0.ISEIM'
=2214
I'm
Ri.13
=2215
CflLL
OOI..ANK
=2216
RET
=2217
SIZECHK
=2229+ SIZE SET 44
=2221+;
=2222+;**-_**_ _ *~**********
=2231 $EJECT
__
All mnemonics copyrighted @ Intel Corporation 1976.
1-115
inter
LOC OOJ
8178 D93A
917A 0193
817C F9
(;8
8171. 539F
9189 96CE
9182 D4D8
91fJ4 Fe
9185 47
9186 5301"
9188 9692
91SA D4D!l
BlOC 2494
81SE D4DJ
!l198
F~
9191 47
9192 D4Dl
9194 F0
9195 D4Dl
0197 93
9920
L1/£
S(XEE
STRTEI'II:NT
COD£BLK J5
ORG
376
=2246 ; ~ tJ1)AT[ OODRESS FIELD
=2247 ;
(LAST nm CHf~TERS OF DISPLAY) WillI flOOfI'HI
=2269
Cfl.L
WOI5/'
=2279
!'lOY
fl, flIR9
=2211
ZIoIlI'
/l
=2272
ANI.
A, tefH
=2273
JNZ
DSP!'I1
"2274
CRLL
MOl51'
=2275
JMP
DSPLO
=2276 DSPIII, CALL
DSPACC
=2277 DSPf1ID: I'IOV
Il, tIR0
=2276
SWAP
R
=2279 DSPf11 CfLL
DSPRCC
=2'.169 DSPLO: I'IOV
A, ~8
=2231
CfLL
DSI'RCC
=22C2
RET
=221.13
SIZECIIK
=2206-1 SIZl! !.ET 12
=2232
=2242+
8178
9170
AP·55A
=2'.!B7{ ;
=2280+;
=2297 $EJECT
***********-_**_*******____**___
All mnemonicS copyrighted C9 Intel Corporation 1976.
1-116
AP·55A
Loe OBJ
8198
11198
1I19A
019C
019E
01!11"
eIRe
IlOO4
Er02
74D1
27
l>7
FEl
01Al D317
01A3 C6I)G
01AS 27
01AC 3400
01r.s FA
I!lA9 041)3
01R!)
01AD
alAr
01El
0182
01114
01£16
B93El
611F
14EC
FD
D3E
9698
0429
LINE
SOURCE STATEMEN1
=22')8
CODEBLK 35
=2303+
ORG
408
=2312 ; r'ERROR .
REPEAT
=2313 ;
OUTPUT J'/[SSAGl:(P~R()IU'ROI'IPT)
=2314 •
OIJTPUHLDATAl
=2315;
CAlL INPUUlI'lE(K[Y)
=231G ;
UNTIL KEI'='a.EIlRt'f'k'EII!OIJ.j'
=2317 RCRflOR' MOil
LI!ATn.14
=2313 PERROI"<- IIOV
XPCOOE••2
=2m
lkLL
xrrrsT
=2328
a.R
A
=2321
I'KJV
P~. A
=2322
II()\/
A. KEI'
=2323
XRL
A.IKE\'CLR
=2324
JZ
E.I1R0R2
=2325
CLR
A
=2326
CALL
OUTUl L
=2327
ItOV
A, LDRTR
=2328
CfU
DSPOCC
=2329
MMOIl
KBOOUF. NEGl
=2340+
PIOV
Rl. IKCDClUF
=2341t
MOIl
@R1. HGl
=2345
CALL
1Nf'1(fI'
=2346
MOil
fl. KIY
=234;'
XRL
fl.IKEI'E/{'l
=2348
JNZ
RERROR
=2349 ERROR.,: JMP
/'lAIN
=2350
SIZI:.CIIK
=2353+ SIZE Sf.T :s2
=2354+ ;
**************',***************",***********************"*****
0200 2306
0202 8936
0204 61
020S 83
8206
er
Irll!7 28
11288 22
021!9 lR
821!fl 11
0200 16
820C 2C
02I!D 2&
02I!E 2(;
82I!r 444f
9211 85
=2355i ;
=2364 ;
=236!J
=2330+
=2384 ; IREM
=2385 II'II'LE.I1:
=2336
=2392+
=2393+
=2397
=2398 ;
CODEDLK 80
oro
512
IIf'lU'[NT COMMfINI)
1l..ILOW(JI'II'TllL>
/'/ROO
A. OClJD(
/'lOll
Rl, .BCOOE
1100
fl, ~
JI'tPP
(ffl
/'lOll
=2399 Jlf'Tl'.t.:
=24118
=2481
=2482
=2483
=2484
=2485
=2486
=2487
=2483
=2409
=2410
=2411
=2412
DIJ
LOW(JTO/'I()/)
00
LOW(JTOOO)
LOW (JTOF"IU
LOIHJTOLST)
DIJ
DB
·DB
00
D!l
00
DB
;
JTOI1O[l: JMI'
;
nOR[c' CLR
LOW(JTOREC)
LOWOTOREU
LOW(COI'IS[:R)
LOW(C~BR)
LOW(JGORES)
foXfl/'lIN
Fe
All mnemonics copyrighted © Intel Corporation 1976.
; r 0=8 ==) lEX FORmT DR1 A DU/'IP
1-117
Ap·55A
LOC OIlJ
0212 B472
0214 0429
9216 5497
0218 042'.3
921A 85
0218 9S
021C B472
921E 0429
9229 8499
9222 W5
9224 9429
9226 8461
9228 BFI99
822!1 442E
922C 1JA01
922E 2304
0239
0232
i!233
0234
8236
0237
9239
023B
El9J7
61
A1
F400
FB
Dm
0230
023F
0241
i!243
0938
0191
OSSll
0090
9245
9247
0249
1r.!4B
024D
C64D
14EC
0931
8199
14C0
E634
0429
LINE
sotnE STATEPENT
=2413
CALL
flFILEO
=2414
JMI'
MAIN
=2415 ;
=2416 J10RR CALL
f:ReCIN
=2417
Jrt'
MAIN
=2418 ;
=2419 JTfl..ST: CLR
F0
=2420
CPL
F9
=2421
HFILEO
=2422
Jrt'
MAIN
=2423 ;
=2424 JTOGO: Jrf'
EPRUN
=2425 ;
=2426 JlOFIL: c/u
COI'IFIL
=2427
Jrt'
MAIN
=2428 ;
=2429 JGORES: Jrt>
COI'IGOR
=2439 ;
=2431 ; CCIIUlR C~ TO CLEAR BREAKPOINTS
=2432 C!JICDR: I'KJY
LDflH1I9
=2431
JIf'
BRKfIL
=2434 ;
=2435 ; ctmSBR COItVlND TO SET BREAKI1JINl S
=2436 COI'ISCR I'KJY
LDftTfl•• 1
=2437 BRKFIL: !'lOY
A..'4
=2438
I'troD
T'lP1J n
=2t48+
I10Y
R1.'TVPE
=24491
AOO
n. @R1
=2455-1
I'1OV
@rd. n
=2459 BRKNXT: CALL
L5TORE
=246e
110\1
A, KEI'
=2461
XRL
A. IKEI'END
=2462
Ji
lJRKOO
=2463
CALL
IWKEI'
=2464
ItIOV
NUI'ICON. PLI.I$1
=2475+
!'lOY
RL INI.JIUtI
=2476+
I'KlV
@Ri. IPlI.I$1
=2489
MOY
RO. ISI'IflO
=2481
!'lOY
il'R0, 19
=2482
I'l'101/
51'1A1H. ZERO
=2493-1
I10V
RL .2ftl1
=2494+
MOY
@Ri.'ZERO
=2498
CALL
I NPRDR
=2499
JNC
DRKI«T
=2""...00 BRl(END· JI'I'
MAIN
=2501
SIZECIlK
=2504·f <:;Ize 51:.1 79
=2595+;
cru
************************************************************
=2506+;
=2515 $[JECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-118
AP·55A
LOC 08J
LINE
=2516
=2531'1
924F
5~CE
STATEl'ENT
COOCBLK 75
ORG
591
=~35
; EXAI'IIN EXAI'IINEII1OOIF'!' I'[~' COItIAND.
=2536 ;
DISPLAYS ME110RV f1ODRE55 SPACE OPT! ON, f'lDDfBS VALUE, AND CURRENT DflTA.
=2537 ;
READ!; 1([','BOflR() fIN) INTERPRETS RESPONSL
024F
as
9250
am
0252 F1
0253 0326
9255 3492
0257 EB31
9259 347C
02".Al 2348
025D D400
lJ25F 14FC
1I261 FA
02(.2
9263
9265
92£6
926!)
47
D4D3
FA
D4D3
14EC
. 926A FE)
9268 9278
II:!6/)
026E
926f
11271
9273
0274
0275
9276
9277
9279
FA
47
5JF9
B675
27
95
68
AA
F409
4459
=2538 ;
=2539 ;
OUTT'1JT_MES5AG( ( (1'II:roR\'_SPRCE_Of'n OH)(SMflY =' (DRTfLBVI E> )
=2549 EXAMIN: CLR
F0
=2541 EXR/'I0: mlV
A. TI'PE
. =255fji
1'1011
R1,ITl'PE
=2551+
MOV
A, @R1
=~55
=2556
=2557
=255lJ
=2559
=2!:>G9
=2561
=25&2
=2563
=2564
=25(;5
=2566
=2567 .:
=2568 1
=2569 .:
=2579 .:
=2571 .:
=2572 .:
=2573 .:
=2574 .:
=2575 .:
=2576 .:
=2'577 .:
=257C .:
=2579 .:
=2589
=2581
=2597+
=2601
=2692 .:
=2693 .:
=2694 .:
=2[.e5 .:
=2696 ;
=2697
=2600
=2(;99
=2610
=2611
=2612
=2613 I,J Er wmt SYSTEM STATUS AND RELEflC...E.
SEQlENCE IS AS FOLLOWS'
IF L1J1tfIND WAS TERIIINffTEl) 8Y TIE 'NEXT' KEY:
$lORE SI'IfI INTO EP PC;
STORE EP PC INTO TOP··QF-STOC.K (RELATIVE. '/0 Er P'--U);
PfiSS EP Re;
PASS EP PSW;
Pf\5S Er TIMER;
PASS EP ACClKlATOR;
MOV
GILL
n,12
OOTUTL
~Y
A,NIJ1CON
Ri, 1/UIC!14
A,@Ri
EPC!I4T
E.PrClO, 5Ift.O
I10V
i'IOY
JNZ
I'II'fO\I
MOV
I10V
PlOY
i'IOY
MmY
i'IOY
I'IOY
MOY
Ri,ISlft.O
A,@R1
R1, 1EI'PCl0
@Ri,A
EPrCllI,5If1III
RL IS/'IAHI
A,@R1
RL IEPPCIII
@R1,R
!'lOY
I'IOY . R,KE\'
ftll
0YSIfIP
SET If BREAK LOOIC FOR APPROPRIRTE
Df."PEND ING 00 COOENTS IF '"M'('.
III)Y
I'IOY
l'IO'II
A,lWE
RL.TVPE
fl,@R1
AOO
R,ILI»! GOTBL
JII'I'
(If!
00
LI»!(CGOtIl)
All mnemonics copyrighted © Inlel Corporalion 1976.
1-122
BI\tfII(
COtI)ITIIIIS,
Ap·55A
LOC ODJ
0472
8473
0474
0475
76
80
76
80
8476 99fD
11478 8~'91
047A 8482
947C 99F"C
847E 8482
0482
8484
9486
04eS
ffi29
9flEF
991)1'
F4F4
948f1 F4AC
948C r4flF
948E 37
84er F2!15
8491 86S9
0493 8400
9495 0499
9497 84ln
0499-B400
9498 8937
049D Fl
849E 93A!
9400 113
94Al A6
84A2
94A3
84R4
04A5
SA
SA
Afl
All
LIN[
=3929
=3921
=3922
=3923
=31124
=3025
=302G
=3927
=3028
=3929
=3030
=3931
=3032
=31G3
=3034
=3035
=3936
=3917
=3938
=3939
=3049
=3941
=3042
=3843
=-3944
=3845
=3946
=3847
=3848
=3849
=3959
=3951
SOLm: STATEIt::NT
00
00
DB
DB
;
cGOpnr:
CGOWO· AIIl..
OM_
Ji'tP
LOW(CGQIoIl)
LOW(CGOSS)
L~(CGOPAT)
LOW(CG()TRA)
Pi, INOT Il90099100
Pi. 1990099911)
Ept;>lJI4
;
CGOIID·
ANI..
JI1P
Pi, INOT 9IlIlOO911B
EPRUN4
;
CGOTRA:
CGOSS· In
Pl, .il8OO9911B
;
; EPRUN4 SE1 Uf' CONTROL LOGIC TO RUN USER'S I'ROGRAI'I.
,
~'ELEASE PROCESSOR TO f.
BREAK EI'IUlf1TJON /100£,
CONTINUE ACCORDING TO GO COItIAND TYPE .
CfilL
STSAVE
i'II'JJV
MOV
I10V
A, WI'E
R1, ITYPE
A, @Rl
fl, 'UlII CNTmL
flIA
fllD
JI'1PP
DB
00
DB
00
DB
LOW(BRKERR)
LOW(EPRUN6)
LOW(EPIWN6)
LOW(CNTTRA)
LOW(CNTTRA)
All mnemOnics copyrighted © Intel Corporation 1976.
1-123
Ap·55A
LOC 08J
LINE
SWlCE STRIDENT
=3986 ; ~ BREAKPOINT LATCH IllS SE"I TllOOOH BREflKPOINl 5 NoT EIflBLED.
=3987;
DISPLAY
=J9S8 1lRKERR: !lOY
Il4fI6 BIl8Il
94IlS 249A
=J009 '
94AA om
94AC F1
=31!99 ;
=3991 CNTTRA: I'II1OY
=3193+
!lOY
=3191+
!lOY
94AD 94F2
04flF F4fIF
94Il1 F241
, 0483 14EC
84B5 Fa ,
94~ DlD
9488 96C7
94IlA 14EC
94BC FE
9400 D112
94Ef 96C7
94C1 2382
94Cl 3499
94C5 8441
94C7 9433
.M'
I~ ~'a1I1ESSAGE.
LOflTA, I9EII
rH'J/OR
A,DSI'll"
Ri,'DSf'TIII
fl,lIR1
=3195
CIU
DElAY
KOOI'(l.
=3196
CALL
=3197
JB7
; Bi' SET INDICATf:S NO KEYSTRM.
EPCNT
=3198 ;
=3109 ; Ef'RlK) IIf'UTCKEY),
=3119 ;
Ir KEY--OO GO TO PARSER,
=3111 ;
It.fUT KEY,
=3112 ;
IF KlY()1£l(T GO TO f'Al&R,
=:!113 ;
CONTINI..( IN SAI'IE 11ODE.
=3114 ;
=3115 EI'RI.Ki: CALL
INPKEY
A,KE\'
=3116
MOY
A,IKEYOO
=3117
XRl
=3118
JHZ
EPREl
=3119 EPRI.Il6: CALL
IIf'KEY
fl,KEY
=3128
lIllY
/I, IKEYNXT
=3121
XRL
=3122
JNZ
L1'RET
/1,12
=3123
I'tOY
=3124
CAlL
runm.
=3125
Jill'
Ef'CNT
=3126 ;
=3127 ; EPRET EXECUTIIIl I'IOOE IS TO BE TtRI'IIIflTl:l),
=3128 ;
JIJtP IN10 PARSER TO INTERPRET KE\' ALREADY DETECTED.
=3129 EPRET: JItP
1lA1N2
=3139 ;
=3131
SIZECHK
=3134+ SIZE SET 291
=:1135+;
=3BGi'; **t_**~,******._*_*_*_********_t
"*
=3145 $EJECT
__
All mnemonics copyrighted © Intel Corporation 1976.
1-124
intJ
LOC OOJ
85IlII
85IlII 74418S82 2383
85843488
858G 74511
8588 1lS8I:
858fl 746A
858C 8A28
Il5IE 2314
8518 91
8511 9fIOF
!!:i13 8983
8515 F40B
8517 eA20
85199fU
8518 8903
851DF400
8!!1F B!lA5
8521 7461-1
1!523 F4D8
B928
8527 Ai
8:)25
8528 F400
852A 8922
852C Ai
852D F4D8
852F 8921
8531 A1
8532 1:400
8534
8536
!!:i37
8539
8923
Ai
C8IlB
746A
8538 b'921
8531) F1
1153£ 87
853f 5387
AP-55A
LINE
sotm 51 ATEI£NT
=3146
=3171+
=3175 ; STSAYE
=3176 ;
=3177 ;
=3178 ;
=$179 ;
=3188 ;
=3181 ;
=3182 ;
·=3183 STSAVE:
=3184
=3185
=3136
=3187
=3188
=3189
=3198
=3191
=3192
=3193
=3194
=3195
=31%
=3197
=3198
=3199 ;
=3288 ;
=3281 ;
=3282 ;
=:a83
=3284
=:1285
=3286
=3219+
=S22B+
=3224
=3225
=3238+'
=32$9+
=3243
=3244
=3257+
=3~O+
=3262
=32G3
=3276+
=3277+
=J281
=3282
=3283
=3292+
=3293+
COOEBLK 115
IE
1280
EP STATUS SAVE 9JlROOTlI£.
F(gE CALL TO LOC 814H;
SAVE EP ACC;
$AYE Er TII£R;
Sf1Yf:. EP P$II;
SAVE EP Re;
SA'IE EP lW-(F-5TACK IN EP PC;
kE1U!N.
EPfJRt(
CALL
R,13
/'lOY
CAl.L
OOTUll
CALL
OVSIR'
1\'8, 1l000(OY8OOS+OYSIZD
/'lOY
(M.0fl)
CALL
P2, 1II81!18OO81l
Il
EPt'ASS
EPACC,f}
1\'1,tEM;C
I!RLR
EPPASS
EPTlI1R, A
R1,I£PTI~
@Rj.,A
EPPASS
EPPSW,R
RLIEPPSW
PRLA
B'PflSS
EPR8,R
R1,1EPR8
@R1,A
R8, 1l000(0Y1BAS'IOYSIZE>
OYLOflD
R,EPPSW
fd.,1EPPSW
A, f!fd.
A
A. 18711
All mnemonics copyrighted © Intel Corporation 1976.
1-125
inter
AP·55A
lOC OBJ
LINE
9541 E7
85428388
=3299
=1J88
=3J81
=3J14.
=J:U5+
=3119
=1128
=1121
::JJ22
::11J5+
11544
854G
8547
8549
854B
B9J8
Ai
F487
93ft
AA
II54C 11924
Il54E Ai
854F
8551
11553
8554
85!J6
8557
0559
Il55A
F4C1
B9J8
11
F487
fVl
5JF9
2A
1JFF
055C~
Il55E Il925
Il568 Ai
8561 4A
IlS62 fIA
Il56J F4C1
8565 Il825
8:i67 347C
9569 2348
056B D4DS
056() B82Il
Il56F 3498
8571 03
8872
SW!CE STATEtt:NT
RL
roo
/'IllY
IIJV
IIOY
=:S~lG'1
=3348
=3341
=3342
=3343
=3344
=3345
, =3346
=3347
=3348
=3349
=3362+,
=3363+
=1367
=3368
=3J69
=n78
'
=3371
=3372·
=3173
=3374
=3375
=3376
=3377
,
=3J88+ SIZE
=3381+;
II
A.10SH
SIIfl.O, A
R1.ISIR.O
8RLA
Cfl.l
roD
!lOY
Ef'FET
I'RlY
IIOY
El'PCl.O, A
Rj"IEPPClO
I!OV
Cfl.l
EPST~
I'KlY
INC
C/U
/lOY
All.
XCI!
AOOC
AtL
/'IllY
IIJV
IIOY
0Rl
IIJV
CAll
IIJV
CAll
IU-2
WfllA,1I
8RLA
RLISIR.O
lIR1
E1'FET
lDflTA. n
A. 1111188888
A, looTA
A.'-1
fl.18IlII811118
ErPCHI,A
R1. IU'PCIII
I!RLA
A.lDflTA
lDflTA.1l
EPSTOR
Re,1EPPcH1
lIf'1)fI)1'
1819888888
I'IOV
fI,
Cflll
IIJV
CfLl
WDISP
; "-" ~ DISPlAY
R8,IEPfJX
DSF1IID
RET
SIZECII<
114
S£:.T
***-**********---*********--*-****
=3382+;
=3391 $EJECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-126
intel'
LOC OOJ
11090
90IIA
991A
9297
9297 34CD
9299 D31A
929B C6E9
929() D31A
829F 033A
92A1 9697
92A3 rooo
92A5 14F9
92fl7 E941
92A~ A1
92AA 14F9
92AC 9931
92AE A1
92flF 14F9
92E1 B938
92E3 fl1
9284 14f0
02868942
92B8 A1
92E9 8941
9200 F1
92b'C W:C
92BE 14F0
92C9 AA
92C1r490
92C3 341'2
92C5 B941
92C7 F1
92Cll 97
92(,'9 A1
92CA 4489
0:iCC
92CE
92D9
9202
92D4
II2D6
34CD
0331C6DB
033F
348/l
14F2
AP·55A
LItE
sotm STnTEI'ENT
IIUOO£( :~9:HfILE.I'O)
3392 $
; (CR)
=3393 CHf1RCR EOO
0011
; (Lf)
=3394 CIm..F Et;'U
9FIl
; CONTROL-Z
=3395 CNTRLZ [00
1P.H
=3396 ;
=3397
COOEBLK S9
=3412+
ORG
663
=3416 ; tlRECIN IlEXFILE RECORD IIf'UT ROUTINE
=3417 Ift:CIN' CALL
CHRRIN
A, ICNTRI.2
=3418
XRL
=3419
JZ
DONE
A, ICNTRLZ
=3429
Xli'L
R, ,(': ')
=3421
XRL
tRECIN
=3422
JNZ
CHKSUI1, ZERO
=3423
ItIOV
CH FOlR BIT VALlE.
NOTE,· ~ ClECKING I.lOI£ TO VERIFY I£XIDECIIR. VALlDIT\'
C/U
CHARIN
; OCC=0F6-8FF FOR CllAROCTERS '8'-'9'
ROO
/l.. .-~
; CHARACTERS ) '9' f'ROOlJCE OYEkfL~
1M:
NIBB
ADD
; ACC=8"'5 FOR CIfIRIlCU:RS 'A' -'I·'
; ~ IF CHARRCTER BEllEEN 'S' IN> 'A'
me
ACC=0F61Hl5H FOR ClflRACTERS '8''''F'
All mnemonics copyrighted @ Intel Corporation 1976.
1-128
intel'
LOC OGJ
91C2 !!3FA
91C4 0310
91C6 E6C9
B1GS 83
91C9 E:Aen
B1C1l 249fl
0015
AP-55A
LIt£
SOURCE STATEtENT
=3708 NIBI3:
=37l.l9
=3710
=3711
=3712
=3713 ;
=3"114 ; fl'IERR
=$715 ASCERR
=3716
=3717
=372l1t SIZE
=3721+;
n.I-·6
ADD
ADO
. A.I1BH
JNC
A'IfJ'F:
;ACC=0fflt·0fFfl for.: CHfIkflC1ERS '€I'-'F'
;f1CC=OOfHlFlI FOR CHARACTlRS '0'-'F';
; OV£.f..'FLflI If f1IlO\J[ 15 JR!.(.
RET
ILLEGFt f£XIDECIMfll CfffllCTER
i'KN
LDAIn. leAH
JI'IP
PERROR
SI2ECHK
SET 21
~,[CEIV£D
=3722+; ******************~'************************'I"****************
=31'31 ;
=3,32 ;
01CD
B1L!) 1)449
1l1eF 537F
01D1 83
=3733
=:>743+
=3747 ; CUMIN
=3748;
=3749 Ch'ARIN'
=3753
CODE81K 5
ORG
461
CHARACTER IIf'U) ROUTINE.
RECEI't'[S 01£ fl'".>CII CHARACTER FROI'1 11£ LOGICft READER DEVICE.
CAU
CIN
ANI..
n••7FH
RET
=1.752
SIZECHK
=375S'f SI2[ 51: T ~
=~Z751
=3756+ •
=3757+; t****************************~'***********************t******
=3l66 ;
=3767 ;
=3768 $EJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-129
inter
LOC· 00,1
8572
9572
9574
9575
9S7?
8931
957lJ
957A
9S7B
1I!!711
8939
F1
8934
A1
9S7E
rooo
1'1
8935
fl1
9SOO B865
Il582 14FC
9S84 1'1\
9S8S All
9S86 18
8587 84£2
9589 E696
958B 34F2
FB
9388
E682
D49Il
0594 A472
95ro
II5SE
9599
9592
Ap·55A
SOO«I 5TATElENT
LIIf:
=3769
=3794i
=3798 ; !-fILEO
=3799 ;
=J009 ;
=3881 HFILEO:
=3B17+
=3S1e+
=3B24t
=3825+
=3820
=3S44+
=3S45i·
=3851+
=3852+
=38:iS
=3860+
=3864
=3865 ;
=3866 ; LDB\'TE
=3867 LOOVTE:
=3868
=3869
=3879
=:ro71
=3B72
=3873
=3874
=387S
=3f;76
=3877
=387S
=3879 ;
COO[[lLK 190
C»1G
1394
HEX FILE ooTPUT SlIlROUTIIf:
lIEN CALLED WITH F9=9 OOTPUT IS STfHJflRO lEX FILE FORPIflT.
WHEN CRLLED 101m: F0=1 ooll,\.IT IS rORllAlTED DA1A DUMP TO CRT
I'II'IOY
~w
MO\I
MOV
1E11H1.. SPfAHI
R1, tsI1flHl
n, @R1
Ri, lIIEIVII
A
I'£I'ILO, SIRO
Ri, 1Slft.0
A, toR1
MO\I~,
I'mV
MO\I
MO\I
'ItJY
MOY
ItIOY
MO\I
MOV
R1, 1tE1L0
@R1, A
Clf(SU/'I, ~
CllKSUI'I, lZERO
1"9, 1HEX8lf
LOAD /£XT B'r'TE FROI1 I'EI'IOR\' INTO lEX BLfFER
CIU
LFETt:f1
110V
It, LDflTA
MOV
INC
@Re, A
CALL
,Ill:
CllPI'IAS
OOFIL
CPU
110''
OOD
JNC
CAlL
JMP
R0
1NC'"J1A
A, R9
A, t· (IllRlN+HEXBlf)
L()[l\'TE
HRECO
IFILEO
=3889 ; BUll 00 f£X FILE TRflNSI1ISSION·
PRINT OUT BlfFIR FOR LAST DArn RECORD
PRI NT OUT CAlf£D 'EOO-or· -FILE' RECORD
95%
959S
9S9A
959C
959E
9S9F
95A0
95A2
=3881 ;
=3882 .;
=3W3 ;
RE1LRN.
D400
=3884
CAlL
IRECO
B6/l7
34D2
B8AE
1'8
fl3
CCA7
=300S
=38CG
=3887
=300S E1I>F1:
=300s
=3899
=3891
=3892
=3893
=3894 HFOO/£:
=3895
=3896
=3897
=3898 ;
JFe·
CIU
ffDOl£
TCRlFO
~.'8, I(L(Io/ EOFREC)
B4flI)
. 95A4 18
85A5 A49E
~7 34D2
95A9 2310
9SAB S48D
0SfID 83
oom.
MOV
MOY
I1OYI'
JZ
CALL
Ill:
Ji'IF'
CALL
I'IOY
CllLL
f\,@A
ffOONE
ClfIRO
R0
[N>f1
TCRLFO
fl, ICNTRLZ
CfflRO
RET
=:r099 ; EOFREC CHARACTER SkTING FC»1 t'fllH:D END-{f-fILE RECORD rOR
=3909 ;
INT[l lEX rILE FORIIAT STf1NDARD.
95AE 293A3838
=3901 [OFREC: 00
' :OO000091Fr'
All mnemonics copyrighted @ Intel Corporation 1976.
1-130
inter
LOC OOJ
05B2 39393939
95B6 30314646
9SBA 00
0049
AP·55A
LINE
SOlJ:CE STRTEI'lNT
; EIIl Of STR II«.i COO[ BVTl
=3902
DB
9
=39113
51ZECH<
=3ge6l S12E SET 73
=3997+;
=3988+; ""***********************""*~-'''******.**-************'I''*
=3917 ;
=3918;
II68Il
Il689 FB
9601 9398
11603 8941
9605 A1
9606 3402
8688 2329
9600 B4CO
960C 8617
96IIE 233f\
9WI II4BI>
11612 8941
9614 F1
9615 3400
9617 8935
11619 F1
1161A34DB
961C 13934
961E F1
1161F34DB
11621 B62B
11623 27
11624 3408
962(; C42C
9(;28 2330
~B4BD
962C [:865
1162[ 8(;32
9630 C436
11632 2329
0634 E4BD
9&36 Fe
9m 3400
1lG391S
963A 13941
963C F1 .
11630 97
=J919
=j94!1+
=3953 ;~IIIECO
=3954 ;
=3955 URECO'
=3956
=3957
=3970+
=3971l
=3975
=3976
=3977
=J978
=3979
=3989
=3981
=3990+
=3991+
=J995
=3996 rDUl'\P1:
=4005+
=4006+
=4019
=4011
=4929+
COOEBlK99
ORG
1536
HEXIDECIIR. REcoo) OOTPUT SEQlBa.
lEX BlfFER ALREAD\' LOOOCD.
A,RQ
MOV
A,I-fEXBlf
flOO
BlfCNT, A
MtIOV
Ri, IBUFCNT
I'IOV
~,R
MOV
TCRLFO
CALL
fl, I' ,
/lOY
CALL
!lAW
Jf9
FOOf'1
A,I' :'
MOV
CIU
CIlARO
ItIOY
A, IllFCNT
RL IBUFCNT
A, @l.:1
()'{fEO
CALL
R, I'EI'IHI
tmV
Ri, tl'lEl'IHl
I'IOIJ
A,@R1
!'IOV
CALL
B't'TE0
A, 1'E1'l0
ItIOY
MOV
R1, II'IEIt.ll
A,@R1
=4921+
!'lOY
=4825
C/lLl
BYTEO
=4926
Jf9
FOUI'IF'2
=4927
CLR
A
=4112!l
CRI.L
B'fTEO
JIll
ooTO
=4929
=4039 FDltIP2: /lOY
A, 1'='
=4031
CAll
CHARO
=4932 ;ooTO DAHl OUTPUT
=4933 ooTO: MOV
RfU/lEXBlF
=4034 ooT01: JF9
FDUIf'5
=4035
Jl'IP
f-0UI'IP3
A,l' ,
=403& F/.lUI'IP5: MOV
=49:17
CIU
CHARO
A,@RIj
=4038 FllUI'If'3: /'lOY
=4039
CI1I.L
BYTEO
=4040
INC
R9
=4041
1'IOJN2 BtfCNTI DAT01
=4046+
/lOY
RLIBlfCNT
A,@R1
=4047+
/lOY
I)£C
=4051+
A
All mnemonics copyrighled
©
MOV
MOV
Inlel Corporation
1976.
1-131
inter
LO:; OOJ
063£ Ai
8QF 962E
9641 B648
9643 fI)
8644 37
8645 17
964(;
3400
9648 83
9849
AP·55A
LINE
=4956+
11)\1
I!R1., A
=496&+
JNZ
DAT01
=4062 ;
=4IJ6J ; EN>REC EN) RECORD BEll«] TRANSMInEO
=4964 EIMC: JF9
FDUI1I'4
=4965
.=4IlB1+
Ift)Y
11)\1
A, (;III(SIJI
A, CfI(SIJI
=4885
CPL
A
=4006
II«:
A
=4987
Cfll
BVTEO
=41J88 FDI..I?I'4: I5
94E9 83
9918
AU mnemonics copyrighted © Intel Corporation 1976.
1-133
intJ
LOC OOJ
II5IlB
95B8 34EG
85BD 11944
II5IlF /l1
85CII fl94J
95C2 BiIlB
95C4 97
~F6CB
95C7 9geF
95C9 fl4CF
95CB 8948
~
95CE
Il5CF
851>1
851>l
Il5D4
011
011
94C9
94C9
97
A7
8944
951)7 F1
85DS G7
85D9 ft1
85J)S
AP·55~
LII£
=4358
=4383+
=4387 ; NIIJO
=4388 NIBO:
=4389;
=4398 ; 0fIR0
=4391 ;
=4392 ClfRO:
=4485+
, =4496+
=4419
=4421+
=4422.
=4426
=4427 C01:
=4428
=4429
=4439 CO2:
=4431
=4432
=4433 COl:
=4434
=4435
=4436
=4437
=4442+
=4443+
=4447'1
=4452+
=4455
=4456
95DR 8943
II50C f1
9500 97
050C R1
05DF 96C5
05E1 8l
11827
S(lf
cle
cle
CI1
el1
~'
CI1
1B>I.A't'
All mnemonics copyrighted © Intel Corporation 1976.
1-134
intel'
LOC
OIIJ
965B
IIG5D
965F
9668
96G2
9663
94C9
5662
97
C465
97
A7
0664 90
fIG65 98
0666 ee
9667 ee
9668 8944
Il6GA F1
0C6B 67
966C R1
11661)
8943
9W" F1
9679 97
9671 A1
1lG72 %59
9674 B944
11676 F1
9677 83
IlIJ2F
AP·55A
sotm STAIDIEHT
LIN:
=4538
=45"".$9
=4549
=4541
=4542 CIl:
=4543
=4544
=4545 C14:
=4546
=4547
=4548
=4553+
=4554+
=4~-I
=4563-1
=4566
=4571+
=4572+
=4576+
=4581+
=4585+
=4587
=45%+
=4597+
CfU
IflDI..RY
JT1
CLR
JII'
CIJ
; C1£CK SID LIN: LEII[l
C
Cl4
C
C
; DATfI BIT IN C'!'
CLI!
(;f'l
to'
10'
NOr
I«lP
m1C
I'IOV
IIOV
REGC
R1,IREGC
RRC
IIOV
tl)JNZ
IIOV
A
@I/1,A
El. CI2
R1,1B
A..@R1
A
@fU,A
CI2
A..REGC
R1,IREGC
A..@R1
; CIIRRACTER CO/fl.E1E
IIOV
DEC
IIOV
1HZ
ItIOY
IIOV
IIOV
=4691
RET
SIZECl-1<
=46112
=4695t SIZE SET 47
=4696+;
=46117i;
; EVEN OUT BmOf EXECUllOO TIlES
A,~
*******_ _ _ _ _ _ _ _ _**'.:**
=4616 $EJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-135
inter
LOC
ooJ
AP·55A
L11£
4617 $
=4618
82E~
B9J4
92E7 F1
I12ES RfI
82E9 F489
82EB B4E2
82ED E6FJ
82EF J4F2
82F1 44E9
82FJ 8J
=46JJt
=4637 ; COIFIL
=46JS ;
=4619 mtrIL:
=4655i
=4656+
=4669+
=4672 LrILL:
=4673
=4674
=4675
=4676
=4677 LFILL1:
=4678
=4681+ SIZE
ItnUllE( :~9:1EPI!Er.ID»
COOEBLK 15
ORO
CIltRI)
IN LOll
I1IKlY
I'IOY
I'IOY
I'IOY
CII.1
741
TO riLL fl)l)RESS SPfa: OCllEEN SIfl
BYTE (f /'IEPl
LDATA, 1ElL0
RL 1tElL0
A, I!R1
LDA·, A, A
LSTORE
III)
EIII .. mlllRTft
CfLL
CI'fIft)
JlI:
LrILL1
CfLL
INCSIfl
JIf'
U"ILL
RET
SIZECII{
SET . 15
=4682+;
=468J+;**_*1..._IIIIII ..._*_ .. I _ _ _***II .. IIIIII .. 44
09FC D478
eerE flA
09FF 8J
=4692 ;
=4693
=4698+
=4792 ; LmCH
=479J ;
=4794 LFETCH:
=4795
=4786
=4797
=4718+ SIZE
=4711-1;
COOEIlI..K 4
ORG
252
FETCI£S CIIlTENTS IF LOGICfl. 1£Im,' mDl. INTO
872F
8lS8
9732
8733
8938
Fl
5s7F
C62f'
E4C3
FA
11923
Ai
83
AP·55A
LItE
SMCE STRTEIENT
=4915
=4958f
=4954;
=4955 ; LSTIJ:E
=4956;
=4957 LSTIIIE:
=4966+
=4967+
=4971
=4972
=4973 ;
=4974 LSTIIJI.:
=4975
=4976
=4977
=4978
=4979
=4988;
=4981 LSTI'tI:
=4998+ .
=4991+
=4995
=4996
=5885+
=5986+
=5818
=5811
=5912
=5821+
=5822+
=5826
=5827
=5828
=5829
=5838
=5831 ;
=5832 LSTDII:
=5833
COOEBLKSS
am
1792
LOOICII. STIllE SlIJROOTItE
STIllES cam:NTS (J LDfIm INTO YRRIOOS 1EIDl\' SM:ES.
fl,TYPE
IftJY
..w R1,I'M'[
..w A, (IR1
fI)I)
A, ILOW LSTTBL
I!fl
JII>P
DB
LOW
LOW
LOW
LOll
LOW
LOW
DB
DB
DB
DB
00
/I'KlY
..w
..w
JNZ
/I'KlY
IllY
..w
fI)I)
Je
/ftlY
IllY
IIOY
fI)I)
IllV
IllV
IllY
LSTPI1
LSTDII
LSTREG
LSTINl
LSTBRI(
LSTiiRl<
fl,SlDtI
RL ISIftfI
'URl
LSTDII
A, SlR.O
RLISlR.O
A, (IR1
Itl-OYSIZI:
LSTDII
ItS/R.O
RLISIft..O
. fI, I!R1
It IOYIltf
RLA
ItLDflTA
f!R1, A
RET
ClLL
lIlY
=5834
11M(
=5835
;'5836 ;
=5837 LSTREG:
=5846+
=!IIM7+
=5851
=5852
=5853
=5854 ;
.=5955 LSTR8:
=5878" .
=5884+
=5885+
=5888
=51189 ;
=5898 LSTINl:
Rtf
PKIY
IllV
mY
IN..
12
JI1P
/I'KlY
mY
IllV
IllV
LPGSEL
A,LDflm
!!H1, A
It SlR.O
R1.ISIR.O
A, I!Rl
A, 181lli111f1
LSTh'8
EPSTIR
; CI£CK IF LOW IJ.'DER BITS = 8
EPR8,LOATA
ItLDflm
RLID'R8
f!R1, A
RET
IftIY
ItSIR.O
All mnemonics copyrighted @ Intel Corporation 1976.
1-138
AP·55A
LOC IEJ
07148930
0736 F1
0737 0320
97J9 A9
97JA rR
0738 Ai
073C 03
973D
073F
0740
0742
9744
9746
9749
974A
0749
9740
94£1
FA
1246
9ge1
E448
99FE
991'7
81
890B
03
004E
94E1
04E1
94E3
94E4
94E6
8937
r1
5301
47
94E7 8931
!l4E9 41
94EJl 4340
84EC 3A
94EI) 8930
94EF F1
WI! A9
94F1 93
9011
LINE
SIX.m: STATEIEHT
=5099-1
Ri,IS/ft.O
I10V
A,@R1
=5100+
1m
A,IEPOCC
=5104
ADD
Ri,A
=5195
IIOY
A,LOAm
If.J\I
=5196
@R1,A
=5197
PlOY
=5199
RET
=5199 ;
=5110 ; LSTIlRK LOGICRL STORE !W BmlK-POINT DATA
=5ill LSTBRK: CALL
Lf'GSEL
=5112
t10V
Ii, LOATA
=5113
JOO
LSTBR1
=5114
0Rl·
Pi, t999ll09918
=5115
JIf'
LSTBR2
=5116 LSTBR1: ANI.
Pi, INO r 1IIl0IIIlIl01B
=5117 L!::TBR2: AtI.
11., INOT 1l0Il011l01l0
=5119
I'KJ\IX
A, @R1
=5119
OR!.
Pi, tIl0Il0199IIB
=5129
RET
=5121
SIZECH<
=5124+ SIZE SET 7S
=5125+;
=5126+; ***----"*****_*_******_*_ _*****
=51~ ;
=5136
COOEBl.I( 17
=5156+
ORG
1249
=5160 ; LPGSEL LOGICAL PAGE SELIOCI.
=5161 ;
SETS lJ' PORT 2 TO AOORf.SS Af'I'RtrRIATE BYTE !W RfIPI BLOCK.
=5162 LPGSEL: I'II1OV
A, TVPE
=5171+
IIOV
RUnoPE
=5172·.
I10Y
fl, @R1
=5176
IN.
fl, t090Il0II81B
; tfASI( Off DlITR noPE SElECTIII BIT
=5177
SI«lP
A
=5178
IQ\.
A, SIflHI
=~104i
roy
R1, ISlftIi
=5195+
OR!.
A, f!R1
~1!)9
ORL
fl, 1019000098
=5199
=5191
OUTL
I'II'IOV
/lOY
/lOY
P2, A
n, SlfLO
Ri, 1Slft.0
A, @R1
RL A
=5200+
=5291+
=5205
=5296
=5207
=5219-1 SIZE
I'IOV
. RET
SIZECHK
SET 17
=52W;
=5212+;**-**_ _**********_ _ _*****=5221 ;
=5222 $EJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-139
AP·SSA
LOC OOJ
LII£
SOO1CE STRTEl£NT .
=5223
COOEBLK 11
=523".$~
1I1F2
91F2
01F4
01.F5
01F6
8938
11
F1
96Ft
81f8
01F9
01FR
01FB
91fC
19
F1
17
31
83
OF:G
=5237 ; IN;!;I1A
=5238 IN;!;I1A:
=5239 11«:11:
=5240
=5241
=5242
=5243
=5244
=5245
498
11«:REl£NT ST~TII~ 1'E/IlR't' fl>DRESS WORD.
I'KlY
Ri, ISM.O
It«:
I«lY
JN2
It«:
I'KlY
It«:
XCII)
@R1
R. @R1
11«:111
Ri
A. @R1
A
A. @R1
~46
11011: RET
=5247
SIZECII<
=5250+ SIZE SET 11
=5251+;
******.----..
02F4
02F4 8938
1l2f6 F1
02F7 07
02F8 21
Il2F9 96FF
02FD 19
02FC F1
07
02FE 31
02FF 83
Il2fl)
=5252+;
=5261 ;
=5262
=5277f
=5281 ; DECSIII
=5282 DECSIIA:
=5283
~*******"*-**-**-**
COOEBLK '12
(RG
i'56
DECREI£NT SIIfl lOW.
I'KlY
Ri,
IllY
A. I!R1
~
DEC' A
=52re
XCII
A.1!R1
=5286
JNZ
DECSIU
=5287
INC
Ri
=52S8
I'KlY
Pu I!R1
=5289
DEC
'A
=52ge
XCII>
II. IR1
=5291 DECSItt: RET
=5292
SIZECHK
=5295+ SIZE SET 12
=5296+;
mo
=52S7·~;~**
=5386 ;
=5387
=5l32~
_ _**._ _ _
COOEBLK 15
(RG
1~
=5336 i CIf'IfIS COI1PARE I£IllRY ADI1RESSES
=5337 i
CIII'fRE SIfl BVTES WIlli BIA BYTES TO DETmlII£ RD.ATIYE IRlNlTWE.
=5338 i
RETIIlNS WITH CfflRY=1 IFF (SIIfl) )= DC
It ElRiI
ItlY
flOOC
RL IEIIIlI
A, I!R1
RET
SlZECII<
SCT 15
=5481+;*.*'I:*.*********_ _ _ _ _* * - _
=54111 $EJECT
All mnemonics copy'ighled @ Inlel Co'po,alion 1976.
1-141
inter
lOC OOJ
Ap·55A
LIIE
SIUCE STRIDENT
5411 $
IlUl.OC( :F9:KOO.I'ro)
CODEBLK 199
=5412
974E
=5447+
OOG
=5451 ;
=5452 ;
974E
os
974F B93E
97~1 A1
975223f9
975462
8755 27
9756 3E
9757 3D
9758 FD
9759 97
07SA 3f
0758 OC
975C AA
0750
07Sl
0?Sf
0761
9762
9763
0764
9765
FD
97
0346
~ AM)
=5453 ;
=5454 TIINT:
=5455
=5468+
=5469+
DISPLA\' PROCESSINl ROOTII£
I'ERIOOIClLl \' loRN KIlO fH) DISPLAY fl.'E "fO BE fl.IYE.
5El
R81
ItKJV
AS/lYE, /1
~
R1,1ASf1Y[
IlO\l
@I/1,A
CfU[J)
~
=5473
=5474
=5475
=5476
=5477
=547lJ
=5479
~
QR
llOYD
llOYD
~
DEC
/'lOYD
=5489
=5481
=54!J2
=5483
=5484
A,'(-19H)
I, A
R
PSEGHI, A
PSEGlO, A
R,ruIDIG
I'IOY
IlO\l
R, ~D JG
DEC
AOO
1'10'1
R, t<"...EGIR'
f'IO\II)
; REUB> TIllER INTEIt-1<*******~'***********************************************
=5549 ;
076F B93C
9771 F1
=5541
=5550+
A, mtOC
=55~1+
A,~1
Rl, tKE'r'lOC
All mnemonics copyrighted © Intel Corporation 1976.
1-142
AP·55A
LOC OEJ
LIIE
em 2C
em DC
=5556
e774 C67C
5O.E[ STATEI1ENT
=5557
=555e ;
=5559 ;
=5568 ;
=~561 ;
=5562 ;
=5563 ;
0776 B9JD
=5564
9778 8106
I177A 1:488
=5SGS
=5566
=5567 ;
=5560
=5569
=5578
. =5571
=5572
8nc B93D
8nE F1
ilIfF C6BB
9781 07
0782 !J93D
8784 Al
07ElS 968B
XCH
XRL
J2
=5555
. A. LHSTK'r'
A. LASTK'r'
SCAN3
***********-***************-*-**-**
A DIFFERENT KEY If1S R£AI) ON THIS C\'CLI:. THAN III THE PREVIOUS C\'CLE..
;
;
;
;
;
SET NREPTS TO THE OCIlOONC[ PARAME1Ell FOR A NEW COUNTDOWN.
*****___ t***********_*_*****ot-******,t,***~:*****
mil
I10V
JI1P
Rl.INREPTS
@R1.1G
SCAN5
*****__**,t:*_-************_*******************_**
SAI1E KE\' WAS DETECTED 3S III PREYIOOS CYCLE
L()()I( AT Nro'TS: IF ALREAD\' ZERO, DO NOTHING.
•ELSE DECREI'IENT NRCPT!;.
IF THIS R£SIUS IN ZERO, /'lOVE LASTKY INTO KOOCUF.
=5573 ; ***:t:***_**~·*********-~******************************_***
=5574 ;
A.NR[PTS
=5575 SCflNJ: I'IMOV
R1,INREPTS
=5584+
MOY
A,~1
=5585+
I10Y
; IF flLREflD\' ZERO
=5589
12
WlN5
; INDICATE ONE I'IORE SOCCESIVE KE.Y DETECTION
=5590
A
DEC
I'ItlOV
NREl'T5. A
=5591
RLINREPTS
=5684+
MOY
=5685~
I10V
~1.A
=5689
=56HJ
=5633+
JHZ
SCANS
I'II'IOV
!'lOY
KBD8UF. LASTK\'
07se
=5639·~
I10Y
97SA 111
=5649+
=5643 ;
=5644 SCIlN5:
=5645
=5646
=5647
=5643
=5649 ;
MOY
0787 Fe
B93B
0788 B93C
0780 11
07aE EC63
0790 EDIlS
iJ,'92 t;OOS
MOV
INC
DlNZ
DJNZ
I10Y
; IF DECREMENT DOES NOl RESlU IN ZERO
; TO MflRK NEW KEY CUYJ.JRE
/), LflSTKY
R1,IKBOOUF
@FILA
Ri.IKEYLOC
@R1
ROTCNT, NXTLOC
CURDIG, TIRET1
CURDIG. lICHf1RNO
=5650 ; ******~:*****~::{:*****_***********,t,*********_*_*~:*****
=5651 ;
THE FOLLOWING CODE SEG/'IENT IS IJSEl) L.... UIE KEYBOflRD SCAItlING ROUTINE;.
=5652 ;
IT IS EXECUTED ONL \' AFTlR r. REfRESH SEQUENCE IS COI'IPLETEO
=5G53 ;
=5654 ;
=5655
****************************......*****'t:********'t"t.*_**-..
9794 B9:>C
0/96 Bllil0
=5666~
lIns rl:
=5671
=5672
=5673
=56j'8+
=5632 ~ANS:
=5683 ;
0799 969D
079B BCFf079D BE90
=5667·~
I'II'IOV
!'lOY
I10Y
I10Y
JHZ
MMOY
MOil
I10Y
KEYLOC, ZERO
R1, lIKEYLOC
@RL.ZERO
11, KEYFLG
; JUI1P IF AN\' KEYS WERE DHECl ED
SCANS
; CHANGE (LASTK\') WHEN NO KE\'5 lIRE DOWN
LAST((Y. NEG1
LAS1 K',', llNEG1
KE\fLG.1I0
All mnemonics copyrighted @ tntet Corporation 1976.
1·143
inter
LOC
()(jJ
AP·55A
SOIJ!CE STAT£]'I[NT
lifE
=5G85
!
=5636 ;
KOOIDISP RETURN COO[- RESTIMS SYSTE" ~TATUS.
A, RtlELA't'
I'II'IOIJ
=5696+
Rj., IRDELflV
!'lOY
R,@R1
=569;'+
I'IOV
=5791
JZ
lIRETi
=5782
DEC
A
k'OCLAI', A
=5793
I'IMO\I
=5716-1
I'KlY
R1, IRDELA\'
@RLR
=5i'17+
tIOY
=5121 TIRETi: I'II1OY
A,AS/We
=57J3-I
!'lOY
RLWJlYE
A, INd.
=5731'1
I'IOY
=5735
RETR
=5736 ;
=5737 ;
=5738 ; TOFPOl. TIIa OVERFLOW POLLING sueROOTINE.
=5739 ;
CfUED REl'EATEl'il..Y FROI'I IKID'ER I(BllIDISr /'lUST BE. fiLlYC.
=5740 ;
I'OIITOR!; mE TIIG OYERF1.1101 FLAG 3 5:;or
06D5 83EF
0607 A3
0600 AE
=5907
=5937+
=5941 ; OSF'ACC
=5942 DSPACC:
=5943
=5944
=5945 ; WDISP
=5946 ;
=5947 ;
=5940 WDISP:
__
COOECLK 44
ORG
1747
DISPLAY VALUE or LOW NIBBLE Of IICC
ANt.
fl. IffH
ADD
A, #OOPATS
MOVP
A. @A
WRITES BIT f-'AlTERN IJOW IN ilCC INTO NEXT UiARfICTER rOSITlON
OF THE DISPLAY (NEXTPl). INCREMEN1S NEX1PL
RESULTS IN DI$PLA~' BEING FILLED LEFT TO RIGH"f. lHEN RESTARTING
MOV
DSPTMP. A
All mnemonics copyrighted @ Intel Corporation 1976.
1-145
inter
LOC
OOJ
0609 BF04
9600 7401
AP·55A
LINE
=~949
=59~
=5951
96DD
0CDF
061:9
06£2
960
96E4
893R
F1
9345
R9
FE
A1
96E5
96E7
96ES
96E9
96EA
093A
Fl
97
A1
96EE
9(;[C !l10S
06EE 83
IlIlEF
96EF
0Cf9
96F1
116F2
116F3
06F4
96F5
96F6
06F7
06f8
96F9
86rA
86rE
96FC
96FD
06FE
3F
96
5E
4F
66
61)
7D
97
7F
6"?
77
7C
39
5E
79
71
882C
=5960+
=5961+
=5965
=5966
=5967
=5968
=5969
=5974+
=5~75+
=5979+
=5984-1
=598S~
SOlJ.'CE $TRTIJENT
I10Y
CflLL
MMOY
/'f0','
110','
000
tm
!'lOY
!'lOY
Ml)JN£
I'IOY
I10Y
DEC
110','
JNZ
=59'"j9
MOOf
=5991 WDISP1: RET
=5992 .;
=5993 ; OOPAT$ IS TI:E
=5994 ; I-IERE. THE FULL
=5995 ;
=5996 DGPAT$ EQU
=5997 ;
=5998 ; FORI'IAT 1$
=5m;
DB
=600Il
=6091
DB
=6092
DB
=6003
DB
xrcOOE,14
XPTEST
Il,NEXTPL
R1, INEXTPL
iI; ~1\'1
Il, #$EGMflP·1
R1,fl
A, D5PTMf'
@ld,A
NEXTI'L, WI) ISPi
R1.iNEXTPL
A,@R1
R
@R1,A
WDISP1
@Rl, .CHARNO
BASE FOR THE TAIlI.( OF $EGMENT PATTERNS FOR HEX DIGITS.
I-lEX SET (0··n IS INCllVED.
f AND 0fFH
PGFEDCBA
1l8111111B
eee09110C
01111191113
91091111&
DB
01109111113
=6004
01}
01101101&
=6995
Of)
=6006
91111191El
Of)
=6807
00009111B
91111111B .
=6900
I.lfl
01100111B
=6999
DB
=6010
00
911191110
Of)
=6011
91111100E:
=6012
011
001110018
Of)
=6013
019111100
=6914
DB
011110018
.811100018
=6915
00
$IZECHI(
=6016
=6919+ SIZE. SET 44
=6920+;
IN STANOORO SEY[N-Sl(i1'lENT ENCODINU C(JI\IENl ION
WHERE r REPRESEN1S TIlE DCCIIR POINT
; SEGMENT PATTERN FOR DIGIT '9'
; SEGl'ENT r'ATTERN FOR DIGIT '1'
j ~EG1'IENT PAT! ERN FOR DIG IT '2'
; SEGMENT PATTERN HlR 0IG n '3'
; SEMNT PATTERN FII: 0IG IT ' 4'
; SEGMENT PATTERN FOR DIGIT '5'
; SEGI1ENT PRTlERN FOR DIGIT '6'
; SEGl'lENT PflTTERN FOR DIGIT '7'
; SEGl'ENT f'fITTERN FOR DIGn 's'
; !;EGIlENT PATTERN FOR DIGIT '9'
; SEGI1ENT PATTERN FOR DIGIT 'n'
; SEGI'fENT PATTERN FOR DIGIT 'B'
; SEMNT PATTERN FOR DIGIT 'c'
; $EGI1[NT PftTTE.RNTOR Dlull 'D'
; SEGMENT PATTERN FOk OIGIT 'E'
; SEGrlENT PATTERN rll: DIGIT 'F'
******************************-********************
94F2
94F2 893F
94F4 Ai
=6921t;
=6039 ;
CODEEllK 12
=6031
1266
=6051+
ORG
=6055 ; DELAY SUBROUTINE IofIITS FOR TIlE NltIBER OF COItPLETE
=6056 ;
DISPLAY SCANS CORRESPONDING TO THE ACC CllfTENTS.
USE!) WITH CRUDE Ill..l'Im INTI:RrRCES- AS WHEN OPERATOR SlW..D SEE
=6057 ;
=6958 ;
SOI'IE DISPLAY CHANGE IoIIIU: IT IS CHANGING:
ROELAY, It
=6959 DELI1Y: /'fI1OV
=6072~
1'10\1
R1, 'RI>ElR'o'
@R1,A
=6073+
I'lO\l
All mnemonics copyrighted © Intel Corporation 1976.
. 1-146
AP·55A
LOC OBJ
84F5 F4AC
9417 D93F
114F9 F1
I14FA 96F~
I14FC 83
LIM:
SlUCE STATEPENT
=6877 ocLAI'1: CALL
lOITOL
=697B
A, ROCLAI'
=6987+
=6888 f
=699'.1
m:lV
MOV
RLtRDELR\'
I'tOV
fi,~1
JNZ
DELAY1
=6993
RET
=6B94
5IZECHK
=6097+ SIZE SET 11
=6998+;
=6899+;
=6198 ;
=6199
**...*******~,*"......**_**********...**..***...._***..
COO[8LK 8
87fIF
=6144+
87fIF 8F95
=6148 ; KeDl'OL POlL STATUS (f KE.I'SOARD INPUT ROOllNE.
=6149 ;
RETURN loin II ACC BIT 7 =, 0 IF KEI'SOfIRD IWUT HIlS BEEN RECEIYED.
=6159 KBDI'OL. I'tOV
XPCQDE, 115
9781 7401
07B3 B93B
9785 F1
97EJ6 113
=6151
=6152
=616H
=6162+
=6166
=6167
(IlG
CflL
I'IIIOY
I10Y
MOY
1967
XPTEST
n, K8DBI.Jf
I~L .KElDBlf
A, ~1
RET
SlZECHK
=(;179+ SIZE 5[1 B
=6171+;
=6172+; ***",*.*~,**",*******,,*************-**********--****~,
=6181 SEJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-147
inter.
LOC OOJ
AP·55A
LINE
SCdJRC[ STATEI£NT
6182 $
=6183
=6218.
97E7
97E7
9789
971lR
97BC
971£
97C9
97C2
IInUDE( :F9:LINK.I1OO)
COOECLK 15
ORG
1975
B9J9
F1
F4DO
2389
F4D0
F4D9
83
900C
97C3
=6222 ) Ef'fET
=6223 EPFET:
=6212+
=6233+
=6237
=6238
=6239
=6249
=6241
=6242
=6245{ SIZE
=624&+)
FETCH DflTIl B\'TE FROM Er INTERIft. RAP! ADDRESSED B\' 5IR.O.
I1I1OV
A, Sl'lALO
MOY
R1.. tSI'R.O
MOY
1l.@R1
CALL
EPrASS
MOY
CALL
CALL
A••19999080B
£l'PA5S
EPPASS
RET
SIZECH<
!.El 12
=6247+; ~. *****>t.***_",,**_**********_"'******'I"*****~"************
=6256 ;
=6257
COOEBLK 15
=6292~
ORO
1987
=6296 ) EPSTOR STORE DATA IN Loom IN EP INTERIR. RAt! AT (SIflO)
97C3 rA
97C4 F4D0
97C6 8939
9i'C8 F1
97C9 5371"
=6297' EPSTOR:
=6298
=6299
=6300+
=6399+
=6313
07CB F4D0
=6~14
1l7Cl> F4D9
07CF 83
=6315
=6316
MOY
Cill
I'II'IOV
A. LOOTA
El'PASS
A. SIfl..O
RL .SMALO
!«)II
A. @R1
/'lOY
AN.
CALL
CALL
A, 1011111111)
EI'Pf1S5
EPPAS5
RET
SIZECUK
=6329+ SIZE Sll 13
=6~17
=6121+)
*-*****"'****"''''************'''************-************
=6122+)
=6331 $EJECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-148
intJ
LOC OIlJ
9700
AP·55A
LINE
!>OI.RCE !il flTEMENT
=63J2 ;
=6333 ;
THE rOlLOIolING UTILITIES IN'r'Ol't'E INTERCIfINGES IlETloEEN TI£ 1'If'
=6334
COOEIlLK 11
=6369-1
All)
[Po
ORG;:'000
=6373 ; EPPASS PASSES II SINGLE f'fII'7F400
9709 81
9700 BJ
=6377 ;
RET~N.
=6370 EPPASS: OI\t
P2••99110099B
=637S
1'10'(;(
liR1.fI
=6300
=6381
OR\.
AIL
=6382
=63!B
CAlL
IIOYX
=6J84
RET
; lNABlE llNK WRITES.
; WRITE ACe '10 LIN(.
; OI5ABll BREAKPOINTS.
; SET TO EREIlK ON LINK RlFERUU.
Pl. INOT ENIlRPoPI
P1.ICNIlLNK
~f'51 EP
fl. @Rl
=638:>
SIZECflK
=6333+ SIze SE.T 11
=6389-1;
=6399+; **********.*************~.~,****'1"**-"'I-.******
=6399 ;
=6499
9700
9700 F4f4
9700 Il99A
97Df 861"1
97E1 E9I)~
9788919
97E5 744f
97E7 B8BB
97E9 746R
97ED 99EF
97m Ilfl9E
97EF 249R
9i'Fl 744f
•••" ••*.*
COOCBlK 2J
=6435+
ORG
2011
=6439 ; EPS1Er RELEASES EP TO RUN IN PRESENT "00[ lRlTIL AN f1NTICIPAlm
=6449 ;
IfflROWARE BREAK OCCURS.
=6441 ;
(DUE TO SINGLl STEPPING, UNK Il'Coo[ FETCH. ~ LINk DPoTA mCH. )
=6442 ;
I'IUST OC~ WIlHIN fI FINITE NUlt3ER Of ClUES «49 I1f' CYClES)
=6443 ;
OR IoIATCHDOG TIMER WILL RSSUME A COMtlUHICATIONS [R~OR
=6444 ;
BETWEEN TI[ If' I1lD EP.
=6445 EPSTEP: CALL
EPREl
=6446
I'IOV
R1, 119
=6447 EPSTE1: JNI
EPSTE2
=6448
DJNZ
Ri, EPSTEt
=6449
ORL
Pl. iEPRSET
=6450
CtlLL
EPERK
=6451
MOIJ
[,\1, ilOlolWY1BA5+0IlS1ZE)
=6452
Cflll
O't'LOAD
=6453
ANI..
Pi, INOT EPRSET
=6454
1'1011
LDATA, .9E1l
=6455
JIf'
PERROR
E~'IlRK
=6456 trSTE2: CALL
97f3 83
=6457
=6458
9919
=6461+ SIZE SI:."T
=6462+;
=6463+;
RET
SIZECHK .
25
**"'******************_*'1"'****__**_*********_
=6472 ;
=6473 ;
=6474 *EJECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-149
intJ
LOC OOJ
AP·55A
LINE
SOlE[
=6475
COOEBLK 9
=6510~'
1l7F4
07r4
07F6
07F8
07FA
07FC
STflTEI£NT
ORG
2036
=6514 ; fJ'REL RELEASES Er TO
IN PRESENT 1I00I:.
=6515 ;
Sl:QUENCE IS AS FOLLOWS:
=6:116 ;
PUT 1'IEI'llR\' flRRA',' IN EP I'IOOE;
99f7
890S
9fI3F"
8904
83
m.
=6517 ;
RAISE ISSTEP;
=6518 ;
RETURN.
=6519 EPREL: fK.
Pi. lOOT CLREFF
=6529
P1,ICLRBFF
OR\..
=6521
IK.
P2. lOOT 010II08II0B
=6522
ORL
PL 10000010011
=6523
RET
=6524
SIZECH<
=6527+ SIZE SET 9
; CLEAR BREAK FIF.
; RE-OHlLE BREAK f IF.
; ElflBLE Er COOTRll. IF IEII fRRtW
; fREE EP TO RUN tllTIL 1J.'EflK.
=652St;
=65:ro ;
=6519 ;
034f
034F 99FB
03:51 8929
8353 B995
0355 E955
0357 9A48
0359 83
11
=6540
=6588+
COOEBI.J(
=G5B4 ; EPBRK
=6565 ;
=6586 ;
~7 ;
REGAIN COOTROL Cf I'EJ'IOR',' ARRftY FRa'I EP.
DROP ISS1EP;
IIIIT 30 USECS.;
PUT IDORY ARRfI\' IN If' i'IOOE;
=6508 ;
RETLm
ORG
=6589 EPBRK: fK.
=65S0
0I\'l
=6591
t«lY
=6592
=6593
=6594
=6595
=6598+ SIZE
=6599";
()JNZ
047
PL lOOT 000001000
Pi. II'IOOOUT
Ri. 15
R1, $
P2,I010001l001l
ORL
REl
SIZECHK
SET 11
; FRlEZE ElU.ATION PROCES!;(R.
; SIGIR. EI' IS ooT RIHIING USER COOE.
; 1>EUl\' FOR Ef' TO FINISH INSTROCTION.
; SEIZE CONTROL or I'IEJ'I ARRfl','.
=6609 ;
9351: 0917
=6610 ;
=6611
=6651+
=6655 ; OYSWAP
=665C ;
=6657 0\I5IflP:
=665S
835E 2340
=6659
0:s60 3A
0361 ca
=6G60
=6661 OYSWi:
=6662
DEC
I)(C
R1
=,6663
I1OY'O<
Ii, @R1
ItJV;<
fl, @R0
@R1. A
0351\
8J5A B865
8362 C9
0363 81
0364 20
0365 91
0366 F9
83679661
8369 83
=66(;4
=6665
=6666
=6667
=6668
=6669
COOEBLK 16
ORG
S5fJ
OVERLAY !;Wff.
SWAPS BLOCK OF DAlf1B','TES (USER'S
/'lOY
RIl,IOYIlI..f+OIlSIZE
I10V
Ri. IOYSIZE
/'lOY
R. l01i10OO0eB
OUTL
Fr.?, A
xi:H
R0
I'IOV
A, Rl
JHZ
RET
OYSII1
SIZ[CHI{
=6672+ SIZE SET 16
All mnemonics copyrighted @ Intel Corporation 1976.
1-150
~)
BETIEEN '" RAI'I & EP PIt
AP·55A
LOC OOJ
LINE
S(uCE
~TRT[Il.NT
=6673+;
8361l
8J6A
936C
9J6E
936r
8370
8371
93"12
9373
8374
8375
8377
=6674+; ***-.*****-****~:*********~:*************-*********.*.
=6603 ;
=li684
COOEBLK 14
=6724+
(J.'G
874 .
=6728 ;
OYERLA'I' LOAD.
=6729 ;
I'KM$ IlLOCK Of OOTAEYTES (flSSlllliD ~(''E) fRc.I PG3 10 EP PII.
=6739 ;
TOP Of DIlTA BLOCK LOAI)(]) AI«) BLOCK lEMlTIl DETERtlIIf:D B\' 1!9 IliI Ri.
=67J1 OYLOOD: IIOY
R1.IOYSIZE
=67J2
tIOV
A, 1019080000
=e7J3
OUTl
f'2, A
=6734 IIL01: DEC
R8
=6735 '
DEC
R1
=6736
MOY
fl, R9
=G737
MOYP3 fI, @A
=6738
I'XJYX
~1, A
=6739
MOY
fk R1
=6740
JNZ
191..01
=6741
RET
=6742
SIZECI-IK
=6745+ SIZE SET 14
=6746+;
ovum
1l91i'
2340
3f!
C9
C9
Fa
EJ
91
F9
9G6f
83
_****_********__*************11:****_************
=6747+;
=6756 $EJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-151
inter
lOC OOJ
AP·55A
Uti:
SOO!CE STRTDENT
=OlS7 ;
,=6758 ;
=6759 ;
=6768 ;
=6761 ;
=6762;
=6763 ;
=6764 ;
=6765 ;
=6766
=6771+
8178
=6775 ;
=6776 ;0Y8~mi
=6778 ;
=6779 ;
=6789;
8378
8378
8378 1489
rnA 88
8378
8378 1489
837D 88
837E 88
837F
837F
8381
8382
8383
1489
88
88
88
8384 88
8385
8386
8387
8388
8389
118
88
88
88
88
83SR 88
8388 88
838C
838C
8816
84w.)
11£ REST (f lHIS PIOOllE COO'A1NS THE "INI-fOUTIJ1S IfIICH OYm.R'1'
11£ EIllRTIIII f'ROCESSG< PI\'OG:RIf RfII 10 GIVE 11£
/lASTER PROCESSCJ: ACCESS 10 INlERIR. REGISTERS IN> RAIl IX- 11£ Ef'.
DflTfW(
22
~
80S
OYERI.RY 10
IIREfI( EP EXECU"l11II fIN) JlJIP TO lOCRTIIII 8II9H.
lOCRTIIII II8SII REfICIEI) WITH T(J'-(f"-STfO. = RETWI OODRESS+2
DIE TO FIJ1CEI) "CAll" DURING IfIICH PC IllS INCREII.NTED.
lOC!; 88JH & 887H CfLll!99H TO SIIUlITE ~ ctN>1TI0N
IF BREAK ~ DURING INll"Rru'T C\'Cl.E.
SOl(!CE CODE FIJ:1 mNI--IDInm 0YERlA\'ED OYER lOll ImDER PROOkRII RAIl. .
=67!l1;
=6782 ;
$
=6783 0\IIl8RS EQU
=67fJ4 ~
OYIIBRS
=6785
CAll
089H
=6786
=6787
=6788
=6789
10>
i
~
=6798
0Y9IIRS+883H
CIU
8891-1
10>
=6791
=6792;
=6793 ~
I«JI'
~f94
CIlll
10>
=6795
=6796
=6797
=6798
=6(99
=6S08
=6881
0V9BflS+887H
N(J'
I«JI'
to'
NO!'
NOP
=6882
10>
NO/'
=6883
NO!'
=6884
=6885
=6Il86 ;
10>
=6S87 ORG·
=6888
=6889 i
=6818
=6813+ SIZE
8891-1
NOP
OY8IIRS+814H
8891-1.
JI1I'
SIi::ECII<
SET 22
=6814+;
=6815+;-**=61124 $EJECT
All mnemonics copyrighted @ Intel Corporation t976.
1-152
inter
LOC OOJ
838E
838E
83CE
938E 9499
8399 09
AP·55A
LINE
=6825
=68J9+
=6834 ;
=6835 ;fRJ=6IlJ6 ;
=68J7 ;
=6839 ;
=68J9 ;
=6Il49OVJBAS
=6841 ORG
=6842
=684J
SWkC[
STATEI'ENT
DflTIIlLK 22
919
ORG
OYERLR't' TO SAVE STATUS DflTA IFTER 1lREfJ<,
fICC. TIPlER/COUNTER. PSW (WITH F1). & RflII LOC 9 PASSED SEQl(If1 IfillY
10 1'1'.
Slm:E COOE FOR "INI -IIlNITOR OVERLA\,ED OYER LOll ORDER I'ROGRffI RIll.
EQU
$
O'r'3IlAS
JI'IP
MH
NOr
=6844 ;
8391
8391
9392
9393
8394
83
09
09
09
9395
9395 83
85% 09
8'397
839799
8398 42
8399 99
8l9f1 C7
8398 7611
8390 53F7
8311
939F 99
83A9 C5
83A1 Fe
83R2 9499
9916
=6845 ORO,
=6846
=6847
=6Il48
=6849
=6S59 ;
=6851 OOG
=6852
=6B53
=CS54 ;
=6S55 ORG
=6856
=6857
=6858
=6859
=CS69
=C861
=6862 0Y3Il1
=6863
=6864
OV3IlAS+99JH
RET
NO!'
NOI'
Na'
fR3BAStll97H
RET
NOf'
0Y3IIA5+1l99H
tIOVX
~.A
I'IOY
I'KlYX
I'IOY
@R8.A
A. T
A./'SW
JF1
fR3B1
11. 1111191118
(LOW 0Y3IlfIS)
IN..
*-
roo
I'IOYX
~.fl
=C865
I'IOY
RB0
A.Re
=C866
=6867 ;
=6868
JI'I'
Il99H
sa
SIZECHK
=687H SIZE SET
22
=6872+;
=6873+;_*('********_**('**"'****_*_ _ _*_
=6882 *EJECT
All mnemonics copyrighted © Intel Corporation 1976.
1-153
inter
Ap·55A
~
LOC teJ
STAmEHT
DIlTIIlLK 22
OOG
932
83/14
03A4
83114 848A
8~t6 88
=6892
=689l
=6894
=6S95
=6896
=6897
=6898
=6899
;
; 0Y1"
;
;
OVERLAY 1 10 GIVE II' OCCESS TO Ef' RAIl LOCS. 01H-7FH.
!irud:E COOE FOR I'IINl-IDIITOR OYERLAYED OYER LI»I IR:lU: PROGRfII Rift
OV1B11S EQU
$
;
0V181
=6988;
83A7
83A7
8lAB
83119
8JA1
::(,981
C3
88
88
88
DIm
OV1DllS+883H
=6982
=6983
=6984
RET
=6905
=6986;
I«JP
I«JP
I«IP
83f1l
=6987 OOG
OV1BAS+887H
8:s/13 83
=6988
83RC 88
::(;989
I\'EJ
I«JP
=6918 ;
=6911 DIm
0V1IIfIS+889H
::(;9~
I'IOVX
@Re, A
EQU
$·OY1BAS
I'IOVX
!'lOY
=6913;
888f1
83AE
ee
83AF AS
8388 ee
8381 rID
8383 2e
8384 All
8385 8489
8313
=6914 OV1B1
=6915 ;
=6916
IIOYX
fl,i'R8
RIl,A
fl,tlRIl
JB7
XCII
!'lOY
fl,R0
@RIl,A
JII'
80SH
EQU
H~
=6926
!'lOY
1I/@R8
=6927
=6928;
JPI>
889H
=6917
=6918
=6919
=6928
=6921
=6922
=6923;
=6924 0V1E12
OV1B2
OV1BAS
=6925;
, 838"/ Fe
8388 IH89
=6929
8816
=6932~
SlZECII(
SIZE 5£T 22
=6933+;
=6934+; *~**~
=6943 $EJECT
.*••--***•••*****-****-**--
All mnemonics copyrighted @ Intel Corporation 1976.
1-154
AP·55A
lllC OOJ
11381)
8300 83
83BE 88
83BF 1!8
IBee 88
1l3C1
83C1 83
1l3C2 88
LINE
S~
STATEMENT
=6944
=6949+
=6953;
=6954 ; 0112·=6955 ;
=6956;
=6957 0V2BAS
=6958 ORG
=6959
.
DATABlK 23
ORG
954
=6969
=6961 ;
=6962 ORG
I«lP
=6963
=6964
=6965
=6966
O\lERUlY TO RESTfJ1[ EP STATUS SAYED ON BREAK fft) ~SlI£ USER'S PROORIlII.
SOURCI: CODE F~ I'IINHIONITOR OYERlA'l'ED OVER lOW OODI:R PROGr9
8300 83
931>9 F5
9300 9400
LINE
SOJ:CE STATlI£NT
7995 ;
79116
COOEBLK 11
7946+
ORG
977
7959 Xl'TEST: (R
P2, 100II
7951
IN
A,P2
7952
fH.
f'2, I(NOT
7953
7954
7955
7956
JB7
RLT
SEL
JII'
O~)
$+3
I1B1
S89H
7957
SIZECHK
7969+ SIZE SET 11
7961+;
79621·; _*************************** _ _**_*_*_
93DC
28432931
9lE9 39373929
93[4 494[5445
93£8 4C
931)(;
9199
I&"D
9199
119E9
99fl)
99Ft
9IlFF
9IIFD
7971 ;
7972
7112+
7116
COOEIILK 13
~
00
98{)
'(C)1979 INlli'
7117
SIZEQI(
7129+ mE ~ 13
7121+;
7122+; -*******",*****'I"*******-*-~-*******-******
7131;
?i32;
7133
R'"~
7ilS-.
; CVTES USED 00 POOE II
PGSIZE SET ORGPG9-999I1
; 8YlE!; USE!) 00 PflGf: 1
71364
PGSI2E SET 0RGI'G1-100H
7137+
; BWES lJ'..ED 00 PfIGE 2
PGSIZE SET ORGPG2-299I1
7138+
; BYTB USED 00 PAGE 3
PGSIZE SET ORG'G3- 390H
; BYTES lJ'..E) 00 PAGE 4
7139+
PGSlZE SET 1I!Gf'G4-49IlI1
; BYl E5 USED ON PAGE S
7149+
PGSlZE SET OOG'GS-599H
; BYTES USE!) 00 PffiE 6
7141+
PGSlZE SET ORGPG6-69011
; BYTES Us£:() ON PAGE 7
7142+
PGSIZI:: SET ORGPG7·-79j,Jf
7143+$[JECT
All mnemonics copyrighted @ Intel Corporation 1976.
1-156
infef
LOC OOJ
Ap·55A
~ ~IATEl£NT
LIIE
7145 i-'.**-**-******----7146 i
FILL fl.L lHJSEI) I£IG:\' LOCArHJI5 lin H I«J' IWCOO£S
7147 i
7148 ;
;******---*--*-**--
81FD
81FD 99
81FE 99
81FF 99
83E9
83£9
83EA
83EB
8lEC
93ED
99
99
99
99
99
Ir~ 99
83EF 99
83f"9 89
83F1 89
93F299
93F3 89
93F4 89
83F5 89
93F6 89
93f"7 99
931'8 89
1l3F9 99
93f"A 99
93FB 99
83FC 99
93FD 99
93FE 99
93FF 99
94FD
94FD 89
84FE 99
94FF 99
95FF
7149
7158 ;
7151 $GEN
Will;
7168
7161
i'162
7163
7164+
7165+
7166+
7168 ;
7175 ;
7177
i>178
7179
7188
7181+
7182"
7183+
7184+
7185"
7186·.
7187·'
7183·:
7189+
7190i
7191+
7192+
7193+
7194+
7195+
7196+
7197+
7198+
7199+
7289+
7291~
7292i'
7293+
7295 i
7297
7298
7299
7219
7211+
7212+
7213+
7215 ;
7217
721B
~
IRGPG1
REPT (2Il00 - 0RGI'G1)
DB
8
EN>!!
DB
8
DB
If
DB
8
ORO 0RGf'G3
REPT (499H - 1m'(3)
DB
8
EN>II
00
0
DB
8
DB
0
00
8
DB
9
DB
8
00
8
DB
9'
DB
DB
8
8
DB
DB
8
00
8
DB
DB
9
DB
8
00
9
DB
9
DB
DB
8
9
00
00
9
9
00
"
"
"
ORG (l1Gf'G4
REPT (599H - ORGPG4)
9
00
ENDII
8
DB
9
DB
9
DB
ORG ~
REPT (6911-1 - ORGPGS)
All mnemonics copyrighted @ Intel Corporalion 1976.
1-157
intJ
Ap·55A
LOC OOJ
LINE
!i()lgE
EtI)II
05FF 00
.7219
7220
7221+
00
DB
STRTEl'ENT
8
8
7223 ;
06FF
861'"F 00
87FD
87FD 00
87FE 00
87FF 00
722S
722G
7227
7228
7229t
7231 ;
7233
7234
7235
7236
7237+
ORG IRGPGG
REPT (70IIl - ~)
D8
8
EtI)II
00
8
ORG 1:m'G7
REPT (SIl0H - 0RGfG7)
D8
II
EtI)II
00
7238+
DB
7239+
7241 ;
7242 $EJECT
00
8
8
8
All mnemonics copyrighted @ Intel Corporation 1976.
1-158
intel'
LFILL
LfILL1
LPGSEL
LSTBR1
LSTBR2
LSTBRK
LSTDn
LSlINT
LSTORE
LSTPII
LSTR8
LSTREG
LSTTBL
110
46721
4674
4832
5113
!l115
4978
4975
4977
2459
4974
~
4976
4971
551.
If1
5521
IR)[)
4301
/R.IOC 4351
I1AIN 1434
1fl1N2 15441
'fllm 1594
MIll! 16724
111111)0 1798
IIIINli 18311
111111:1 17161
I'IfIIIt> 1741
IflIIll1 1742
PIfH.
449.
IIlI.OCK 165.
471.
II>EC
It)JNZ 4751
1011 11581
I£It.O 11491
t1ERro1 1592
4611
"III:
1IL01 67341
IftlV
39St
2464
3802
3519
4639
5191
6859
IIOOO.JT S".$7I
445.
11m.
II'USEL 553.
ItRL
482.
4941
I'tRLC
I'RR
4861
ItRRC
11XCI'
I'IXRI..
II:OLS
IEG1
NEXTPl
NIBB
NIllIN
NIBIN2
AP·55A
4676
4677.
4890 5032 5111 5162.
51161
5117.
4979 5111.
4995 5911 5032.
50981
2615 3!l27
4981.
59551
5037.
49741
46n
4957.
1816 2386
5:>l14
15391 1546
3129
1609.
1674
18301
1847
1762
10011
17661
2438
5358
2349
2414
2417
1387
J529
4041
3824
3851
1reat
1743
6748
1558
2482
3063
:s557
4759
J343
C978
3841
1315
1m
4320
4005
4456
4566
5%9
4020
4655
2011
2875
1574
2541
3091
3578
4783
5369
6152
6599
3631
1609
2581
3206
3801
4798
5455
1628
2714
3225
4548
5592
5678
2259
5000
(988
4981 4437
455.
450.
6141 5591
729t 2341
1203. 2253
3792 370Bl1
3627 3638
3553 37991
6223
3820
4814
5541
6299.
2422
2427
2500
2620
1649
2729
J,44
3855
4836
5575
1682
2756
3263
3957
4354
:'1591
1716
2787
3283
3981
1766
28115
3301
39%
1782
2838
3322
4811
4870
4957
5655
!l673
5969
5974
5619
51"(8
5886
:s699.
All mnemonics copyrighled @ Inlel Corporation 1976.
1-159
4~1
1881
21156
J349
4965
4996
5687
1976
2893
3423
4257
5912
~793
1994
2923
3433
4284
5937
5721
2172
2938
3452
4392
5955
5802
2248
2953
3471
4419
5999
51)('5
;m9
296lJ
:S499
4587
:'116<1
:'1951
inter
NIfj()
AP·55A
4159
1521.
IlMl.S 1381.
IIm'TS 12381
IIK:OO 11851
~TlOC 55921
IFTIII1 1991
IFTf112 1997
IFTOO3 1992
IFTI(Jf 11941
(l((lI'G0 1281
2652
4368
6833
ORGPGl 1291
3691
4239
6938
(JiGPG2 1391
4585
6121
0RGPG3 131.
6768
7119
0RGPG4 132.
52201
6628
(J\'(J'(l5 133.
54891
7928
0RIf'G6 1341
5935
~G7 1351
6366
7233
OOTClR 1624
00TI1SG 1797
OUTUTL 1542
0Y8BAS 3187
0Y1B1 6898
0Y1B2 6919
4161
1928
1416
5564
1662
0Y1BRS 1426
0Y2B1 6981
0Y2SAS 2921
3281 6451
69841
6957. 6958
OY3B1
0Y38AS
0Yrllr
0VUJAD
OYSIZE
0YSW1
IJY<'JIJ'
6G62I ,
/QlRI(
6868
3<:113
13191
1427
6461
66611
2985
15181
Pl>IGIT 5171
Pm<
~1S59
PGmE 71351
PINPUT 5291
PlUS1 6991
43001
5584
lS:ro
5684
2181
2469
2475
2723
5646
1903
1908
1999
1641
1488
26741
4495
6111
1952
3739t
4365
6116
2377
4639
6195
1334
6769
71391
2694
S"J24
6791
3168
5434
7994
3946
68291
4947
6367
19741
1827
1973.
6783.
6914.
6924.
1984
19251
1927.
1698
1491
2679
4628
6185
1!153
3740
4588
6198
2378
4631
J
1791
14491
3148
4695
6259
1819
1528
.3399
1873.
361S
4696 47201 4724
6336 6482 6477
21531 2239 2240 22'J6I
3741 37651 3776 3926
4625 4i'29 49'.12 !l143
6264 6341 6407 64S2
25141 2528 2529 2647.
4691. 4734 4927 5148
6346 6412 6487 (;552
~9
.1335 13951 1877 1~78 1943.
68231 6827 682S
6885
7138 7176 7177
2695 31441 3161 3786 3936
5429 5776 5855 5924 6848
7923 7889 7139 7296 7287
3169 33981 3791 3792 39161
5781 5869 5861 59051 592';/
7140 7216 . 7217
3947 41921 4529 4~ 46151
6136 6219 6284 6361 6427
4948 51341 5444 :>445 ~757'
63981 6432 6433 64711 6597
1529
3617
6SS1.
1947
36S1.
4917
6542
2305
4111
5239
6547
2689
5274
6623
6577
6886
2157
3685
5138
6613
2386
4112
4249
6849
4259 4)551 4375
6197. 6126 628Il
3941
6131
4389
6295
4749
6592
6141
6508
4159
6567
6142
6537.
6914
6924
4812
~9
2158
3735
~
6686
2363.
4137.
5231
~2601
6618
3158
5275
6696
6578
69;421
66!11
3499
53951
7918
668SI
6946
2239t 2234
3771 3921
~64
5389
7898 7974
2372 2523
4146 4147
5269 5314
i'9B 7979
3419 36131
5319 !l424
7984 1'137
6648 6649
6947 7993.
2399
41116
5414
7135
2684
41761
2993
6793
3124
6887
3185
68%1 6991
6987
6911
6962
6968
6972
6984
6845
6657
3204
2921
6851
6855
G!lG2
!l926
3188
1426
3282
31S7
6452
6731.
3293
3281
3186
6657.
2713
67B8
23181 2633 3089 3599 3716 6455
7137. 71381 11391 71481 71411 7142.
All mnemonics copyrighted @ Intel Corporation 1976.
1-160 .
-:1651
4234
~761
;>1~
i'1~3
3404
i'136
3781
3153
4185
5766
(159
3931
~7?1
~
~919
4379
690
7169
1179
6722
67551
~19
66821 6721
7943 t'944
4186
5&45
716i1
4244
~ge'J
3698
4213.
~914
78781 7199
~153
,~154
6492
6~7
4937
!l~
&S62
66:S3
!l339
6796
45111
6274
4739
6351
4932
lA17
4381
6279
4491. 4515
6356 6422
4(44
6497
4913.
6638
61!l81
6572
4942
6/11
6215
6643
5439
1933
6216
6716
!l7s6 ~787
7899 7141
62551 6289
7938 i'1f14
6451
66!l7
6651)
6731
1975.
2326
6784
2367
4141
2518
4189
5848
2556
684111 6841
4828
2922
D21
6667
2995
1924
5489
2212
71361
5481
2476
1S8!I 1906 19221
!l8361 5934
7224
6299
'(142
7225
6Il9I
7232
inter
,PlUSl
PRNT1
PRNT2
PSEGHI
PSE!l.O
RDELAY
RECDOO
RECTYI'
7141
2899
19941
5181
51.9t
12481
3524
12751
REGC 1293.
REIJ/G 191.
2524
3686
4112
4586
4928
5320
5841
6117
6275
6428
6578
6722
7999
RERROR 2317.
RINT 15291
ROTCNl
ROTPflT C65I
RSlm: 2761
SCf1N3 5557
SCANS 5532
SCANS 5672
SEGPW 13111
SING 1523.
SIZE 1385.
886.
25Il4I
37551
46951
SIZECH
Sl'lflfI
S/IILO
STRCOII
STRGOC
STRtIEII
STRTIf'
STROll
STSIM:
TCRlFO
TIINT
TIRET1
TOFPOI..
53991
63201
68711
2791
3717
5292
6819
1122.
11131
5995
1623
1927
1922
1257.
1973
3956
3886
54541
5647
3846
AP·55A
2268
20391
2029
1414
1413
56%
35491
3583
4485
1335
~
3691
4142
4511
4933
5325
5846
6122
6289
6433
6614
6769
7995
2348
1923
5501
5482
7133
5476
5477
5716
5491
5439
(:072
5818
5819
6007
3587
4442
1401
2652
3736
4147
4516
4938
5339
5!l51
6127
6285
6478
6619
6C2S
7199
.6132
629Il
6483
6624
6886
7195
4186
4621
4948
5429
5861
6137
6337
C488
6629
6947
7119
5646
5507
5514
5529
5699
564411
587f1
5965
1442
2649
3909
4684
5759
6391
6935
1868
1863.
26641
40921
47101
5826.
6461.
69931
1930
4124
5892
7957
34f.>5
2557
5209
4553
1529
2688
3741
4181
4521
4943
5415
5856
4596
1878
2685
3m
1948
2699
3777
4235
4626
5139
5425
5919
6142
6342
6493
6634
i'OO9
1S53
2695
3782
4240
4631
5144
5439
5915
2240
3159
3922
4361
4(39
52'.16
5445
5939
6291
6362
6543
6687
7929
2M
3164
3927
4366
4n5
.:>231
:>762
5935
629C
6367
6548
6692
7934
2146
:na3
4169
5127
22291
360311
4293.
52101
69971
66721
C1SG
2158
3149
3787
4245
4696
5149
5435
5929
6191
6347
6498
6639
7914
6583
6644
?919
3154
3792
4258
4,('25
5154
5449
5925
6196
6357
6588
6649
7924
1936
3m
4139
4986
5898
2143.
33801
41661
51241
68191
6530
6598. 6681
7963
2283
4342
6167
71291
2359
4478
6242
7123
2591
4602
6317
4m
4999
2889
5184
3314
5J78
2869
5282
5352
6232
6352
2235
2396
3169
3932
4371
4740
5265
576.,
(:034
6211
6403
6553
6697
7939
2368
3480
3937
4376
4(4:>
5279
57(2
6839
6216
6400
6553
67112
7944
2m
3495
3942
4381
4759
:>275
57n
6844
6268
64B
6563
6'(07
?975
23,8
3419
3947
4496
491a
5319
5782
6949
62C5
641!l
6568
6712
1900
2519
3618
41117
4S81
4923
5315
578'(
6112
6279
6423
6573
6717
1'885
55751
5566 5589
5682.
2213 5486
1928
1388 14394
2507 2637.
3758 39061
4688 4681.
5402 5747.
6323 638S1
6874 6932.
1302 1436
3752 3993
5396 5744
686S 6929
2487 2493
1671 1fJ:S1
5021 5946
29371
2954lI
1..'125 294711
1989 2003
2932.
3962 3183.
3894 3975
5742
5791 5721.
5742. 5881
4989
5823
6999
2772
24811
5099
1866
26(,"
4995
4713
5829
6464
6996
2149
4163
6816
7117
3817
2745
5238
1S33.
:s1341
4127.
4903.
58951
6527.
7060t
2217
4200
6994
2555
2916
41191
6077
All mnemonics copyrighted © Intel C?rporation 1976.
1-161
611'.!2
3341
6398
C675
22861 2209
36711 3674
43451 4348
52501 5253
61791 6173
67451 6748
2353.
:f?291
4481t
:>2951
6245.
68131
3131
4900
6524
3377
5121
3689
6385
2661
4791
6458
6595
6669
366S
5247
6742
34\14
3844
4ll0i'
4023
4845
4879
2634
4C78
2223
3686
4286
5213
6100
5297
2356
3723
4484
529\1
6248
6816
inter
Ap·55A
TTYOOT 5J9I 4428
lYPE
lJ'Dfi)1
If'IlOOR
YERSI«)
\oI!RK
11>151'
1I>1SP1
lIPCOOE
Xf'TEST
~RO
11761
22G5I
2195
185111
1'5221
2819
5988
8m
1411
6841
4439
1429 1579
2558 1371
22481
1928
2939
59911
1419
1549
1579
1585
1748
1771' 1777
2269
22i'4
2569
3m
59481
1519
2119
1586
2118
5889
1778
5799
5959
2494
5949
6151
3428
61!!9
(9591
3869 5667
1822
CRO!>S IlEFEROCE CM'LETE
All mnemonics copyrighted @ Intel Corporation '1976.
1-162
2448
255IJ
3811
3872
4i'6a
4966
5171
intel'
BRKFIL 2433
~ 24594
ElfCNT 12661
BlflEN 6621
B\'TE11 ~"54
B\'1EIN 3432
INTEO 3995
eGO
29S6
CGIHI 3819
CGmIT 3822
CGOSS 3821
CGOTRR 3823
CGOIIB 31128
CllARCR 3393.
CHARIN 3417
CHff!l.F 3394.
CIm«l
~geI
CIiARO
CHSPIU 2273
DSPIIID 22771
DSPTI" 1841.
DSPllf' 8281
DSS
2957
DTR
2859
DWBRK 2856
ELSIF1 2186
ELSIF2 2284
E.'l'mI 11481
Elft.O 1131.
ENlJlNI( 5291
EIfJRAII 5281
EN)f'1 3SIl8I
ENDFIL 3872
EIIlREC 48641
EorREC 3887
EPOCC 9691
I:PIlRK 1425
EreNT 29211
EPCON1 2785
EPCONT 2728
EPFET 3319
EPPASS 2937
EPPCHI 19141
EPPClO 111851
6877'
AP·55A
5S4
869
1872
1216
5291.
689
8911
1881
1225
616
911
1896
1234
632
932
1899
1243
2'.!Il1
2328
3219
6450
3125
3374
6456
4!l52
2967
2914
2S21
62231
29S2 3285
3362 :mo
3335
648
1252
678
97J
1117
1261
2564
2566
59421
4384
5184
964
1188
6SS
932
789
991
m
1126
1135
715
111011
1144
1278
1279
12!18
1989
1153
1297
:s262
6237
6239
6248
756
1918
11G2
m
1112"
W1
1188
824
1854
1189 ·1198
6315
6378.
7911
1816
8117
1845
4216
52S2I
68591
6092
20631
28961
2894.
59961
21081
2124.
mal
2092.
2129.
3595.
2135.
21281
21141
21881
21821
211111
29781
21941
29781
2279
22761
22891
22791
3375
3199
5948
2133.
2137.
2131.
2188
2297
5398
5364
3197
3197
3893
3tlS4I
5967
22112.
22m
6381
6388
3991.
2977
3183
3187
2tl85I
2783.
3343
2'J52
2779
2752
65891
3224
3243
All mnel!1onics copyrighted © Intel Corporation 1976.
1-164
6298
6314
inter
EPPSW
EPRIl
rna
9781
9961
3042
311&
536.
2424
3il461
EmT
EPRSET
EPI\'IJN
EI'M1
EPRUN2 3il5il
~3 3049
EF'RIJM 3929
EPWl5 3057
EPRUN6 3081
EPSSTP
EPSTE1
EPSTE2
EI'STEP
El'STOR
EPTIIfR
ERROR
ERROR2
EXIlI0
EXAIf1
EXA1!2
AP·55A
2888
2932
6445
3122
1433
2,12'
2847 2992
3276 4863
6519.
3129.
29S4 29".-6
~7
325(
3292
5884
6449
6453
3951
3962.
3856.
3931 3039.
3115.
3982 31191
532.
6447.
6447
29r.4
21174
987.
741)
2324
2541.
2681
2619
EXAIt3 2624
EXAIM 2629
EXAtIS 2619
EXfIIIN 2419
EXPIIOO 555.
rDllt'1 3978
~D111'2 4926
FWf>34035
fllUllP4 4064
F'DUII'5 4034
Fltro-' 15981
GOTBL 3916
H
13il21
l1li>1 4317
HBl>2 43181
fIlDlR\' 42571
IflITHI 19321
IIlITLO 1923.
II>flTIN 35191
1£XRSC41931
I£XBtf 1327.
HEXNIB 4195
IFOONE 3885
HFlLEO 2413
~CIN 2416
HRECO 3877
6448
645Gt
3194
2920
2962
765
23491
2616
26181
2622.
2627.
2632.
26131
25401
319B
3349
:mB
782
63&2
64451
3369
5053
6297.
m
816
B33
2626
2631
4535
4537
4538
3956
4033
lJ61
882
39961
40301
49381
4888.
49361
1699
3il19.
4289 4325
431S1 4319
4339
4433 4434
4273
4399
3547
4388
~4
38~
41981
3898 38941
2421 38il1. 3878
3417. 342'l 3592
3BB4 39551
tl!EGA 19591
II!EGB 19681
HREGC 19771
Ift:OO 111861
Ift:GE 111951
IREGf 11941
1I1PlEl1 1855
INCSIIA 1431
23&5.
2625
3S2S
3673
4675
523111
All mnemonics copyrighted © Intel Corporation 1976.
1-165
993
924
945
AP·55A
INeN
INCW1
INIT
INITLP
IIf'fI>1
Ill'ADR
Itf'KEV
INYfl.S
ITII'
52391
5241
14891
14131
2187.
1035
1543
1346.
ml
1832
JOOlES 2408
Jltl'TBL.2385
JlorIL 2492
JTOOO 2491
JH1LST 2403
JTOItOO 2400
JTIH:C 2404
JTIH:L 2405
KIlDBlf 12121
KOOI1 51)011
KBOIN 2650
KllOPtt 3847
KCLRB 1515.
KEY
7691
2C59
KEYCLR 15051
KEYI)I1 15041
ID'EtIl 15811
KEI'FIL 14991
KEYFLG 9491
KEI'60 1512.
KEI'lOC 1.<"211
KEI'lSl" 15101
KEI'!IOD 15m
KEI'NX1 15891
Kl:I'f"AT 1583.
KEI'PI1 15881
KEI'REC 15861
KEI'RE(j 15891
KEI'RI:.L 15821
KEI'TRA 1587.
KGORES 151~1
K$ETB 15141
LASTKI' 987.
LDflTA 7521
3321
41611
LDBVTE 3867.
LFllJR1 4897
LFESRK
LFEDPI
LFEINT
LFIJ'I1
LFER9
LrEREG
LmBL
LFETCH
4700
4m
4779
4776
4851
4778
4773
2561
!;2461
14~3
2190
21701
1675
1381
1557
1333
24291
23991
2426.
2424.
24191
2413.
24121
2416.
2334
5816
57991
3106
1908
1544
2783
2323
1923
1545
1983
5533
1902
5558
2498
1828
1417
1590
1837
1846
2196
2345
2463
2588
2658t 3115
3119
1595
1597
1625
1626
1Mb
1647
1,85
1712
1715
1725
1732
1761
1838
'S6J~
5811
6161
1593
3116
2628
1926
1844
1749
3129
1843
21C7
2292
2205
2322
2346
2468, 259tl
2597
2613
2622
2627
2206
2347
2461
2618
3117
5671
568"2
5644
5660
5666
2'203
2623
2784
3121
1929
1923
1905
1m
5626
231;'
Il67
4795
56::;3
232;'
2436
2562
:S629
5878
2565
:s641
5106
2697
364B
Sill
2614
2828
2835
3868
2919
3088
4157
2349
6150'
1~
1901
1923
1906
1929
1909
1997
5555
1B58
3:S44
4662
555G
;''211
3346
4669
:nre
5928
!;6;'l)
2432
3526
5lI:n
:i598
50i'1
3876
489911
4/81 4890#
4797 4813 4832.
48701
4783.
48541
483611
4776.
3B67 4(04'
All mnemonics copyrighted @ Intel Corporation 1976.
1-166
3C69
6297
2632
:s666
6454
3715
4154
intJ
pciGlO 898C
ROTCNT 9983
SIZE 801M)
smJTL 9919
lI'M)1 917C
ZERO 9999
Ap·55A
RDElA\'
ROlPAT
SIZECII
STSfIYE
993F
Il982
9911
Il59II
l.IPOfIlR 9178
fISSEIIJI. V CO'flL TE,
I«)
All mnemonics copyrighted
@
RECOON
r6
4859
2943
:B19
3631'
4875
~
5546
6228
6]04
3562
3392
3583
2388
3l1li7
2444
:s868
3358
4891
*7
5692
5728
4419 4459
7711 ;'00
Il8SI
991
4469 4569
7GB. m
9991
9'&
4579
3051
814
!l22'
9391
943
951.
831
8391
1561
;:387
1561
2439
1567
2909
1610
3632
1616
5179
2390
5359
5385
3444
3511
3517
3532
3542
:>')62
3968
J982
3!188
4044
4954
3426
586
659
71? .
3426
599
654
721
3558
3564
681
671
4217
3571
602
672
421B
35"71
3&58
619
689
4226
3858
J858
4966
617
686
618
687
622
6~
4972
626
695
3327
3333
2939
2945
5082
3249
3255
32B4
:Q9Il
1745
2762
3997
3504
4297
4876
5461
6229
2749
3481
li'OC
2769
3212
3634
4322
4963
1897 IB19
2793 . 2811
~231
3259
3638 3897
4398 4439
4987 51192
5547 ~581
19a2
2818
3269
3814
4458
2999
5465
495J
5691
2776
3811
5629
4332
4449
585.
594
658
725
696
676
4222
4979
633
791
4979
634
792
2lI13
2862
3387
3841
4568
5961
5623
2178
2817
3328
:rJ55
~963
39&7
638
796
3998
2975 3211 . 3:l17
2m 2912 3354 3369
2759 2896 2814 21.19
2798 . 2CJ9 2845 2894
2939 3268 3274 4S55
2969 3238 3236
1634 1655 1600 1695
2547 2587 2729 2735
2944 2959 2974 :sooa
3477 3496 3516 3531
4943 4871 4263 4279
4739 4894 4820 -4842
5197 5349 5361 5375
5!r.>7 5971 6965 69C4
1659 1692 1792 1986
3311 :J332 3359 3443
4492 4649 4659 5965
2923 2452 2887 3541
2990
4861
1722
2742
3069
3563
4299
4869
5387
6153
2739
3462
59S1
3651
!J969
All mnemonics copyrighted © Intel Corporation 1976.
1-168
5594
5918
5597
2!;44
32t'9
3834
4559
5943
5616
4593
5968
~93
2:ss9
2899
4645
::i996
570SI
6395
2766
3599
2797
3821
5636
4468
2815
3838
57B
45611
2a25
3848
6969
4578
2866
3967
3216
5520
5981
4267
3235
4277
inter
AP.·55A
?H~"4
356.
?f0Rlf> 3801
2466
3994
3512
4641
5193
6961
?H
1298.
?HBITH 1928.
?HBITl 1919.
?HEXEU 13241
~GA 19551
?lIREGB 18641
1569
2484
3559
4761
1516
2543
3993
3580
4735
~345
~371
6009
4262
4258
4285
6154
4273
4266
4~3
386S
1611
2583
3200
3803
4S8tJ
5457
6225
4323
42/1
4298
1&39
1(,51
lW4
2?1C
2731
27~
3227
3339
4816
3246
3857
3265
1I1B
2789
3285
3959
3983
m8
483B
4S56
~3
5577
~593
4872
5612
4959
5C!l7
1717
1723
5637
1739
5893
1730
5664
!:i676
~76
3639
3646
1(68
18jj3
1978
285(;
2~
49V3
j351
4067
499S
~i'5
~'9
~
6153
6159
5676
3646
s652
$658
19461
3147•
41491
4916.
59001
2146
3383
4169
339StI 3606
~7
~393·
1784
2840
3324
4013
3425
4259
5814
5795
1996
2925
3435
4286
5039
5723
2174
2948
3454
4394
5&57
:i894
~
4644
4669
2258
295S
3473
4412
5992
2331
2979
:S492
4:,&9
~77
5953
4667
4667
~1(.4
6391
433]
?HRI:OC lBnl
?HREGD
?IMGE
?fRtiF
?ITI'IP
?KEDEU
10021
19911
11991
(741 1687
12981 2I~2
?KEY 757. 2582
?KEYFL 933.
?KEVLO 1217. 5542
?LASTK 8911 :J611
?L1>ATR 7491 2819
5956 5Il64
?LOOT 1333. 1383
. 23661 2587
37341 3758
44944 4698
53001 5402
6258. 6323
68261 6874
?1'IIJ1l1 11541 3896
~It.O 11451 J8I~
?I'IINDX 156. 967
1912 19161
1961. 1061
1196 1111
1156 11691
1295. 1295
1258 1255
1390 1394#
?MSRVE 158. 587
851
872
1966 1975
1219 1219
?NCOL5 6911
?NEGl l16. 2338
?NEXTP 11991 2251
?Nr951.
42541
471101
:k?351
5791.
61461
64371
61261
69511
1861
2204
2662
3669
4090
4343
47118
5248
5824
6168
6459
6743
6991
1861
1869
2292
267Il
3677
4Il9S
4351
4716
1939
5832
6176
6467
6751
6999
1SS21 1931
231111 2351
26991 3132
36951 mB
41161 4125
43851 4479
4754. 49111
52791 5293
58651 5893
62201 6243
65121 G525
6m. 6811
78481 7Il58
1931
2351
6670
6939
1445
2226
2643
S609
3912
4209
4687
5216
5753
6103
6394
66706938
6811
i'058
5991
6251
6533
6819
i'966
2801
1583
3979
3539
21114
1746
4769
41142
2024
1756
4766
4321
1769
4958
4438
1769
4964
4451
1769
1775
5169
4567
1829
2448
2446
2453
2542
5503
~97f1
1767
2483
3424
3856
56:l6
5730
37151
4421 44(,1
1569 1598
4529
1616
2m
1938
1119
1182
1254
741
839
C5Il
934
5694
35Il1
4493
4821
5J58
1383
2141
2582
3378
3753
4164
4603
5122
5397
61117
631B
6596 6604
6869 6Il?7
7118 7126
1987 1995
1577 1~77
3IlIl9 ' 3Il64
2012 2876
1575
1f11l1
1973
1145
1217
(74
993
1065
1137
1209
1281
7i'5
071
875
879
61164
6879
6979
aIC5
4551
4561
.45!J8
4594
5527
623
700
5527
627
797
639
814
2218
4281
6Il95
2491
2141
4164
61117
7118
2757
2861
4S43
6239
141151
21621
2533.
34141
37961
41991
46351
51591
54491
68531
63711
66531
699IlI
1263
757
611
763
4227
iIl58
983
1955
1127
1199
1271
758
934
1956
121l1l
1272
762
128Il
879
1128
l6II1
39Il4
4201
4679
5208
5745
6995
(;386
12tI8
4571
2590.
All mnemonics copyrighted © Intel Corporation t976,
1-170
~163
454~
2284
2662
3669
4Il90
4343
4700
5248
5824
6168
6459
6(43
6991
11119
1982
1154
1226
1298
5256
sae
11119
1991
1163
1235
111211
11192
1164
1236
1928
111l1l
1172
1244
8Il8
8Il9
S13
JD2
3718
4125
4479
49111
!:i2S3
5893
6243
6525
91B
2359
3140
3726
4133
4487
4999
~301
inter
LOC OOJ
Ap·55A
LINE
7243
USEk S~'lW..S
?II
IlOO4
?IlIlR6 9997
'!B1R7 898f)
?CQ6T 9983
?EJ'F'CH 8992
?FOOM4 9Il1C
?HF:EOC 09Il2
?KEYLO IlOO2
?t«:Ol.S 8003
?PUJS1 9993
?REOC IlI!82
?START 930C
fl<".1lVE 993E
IlRKNXT 9234
CGCfAT 9476
CHIlRO 958D
9649
CIN
CNTTBL 94A1
~9461
DEtfN(
DECSII1
OOR
I>PI\'I'IEft
DSPIU
DWBRf(
EII)fIL
EPrET
EPRSET
EPSSTP
EXAIIl
FDlIIP2
1IID2
ffl>ONE
HREGE
INPADl
95F5
92rF
8150
8151'
!l1SE
9160
9596
9787
8919
9994
9270
8C28
94D5
1J:lfl7
892E
9OC7
J1000 922lI
KBDPOI.. 9M
Kl~'GO
981E
991B
96C1
98FC
97.>4
/R)()
8924
I'IAlNe1 0075
I'Elt.O 8934
I1RL
892E
NEXTPI.. 003f1
NIJ[{)N 0038
IJ1GPG2 9389
OUTUTL 9109
OY3BAS93SE
F'ERRlJ: 819A
KEYREG
LfEBR1
LFETCH
LSlINT
?ASAYE
?B8Ri'
?BCOOE
?CURD I
8992
909S
SOURCE STflTEI1ENT
00
8992
8087
90e2
9922
0001
0003
?EPPCL 8002
0002
?F0RI15 001E
9002
?If(EGI) 0092
?li:[G[ 9002
?LRSTK 0001
'!lDRTA 0909
?lEG1 M3
?NEXTI' 0082
?PlUS3 8003
?R1
9800
?ROTCN 11091
?ROTPA 0001
?STRTI1 9002
?TYPE 9992
ASCERR 81C9
El
9043
BLfCNT 9041
BlfL£:N 0019
CGOSS 9489
CGOTRA 9480
CHKERR 92f1
CHKSUI1 0895
(;KSI1OI( 921)13
ClUIR 95F1
CNTTRA 94AfI
cot 95C5
C(»ISIlR 922C
COI1SIZ 8903
DBPNT 9144
OORK 8915
DELm' 94F2
DECSI'IIl 9?F4
DINTRG 8169
DlST 914E
DREC 9151
DREL 0154
DSFtO 0194
DSPI'I1 B192
ELSIF1 9007
ELSlf2 09£5
ENOREC 9641
EOfREC 05AE
EPPflSS 9709
EPPClII 9925
EPRUN1 848A
EPRUN 9489
EPSTEi 87DF
EPm207F1
EXAPI2 92£:1
EXAH3 028fl
rDUl'l'4 064S
FDUlf'3 9C36
flBlTHI 8927
HBDlflY 94C9
HFILEO 9572
HRECIN 9297
IR:GF 1182F
II'IPLEI'I 0200
1NPf:DR 9IlC9
INPKE'r' OOEC
JTOLST 921Il
JTImOD 029F
KCLRIl 999C
KE'1'
0093
rntoc 983(; KEYLST 981C
KEYREL 9814
KI.'YTRfi 0919
LFEBRK 86B1 . Lr~ 11698
LfILL 92E9
LFILLl 1k"f3
LSTORE 8789
LSTPII !l79C
IflDOC 8925
MAIN 8929
I'IAIND 9993
I'IAIN>l 8007
I'IERROR Il9IlC
MINC 89211
I1RLC 0931
IIRR
002F
NIBI3 81C2
NIBIN 9188
NXTLOC 87CS
OPTAB1 933f
ORGPG3 93E9
0RGI'G4 84fD
0V9ElAS 9378
OV1B1 89!lR
0VBlF 004E
OYLOflD 936A
PGSIZE OOFD
PINPUT 999lJ
All mnemonics copyrighted © Intel
?B
?BiPNT
?IlllO'
?DEBNC
?EPPSW
?H
Corporati~n
?BIlf'NT eeec
?B1R2 9993
?BITSO 9003
?I)<".,/'n
?IlI'IR2
?B1R3
?BtfCN
?DSPTI1
?EJ'TlI'I
?llBlTL
0002
e994
9982
8900
09Il2
0092
?ITII' 0009
?IJ'R0 ilOO2
?IIH"iH 0082
?I-REGF 99Il2
?LE:t«iT 99EII)
?NREPT Il9Il2
?lE1II1
?tu1CO
?Rf!8
?'"..EGIIl
?YERSN
ElITSO
?R~
0002
?RSAVE
?I.tIAR'.'
SCOOE
BVTEl1
CGOIIl
CI9
CLRBFr
CO2
CTAB
009Il
992A
89j6
99F2
DCB
915A
94F5
9146
91C3
81S1l
003J
9929
0024
9499
970B
0293
11632
11026
8699
01F2
0389
9211
0017
DElfl'1'1
DI'IOD
Dim
DSPI'IID
Emf-II
EPACC
Erf'CLO
EPRUN2
EPSTEP
EXIlI4
FDIJf'S
HBITLO
HRECO
INCSl'IA
INVALS
JTOREC
KE'lCLR
8993
~76
0640
0000
95CB
0923
Kl ~'IIOD 981F
KGORES 9Il1D
LFtlNT 96AS
U1lSEl. 94f1
L~TR9 872F
1'Il1N2 003~
IIIH. ge26
111.01 836F
I'IRRC 8939
NIBIN2 91BA
OPTAB2 9346
ORGPG5 95FF
0Y1B2 8313
OVSIZE 9817
PLUS1 0091
8002
0092
8Il89
9083
8002
9900
II~'TEIN 99F9
CHARC~ il90D
9651
Cit
CMl>INT 89I3A
cm 95Cf
.CURD I G 0005
00flBRI( 9167
OCRROR 9131
DNOBRK 9168
DRUN 8m
DSPTlII 0028
EI'1AI..O 0!l32
EPElRI( 834F
EPPSW 0021
EPRUN3 9495
H'STIJI 97C3
\:XAI'IS 9275
FINDOI' 0942
HDATIN 82B9
HREGA 11021-1
INCW 91F4
lTl'1I'
99Il4
JTOREL 9216
KE'r'DI1 9916
KE'r'NXI 9912
KSETB 9Il9B
LFEPI'I 11684
LSTBR1 9746
~lREG 8726
IflINA 11052
IIllOCK 9Il82
I'IIOY 8928
I1XCH 8929
NIBO 95BB
OPTAIB 8349
0RGP66 96FF
OV1BAS 93A4
0VSII1 9361
PLUS3 1le93
1976.
1-171
?88I 9913
m'PAT 9815
LASTKY 9Il94
LFER9 96A5.
LSTER2 0748
~T1BL 0796
IfllNB 8969
!'IDEe 002C
I'IOOOUT 8928
MXRI. 0028
N3
1)1k
91'/5
ENDf1 959E
EPCONT 941~
IOf'RET 94C7
EPRI.tl6 948R
[XA119 9258
FDIJ1P1 9617
HEXNIB 9ill
liREliD 082D
INITLP
JTOfIL
KBl>IN
KE YF1G
m'REt;
LOOYTE
LFElfJL
99IlE
8222
00:2
9Il86
9818
8582
96(£
~TDI1 11721
111
8929
I'IAINB1 9IlA9
IIEIIII OO:s5
PIPUSEl. 9Il48
Nl:.G1 HfF
IfID'TS 8!l3D
ORGPG1 II1FD
0UTl1SG 9194
0\I3t'1 9311
I'DIGIT 898t
f'C..EGlil I!9!j()
intJ
AP·55A
APPENDIX C
COMMAND SUMMARY
Program execution commands:
The following is a summary of the commands implemented by the HSE-49 emulator monitor. Within each
command group, tokens in each column indicate options the user has when invoking those commands.
Tokens in square brackets indicate dedicated keys on
the keyboard (some keys having shared functions);
angle brackets enclose hex digit strings used to specify
an address or data parameter. Parameters in parentheses are optional, with the effects explained above.
The notation used is as follows:
Program/data entry and verific;ation commands:
[EXAMI
[PROG MEMJ" [.) [NEXl]
[DATA MEM)
[PREy]
[REGISTER)
[.)
[HWRE REG)
[PROG BRK)
[DATA BRK)
Program/data initialization commands:
[FILL)
[PROG MEM)- [.) [,I [.)
[DATA MEM)
[REGISTER)
[HWRE REG)
[PROG BRK)
[DATA BRK)
Intellec@ development system or TTY interface commands (for transferring HEX format files):
[UPLOAD)
.[DNLOAD)
[PROG MEM)' [,) [.)
[DATA MEM)
[REGISTER)
[HWRE REG)
[PROG BRK)
[DATA BRK)
[PROG MEM)' [.)
[DATA MEM)
[REGISTER)
[HWRE REG)
[PROG BRK)
[DATA BRK)
Formatted data dump t9 TTY or CRT:
[LIST]
[PROG MEM)' [,) [.)
[DATA MEM)
[REGISTER)
[HWRE REG)
[PROG BRK)
[DATA BRK)
[NO BREAK)' «SMA» [.)
[WI BREAK)
[,)
[SING STp)
[AUTO BRK)
[AUTO STp)
[GO/RSl]
[NO BREAK)' [.)
[WI BREAK)
[SINGSTP)
[AUTO BRK)
[AUTO STP)
Breakpoint setting and c[earing:
[SET BRK)
- Starting Memory Address for block command,
- Ending Memory Address for block command,
- LOCation for Individual accesses,
- DATA byte.
Asterisks (*) indicate the default condition for each
command; thus that token is optional and serves to
regularize the command syntax.
[GO)
[PROG MEMJ" «,) ... ) [.J
[DATAMEMJ
.
[CLR BRKJ [PROG MEMJ' ([,J ... ) [.J
[DATA MEM)
APPENDIX 0
ERROR MESSAGES
The following error message codes are used by the
monitor software to report an operator or hardware error. Errors may be c[eared by pressing [CLR/PREV] or
[END/.]. The format used for reporting errors is
"Error- .n" where "n" is a hex digit.
Operator Errors
1. IIlega[ command initiator.
2. Illegal command modifier or parameter digit.
3. Illegal terminator for Examine command.
4. Illegal attempt to c[ear Error mode.
5-9. Not used.
Hardware Errors
A. ASCII error - non-hex digit encountered in data
field of hex f9rmat record.
B. Breakpoint error. Break logic activated though breakpOints not enabled.
C. Hex format record checksum error. Note - the
checksum will not be verified if the first character of
the checksum field is a question mark ("?") rather
than a hexidecimal digit. This allows object files to
be patched using the ISIS text editor without the
necessity of manually recomputing the checksum
value.
D. Not used.
E. Execution processor failed to respond to a command
or parameter passed to it by the master processor.
EP automatically reset. EP internal status may be
lost. Program memory not affected.
F. Not used.
All mnemonics copyrlghted©lntel Corporation 1976.
1-172
APPLICATION
NOTE
Ap·91
INTEL CORPORATION ASSUMES NO RESPONSIBIlITY FOR THE USE OF ANY CIRCUITRY OTHER THAN CIRCUITRY EMBODIED IN AN INTEL PRODUCT. NO OTHER CIRCUIT PATENT LICENSES ARE IMPLIED.
©INTElCORPORATlON.1979
AFN.(J1364A..()1
1-173
i~
AP·91
USING THE 8049 AS AN 80 COLUMN
PRINTER CONTROLLER
I. INTRODUCTION
This Application Note details using INTEL's 8049
microcomputer as a dot matrix printer controller.
Previous INTEL Application notes, (e.g. AP-27 and
AP-54) described using intelligent processors and peripherals to control single printer mechanisms. This
Application note expands upon the theme established
in these prior notes and extends the concept to include
a complete bi-directional 80 column printer using a
single line buffer. For convenience this application
note is divided into six sections:
1. INTRODUCTION
2. ·PRINT MECHANISM DESCRIPTION
3. INTERFACE CIRCUITRY
4. SOFTWARE
. 5. CONCLUSION
6. APPENDIX
Over the last few years 80 column output devices have
become· somewhat of a defacto output standard forbusiness and some data processing applications. It
should be mentioned that by no means is the 80
column format a "new" standard. 80 column computer
cards have been around for more than 20 years and
perhaps the existence of these cards in the early days
of computers is why the 80 column format is a standard
today.
Many CRT terminals use the 80 by N format and
to complement this a number of printers use this same
format. One reason, aside from those historic in
nature, for the 80 column standard is that 80 columns
of 12 pitch text on standard typewritten 8.5 inch by
11 inch paper completely fills up an entire line and allow ample room for margins. So, the 80 column format
is an aesthetically convenient format.
Printers are usually divided into either impact or nonimpact and a character or line oriented device. Impact
printers actually use some type of "striker" to place
ink on the paper. More often than not the ink is
contained on a ribbon which is placed between the
striker and the paper. ·Non-impact printers use some
means· other than direct pressure to place the characters on the paper. This type of printer is very fast because there is very little mechanical motion associated
with placing the characters on the paper.. However,
because the paper is required to be treated with a
special substance, it is not as convenient as an impact
.
printer.
Character printers are capable of printing one character at a time. (Any standard home typewriter is in
effect a character printer.) Line printers must print an
1-174
entire line at a time. Line printers are usually quite
a bit faster than character printers, but they usually
don't offer the print quality of character printers.
In recent years, the "computer boom" has caused the
price of printers to tumble markedly.. High volume
production, competition, and the tremendous demand
for reliable print mechanisms have all corttributed to
the decrease in price. Because of their simplicity, line
printer mechanisms have decreased in price faster
than other mechanisms. Therefore, when high quality
print is not needed, a line printer is a very attractive
choice.
This application note describes how to control all 80
column impact-line printer with an 8049/8039. The
complete software listing is included in the appendix.
The 8049 is the high-performance member of the MCS48TM microcontroller family. The Processor has all of
the features of the 8048 plus twice the amount of pro-·
gram and data memory· and an llMHz clock speed.
For details about the 8049, please refer to the MCS-48
user's manual.
II. PRINT MECHANISM DESCRIPTION
The model 820 printer is available from C. .ITOH
ELECTRONICS (5301 BEETHOVEN STREET, LOS
ANGELES, CA 90066). This inexpensive and simple
printer is ideal for applications requiring 80 columns
of dot matrix alpha-numeric information.
The model 820 printer is comprised of three basic
sub-assemblies; the chassis or frame, the paper feed .
mechanism, and the print head. The diagram in Figure 2.1 ~ves the physical dimensions of the basic print .
mechanis~. The basic chassis for the printer is constructed out of four sheet metal stampings. These
stampings are screwed together to form a sturdy base
on which all other components of the printer are
mounted.
The paper feed mechanism consists of a toothed wheel,
a solenoid, a tension spril)g, and a "catcher." When the
solenoid is activated, the arm of the solenoid pulls
against the spring and drags over the toothed wheel.
When the solenoid is released, its arm is pulled by the
spring, but this time the arm grabs a tooth on the
wheel and pulls the wheel forward which advances the
paper. A "catcher," which is merely a piece of plastic
held against the toothed wheel, is added. to assure
that the paper is advanced only one "tooth" position
each time the solenoid is activated.
The print head is comprised of seven solenoids which
are mounted in a common housing. The solenoids are
physically mounted in a circle, but their hammers are
positioned linearly along the vertical axis. These
seven vertically positioned hammers are the strikers
that actually do the printing.
.
intJ
Ap·91
~
649(164'8):~
5.63 (143.0)·~
~2~1463(117.6)
..L
T
_
'1
"
:'.,.,
""
9B8~0015
(251 0
~
1038
(263.6)
04)
r--gL
025
(64)
I
fu2~.
--1
Q,
I
~-4 77 (121 2)~
j3)
3.32.
___
H
MARGIN FOR HEAD
CABLE ROUTING'
--~-.1132(287.5),----------I
__ ~ _ _ _ ".82 ± 0.015
(3002 ± 0.4)
1-----6.18(157.0)----
UNIT INCH (MM)
DIMENSIONS IN INCH GOVERN
Figure 2.1 Physical Dimensions of C. ITOH Model
820 Printer
~~~~~
~
~
~.~~~
~
~
~~~~rx1
Figure 2.2 "Formation" of a Character by a Dot
, Matrix Printer
PRINT
WIRE
2
3
4
5
6
7
A motor. mounted toward the back of the print mechanism. drives a rubber toothed belt which turns a roller guide. A motor turns a guide that moves the
print head from right to left and left to right. By properly timing the current flow through the solenoids
while the print head is moving across the paper, char·
acters can be formed. Figure 2.2 illustrates how the
dot matrix printer "forms" its characters.
The timing pulses for the print head mechanism are
generated by an opto-electronic sensor. This sensor,
located on the left side plate of the printer, informs
the print controller.when to apply current to the print
head mechanism. This "on-board timing wheel" assures
that all characters will be properly spaced and that
they will all be "in-line" in a vertical sense.
The print mechanism is also equipped with two additional sensors. Th~se are the left home position
sensor. located near the left front of the mechanism.
and the right home position sensor, located near the
right front of the print mechanism. These sensors
simply tell the controller when the print head is in
either the left or right home position. A complete
timing chart for the printer is shown in Figure 2.3.
III. INTERFACE CIRCUITRY
The manual supplied with the printer recommends
some specific interface circuitry. For the most part
the circuitry used in this Application Note followed
these suggestions. The circuitry needed to drive the
print head solenoid is shown in Figure 3.1. This same
1-175
intJ
AP·91
MOTOR POWER
LEFT HOME FLAG
~:F
-I
,
I
1-
~--------
75-1(10 ms
(IN CASE MOTOR OFFl ::: -
~::~-----,~----------------------------------------------~------~
DARK
RIGHT HOME FLAG
-.J
I
LIGHT -----.,;----------------------......11
I
~
'ms._
L TO R PAINT
53BmsNOMINAl
-
TIMING PULSES
ISCALENOTPROPORTIONALI
PAPER FEED POWER
OFF
1_
J1
'-------!I--------- M
t
t
1-
"7"""---------------------------------
-I -,
I
5ms(DELAYFORALlGNMENn
R TO L PRINT
538msNOMINAl
-
--t 1- ~gM~~AI
--~
J\M
t
------~r-------
M
,
-~S_--
T~""
T,
T480
-I
~
1..
179 m$
--NOMINAl--
Tt
ON
-I Nb~,o;;~L
r-----1
1-'S-20ms
-I
__________---'n
I_lOoms
nnFL_f1_
(PAPER SLEWINGl
Figure 2.3 Timing Diagram of C. ITOH
Model 820 Printer
+ 5V
and converted to TTL levels in order to interface to
the controller. This conversion is accomplished with a
simple voltage comparator. Figure 3.2 'is a schematic
of the sensor interface circuitry. Note that hysterisis
is employed on the voltage comparators. This eliminates "false" sensing,
~ 5%
S'
SOLENOID
Tr,
A,
250633
33OQ.lIBW
R2
13Q::t5°'o.5W
RJ
lkO,l12W
o
38Z61
C
G
l",F l00V
SN74060A EQUIVALENT
33K
>"'1-.,.--0
OUTPUT
Figure 3.1 Solenoid Drive Circuit
(Eliminate R2 for Line Feed Solenoid)
circuit is used to drive the line feed solenoid except
that the current limiting resistor R2 is eliminated.
This resistor is not needed because the line feed solenoid is physically much larger than the print head solenoids and can'tolerate much higher levels of current.
The print head drivers are connected to an 8212
latch. The latch is interfaced to the BUS PORT on the
8049 and is enabled whenever the WR pin and the BIT 4
of PORT 1 are coincidentally low. The line feed driver
is connected to PORT 1 BIT 1 of the 8049.
Note that the driver is simply a Darlington transistor
that is driven by an open collector TTL gate. Resistor
R2 is the current limiting resistor and diode D. capacitor C. and resistor R3 are used to "dampen" the inductive spike that occurs when driving solenoid S.
This circuit is repeated for each of the seven solenoids
in the print head. It should be mentioned that. although the type of Darlington transistor needed to
drive the print head is not critical. a collector current
rating of at least 5 amps and a breakdown voltage
(Vceo) of at least 100 volts is needed. Transistors that
do not meet these requirements will, be damaged by
the inductive kickback of the solenoids.
As mentioned in Section 2. the printer provides some
sensor interface signals that are derived via three opt(}electronic sensors. These signals must be amplified
56K
Figure 3.2 Example of Sensor Circuit
Motor control is accomplished by using a Monsanto'
MCS-6200 optically-coupled TRIAC. This part is ideal
in this kind of application because it provides a simple
means of controlling a line-operated motor without
sacrificing the isolation needed for safe and reliable
operation. Figure 3.3 is a schematic of the motor driving circuit.
+5
YELLOW
\
soov
7
TOR
rBLK/RED
NEU
HOT
'---..--/
,'SVAC60HZ
Figure 3.3 Motor Driving Circuit
1-176
Ap·91
To interface 8049 to the outside world one 8212 latch
was used. This latch was connected to the BUS PORT
and is enabled by an INS or MOVX instruction coincident with BIT 4 of PORT 1 being in a logical zero
state. In this configuration, the 8212 was used to hold
the data until read by the 8049. The connection of
the 8212 to the 8049 is shown in Figure 3.4 and the
parallel port timing diagram is shown in Figure 3.5.
The 8212 parallel port was connected to the LINE
PRINTER OUTPUT of an INTELLEC MICROCOMPUTER DEVELOPMENT SYSTEM.
C
~
010
0"
--i; Db
INPUT
LINE
S
-fa 0:01,
~
01.
20 Db
~~ 01.
8212
gg; :
DEl<>
DB.
DB,
DB,
DB.
DB,
De.
DB,
00,
Db~ 10
DO~ 1
DO.
00,14
DOa 21
OS.
This routine also initializes all of the variables used by
the printer.
The INPUT ROUTINE reads the characters that are
present in the 8212 input port and writes them into the
8049's buffer memory. The routine then checks the
characters to see if a CARRIAGE RETURN (ASCII
OCH) has been transmitted. If a CR is detected, the
input routine automatically inserts a LINE FEED as
the next character. When the input routine detects a
LINE FEED, it stops reading characters and sets the
direction bits and the print bit in the status register.
This action evokes the OUTPUT ROUTINE. A detailed
flowchart of the INPUT ROUTINE is shown in Figure
4.1.
8049
RO
OS,
<}-- PI.
INT
TO
I
BUSY
Figure 3.4 Connection of the 8212
Input Port to the 8049
DATA
~~------------------U
BUSY
ACKNLG
~r-------------,~___
--'----------L-S
I----VARIABLE T I M E : - - - - I
Figure 3.5 Parallel Port Timing
IV. SOFTWARE
As mentioned in Section 2, the bulk of the timing
needed to control the printer is actually generated by
the printer itself. Therefore, all the software must do
is harness these timing signals and turn on and off the
right solenoids at the right time.
To make things easy, the software needed to drive
the printer is broken into four separate routines.
These are:
1. INITIALIZATION ROUTINE
2. INPUT ROUTINE
3. OUTPUT ROUTINE
4. LOOKUP ROUTINE
The INITIALIZATION ROUTINE turns the motor on
and checks the opto-electronic sensors. If a failure is
found, the routine turns off the motor and loops on itself. This insures that the print mechanism is cycled
properly before characters are accepted for printing.
Figure 4:1 Input Routine Flowchart
1-177
AP·91
The OUTPUT ROUTINE initializes both the input and
output buffer pointers and then reads the characters
from the 8049's buffer memory. After a character
is read the OUTPUT ROUTINE calls the LOOKUP
ROUTINE which reads the proper bit pattern to form
that character. This bit pattern is then used to strobe
the solenoids. After each character is printed, the
OUTPUT ROUTINE calls the INPUT ROUTINE and
another character is placed into the buffer memory.
This type of operation guarantees that the input buffer
cannot "overrun" the output buffer. A flowchart
of the OUTPUT ROUTINE is shown in Figure 4.2.
Initially the input buffer pointer is loaded with the ad·
dress of the first location in the buffer memory. As
characters are read, the input buffer pointer incre·
ments and fills the buffer memory as shown in Figure
4.3(b) through 4.3(f). When a CARRIAGE RETURNLINE FEED (CRLF) is encountered the input buffer
pointer and the output buffer pointer are reset back to
the first location. The OUTPUT ROUTINE then reads
the character from the first location in the buffer memory, increments the output buffer pointer and calls the
INPUT ROUTINE, which reads another character
from the parallel input port.
The OUTPUT ROUTINE, reads the e,ntire buffer, inserting space codes (20H) after a CR is detected,
and the input buffer pointer follo~s the output buffer
pointer as they "increment" up to the buffer memory.
When the OUTPUT ROUTINE has printed the last
character or space, the output buffer pointer and the
input buffer pointer are set to point at the last location
of the buffer memory. The OUTPUT ROUTINE then
reads the character from the last location of the buffer
memory and proceeds to "decrement" down the buffer
memory. Space codes are inserted until a CR is found.
Figure 4.3(1) to 4.3(0).
The input buffer pointer follows the output buffer
. pointer just as in the previous case. When the last,
or in this case the first character is printed, the output
buffer pointer and the input buffer pointer are set to'
point at the last location of the buffer memory. Now
the pointers are "decrementing" down the buffer
memory, but the printer is actually printing in a "normal" left to right fashion.
When the last character or space is printed, the output
buffer and the input buffer pointer are set to the first
location of the buffer memory and printing takes place
in a reverse or right to left manner. After this line
is printed, the print head and both buffer pOinters are
in the same position as they were initially. So, four
lines must be printed before the buffer pointers and
the print head complete a cycle. Each of these situations is handled separately by four different subroutines: CAS EO, CASEl, CASE2, and CASE3.
IV·II. TIMING
Figure '4.2 Output Routine Flowchart
IV·I. HANDLING THE 1/0 BUFFER
Since the C. ITOH Model 820 printer is capable of
printing in both directions the 80 character buffer
must be manipulated in a manner as to allow maximum
input-output efficiency. This is accomplished by reversing the "direction" of the buffer memory each time
the printer is printing from right to left. For simplicity, if it is assumed that the buffer is only five bytes
long, Figure 4.3 can be used to help explain the buffer
operation.
All critical timing for the printer controller came from
two basic sources; the timing sensors on the printer
and the internal eight-bit timer of the 8049.
The internal timer of the 8049 was used to control
the length of time the solenoids, were fired (600
microseconds) and was also used as a "one-shot" to
align the printer. This alignment is needed to make
the "backward" printing line up vertically with the
normal or forward printing. The "one-shot" is used to
measure the time from the last column of the last
character position until the right sensor flag is covered.
1-178
inter
4.3A
Ap·91
BUFFER MEMORY
INPUT BUFFER
4.38
4.3P
OUTPUT BUFFER
OUTPUT BUFFER
1: 1
,
INPUT BUFFER
4.30
BUFFER MEMORY
INPUT BUFFER
4.3R
OUTPUT BUFFER
BUFFER MEMORY
INPUT BUFFER
4.30
4.3E
,
BUFFER MEMORY
A
1
I Ic
INPUT BUFFER
4.35
1
INPUT BUFFER
4.3T
BUFFER MEMORY
4.3F
4.3G
4.3H
4.31
4.3J
4.3K
4.3L
4.3M
INPUT BUFFER
4.3U
OUTPUT BUFFER
BUFr:ER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
4.3V
OUTPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
4.3W
OUTPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
4.3X
OUTPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
4.3Y
OUTPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
4.3Z
OUTPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
4.3AA
OUTPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
4.388
OUTPUT BUFFER
INPUT BUFFER
4.30
OUTPUT BUFFER
BUFFER MEMORY
1
OUTPUT BUFFER
BUFFER MEMORY
4~3N
OUTPUT BUFFER
BUFFER MEMORY
B
OUTPUT BUFFER
INPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORy
OUTPUT BUFFER
INPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
1
INPUT BUFFER
4.3C
OUTPUT BUFFER·
BUFFER MEMORY
I
IJ
OUTPUT BUFFER
BUFFER MEMORY
1
INPUT BUFFER
4.3CC
OUTPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
4.300
OUTPUT BUFFER
OUTPUT BUFFER
BUFFER MEMORY
BUFFER MEMORY
INPUT BUFFER
INPUT BUFFER
Figure 4.3 1/0 8uffer Handler
1-179
a
AP·91
When the print head reverses direction and the right
sensor flag is uncovered. the timer is then used to
determine where to start printing in the reverse
direction.
The timer and the print wheel on the printer are used
to determine when to place a character. The strobe
from the print wheel informs the 8049 when to fire the
solenoids and the timer allows the proper spacing
between the characters .
. V. CONCLUSION
Although the full speed of the 8049 was not used
in this application. the high speed of the 8049 makes it
possible to "fine·tune" any critical timing parameters.
Additionally. the extra available CPU time could be
used to add an interrupt driven keyboard and display.
such as the ones discussed in AP-40. to the printer.
This would allow the printer to function as a complete
"terminal".
Very little attempt was made to optimize the software.
but still the entire program fits easily in 1.25K of
memory; 750 bytes for printer control and 500 bytes
for character lookup. Adding lower case to the printer
would require an additional 500 bytes of lookup table.
·The remaining 250 bytes should be used to add "user"
features such as tabs. double width printing. etc.
The high speed of the 8049 combined with its hardware and software architecture make it an ideal choice
for controlling an 80 column. bi-directionalline printer.
The 1/0 structure of the 8049 minimizes the amount
of external hardware needed to control the printer and
the large amount of on-board program and data memory allow quite a sophisticated control program to be
implemented.
1-180
APPENDIX A. SCHEMATIC DIAGRAM
(
+ 5 VOLTS
~
11.0 MHZ
XTAL
2 XTAL 1
=
I
,.
I
,
,
15pF
P11~
2,uF
2716
PlO 27
rlRESET
I
OPTO·TRIAC
MOTOR DRIVER ~
r---------------------------------,
3 XTAL 2
8049
8039
P20~
P21 ~ ...
P23
TO
PSEN
WR
RD
DBa
DB1
DB2
DB3
DB.
DB5
DB6
DB7
......
,
......
~
<0
1
9
10
8
12
13
14
15
16
17
18
19
I
21
19
17
15
10
8
6
4
008
007
006
005
004
003
002
DO,
8212
018 22
017 20
016 18
0151-1:..::..---,
014 9
013 7
012 5
Db 3
L
THE 8212 AND THE 2716
WOULD NOT BE NEEDED IF
AN 8049 WAS USED INSTEAD
OF AN 8039
~-----ll SOLENOID DRIVER #11
r---i
SOLENOID DRIVER #21
r---1S0LENOID DRIVER #31
DS2
J~"UV"
1
2
3
4
5
6
7
8
l
1 23
D01DS1 INT
DO,
003
004
L.---:~D05 8212
L._ _ _1~5HD06
L.._ _ _--.;.1;M7 007
L-_ _ _ _~1~~~D08
~
A7
A6
As
A4
AJ
A2
A1
LINE FEED
DRIVER
~2
011
012
013
014
0,5
016
017
3
5
7
9
16
18
20
r-
{>o-- BUSY
DATA1
DATA2
DATA3
DATA4
DATA5
DATA6
DATA7
SOLENOID DRIVER #41
SOLENOID DRIVER #51
8212
ll.i:=
ISOLENOID DRIVER #61
L-----IISOLENOID DRIVER #71
>
~
....
inter
AP·91
APPENDIX B. MONITOR LISTING
dl (
08 J
~Eg
,"I,
,P.O.P.."
IMPLE"ENTS CONTROL OF THE C ITDH "ODEL 82B
THE H"ROWARE CONFIGURATIDN IS AS SUCH:
,'PINTER
:8212 INPUT PORT ON 8us • DATA INPUT
16
;8212 OUTPUT PORT DN BUS' OUTPUT TO SOLENOID HAM"ERS
;TI !HPUT • CHARACTER POSITIONING SENSOR ON PRINTER
,TB :HPU! • iNTERRUPT FRO" 8212 INPUT PORT
;PORT IB
MOTOR ON, LOW' ON
,PORT 11
LIME FEED STROBE, LOW' ON
'PORT 16 • LEFT HARGIN SENSOR, LOW WNEN COYERED, HIGH WHEN OPEN
:PORT ,7 • RIGHT MARGIN SENSOR. LDU UHEN COVERED, HIGH UHEN OPEN
;TI • PIM 2 OF L"339, PRINT WHEEL SENSOR
:PORT 16
PIN 13 OF LM339
:PORT 17 • PIN \4 OF LH33'
17
13
:.~
s
~
10
J.I
12
13
14
15
19
20
21
OBBa
B8BI
0811~
BD B3
~
~.*
STBCHT
9804
26 TEMPI
BOO~
27
STATLIS
E9U
E9U
E9U
EgU
EDU
egU
;POINTS
:POINTS
;STATUS
: STROBE
P.B
Rl
~,;!
R3
38
3I
32
33
34
35
36
37
aBOF
aS26
38
3q LI HCH T
4B ,IUNK 1
41 "AX
42 FI P. ST
43 SEJE['T
egU
egU
EQU
EQU
AT INPUT LOCATION
AT OUTPUT LOCATION
FOR PRINTING
COUNTER
;BIT
LINE FEED SET
;BIT
PRINT
:BIT
CONTINUE
;BIT
• CR FOUND
:BIT
LF FOUND
:BIT
LF FOUND IN PRINTING
;BIT 6
PRINT DIRECTION
;9 = RIGHT TO LEFT
:\ = LEFT TO RIGHT
:BIT 7 • BUFFER LOAD DIRECTION
;B = FIRST TO "AX
:\ = MAX TO FIRST
:THE LIKE COUNTER
29
Bsa,
••••••••••••••••••••• •••••••••••
R4
R5
2S
BBB6
~.~
: SYP EM EOLIATES
22 i IlB UF
23 OUTBUF
24 SAIIPHT
2S
.•.• .. -.... •• * •••••••••
R6
~7
6FH
:"AX BUFFER LOCATION
:BOTTOM OF BUFFER
~BH
1-182
intJ
LOt
OBJ
AP·91
SE9
S OllP,( E 5THTEH£HT
.4
asBB
45
ORe
4.
'7
, J UM P
4~
[IJ S
5B
51
52
53
54
O~
43
JaBB 15
aBB 1 94BB
BBBA
aOOH
on R
'! HE
IHTERRUPT LOCATIOHS
I
BL I H
, ' "P
G
; DOH' T LISE IHTERRUPTS
:BEGIH THE PROGRA"
BAH
:START THE PROGRAH
55
56
57
BBBA FD
DB OF 3211
BBBD 340B
OB BF 04 BA
58
'L O(IP
PRHT,
5~
60
61
62
63
64
65
67
iI( HK
69 LPRHT: ,IHP
: GO F I X UP TH E STATUS
6~ LPRIH l'
J87
; ,IUHP TO CASE 2 AHD 3
[.~SE23
70
,I"P
: ,I UHP TO CASE B AHD I
( ~ SE 8J
7I
72
,( .. 5 E0 I ' LOA[II HG THE BUFFER FRO" FIRS T TO "AX
,
n
BBI7
B~2B
74
CASESl: HO ';
8828
~5
lu
, ,
"0';
BSIB FA
as lL 940['
[)2S2
~4 8 3
?a
OB2B
lJB22
B431
as
9 I'
82
B3
882'-
B~6F
84 CASH3:
35
ao 26
BBbF
aa28
e92[1
aB2F
~9
CHL
JBb
CPLL
JHP
:(~~E23
NOV
HOV
MY
CALL
9483
8~
CALL
04 aD
98
~ I
92 HHC-T
\,I"P
D2C2
87
\186
T
(lUT9UF ,HIRST
1 H3llF, 'FIRST
A, ,A'/PHT
"0'/
a.
as
0828 F~
31329 '34 [1[..
: GE T THE STATUS
: IF PRIHTIHG, [:DHTIHUE
:READ IHTO THE BUFFER
:LOOP
,T HIS ROll T I HE PRIHTS A LI HE
FIP.~T
SA 'JE S THE STATUS
,AHD THEH DE~ER"IHES WHHH DIRECTIOH TO PRIHT
'AHP HCI!4 a MAHIPULATE THE BUFFER
8019
BBJE
THE BUFFER F lLL S UP
A,saTUS
lPRl1T
UIBUF
PPIH
'p
6.
DB II 34C'
aSI, F224
aSls 0417
LIN T I I
HOV
J BI
CALL
J"P
"[)TON
( t-I SE 1
PP.HTBK
( "SE 0
.
:SET UP OUTBUF
:SET UP IHBUF
:GET THE SAYED STATU S
;TURN OH TNE MOTOR
:PRINT F OW ARD
:GET REAOV TO PRINT BACKWARDS
;PRIHT BACKWARDS
LOA[II HG BUFFER FRDH MAX TO FIRST
Ol! TaUF ""AX
,HBUF, 'HAX
A '; !1'Jp NT
HOHlIl
C""E 3
P~llTBK
( H 5E 2
1-183
: SE T UP OUTBUF
:SET UP IN8UF
; GE T THE PRINT STATUS
,: TURN OH THE HDTOR
; PR I NT LEFT TO RIGNT
:GET READY TO PRINT BACKWARDS
,PP.INT RIGHT TO LEFT
inter
loe
OBJ
Bnl FI
8132
8134
·1136
1138
lilA
IIlC
813E
1141
1142
1144
34'1
8121
F242
'45E
CUE
BF2B
'463
1431
BF28
8I4A
884B
884D
114F
1151
FL
B128
l491
AF
1444
H6J
8146 945E
8848 CiAE
1152 FI
Bl53 3491
IISS AF
1156 8128
1158 F262
liSA 9463
115C '4SE
liSE C675
8168 8452
8862 B128
1164 BF28
I I " 9463
816B 945E
IIU Ci75
8B6C Fl
IB6D 3491
IBiF 8462
AP·91
SED
9J
H
SOURCE STATEIIENT
CASEI'
95
,."
IBI
"
IBI
H
112 FOC'
183 FOC I'
184
115
186
187
188
IB'
118 "
111
112
113
114
115
116 CASEI'
117
liB
119
121,
121
122
12l
124
125 CRFOKD.
126
127
12B
129
131
131
Il2
133 tEJECT
IIOY
CAlL
HOY
JB7
CALL
JZ
"OY
CALL
JIIP
HOY
CAlL
CAlL
JZ
"OY
"OY
CALL
HOY
Jill'
A, .OUTBUF
FKPRHT
.OUTBUF,12IH
FOC
I NCT ST
WATCHD
JUNK L 128H
GTPRHT
CASEI
J UNU, 128H
GTPRNT
I KCTST
WATCHD
A, IDUTBUF
tDUTBUF,12IH
FKPRHT
JUNU,A
FOCI
IGET THE CHARACTER
IADJUST FOR PRINTING
,PUT A SPACE IN BUFFER RAN
'FOUND A CR
'UPDATE OUTBUF
I WAIT FOR" END
ICET A SPACE TO PRINT
IGO PRINT A SPACE
IlOOP
IGO PRINT THE LAST SPACE
IGO PRINT A CHARACTER
)CHECK OUT BUFFER
IWAIT FOR THE END
)GET THE CHARACTER'
,PUT A SPACE THERE
IFIX THE CHARACTER UP
) SAYE IT
,LOOP
)
:CASE I. PRI NT! NG LEFT TO RIGHT. LOADING 8UFFER FRO"
)FIRST TO UX
"OY
CAlL
"OY
"OY
JB7
CAlL
CALL
JZ
J"P
"OY
"OY
CALL
CAlL
J2
"DY
CALL
JIIP
A.IOUTBUF
FKPRNT
JUHU.A
.OUTBUF,128H
CRFOHD
GT PRHT
INCTST
. YATCH
CASE I
tDUTBUF .128H
J UKK I •• 28H
GTPRHT·
IHCTST
YATCH
A, lOUT BUF
FXPRHT
CRFOHD
1-184
eET THE CHARACTER
ADJUST FOR PRINTING
SAYE Ace
PUT A SPACE IN THE BUFFER
FOUND A CR?
GO PRINT THE CHARACTER
CHECK THE BUFFER
IS THE LAST CHARACTER BEING PRINTED?
LOOP
PUT A SPACE IN THE BUFFER"IIEIIORY
PUT A SPACE IH TEIIP LOCAT 10K
GO PRINT THE SPACE
CHECK THE BUFF ER
LAST CHARACTER PRIHTtD?
GET THE NEXT CHARACTER
ADJUST IT
LOOP
intJ
Lot
OBJ
AP·91
SEll
SOURCE STATE"ENT
I J4
lI?l 947B
BB73 148A
BI75
8876
Bl77
Bl7B
887A
887B
8170
887E
117F
27
62
55
3488
.,
F27A
65
FD
5285
8881 '4DF
8883 53FD
8185 53F8
8187 AD
IBBB FA
IIU B271
BBBB B4BA
135
136
137 DOLF.
138
139
141
141
142
143 WATCN.
144
145
146
147 LOOPY.
14B
149
151
151
152
153
154 OYRI.
155
I"
157
158
159
JTHIS ROUTINE CALLS THE LINE FEED
;STROBE LINE FEED SOLENOID
;GO BACK TO THE PRINT ROUTINE
L1HEFD
PRHT
:THIS ROUTINE CO"PLETES A LINE WHEN THE PRINT
:NEAD IS "OYING LEFT TO RIGHT
CLR
"OY
STRT
CALL
IN
J87
STOP
noy
JB2
CALL
ANL
ANL
nOY
nOy
JB5
J"P
: ZERO Aci;
:ZERO TI"ER
:START THE TInER
:GO READ TNE LAST CHARACTER
:EXAnIH PORT ONE
:CNECK RICNT NAND SENSOR
) SlOP THE TI"ER
;GET THE STATUS
:JUHP IF CONTINUE IS SET
; TURN "DTOR OFF
:RESET BIT ONE
:RESE~ CONTINUE BIT
; RESTORE STATUS
ICET THE SAYE_ STATUS
:00 A LINE FEED IF BIT IS SET
IGO BACk TO PRINT ROUTIHE
A
T, A
T
LDBUF
A, PI
LDOPW
TCNT
A,STATUS
OYRI
"OTOF
A,IBFDH
A,'BFBN
STATUS,A
A,SAYPNT
DOLF
PRNT
I6B
BaeD FI
U8E 34'1
.891 8121
8892 F2'E
8894 9472
8896 t6AE
889B 8F28
189A 9463
IUC 8480
189E 8F 21
llAl '463
81A2 ,. 72
IIA4 .t6AE
llA6 F I
BlA?
BlA'
IUA
BlAC
3491
AF
BI28
BUB
161
162
163
164
;CASE 2, PRIHTING RIGHT TO LEFT, LOADING BUFFER FRO"
)"AK TO FIRST
165 CASE2.
"OY
CALL
166
167
168
169
178
171
172
173
174 FDCA'
1?5 FHRI'
176
177
178
179
188
181
182
183 $EJECT
noy
JB7
CALL
JZ
"OY
CALL
JftP
noy
CALL
CALL
JZ
noy
CALL
noy
"OY
J"P
A.eOUTBUF
FXPRNT
tOUTBUF, '28H
HCR
T>ECTST
WATCHD
JUHKI,128H
GTPRHT
CASE2
.1 UNK J, .2BH
GTPRNT
DE CrsT
WATCHD
~,UUTBUF
FXPRNT
JUNKI, ~
POUTBUF,128H
FDCRI
1-185
GET THE CHARACTER
ADJUST FOR PRINTING
PUT ~ SPACE IN BUFFER RA"
FIND A CR YET
CHECK THE BUFFER
IF ZERO YAIT FOR SENSOR FLAG
PUT SP~CE IN TE"P LOCATION
GD PRIHT SP~CE
LOOP
GET A SPACE
GD PRIHT THE CHARACTER
CHECK THE BUFFER
LEAH IF DDHE
GET A CHARACTER
ADJUST THE CHARACTER FOR PRINTING
SAYE IT
PUT A SPACE WHERE THE CHARACTER WAS
LOOP
inter
LDC
IIAE
1188
IIBI
1183
1184
D8J
.,3411
IUA
118C
IIBD
Bl8E
BlCI
02AE
FD
52BA
940F
UFo
53FB
AD
FA
8271
IUA
IIC2
IICl
IIC5
.IC6
I.CB
IICA
IICC
18CE
8101
1802
BI04
1106
IIVB
810A
BlOC
liDO
BlOF
FI
3491
AF
B128
H02
9463
9472
C675
B4C2
BI21
BF28
'463
9472
C675
FI
3491
8402
I."
IIB8
Ap·91
SEa
SOURCE SUTUENT
184
: THI S ROUTINE WAITS FOR THE SEHSOR,FLAGS TO BE COYEREO
185
:IIHEN PRINTIHG RIGHT TO LEFT
186
187
188 WATCHO: CALL
LDBUF
:GD READ THE LAST CHARACTER
A, PI
IN
JCET SENSOR IHFOR"ATION
18'
191
JU
IIAltHD
:'LOOP IF SEHSOR IS NOT COYERED
A,STATUS
191
HOY
JCET THE STATUS
OYR
:SEE IF CONTI HUE IS SET
192
J82
193
CALL
:TURN THE ROTOR OFF
"OTOF
A,IIFOH
:RESET BIT I
194
ANL
A,IIFBH
:RESET BIT 3
195 OYR :
ANL
STATUS,A
196
HOY
:RESTORE STATUS
A,SAYPHT
:CET
THE SAYED STATUS
197
"DY
DOLF
J DO A LI HE FEED
198
JB5
JRP
PRHT
J HIT
199
288
:CIISE l, PRIHTlNG LEFT TO RIGHT, LOADING BUFFER FRO"
211
282
:"IIK TO FIRST
283
I
214 CASEl : "OY
A,'OUT8UF
GET A CHARACTER
FKPRHT
FIX FOR PRINTIHG
285
CALL
S'AYE CHARACTER
216
JUHK),A
"OY
tOUTBUF,12BH
287
HOY
PUT A SPACE IN THE 8UFFER
JB7
LEAVE IF A CR IS FOUND
288
CR'FNO
219
GTPRHT
GO PRINT THE CHARACTER
CALL
21B
CALL
DECTST
CHECK THE BUFFER
211
WATCH
LEAVE IF DONE
JZ
LOOP,
212
CASEl
J"P
POUTBUF,128H
213 CRF NO: HOY
PUT II SPACE IN THE BUFFER RA"
214
HOY
JUHK1,'2BH
GET A SPACE
215
CALL
GTPRHT
PRINT A SPACE
216
CALL
DE CT S T
CHECK THE BUFFER
217
JZ
WATCH
LEAYE IF DONE
,2.18
A,tOUTBUF
GET NEXT CHARACTER
"OY
219
CALL
FXPRNT
ADJUST IT
228,
CRFNO
LOOP
J"P
221 SEJECT
1-186
AP·91
LOC
OBJ
BIBB
BIBB
BIBI
BIB3
8115
IIB7
8119
IliA
BIIC
BIBD
BIBF
BIll
1113
1114
8116
8118
IlIA
n
B21C
1287
8981
928F
FE
438B
AE
23FF
721A
H78
19
721A
'JZU
2413
2488
SE Q
222
223
224 L08UF:
225
ORG
I BBH
IN
A. PI
READ PORT I
JB5
IN"ODE
8IT 5 = H = LINE "ODE
226
J81
ARNP
JU"P AROUHD IF "OTOR IS ON
227
PI. 181 H
ORL
TURN TNE "OTOR OFF
J84
NOFF
228 ARHD'
NO F OR" FEED
KOY
229
A.L1NCNT
GET TNE LINE COUNTER
231
ORL
A.188N
SET KS8
231
KOY
L1HCHT.-A
RESTORE THE LIHE COUHTER
A,IBFFN
KOY
232
SET ACC
J83
233 HOFF:
NOlF
JUKP IF NO lINE FEED
234
CALL
llHEFD
GO DO A IF DR FF
235 8UTlOP: IN
READ THE PORT
A. PI
WAIT FOR SWITCH TO 8E RELEASED
236
JB3
NOLF
237
WAIT FOR SWITCH TO 8E RELEASED
JB4
NOlF
8UTLOP
LOOP
238
J"P
lOOP
2H HOlF'
LDBUF
J"P
248
241
,FIRST SEE IF A CHARACTER IS PRESENT IN THE BUFFER
242
IIIC 261F
III E 83
BlI F FD
Bl2B 5249
1122 9249
BI24 724A
1126 9406
B128 3461
BI2A A8
8128 FD
112C F239
812E 18
812F 2378
8131 08
8132 %49
BI J4 F8
8135 17
1136A8_
BI37 2449
BI39 F8
BI3A B7
BI38 A8
BI3t 231F
BI3E 08
BI3F %49
BI41 18
1142 2449
BI44 FO
BI45 1249
BIH 9258
BI49 83
243 lNHOPE' JNTlI
:IF CHARACTER PRESENT. READ IT
CHAR
244
; IF NOT. EXIT ROUTINE
RET
245
2H
,IF THERE IS
CHARACTER. READ IT
247
248 CHAR:
A.STATUS
:GET THE STATUS
"OY
: IF COHTINUE IS SET. DON'T LOAD
249
ARHDJP
JB2
258
:IF IF IS SET, DON'T LOAD
JB4
ARHDJP
JBl
LFCRCK
'WAS CR SET. SEE IF NEXT CHAR IS LF
251
252
CAll
GTeAR
'CD ~EAD A CHARACTER
253 GOOD:
CALL
FXCHAR
:"AKE SURE IT IS OK
254
KOY
;SAYE CHARACTER IN BUFFER "EHORY
PIHBUF.A
255
HOY
A, STATUS
:GET THE STATUS
256
J87
SUBI
:IF BIT 7 IS SET DECRE"ENT BUFFER
257
INC
IH8UF
:UPDATE IH8UF
HOY
258
A,I"A~.I
:CET TOP
259
XRL
A"IllBUF
:ARE WE AT THE TOP?
268
JNZ
ARHDJP
: IF HOT ,GET THE STATUS
Koy
261
A.INBUF
:GET IHBUF
262
DEC
A
: CHANGE 8V ONE
IH8UF,A
263
KOY
:PUT IT 8AC~
264
ARHOJP
:GET THE STATUS
J"P
265 SUBI:
"OY
A.IHBUF
'GET IN8UF
;CHAHGE
BY OHE
DEC
A
2"
;PUT INBUF BACK
267
KOY
IHBUF.A
268
:GET THE BOTTO" OF THE 8UFFER
HOY
A.IFIRST-I
A,INBUF
;TEST THE BUFFER
269
XRL
,INZ
'IF HOT ZERO READ THE STATUS
271
ARHDJP
271
INC
I HBUF
:"DVE INBUF BACK
272
ARNOJP
:CO GET STATUS
J"P
273 CETSTA: Koy
A,STATUS
'CET THE STATUS
274
ARHDJP
JBB
:IF BIT B SET. BYPASS
275
JB4
~TBlTl
'IF LF IS FOUHD. SET THE STATUS
276 ARNDJP' RET
: EXIT
277
278
279
BI4A 9406
814C 2J8A
814E 2428
;THIS ROUTINE "FORCES· A LF AFTER A CR
281 LF CRCK: CALL
281
KDY
282
283
284
J"P
FP
3259
4382
8348
AD
83
5268
4384
1348
AD
1168 83
286 STBITI' "OY
287
288
J8I
ORL
ADD
Koy
291
RET
292 STPRHT: JB2
293
ORL
294
ADD
HOY
8VEBVE: RET
289
298
2"
2"
297
;REAO A CHARACTER
;CET A lINE FEED
:JUMP BACK
;THIS ROUTIHE SETS THE STATUS BITS
285
815B
BI51
8153
81SS
BI57
1158
8159
8158
8,150
815F
GreAR
A,I8AH
GOOD
A.STATUS
STPRNT
A.182H
A.I48H
STATUS,A
BYE8YE
A. tB4H
A. t48H
STATUS. A
1-187
LOAD 'tHE STATUS
IF STILL PRINTIHG, LEAYE
SET PRINT'8IT
UPDATE POSITION COUNTER
PUT STATUS BACK
EX IT ROUT! NE
CHECK CONTINUE 81T
SET COHTINUE BIT
UPDATE PRINT DIRECTION
~UT THE STATUS 8ACK
EX IT
inter
LOC
OB,I
AP·91
SOUHE
SE"
~,lH~E"'EHT
;THIS ROUTIHE 'CONYERTS' LOWER CASE LET TERS TO
;UPPER CASE
2'8
299
HI
8161
8162
8164
8165
BI67
81 "
8UA
BI69
8160
BHE
Bl7B
BI71
8173
BI74
8175
BI77
817'
BI7A
BI7C
BHD
BI7F
BI88
BI82
8184
8185
'7
537F
AF
B3AB
E678
FF
37
8328
37
2474
J7
B3AB
37
AF
D3 BD
,67F
FD
HB8
AD
248F
FF
038A
C689
FF
D3ac
8187 '68F
8189 FD
BIeA 4318
81SC AD
8180 3458
818F FF
LOC 08,1
8198 83
81~1
8192
8134
BI96
BU?
8199
BI9B
819C
BI9E
BlAB
81AI
BIA3
BIA5
BIA?
BlAB
BIAA
BlAB
BIAe
BIAE
BIAF
81Bl
8182
BIS3
BIB~
UI B6
BIB7
81B9
BIBA
BIBC
BIBD
BIBE
BICB
H
03ac
C682
FF
3BI
3B2
383
3B4
3B5
386
3B7
388
3B'
31B
311
312
313
314
315
316
317
318
319
328
321
322
323
324
325
326
321
328
32'
338
331
SEg
FKCHAR': CLR
AIIL
A.17FH
HDY
JUH~J., A
ADO
A,IBABH
JHC
F I HE
A, ,I UH~ I
"DY
ePL
ADD
A,128H
CP L
A
FIXDUH
J"P
FIHE:
CPL
A
ADO
A,taASH
CP L
A
FIXDUH: HOY
JUHKI,.A
XRL
A,teOH
JHZ
LFTEST
A.STATUS
"DY
OH
A,IBSH
HOY
STATUS, A
F I XF I H
J"P
LFTEST: HOY
A,JlIHY.1
XR L
A, IBAH
J2
FIXUP
HOY
A.JUHKI
XRL
A,18CH
JII2
F I XF I H
F I XUP:
HOY
A,. STATUS
ORL
A,IIBH
HOY
STATUS,A
CALL
STBIlI
F I XF I H: HOY
A. ,IUH~ 1
SOURCE STATEMEHT
"
RET
3H FXPRHT:
HOY
XRL
J2
HO',
,IUHKJ, A
A, UCH
FFFIX
A. taOH
CRFIX
343
XU
J2
HOY
FF
344
345
346
347
348
HOY
AIIL
,IH2
358
351
HOY
352
RET
353 CRFIX' ORt
354
RET
355 l F F IK'
HOY
356
ORt
357
HOY
359
HOY
RE T
35'
HB FFF IX:
HOY
361
ORL
362
HOY
363
HOY
364
ORL
365
PiOY
,HOY
366
RET
367
368 lSCHAR' KOY
AHL
369
37B
RET
33
FF
533F
93
34~
; SAY( A
,: IS CHAR~CTER A CR
; IF IT IS HOT TEST LF
; CE T THE STATUS
J SE T BIT 3
:RESTORE THE STATUS
,: LEAYE
:CET CHARACTER BACK
; IS IT A L F
; TF ITS HOT, WE ARE DOHE
:CET THE CHARACTER BAC~
; IS IT A FOR" FEED
; IF HOT FOR" FEED, JUMP
; CE T THE STATUS
; SE T BIT 4
,:RETURH TH E STAT US
; SE T THE STATUS
;CET THE CHARACTER
.: THI S ROUTIHE RECOGNIZES A LF, FF. AN[' CR
;DURING THE PR I HT OPERATIOH
.: I T ALSO FORCES A SPACE IF A CHARACTER FOUHD
,: I H THE SUFFER IS HOT I H THE LOOKUP TABLE
03BD
C6AB
FF
03BA
C6AB
53EB
%BD
232B
83
4398
83
FO
4328
AO
2328
83
FO
4328
AO
FE
4398
AE
2328
:JUHP TO TEST CR LF
!HOW SUBTRACT ABH FRO" AC C
:EKIT FIx('HAR
332
333
334
335
336
337
338
34B
341
342
CLEAR THE CARRV
SYRI P "S8
SAYE ACC
SEE IF HUI/BER IS 6BH
: IF CARRV IS~'T SEL ,IU"P
; CE T Ace BACK
; SUBTRACT 2BH FROI/ THE ACe
XP.L
J2
ACC
:FDRM FEED
,: CO SET FOR" FEED
:RESTORE CHARACTER
:SEE IF IT IS A CR
:LEAYE IF IT IS
;GET ACC BACK
:SEE IF IT IS A IF
'LEAH IF IT IS
:CET CHARACTER BACK
.: SE E IF IT IS A CHARACTER
;IF IT IS JUHP
:PUT A SPACE I H ACC
; SA liE
A ••.1 UHK 1
A,JUNK!
A,IBAH
LFFIX
A, ,I UHK 1
A,IBEBH
I SCHAR
A.12BI!
;HIT
>.BBH
A.STATUS
A,laH
STATUS, A
A,12BH
A.STATLIS
A.12UH
STATUS, A
A,LlHCHT
A,18BH
L1HCHl,. A
A,12BH
A J LINk 1
A,I3FH
; SE T 81T 7
: EX I T
:CET THE STATUS
:SET LF BI T I II STATUS
:PlIT THE STATUS BACK
: CE T A SPACE
; EXI T
:CET THE STATUS
,: SE T L1HE F fED BIT
:PlIT THE STATUS BACK
; GE T THE LI HE COUHT
: SE T BIT 7
,: PU T L1HE COUNT BAC~
:CET A SPA CE
:EXIT
:GET CHARACTER BACK
:STRIP THE TWO "SB
: HIT
1-188
intJ
LOt
08,1
Ap·91
~H
371
H2
!.OURCE STHTE"EHT
:THIS ROLITlHE PRIHTS THE
373
AC
E7
E7
BICI
BIC2
BIC3
BIC4
6C
BICS
BIC.
81 CB
BICA
2C
82CA
44AB
6U8
BICC
BICD
BICE
BlOB
BID2
BID4
8106
DID7
AF
FD
0204
5608
2406
4604
BI08
BIDA
BIDB
BlOC
81 DE
81 EB
BIEI
81 E2
81 E3
23F3
FF
9B
62
55
I6EB
24 DC
27
9B
65
83
CH~p.AeTER
1 H THE ACe
TEftPI.A
; SA'H CHARACTER
PRHTIT: HOY
A
:"ULTlPLY BY TWO
RL
37S
:"ULTIPLY BY FOUR
RL
A
376
A,'TEHPI
:ADO OHCE TO HULTIPLY BY 5
ADD
377
378
;HOU SEE WHAT PAR T OF THE LO[o':UP TABLE TO USE
379
388
:PUT CHARAC'TER I H A, TAR~ET IH TE"P I
XCH
381
A.TE"PI
,185
SHORT
: ,IU"P TO HI CH A[IDRESS IF BIT 5 SET
382
:CO TO FIRST PART OF LOOKUP TABLE
PACEI
3B3
J"P
;GO TO SHOHD PACE OF LOOr.UP TABLE
PAGE2
384 SHORT: J"P
3B5
:THIS ROUTIHE TRIC~ERS THE SOLEHOIDS FOR 6BB "ICROSECOHDS
3B6
; AF TEP. WAITJH~ FOR THE HIGGER SI~HAL FRO" THE PRINTER
387
:
3BS
3B9 FIRE:
HOY
JUHKI,A
: SAYE THE ACC
39B
HOY
A,STATUS
:GET THE STATUS
391
JB6
HTI
: SEE IF FORWARD OR BACKWARDS
392 FIREX:
JTl
; WA IT FOR T1
F I REX
393
FIREY
: LEAVE
J"P
394 NT 1 :
NTI
JHTI
'lOOP
395 FIREY:
A.JUNKI
:GET ACC BACK
HOY
396
PRB,A
:TRIGGER THE SOLEHOID
HOYX
397
398
:HOW ~ILL .BD HICROSECONOS
399
A, IBF3H
:LOAD DELAY HUnBER
4BB
HOY
T.A
: PU T IT IH TI"ER
4BI
HDY
T
; START THE TIHER
482
STRT
;LOOP OH TlftER FLAG
JTF
KrDUN
4B3 TSJTF:
TSJTF
4B~
J"P
;ZERO ACC
4B5 ~TDUH:
CLR
A
UB., A
;TURN OFF SOLEHOIDS
HDYK
486
TCHT
;STOP THE TI"ER
4B7
STOP
.:
EX I T FIRE ROUTIHE
48S
RET
4B9 tE J ECT
374
.
1-189
inter
LOC
OBJ
AP·91
SEQ
418
411
412
413
8288
8211
8281
8212
·8213
8284
n
8215
8216
8287
8288
828'
?C
12
II
12
7C
828A
8UB
828C
8280
821E
7F
49
H
H
36
828F
8218
8211
8212
8213
3E
41
41
41
22
8214
8215
8216
1217
12J8
41
41
41
3E
3E
41
SO
59
7F
.,
.,
121' 7F
821A
821B H
821C
8210 41
414
415
416
417
418
419
428
421 TABLE I'
422
423
424
425
426
427
428
429
438
431
432
433
434
435
436
437
438
439
448
441
442
443
4"
445
446
447
448
449
451
451
452
453
454
455
456 IEJECT
SOURCE STATEKENT
; ••••
~.~
•••••••
~.~
•• •••• ••••
~
~
~.*
•• •••••• * •• ••••••
~
~
*.*~
•••••• *.
-
!THIS IS THE LOOkUP TABLE. THE "sa IS HOT USED; THE "SB
I
liS THE DOT TNAT IS THE TOP OF AHY GIVEN CHARACTER AHD THE
!LSB IS THE ['OT THAT IS THE BOTTOK OF ANY GIVEN CHARACTER
; •••••••• **.* •• ~.*.~~
.
ORC
)
...... .. ......
~
288H
DB
DB
DB
DB
DB
3EH
41H
SOH
59H
4EH
DB
DB
DB
DB
08
7tH
12H
II H
12H
DB
DB
DB
DB
DB
7FH
49H
49H
36H
DB
DB
DB
DB
08
HH
41H
41H
41H
22H
DB
DB
08
DB
DB
7FH
41H
41H
41H
lEN
DB
DB
DB
DB
DB
7FH
49H
49H
49H
41H
~
.... -
......
•••
... "
.....
_
nH·
............
4~H
•• ••
......
•
.......
......
........
1-190
*•• * •••• ~.*
....
*.* ••••• ~ •••
inter
LOC
OBJ
02lE
021F
0228
8221
8222
7F
89
B9
89
81
JE
41
8223
8224
0225
8226
8227
41
8228
8229
122A
822B
822C
7F
88
OB
8B
7F
822D
822E
B22F
823B
8231
88
41
7F
41
HI
8232
8233
8234
8235
8236
21
48
48
41
3F
8237
8238
82l!
82JA
123B
7F
18
14
22
41
823&
823D
823E
823F
8248
7F
41
48
48
48
1241
8242
8243
B244
8245
7F
82
Be
82
7F
8246
8247
824B
824'
024A
7F
84
88
IB
7F
51
71
AP·91
SE g
457
458
45'
468
461
462
463
464
465
466
467
468
4"
478
471
472
473
4H
475
476
477
478
47'
4B8
481
482
4B3
484
4B5
4B6
487
4B8
4 B'
498
4'1
4 ~2
H3
494
4'5
4%
497
498
499
58B
501
502
58l
584
585
506
587
508
50'
SIB
SOURCE
DB
DB
DB
DB
DB
ST~TE"EHT
7FH
O~H
8~H
8~H
BIH
DB
DB
DB
DB
DB
JEH
4IH
41 H
51H
71H
D8
DB
DB
DB
DB
7FH
8SH
BBH
BBH
DB
DB
DB
DB
DB
B8H
41 H
7FH
41 H
BOH
DB
DB
D8
DB
DB
28H
48H
4BH
4BH
3FH
DB
DB
DB
DB
DB
7FH
88H
I4H
22H
41H
D8
DB
08
DB
DB
7FH
4BH
4BH
48H
48H
DB
DB
DB
DB
DB
82H
BCH
82H
7FH
DB
DB
DB
DB
DB
7FH
84H
88H
18H
7FH
... "...
.......
"
7FH
. . . . . . . III
.......
... "..
.........
.•
.......
...... ,.
.... "..
7FH
........
...... :t • •
511 HJECT
1-191
inter
lOC
OBJ
124B
824C
8240
B24E
B24F
JE
41
41
41
8258
12'1
1252
8253
8254
7F
89
8'
89
1255
8256
8257
8258
82"
3E
41
51
21
5E
3E
B6
825A 7F
825B 89
USC
U
8250 29
B25E 46
825F 2i
U68
82U
8262 49
826l 32
4'4'
8264
8265
82"
8267
826B
81
81
7F
81
81
82" 3F
826A 48
826B 48
BUt 48
8260 3F
8HE
826F
8278
8271
8272
IF
28
48
28
8273
8274
8275
8276
8277
7F
28
18
28
7F
IF
AP·91
SEQ
512
51J
514
515
516
517
518
519
528
521
522
523
524
525
526
527
528
529
518
531
532
53.
534
535
53.
537
538
539
548
541
542
543
544
545
546
547
548
549
558
551
552
55.
554'
555
556
557
558
55'
56D
561
562
563
564
565
566 fEJECT
SOURCE STATE"ENT
•• :fI".
DB
08
DB
DB
DB
lEH
41H
41H
41H
lEH
DB
DB
DB
DB
08
7FM
89M
89M
89M
86H
08
DB
08
DB
lEH
41M
SIH
.21H
DB
5EH
" * ....
DB
DB
DB
DB
DB
7FH
B9H
19H
••••• ,,*
08
DB
DB
08
08
......
........
•
••
..
29H
••
••
46"
26H
49"
49"
49H
32H
08
DB
DB
DB
08
81H
81H
08
DB
DB
DB
DB
3FH
48H
48H
48H
lFH
08
08
DB
08
DB
IFH
28H
48H
28H
IFH
DB
08
DB
DB
08
~FH
••
._.:t.
7FH
81H
81H
........
......
....
..
:
"
. " "."fI:
.........
28H
18H
••
..... "' ......
2BH
7FH
1-192
inter
lOC
08J
827B
827'
827A
8278
B27C
as
63
14
B27D
B27E
B27F
828B
8281
83
84
7B
84
B3
8282
8283
8284
B285
8286
61
51
4'
45
43
14
63
8287 7F
8288 7F
un
H
828A 41
828B 41
82SC
8280
828E
828F
8298
82
84
88
18
28
8291
8292
8293
8294
829'-
41
41
41
7F
7F
B296
8297
8298
B2"
829A
18
DB
B29B
829C
8290
. B29E
.29F
4.
4.
4B
B4
DB
18
4B
4.
AP·91
SEg
567
568
569
578
571
572
573
574
575
576
577
518
579
58B
581
582
5B3
584
585
586
5B7
588
589
"8
"I
B2
593
"4
595
5"
"7
598
599
68D
681
682
6BJ
6B4
6B5
6B6
6B7
688
6B9
618
611
612
613
614
615 .EJECT
SOURCE SHTE"EHT
08
08
DB
DB
08
63H
I4H
88H
14H
63H
DB
DB
DB
DB
DB
B3H
B4H
78H
B4H
B3H'
DB
DB
DB
08
DB
61H
51H
49H
45H
43H
08
08
DB
DB
DB
7FH
••
••
..
••
....
••
..
••
..
••
.........
7FH
41H
41H
41H
DB
DB
DB
DB
DB
B4H
B8H
18H
28H
DB
08
DB
DB
DB
41H
41H
41H
7FH
7FH
DB
DB
08
DB
DB
IBH
B8H
84H
B8H
IBH
DB
DB
08
DB
DB
48H
4BH
4BH
UH
4BH
B2H
.......
.........
.
1-193
inter
loe
12A8
12A2
12A3
IU4
12A6
BU7
IUB
IUR
12AB
B2AC
B2AD
UAF
,8281
OBJ
8811
FA
37
0283
Fe
A3
Hce
IC
18
FB
0385
"A6
84AE
1283 FC
1284
1286
8287
12BB
B289
1288
Inc
BUD
82BE
I2SF
I2ca
I2C2
I2C4
nB4
AC
FC
A3
HCC
FC
87
AC
IB
FB
OU5
"B7
84AE
AP·91
SEQ
616
617
618
619
628
621
622
623
624
625
6a
627
628
629
638
631
632
6ll
634
635
63'
637
638
639
648
641
642
SOURCE STATE"EHT
PAGEl:
lHO:
"OY
"OY
CPl
J86
"OY
"OYP
CALL
INC
INC
HOY
XRL
JHZ
Jilp
BAKWRD: "OY
ADD
"OY
LKLOI: "OY
"OYP
CALL
"DY
DEC
KOY
IHC
HOY
XRL
JNZ
643
J"P
644 fEJECT
STBCHT. nIH
A.·SAYPHT
A
BAKWRD
A. TE"PI
A U
FIRE
TE"P I
STaCHT'
A,STBCHT
A·185H
LHO
SETTI"
A. TE"PI
A.184H
TEKP LA
A.,TE"PI
A. IA
FIRE
A·TEKPI
A
TE"P J.. A
STBCHT
A,STBCHT
A,185H
LKLOI
SETTI"
1-194
ZERO STROBE COUNTER
GET DIRECTIOH
FLIP BITS
IF BACKWARD JUHP OUT
GET THE TARGET
GE T THE DATA
STROBE THE SOLENOIDS
IHCRE"EHT THE POI HTER
IHCRE"ENT THE STROBE COUNTER
GET THE STROBE COUNTER
IS IT FIH
REPEAT IF NOT FIYE
GO BACK
GE T THE TARGET
COKPEHSATE FOR GOING BACKWARDS
SAYE IT
GET THE TARGET
GET THE DATA
STROBE THE SOLENOIDS
GE T TE"PI
DECREASE BY ONE
PUT IT BACK
IHCREftEHT TNE STROBE CDUNTER
GE T THE STROBE COUNTER
IS IT FIH
REPEAT IF NOT FIYE
GO BACK, CHARACTER IS DONE
inter
lOC
OBJ
a385
1386
8Ja7
BlBB
BlB'
88
64~
658
651
652
653
654
DB
DB
DB
DB
DB
BBH
BBH
BBH
BBH
BBH
65'
DB
DB
DB
BB
65&
657
658
08
IB
65'
D9
BBH
BBH
5FH
BSH
BSH
OS
OS
D8
OS
OS
BBH
B7H
S BH
S7H
BBH
DB
DB
08
DB
08
14H
aa
88
aa
aa
88
5F
B3U 87
830E aa
14
7F
14
7F
14
24
211
7F
2A
12
IJU 23
IJIA 13
83IB BS
nlc 64
BHU 62
13lE
831F
832!
8321
8322
.
II
BJBA BS
1314
B315
BJH
8317
B31B
SOURCE SlATE"EHl
;.
ORC
8388 B7
B3BC BB
n8F
13IB
8311
BJ12
1313
SEQ
645
646
647
648
BlBa
8388
a381
B312
B313
lJa4
AP·91
36
49
56
2B
'8
;
66B
661
662
663
664
665
666
667
668
6"
678
671
672
673
674
675
676
677
678
679
681
681
682
683
6S4
685
6S6
687
688
689
6~B
3BBH
·• ••
7~H
. . . . . :t . . .
.......
•
14H
7FH
14H
08
08
08
7FH
DB
DB
2AH
HH
DB
DB
DB
23H
IJH
BSH
·
.........
.• •
~4H
~AH
DB
64H
DB
62H
DB
DB
OS
lDH
HH
56H
2BH
5BH
08
08
...
..••
..••
•• ••
• • ••
•
••
tEJECl
1-195
inter
l[le
OS.I
AP·91
SE
Q
HU~(E
ST~:EI'IEtn
691
8323 8B
B324 99
B32~, B;>
8326 B8
932:' 9B
695
[IS
OS
[IB
[lB
696
['8
BBH
8BH
[IB
[IS
[IB
[IS
[IB
HH
22H
41 H
B8H
88H
[IB
OS
[Ie
DB
[Ie
BBH
8BH
41 H
22H
ICH
['B
[IS
[,e
De
[IB
J4H
~ FH
14 H
22H
692
693
694
...
88H
89H
87H
697
B329
9329
B32A
B328
832C
It
22
41
BB
88
8320 BB
832E BB
832F 41
B338 22
8331 I t
8332 22
8333 14
8334 7F
833~ 14
B3Jt.
2~
8337
8338
83H
833A
833B
9S
98
7F
BS
693
699
788
7BI
7B2
;>B3
7B4
lBS
7B6
797
79B
789
718
711
712
? 13
714
~2H
715
88
71 b
717
718
7B
729
DB
OB
DB
DB
['B
BSH
BSH
?F H
BSH
BSH
721
833t
8330
833E
83 JF
8348
BB
48
3B
B8
B8,
722
723
724
?25
72\i
[I,B
['B
[Ie
[IB
[IB
3BH
[IB
OB
[Ie
[,e
[IB
BSH
BSH
BSH
BSH
BSH
['S
DB
['B
['8
[19
B8H
B8H
4BH
BBH
B8H
[IB
[IB
['B
2BH
18 H
BSH
BSH
4SH
SB~
BBH
7""
8341
8342
8343
8344
8345
BB
B8
88
Be
8B
B346
B34;>
B34S
B349
B34A
88
8B
4B
BB
8B
na
729
738
731
732
"
733
834B
834C
8340
834E
B3H
B358
B3S1
B352
B353
8354
28
18
8&
84
82
3E
51
49
45
JE
734
?3~
736
737
733
733
749
74 l
742
74 J
;>44
745
746
747
746
749
750
['8
B4~
[lB
B2H
[IB
[IB
[IS
[IB
[IB
3 EH
,<1 H
.... ..
'
4~H
45H
JEH
751
8355
8356
B357
835S
8359
9B
42
7F
4B
8B
83SA
B35S
B3 SC
B35D
B3 SE
62
51
752
753
754
7~S
756
[IS
[IB
. (IB
[IS
[IS
BSH
42H
;>FH
4SH
8BH
..
.
757
49
49
46
B3SF 21
BHB 41
759
759
769
761
7ioC!
763
(64
7';5
[lB
[IS
[IB
[lB
[IB
[18
[IS
62H
,<1 H
49H
49H
4f.H
<1 H
41 H
1-196
inter'
l~C
08,1
8361 4~
8362 4P
8363 33
8364
83.5
836£
8367
8368
IS
14
12
7F
18
836~ 27
836~ 45
8368 45
836C 45
8360 39
Ap·91
~E"
76E
76 ;-
768
769
778
771
712
773
774
775
776
777
778
779
788
791
8lOE
830F
8378
8371
8372
8373
8374
8375
8376
8377
3C
782
4A
783
784
4~
49
31
8J
71
99
85
83
8378 36
8379 49
83lA 49
837B 49
837C 36
785
78.
737
783
789
n8
791
792
7S3
7H
795
79i1
;:'97
798
~OUP.(E
P9
81H7;:"EHT
4~H
pe
(.e
4 ['H
33H
(.e
De
(.e
[.e
De
ISH
14H
12H
08
OS
DS
[.s
[.s
18H
27H
45H
45H
45H
3~H
JrH
4AH
49H
49H
31H
(.s
[.e
(.e
DB
['B
8JH
DB
3tjH
08
49H
49H
49H
36H
DB
D8
• .to.,. •••
7FH
De
I·e
09
[.e
pe
(.s
.. .
,..,. ..
...
.. ..
7JH
89H
a5H
a3H
•
799 $EJECT
1·197
inter
LOC
OBJ
B370 46
U7E 49
B37F 4'
neB 29
B381 lE
AP·91
SEQ
8BB
881
882
9BJ
884
B85
SOUP.LE SHTE"ENT
DB
DB
DB
46H
DB
49H
49H
29H
DB
IEH
DB
DB
DB
DB
DB
BBH
BBH
14H
BIH
BlH
DB
DB
DB
DB
DB
88H
4BH
..
••
•
_.:t*
8Bb.
8382 BI
8333
B384
U8S
13U
BB
14
B8
BB
8387
83SB
138'
83BA
8389
8B
887
888
aB'
83BC
83SD
83SE
838F
839.
BB
14
22
41
811
BII
812
91J
BI4
815
BI6
817
BI8
81'
828
821
822
BB
823
8391
8392
8H3
8394
83'S
14
14
14
14
14
48
34
B8
B8
8396 8B
8397
8398
83"
B3'A
41
22
14
B8
8398 82
824
825
82'
B27
828
8n
8J8
831
832
833
8H
835
836
DB
DB
DB
DB
08
DB
DB
DB
08
I'S
I'B
DB
OS
DB
...
34H
88H
BlH
·••
BSH
14H
22H
41H
IBH
••
•
••
·
··
14H
14H
14H
14H
14H
BBH
41H
·
... ••••
22H
1'9
14H
BaH
B2H
B1H
1J9C 81
837
836
08
08
BHO
B3'E B5
nn B2
839
S4B
841
08
5':4H
OS
08
B2H
"
••
.
:
BSH
842 $EJECT
1-198
intJ
LOC
08J
B3AB
83A.
83A3
8lA4
83A6
83A7
83A9
B3AA
BlAC
8lAD
BlAE
8lAF
8lBI
83B3
8385
8386
B388
8lB9
B3BA
8388
8380
838E
838F
83eB
8lC I
BlC2
8JC4
83C6
988a
FA
37
02S5
FC
836a
A3
HCC
IC
10
FO
IIl85
96;'6
34AE
Fe
8364
AC
FC
Al
HCL
FC
87
AC
18
FB
Ap·91
SEQ
843 PACE2:
844
845
8H
847 Lr. HI:
843
849
858
851
852
B5]
854
855
B56
9S7 8KURO:
853
859
86B L K H II :
861
962
D'3
8'4
865
8&6
867
D3BS
96B
%B~
~69
84~E
87B
871 SEJECT
SOLIRL' E
HOV
HOV
CPL
JO.
HOV
.:tDel
HO'JP
CHL
INC
IHC
HOV
XRL
,,1HZ
JHP
HO'I
AO[I
HOV
NOV
HOH
CALL
"OV
DEC
HO'J
INC
NOV
XRL
\IHZ
J"P
sa T EHENl
,18CH., _88H
II·SAVPNl
II
Bt:wrw
A·TEHPI
A·H9k
A.~A
FIRE
TEMP I
ST9LHT
II .• T8C lIT
II ,aSH
U:HI
S Ell I H
A·TEHPI
A.164H
TEMPI .. A
A.1EHPI
A·~A
FIRE
II·TEMPI
A
TEHPI .. A
S10CHT
A,SlBCHT
A,185H
L r. H I I
SEllIH
1·199
:ZERO SHOBE COUHTER
: GE 1 DIRECTION
: FL IP 8ITS
: IF 8ACKWARD JUHP OUl
: GE 1 lHE TARGEl
:.A~~IUSl 1 N E lAHEl
: GE 1 lHE DATA
:SlR08E·THE SOLEIWIDS
: INCREHENT THE POIHTER
: IHCREHEHT THE STROBE COUNTER
:GEl THE SlR08E COUNTER
: IS IT F ]V E
; REPEAT IF HOT F lYE
: GO 8ACK
:GET THE TARGET
: COMPENSATE FOR GOIHG BACKUARDS
: SAVE IT
:GEl THE TARGET
:GEl THE 011 lA
:STR08E THE SOLEHOIlIS
: GE 1 TE"PI
: DECREASE BY ONE
:PUl 11 9AU:
:INCREHEHT THE STROBE ('QUIlTER
:GET THE STROH COUNTER
: IS 11 F I V E
:REPEAT IF HOT FIVE
:GO BliCK, LHARArTER IS [IOHE
intJ
Loe
AP·91
08J
SOURLE S1IITE"ENT
SEQ
872
87J
874
875
876
877
878
879
88B
881
882
88J
884
885
886
887
888
8S'
S9B
891
lUI
,.
8411 27
8411
BU2 '418
G4B4 '4 JF
14B6 B48A
1488 23FE ,
I4IA J'
8488
14BO
BUF
1411
1412
1413
1415
8CB5
8FFF
8EfF
B'
J7
F21D
EE 11
B41? EF8F
B4U ECBD
B418 845A
B410
B41F
1421
1422
1424
B426
B428
8CIN:
.
SETUP:
BCB4
BFFF
8EFF
B'
37
023C
EE J8
EF 2E
EC2C
845A
8'Bl
8J
B43F
1441
8442
8443
B445
84 4~
23FE
62
55
8B28
BEB8
BOBB
B4H
B448
844[>
844E
B44F
8458
B452
8928
2328
Al
19
F"
0378
3HB
8454 "EF
B45& sa
8457 8'IB
:ZERO ArC
:TURN OFF THE SOLEHOIDS
, SE T UP THE PRINTER
:SET UP THE SOFTWARE
:GO 5 TART
A . IBH H
Pl. A
:LDAD At r WITH VALUE TO TURN ON KOTOR
:TURN ON "OTOP.
"O~
,NOW DHA'I J, 2 SECON[>S WH IlE CHECKIIIG RIGHT
SElFC:
SEL FB :
SEL FA:
U2
9B3
'B4
'85
'86
,
A
fRB· A
SETUP
VARSET
PRNT
DUYl
"OY
"OY
KOY
IN
CPL
TE"PI.1B5H
,IUHK I, I8FFH
l I NCHT ,ISfFH
A· PI
,187
OOHER
LIHCHT.SELFA
,I UHK 1 SELF8
TEHP I SELFr
EP. RO R
DJNZ
OJHZ
DJ H2
,I"P
II
JUHKI,IOFFH
LI H~H T UFFH
A. PI
oOHEF
L1HCHT. SELFI
,I UHK 1 .• ElF
ERROR
OOhEF : HOY
SELFCC' HOY
SElF8B: HOY
SElFAA: III
CPt
J86
DJHZ
OJHZ
TEKP 1 104H
JUHKI.I8FFH
L I H['HT *SFFH
A.Pl
A
DOHEl
LIHCHT SELFAA
,I UHK I, SElFBB
TEKP 1, SElF[ C
ERROR
P! .IDI H
OJH~
[>OHEl :
J"P
ORL
RE T
'ND~
YARSET: "[lY
HOY
STRT
928
"[lY
!t29
KO'~
93B
'31
'32
'33
,J4
"[lY
94.
H.
:SET UP DEL AV
: S[IKE HORE [>HAY
:GET THE FL H~ IHFORKATIOH
: IS FLAt rL eARED ,
:IF HOT LOOP
:LOOP 30"E "ORE
iLEHYE IF FLAG IS HOT UNC O'HRED
'HO~
,
AHL
KDYX
ORL
:LOAD [>ELAY
: LOAt> [>ElAY
: L(It~(1 [IE l~ '!' 3
: RE A[> THE PORT
: CHAlICE THIIIGS HROUIHI
ZE R0
:O~
IF BIT
I.
;S"~LL LOOP
;8IG~ER LOOP
:BIGLEST LOOP
:S[lKETHINt IS ~RONG
:TURN MOTOP. (IFF
:CO SACK
"
"
UP THE VARIABLES
SE T
A UFEH
T."
: L (I~{)
T
THE Tl HE R
:LOAD INPUT BUFFER
:SET LI HE r OUH T
. SET FORWAR[I 8 I:
THE Tl HER
:STH~T
I HBUF, HI RST
LIIHIH,IOBH
5TATUS IBBH
'CLEAP. THE RAft "REA BY
OUTBUF.IFIRST
"DY
935 CLR"EH: "DY
A.'2BH
~OllTBUF,"
'36
"O'~
OUT8UF
INC
'37
A,OUTSUF
HOY
'38
A,IIHU(~l
XU
'39
,1HZ
[LR"EK
'4B
'41
,NOW rLEAR THE 8212
942
'43
:""r.E
'NO~ CHEC~: THE LEFT SEHSO~ I H THE 5 AHE "ANHER AS THE
'RICHT SENSOR EXCEPT [IELA't [IHL V 2 5 SE~OH[lS
~27
945
SENSOR
:LDAD DELAV VAlli E OHE
;L[lA() [>ELAV IJAlUE TWO
:LOAO DELAY IJALUE THREE
, RE AD POP.T OHE
THINGS RIGHT
: 1 S 91T 7 SET>
,S"ALL LOOP
,:SIGGER LOOP
: 81 GUST LOOP
:SO"ETHIH~ IS WROHG
'HOW "AH SURE THE RIGHT SEHSOR 15 rLEARED
HOY
HOY
IH
J87
DJHZ
OJ HZ
\,I"P
987
842A
8He
B42E
B4 JB
1431
1432
B4J4
14J6
B438
B4 JA
84JC
B4 JE
CLR
CALL
CAll
J "P
B'3
B94
895
8%
8'7
898
89' DOHER:
'BB SHF;
'BI SELFI:
'B8
'B'
'18
911
'12
'13
• '14
'15
'16
917
'18
'1'
92B
'21
'22
'23
'24
'25
'26
4DBH
"DYX
B92
8FFF
8EfF
I'
F22A
EE 21
EFIF
845A
ORC
PI,IBEFH
A,UHBUF
PI. II 8 H
'47
1·200
~RITIHt
SPACE COl> E5
:LOAD OUTSUF
: PUT SPACE C. 0 [IE IH A [ [
,: PU T SPACE ('O[>E IN OATH HEMOR'I
:UPDATE THE POI NTER
,KOYE THE POINTER I lIT H Arr
:SEE IF [lONE
;LOOP IF NOT CLEARE[>
:5E1 EHABLE 8 I T
:CLEAR THE 8212 IHPUT BUFFER
; RE SE T EHA8LE
BIT
inter
LOC
08,1
Ap·91
5EQ
H8
SOURCE STA7E"EHT
,HOW EKIT VAR&ET
'4~
B45' B3
B4 SA a'FF
B45C 845t
B45E I'
B4 SF 2378
B461
8462 83
8463 0'
8464 37
8465 ['263
846? 1608
B46' 8467
B46B .5
B46C FF
B460 34C1
B46F HIC
04? ] 33
0'
8472
F~
B473 07
OH4 A~
8475 D3]F
B477 33
BHe FE
847; F23B
OHB HF[I
847D
BC4~
OHF BFlJ
8481 Ef 81
B483 H7F
848S 8'02
8497 1 E
B488 fE
B48~
[1328
B488 %8F
B480 BESO
RET
:LEAVE IHITIALIZATIOH
'SO
'51
, THI5 ROUTINE TURIIS THE "OTOR OFF AHO LOOf'S
952
'53
PI,IBFFH
:TURN OFF "OTOR
954 ERROR:
ORL
HAD
'LOOP BECAUSE SO"ETHIHG IS WROHC
'55 DEAD:
J"P
, 56
,THESE ARE ALL SliBROUTIHES TH AT ARE CALLED
957
958
95~ 1 H[ lST:
IHC
OUTSUF
;UPOATE THE POIHTER
NOV
:GET THE VALUE FOR THE LAST CHARACTER
%B
".tttHK+l
A.OUTBUF
961
XRL
: ['0 THE TE S T
962
RET
:E:nT
963 GTP RH T: IN
A.PI
: RE AD PORT OHE
964
CPL
A
:FLIP BITS
GTPRHT
:LOOP UHT lL SEHSOR IS Ulle-OVERED
%5
J86
;SEE IF TI"ER FLAG IS SET
966 TSTJTF' JIF
PIT
H?
TS TJ IF
:TEST FLAC
,I"P
968 P] T :
STOP
TCHT
'STOP THE T IHER
A . ,I UHK I
HOV
:GET THE CHARAI'TER
96~
; PR I HT THE CHARACTER
978
PRIlTI!
CHL
I
; GE T AHOTHER CHARACTER
CALL
LHHOI'E
,n:lT
972
RE T
A.OUTBUF
:GET OUTBUF
~7J ['E CTS T : HOY
~74
A
DEC
'RHUCE B'I' OHE
!475
HO,Y
OliTBUF·A
'PUT 8 AU: ] H Oll TBUF
A.fFIHT-]
:SEE IF IT IS ALL THE WA'I DOWH
9:'':'
XU
:E:OT
977
RE T
,?
"8
979
;THIS ROLITTHE ODES
'8B
A·LIHIHT
'81 L1HEF[" HOV
[. 0 F F
~J8 7'
~a~
,a3 LF [.0:
PI.IBFDH
"Hl
~a4
TE HP I • 4[J H
H["I
.11) N~: I .~3H
995 LF L PI'
HOV
996 LFLP2':
~JH<
.1 U HK 1 LCLP;:
~87
~9.!
OJHZ
ORl
IHC
NOV
XP.L
.1 HZ
9'3
"0'1
TEMPI. LFLPI
PI.I02H
L! IltHT
A.LltHAT
A t23H
'HOTOOH
L I tttH T ISOH
988
981
~~O
~ ~
I
'~4
B48F BtaS
OHI BFfF
84'33
EF~3
04~5
Et31
8497 SJ
04~B
O~
B4~'
H
53CB
04n C69B
049E 8901
S4AB ':147Ee
04A2 FE
04A3 537F'
84 "S 03BB
B4.7 C6,,[I
04.9 94?B
84 AB 134 A2
B4 AD 83
B4~A
B4 AE 23E8
BUB .2
B481 55
8482 83
'35
'96
;HO~
['E Lil \'
~S
LI HE FEE['
:GET THE Ll HE COUHT
BIT ~ IS SET, DO A fORHFEED
: TURIl OH THE SOLEHOID
: L Oft{, OllE [. EL"'I
, LOA[' "HOTHER OELA'I
'lOOP
.LOuP SO HE HORE
:TURH OFf LF SOLEHOID
:UPltATE THE Ll HE COUtHE?
'GET THE L IllE tOUHT
: IS PAGE DO HE
: S~: If' OVER
:ZERD LI HE COUHTER
:IF
HILLl5ECOH['S
:LOAO ['E LAY VALUES
HOHOH: HO'I
TE HP I· ISBH
.1 UHK I .• OFFH
~93 LOP I :
HO'I
HI H~: I . L Of'2
'_GEHERATE OEL AI'
[ILl HZ'
9~~ LOP 2:
TEHP I· LOP 1
ISOS
['J Il'
: Ll HE FEED IS [10 HE
RE T
1 BS 1
IB82
: T Hl S ROll T I HE (IOE S A FORM FEE [.
18B3
IB04
PI
:GET THS &TATU&
IH
1005 ['OF F :
CPL'
. FL If "CC
1886
IBO~
10CBI<
"HL
'LE"VE OHL'I TWO Hsa'S
[l OfF
:IF A n"e ISH' T COVERED, LOOP
1888
J2
P: IBIH
:TURH THE HOTOR OF F
180~
on
101 B
CALL
'GO DO OHE Ll HE fEED
l r :'0
NOV
A Ll HC HT
:GET THE Ll HE COUHT
I B I I FFC>: :
J B 1 .?
J7FH
:ST~lP Bn SEYE.H
"HL
1 B13
XH
: IS IT DOHE
" .• BOH
,I,
I B14
F F DOHE
:LE"VE IF IT IS
lOIS
CALL
L r ['0
'STROBE THE SOLEHOIDS
FfO'
1816
,I"P
: CHEU: TH.E fOR" fEED OU T
1817 FFOcrHE' RET
:t::nT FORH fEEO
1013
A nEBH
:GET [IE L A'l VALUE
1019 SET T] H: "0'./
!
:PUT I H TIMER
1828
HOY
:START THE TI HE Po
STR!
T
1821
: E:nT
RE T
182'2
1823
~97
"
"
1-201
inter
LOC
8483
8484
8485
84810
8487
B488
848'
848A
8UB
B4U
148E
B4Ca
UCI
I4C3
84C5
84C7
84CS
AP·91
SEQ
42
37
17
1824 PRMTBK:
1825
1B26
1827
17
I?
17
17
62
8'
HC8
S488
55
16C5
84CI
23FF
62
83
84CF AD
841'8 8413
84(J~ 4328
8404 SHe
8406 '!lEF
84 DB 98
9918
04!"
841'8 93
840C 9'F£
840e 33
84DF 8'81'
B4EI .83
USER S'tH90lS
HI a;8831
84CJ
BII71
[lOLF
FlIeR!
BlAB
F UfoT
aa~o
L TC"~
B4I'f.
lOBUF
B1 la
L IHrHT B886
L OPI
B4~1
WOlf
BI HI
PIT
SnFI:!
SHORT
T E"P 1
BHE!
0411
81 r~
SBB4
MY
CPt
IHC
IHC
1B2S
IHC
1829
INC
INC
1838
1831
MO"
1832 IULOOP: IH
1833
J87
,.IMP
I8J4
1835 CONPSr.: STRT
183" CONPB: JTF
1837
J"P
1838 ROTOPT: HOY
1839
MOY
1848
RE T
1841'
;TNI S
1842
1843
1844 STACHK: HOY
1845
JB4
1846 84R ET : HOY
1847
ANL
1848
1849
MOY
1858
JHP
1851 LFser, OH
,IMP
1852
1853
1854
;THIS
1855
1856 GHAR: AHL
1857
"on
1858
ORL
RE T
185'
18&8
IBIoI
!THIS
1B102
1863 "OTOH: ANL
1864
RE T
1865
;THI S
1866
1867
1868 "OT OF : OAL
RE T
18"
1878
1871
END
84C' FD
84CA 9202
84CL AA
B4eD 53C2
UHfl
LJiSEB
( OHPB
SOURCE STHTEKENT
08J
HDJf'
8141<1
UISEBl
(OHPU
['OHEf
8917
Hek
F 1 XbUH
Co TPkHT
LF CRC~
LIHEH
lOP~
B4~3
~R
B4RET
[~SE 1
BoIc(
842/01
U!F]X
bONEl
Dj AS
84 J[.
8411,
F F!JDHE
81 74
B4b3
814M
847B
Fl ~F 1 H
1 HBUF
If[lO
U:HI
LPRHT
BolA!'
BISf
BH8
DDS;:
IIBBB
8478
03~6
BD 11
HOTOON B48F
"T!
8104
PRHT
BBBA
&ElFAA D43a
STACHK 84C~
TSJTF
81 ['C
PRHTBk
S,ElFB
&TATUS
T ST~ TF
13"03
OIlBF
HSH"EtL'( ('OHPlETE.
HO~
BIHlS
846;"
, Gel THE TIHER
'TWO$ COMPlEMENT Ace
A."I
A
. A·
•A
)ADJUST "lIHER
)PUT IT BACr. IH THE TIMER
:READ PORT I
: IF HUSOR I ~ HOT COVERED . LEAVE
'OTHERWISE LOOP
.:START THE TIHEP
: SEE IF RE A0'/ TO PRINT
)OTHERWISE LOOP
) LOM' A
)PUT IT IN THE TIHER
: EX IT
T.~
A. PI
CONPSr.
IllLOOP
T
ROTOPT
LOMPS
•. IIFFH
T.A
ROUTINE ADJUSTS AND SAVES THE STATUS
A,STATUS
LFSET
SAVPNT .•
A, IBC2H
DURIN~
PRINTING
) GE T THE STATUS
.: SE T LINE FEED BIT
:SAYE THE STATU&
:RESET EYERYTNI NG EXCEPT
:DIRECTION ANO PRINT
)PUT THE STATUS BACK
)HIT
; SET BIT 5
, ,IU"~ BACK
STATUS.A
LPRNTI
A,IZ8H
84RET
ROUTINE READS
CHARACTER AHO PUTS IT IN
Pl,18EFH
A,@INBUF
Pl,IIBH
.: SE T ENABLE BIT
:REAO THE CHARACTER
:RESET ENABLe BIT
:HIT G.TCHAR
T~E
Ace
ROUT-I NE TURNS THE "OTOR OH
PI,IIFEH
)TURN "OTOP. ON
'eXIT
ROUTIHE TURN& THE HOTOP. OFF
PI, III H
;TURN "OTOR OFF
; £KIT
)OOHE
.(lAt:WRI, 9293
( ~SE2
DBell
[P.FIHI
[lONER
81HIi.
041 [I
8182
8J 8~
845E
Bl AE\
~ HI X
F J :
BBbF
IiDSN
84r5
8480
8158
8875
FXPP.HT
I SCHAR
lFlP .2
It;:LOI
"OTOF
OVRI
S kV'PHT
SEl.FCC
B942
8180
B481
B287
B40F
BB95
8882
i4.2C
5 TPRHT DIS!!
W~TC NO BB~E
ElUTlOP 011 :;
8lH
8472
tHAP.
[lEOST
F[JtI
F I REX
C,EHUI
JUt..: I
lFSE T
lH"ODE
"OTOH
PAGE I
B844
81 DO
BI44
BOO7
IH02
81H
1J4['C
Di!HB
SoELF
84 IF
~E TT 1 H 84.:1E
SUBt
81 J9
EB',' E BI68
(LPHE" 1344B
(lOFF
04"8
(I ~.
F I REY
Iuq,e
o t[,t>
tOOt,
8128
.: J['UH
I.FTEST
BlEB
81 ;OF
BO;'A
f[I(P
L OOPW
140fF
PAC;E2
SelF 1
8111F
HTUP
B3kB
8421
841J[C
TABt.Et
D~D8
MCS® .. 51 Application Notes &
Article Reprints
2
inter
APPLICATION
NOTE
AP-69
May 1980
~
AFN-01S02A-01
Intel Corporation 1980
2-1
intJ
AP-69
vss vee
}-.
P1.0
P1.1
P1.2
P1.3
PO.2
P1.4
P1.5
P1.6
P1.7
VPO/RST
PO.3
P3.D/RXD
P3.1/TXO
Pl.2I1NTO
Pl,-3.iNTi
P3.4/TO
P3.5/T1
RST/VPO
PO.4
PO.6
PO.7
YDO/EA
PiiOGfALE
}-"
PSEN
P2.7
TXD
. {RXD
iNTo
mr1
P2.6
P3.6/WR
P2.5
P2.4
P3.7fiiD
P2.3
XTAL2
XTAL1
P2.2
P2.1
V5S
P2.0
PORT 3
TO
T1
WR
AD
Figure la. 8051 Microcomputer Pinout Diagram
~}~M'.
Figure lb. 8051 Microcomputer Logic Symbol
1. INTRODUCTION
some microprocessor (preferably Intel's, of course) or
have a background in computer programming and digital
logic.
In 1976 Intel introduced the MCS-48'· family. consisting
of the 8048. 8748. and 8035 microcomputers. These parts
marked the first time a complete microcomputer system,
including an eight·bit CPU. 1024 8·bit words of ROM
or EPROM program memory. 64 words .of data memory.
I 0 ports and an eight-bit timertcounter could be integrated onto a single silicon chip. Depending only on the
program memory contents. one chip could control a
limitless variety of products. ranging from appliances or
automobile engines to text or data processing equipment.
Follow-on products stretched the M CS-48'· architecture
in several directions: the 8049 ami 8039 doubled the
amount of on-chip memory and ran 83'ff faster; the 8021
reduced costs by executing a subset of the 8048 instructions with a somewhat slower clock; and the 8022 put a
unique two-channel 8-bit analog-to-digital converter on
the same NMOS chip as the computer, letting the chip
interface directly with analog transducers.
Family Overview
Pinout diagrams for the 8051. 8751. and 8031 are shown
in Figure I. The devices include the following features:
Now three !lew high-performance singlecchip microcomputers .. the Intel® 8051, 8751. and 8031-extend the
advantages of Integrated Electronics to whole new product areas. Thanks to Intel's new HMOS technology, the
MCS-5I'· family provides four tli 'es the program'
memo'ry and twice the data memory as the 8048 on a
single chip. New I/O and peripheral capabilities both '
increase the' range of applicability and reduce total system
cost. Depending on the use, processing throughput
increases by two and one-half to ten times.
This Application Note is intended to introduce the reader
to the MCS-51'· architecture and features. While it does
not assume intimacy with the MCS-48'· product line on
the part of the reader. he/she should be familiar with
• Single-supply 5 volt operation using HMOS technology.
• 4096 bytes program memory on-chip (not on 8031).
• 128 bytes data memory on-chip.
• Four register banks.
• 128 User-defined software flags.
• 64 Kilobytes each program and external RAM
addressability.
• One microsecond instruction cycle with 12 MHz
crystal.
• 32 bidirectional I/O lines organized as four 8-bit
ports (16 lines on 8031).
• Multiple mode, high-speed programmable Serial
Port.
• Two multiple mode. 16-bit Timer/Counters.
• Two-level prioritized interrupt structure.
• Full depth stack for subroutine return linkage and
data storage.
• Augmented MCS-48'· instruction set.
• Direct Byte and Bit addressability.
• Binary or Decimal arithmetic.
• Signed-overflow detection and parity computation.
• Hardware Multiple and Divide in 4usec.
• Integrated Boolean Processor for control applications.
• Upwardly comp~tible with existing 8048 software.
AFN-01502A-04
2-2
intJ
AP-69
All three devices come in a standard 40-pin Dual InLine Package, with the same pin-out, the same timing,
and the same electrical characteristics. The primary
difference between the three is the on-chip program
memory --different types are offered to satisfy differing
user requirements.
ware application examples illustrate many of the concepts.
Several isolated tasks (rather than one complete system
design example) are presented in the hope that some of
them will apply to the reader's experiences or needs.
A document this short cannot detail all of a computer
system's capabilities. By no means will all the 8051 instructions be demonstrated; the intent is to stress new or
unique MCS-51'· operations and instructions generally
used in conjunction with each other. For additional hardware information refer to the Intel MCS-S\'· Family
User's Manual. publication number 121517. The assembly
language and use of ASM51. the MCS-51'· assembler,
are further described in the MCS-S\'· Macro Assembler
User's Guide, publication number 9800937.
The 8751 provides 4K bytes of ultraviolet-Erasable,
Programmable Read Only Memory (EPROM) for
program development, prototyping, and limited production runs. (By convention, I K means 2'" = 1024.
I k·-with a lower case "k"-equals IOJ = 1000.) This part
may be individually programmed for a specific application using Intel's Universal PROM Programmer (UPP).
If software bugs are detected or design specifications
change the same part may be "erased" in a matter of
minutes by exposure to ultraviolet light and reprogrammed with the modified code. This cycle may be
repeated indefinitely during the design and development
phase.
The next section reviews some of the basic concepts
of microcompu\er design and use. Readers familiar
with the 8048 may wish to skim through this section
or skip directly to the next. "ARCHITECTURE AND
ORGANIZATION."
The final version of the software must be programmed
into a large number of production parts. The 8051 has
4K bytes of ROM which are mask-programmed with the
customer's order when the chip is built. This part is considerably less expensive, but cannot be erased or altered
after fabrication.
MIcrocomputer Background Concepts.
Most digital cdmputers use the binary (base 2) number
system internally. All variables. constants, alphanumeric
characters, program statements, etc .• are represented by
groups of binary digits ("bits"), each of which has the
value 0 or I. Computers are classified by how many bits
they can move or process at a time.
The 8031 does not have any program memory on-chip,
but may be used with up to 64K bytes of external standard
or multiplexed ROMs, PROMs, or EPROMs. The '8031
fits well in applications requiring significantly larger or
smaller amounts of memory than the 4K bytes provided
by its two siblings.
The MCS-51'" microcomputers contain an eight-bit
central processing unit (CPU). Most operations process
variables eight bits wide. All internal RAM and ROM.
and virtually all other registers are also eight bits wide.
An eight-bit ("byte") v'ariable (shown in Figure 2) may
assume one of 2" = 256 distinct values. which usually
represent integers between 0 and 255. Other types of
numbers. instructions. and so forth are represented by
one or more bytes using certain conventions.
(The 8051 and 8751 automatically access external program memory for all addresses greater than the 4096 bytes
on-chip. The External Access input is an override for
all internal program memory-the 8051 and 8751 will
each emulate an 8031 when pin 31 is low.)
Throughout this Note, "8051" is used as a generic term.
Unless specifically stated otherwise, the point applies
equally to all three components. Table I summari7.es the
quantitative differences between the members of the
MCS-48'· and MCS-51'· families.
For example, to represent positive and negative values.
the most significant bit (D7) indicates the sign of the other
seven bits-O if positive. I if negative-allowing integer
variables. between -128 and +127. For integers with
extremely large magnitudes. several bytes are manipulated together as "multiple precision" signed or unsigned
integers-16. 24. or more bits wide.
The remainder of this Note discusses the various MCS-51'·
features and how they can be used. Software and/or hard-
Table 1. Features of Intel's Single-Chip Microcomputers
EPROM
Program
Memory
ROM
Program
Memory
External
Program
Memory
Program
Memory
(Int/Max)
Data
Memory
(Bytes)
Instr.
Cycle
Time
Inputl
Output
Pins
Interrupt
Sources
Reg.
Banks
--
8021
8022
8048
8049
8051
--
IK!IK
2K'2K
IK:4K
2K,4K
4K,64K
64
64
64
8.41,Sec
8. 4 "Sec
2.5"Sec
1.36,ISec
1.0"Sec
21
28
27
27
32
0
2
2
2
5
I
I
2
2
4
8748
8751
8035
8039
8031
128
128
AFN-01S02A-05
2-3
intJ
Ap·69
The letters "MCS" have traditionally indicated
a system or family of compatible Intel@> microcomputer components, including CPUs, memories, clock generators, I/O expanders, and so
forth. The numerical suffix indicates the microprocessor or· microcomputer which serves as
the cornerstone of the family. Microcomputers
in the MCS-48'· family currently include the
8048-series (8035,8048, & 8748). the 8049-series
(8039 & 8049), and the 8021 and 8022; the
family also includes the 8243, an I/O expander
compatible with each of the microcomputers.
Each computer's CPU is derived from the 8048,
with essentially the same architecture, addressing modes, and instruction set, and a single
assembler (ASM48) serves each.
a single character. and a word or sequence of letters may
be represented by a series (or "string") of bytes. Since the
ASCII code only uses 128 characters. the most significant
bit of the byte is not needed to distinguish between characters. Often D7 is set to 0 for all characters. In some
coding schemes, D7 is used to indicate the "parity" of the
other seven bits--set or cleared as necessary to ensure
that the total number of "I" bits in the eight-bit code is
even ("even parity") or odd ("odd parity"). The KOSI
includes hardware to compute parity when it is needed.
, A computer program consists of an ordered sequence of
specific, simple steps io be executed by the CPU one-ata-time. The method or sequence of steps used collectively
to solve the user's application is called an ··,algorithm."
The program is stored inside the computer as a sequence
of binary numbers. where each number correspond~ to
one of the basic oper,ations ("opcodes") which the CPU
is capable of executing. In the 80S I. each program
memory location is one byte. A complete instr.uction
consists of a sequence of one or more bytes. where the
first defines the operation to be executed and additional
bytes (if needed) hold additional information. such as
data values or variable addresses. No instruction is longer
than three bytes.
The first members of the MCS-51'· family are
the 8051, 8751, and 8031. The architecture of
the 8051-series, while derived from the 8048,
is not strictly compatible; there are more
addressing modes, more instructions, larger
address spaces, and a few other hardware differences. In this Application Note the letters
"MCS-51" are used when referring to architectural features of the 8051-series-features
which would be included on possible future
microcomputers based on the 8051 CPU. Such
products could have different ·amounts of
memory (as in the 8048/8049) or different
peripheral functions (as in the 8021 and 8022)
while leaving the CPU and instruction set
intact. ASM51 is the assembler used 9Y all
microcomputers in the 8051 family.
The way in which binary opcodes and modifier bytes are
assigned to the CPU's operations is called the computer's
"machine language." Writing a program directly in
machine language is time-consuming and tedious. Human
beings think in words and concepts rather than encoded
numbers. so each CPU operation and resource is given a
name and standard abbreviation ("mnemonic"). Programs
are more easily discussed using these standard mnemonics.
or "assembly language." and may be typed into an Intei'·
Intellec® 800 or Series Il® microcomputer development
system in this form. The development system can mechanically translate the program from assemhly language
"source" form to machine language' "object" code using a
program called an "assembler." The MCS-SI'· assemhler
is called ASMSI.
Two digit decimal numbers may be "packed" in an eightbit value, using four bits for the binary code of each digit.
This is called Binary-Coded Decimal (BCD) representation, and is often used internally in programs which
interact heavily with human beings.
There are several important differences between a computer's machine language and the assembly language used
as a tool to represent it. The machine language or instruction set is the set of operations which the CPU can
perform while a program is executing ("at run-time"). and
is strictly determined by the microcomputer hardware
design.
Alphanumeric characters (letters, numbers, punctuation
marks, etc.) are often represented using the American
Standard Code for Information Interchange (ASCII)
convention. Each character is associated with a unique
seven-bit binary number. Thus one byte may represent
I
The assembly language is a standard (though more-orless arbitrary) set of symbols including the instruction ,et
mnemonics, but with additional features which further
simplify the program design process. For example.
ASMSI has controls for creating and formaning a program listing. and a number of directives for allocating
variable storage and inserting arbitrary hytes of data into
the ohject code for creating table> of con,tants.
0
07
06
05
04
03
02
01
DO
Figure 2. Representation of Bits Within an Eight-Bit
"Byte" (Value shown = 01010001 Binary =
81 decimal).
AFN-01502A·06
2-4
AP-69
In addition. ASM51 can perform sophisticated mathematical operations. computing addresses or evaluating
arithmetic expressions to relieve the programmer from
this drudgery. However. these calculations can only use
information known at "assembly time."
assembly language by a series of ones and zeros
(naturally). followed by the letter "B" (for Binary); octal
numbers as a series of octal digits (0-7) followed by the
letter "0" (for Octal) or "Q" (which doesn't stand for anything. but looks sort of like an "0" and is less likely
to be confused with a zero).
For example. the 8051 performs arithmetic calculations
at run-time. eight bits at a time. ASM51 can do similar
operations 16 bits at a time. The 8051 can only do one
simple step per instruction. while ASM51 can perform
complex calculaiions in each line of source code. However. the operations performed by the assembler may only
use parameter values fixed at assembly-time. not variables
whose values are unknown until program execution
begins.
Hexadecimal numbers are represented by a series of hexadecimal digits (0-9,A-F). followed by (you guessed it) the
letter "H." A "hex" number must begin with a decimal
digit; otherwise it would look like a user-defined symbol
(to be discussed later). A "dummy" leading zero may be
inserted before the first digit to meet this constraint. The
character string "BACH" could be a legal label for a
Baroque music synthesis routine; the string '~OBACH" is
the hexadecimal constant BAC,.. This is a case where
adding 0 makes a big difference.
For example. when the assembly language source line,
ADD
A,#(LOOP_COUNT + I) * 3
Decimal numbers are represented by a sequence of decimal
digits. optionally followed by a "D." If a number has no
suffix. it is assumed to be decimal-so it had better not
contain any non-decimal digits. "OBAC" is not a legal
representation for anything.
is assemhled. AS M51 will find the value of the previously-defined constant "LOOP_COUNT" in an internal
symbol table. increment the value. mUltiply the sum by
three. and (assuming it is between -256 and 255 inclusive)
truncate the product to eight bits. When this instruction
is executed. the 8051 ALU will just add that resulting
constant to the accumulator.
When an ASCII code is needed in a program. enclose the
desired character between two apostrophes (as in 'W) and
the assembler will convert it to the appropriate code (in
this case 23H). A string of characters between apostrophes is translated into a series of constants; 'BACH'
becomes 42H. 41 H, 43H. 48H.
Some similar differences exist to distinguish number
system ("radix") specifications. The 8051 does all computations in binary (though there are provisions for then
converting the result to decimal form). In the course of
writing a program, though. it may be more convenient
to specify constants using some other radix, such as base
Hr.,On other occasions.it is desirable to specify the ASCII
code for some character or string of characters without
refering to tables. ASM51 allows several representations
for constants. which are converted to binary as each
instruction is assembled.
These same conventions are used throughout the associated Intel documentation. Table 2 illustrates some of the
different number formats.
2. ARCHITECTURE AND ORGANIZATION
Figure 3 blocks out the MCS-51'· internal organization.
Each microcomputer combines a Central Processing
Unit, two kinds of memory (data RAM plus program
ROM or EPROM), Input/Output ports. and the mode.
For example. binary numbers are represented in the
Table 2. Notations Used to Represent Numbers
Bit Pattern
00000000
00000001
...............
00000111
00001000
00001001
00001010
...............
0000 1 1 1 1
00010000
...............
o1
1 1 1 1 1 1
10000000
10000001
...............
1 1 1 1 1 1 10
111111 I I
Binary
Octal
HexaDecimal
Decimal
OB
IB
OQ
IQ
OOH
OIH
IIIB
1000B
100lB
10 lOB
7Q
IOQ
IIQ
12Q
07H
08H
09H
OAH
IIIIB
looOOB
17Q
20Q
OFH
IOH
15
16
177Q
200Q
20lQ
127
128
129
........
...
7FH
80H
81H
1l111l10B
IIIIIIIIB
376Q
377Q
OFEH
OFFH
254
255
..
..
..
lllllllB
10000000B
1000000lB
'"
. ..
0
I
Signed
Decimal
0
+1
...
..
. ...
...
..
. ...
...
...
7
8
9
10
"
...
+7
+8
+9
+10
+15
+16
....
+127
-128
-127
....
-2
-I
AFN·01502A·07
2-5
AP-69
TIMER
CONTROL
Figure 3. Block Diagram of 8051 Internal Structure
status. and data registers and random logic needed for
a variety of peripheral functions. These elements communicate through an eight-bit data bus which runs
throughout the chip. somewhat akin to indoor plumbing.
This bus is buffered to the outside world through an I/O
port when memory or I/O expansion is desired.
Let's summarize what each block does: later chapters dig
into the CPU's instruction set and the peripheral registers
in much greater detail.
Central Processing Unit
The CPU is the "brains" of the microcomputer. reading
the user's program and executing the instructions stored
therein. Its primary elements are an eight-bit Arithmetic/
Logic Unit with associated registers A. B, PSW. and SP.
and the sixteen-bit Program Counter and "Data Pointer"
registers.
2-6
intJ
AP-69
Arithmetic Logic Unit
•
•
•
•
•
The ALU can perform (as the name implies) arithmetic
and logic functions on eight-bit variables. The former
include basic addition. subtraction. multiplication. and
division; the latter include the logical operations AND.
OR. and Exclusive-OR. as well as rotate. clear. complement. and so forth. The ALU also makes conditional
branching decisions. and provides data paths and temporary registers used for data transfers within the system.
Other instructions are built up from these primitive functions: the addition capability can increment registers or
automatically compute program. destination addresses;
subtraction is also used in decrementing or comparing the
magnitude of two variables:
Arithmetic Operations
Logical Operations for Byte Variables
Data Transfer Instructions
Boolean Variable Manipulation
Program Branching and Machine Control
MCS-48'· programmers perusing Table 4 will notice the
absence of special categories for Input/Output. Timer!
Counter. or Control instructions. These functions are all
still provided (and indeed many new functions are added).
but as special cases of more generalized operations in
other categories. To explicitly list all the useful instructions involving I/O and peripheral registers would require
a table approximately four times as long.
Observant readers will also notice that all of the 8048's
page-oriented instructions (conditional jumps. JMPP.
MOVP. MOVP3) have been replaced with corresponding
but non-paged instructions. The 8051 instruction set is
entirely /loll-page-oriented. The MCS-48'· "MOVP"
instruction replacement and all conditional jump instructions operate relative to the program counter. with the
actual jump address computed by the CPU during instruction execution. The "MOVP3" and "JM PP" replacements
are now made relative to another sixteen-bit register.
which allows the effective destination to be anywhere in
the program memory space. regardless of where the
instruction itself is located. There are even three-byte
jump and call instructions allowing the destination to be
an,l'll'here in the 64K program address space.
These primitive operations are automatically cascaded
and combined with dedicated logic to build complex
instructions such as incrementing a sixteen-bit register
pair. To execute one form of the compare instruction. for
example. the 8051 increments the program counter three
times. reads three bytes of program memory. computes a
register address with logical operations. reads internal
data memory twice. makes an arithmetic comparison of
two variables. computes a sixteen-bit destination address.
and decides whether or not to make a branch-all in two
microseconds!
An important and unique feature of the MCS-51 architecture is that the ALU can also manipulate one-bit as
well as eight-bit data types. Individual bits may be set.
cleared. or complemented. inoved. tested. and used in
logic computations. While support for a more primitive
data type may initially seem a step backwards in an era
of increasing word length. it makes the 8051 especially
well suited for controller-type applications. Such algorithms inherent~1' involve Boolean (true/false) input
and output variables. which were heretofore difficult to
implement with standard microprocessors. These features
are collectively referred to as the MCS-51'· "Boolean
Processor." and are described in the so-named chapter
to come.
The instruction set is designed to make programs efficient
both in terms of code size and execution speed. No
instruction requires more than three bytes of program
memory. with the majority requiring only one or two
bytes. Virtually all instructions execute in either one or
two instruction cycles-one or two microseconds with
a 12-MH7. crystal-with the sole exceptions (multiply
and divide) completing in four cycles.
Many instructions such as arithmetic and logical functions or program control. provide both a short and a long
form for the same operation. allowing the programmer
to optimi7.e the code produced for a specific application.
The 8051 usually fetches two instruction bytes per instruction cycle. so using a shorter form can lead to faster
execution as well.
Thanks to this powerful ALU. the 8051 instruction set
fares well at both real-time control and data intensive
algorithms. A total of 51 separate operations move and
manipulate three data types: Boolean (I-bit). byte (8-bit).
and address (16-bit). All told. there are eleven addressing
modes-seven for data. four for program sequence control (though only eight are used by more than just a few
speciali7.ed instructions). Most operations allow several
addressing modes. bringing the total number of instructions (operation/addressing mode combinations) to III.
encompassing 255 of the 256 possible eight-bit instruction opcodes.
For example. any byte of RAM may be loaded with a
constant with a three-byte. two-cycle instruction. but the
commonly used "working regi~ters" in RAM may be
initiali7.ed in one cycle with a two-byte form. Any bit
anywhere on the chi p may be set. cleared. or complemented by a single three-byte logical instruction using
two cycles. But critical control bits. I/O pins. and software flags may be controlled by two-byte. single cycle
instructions. While' three-byte jumps and calls can "go
anywhere" in program memory. nearby sections of code
may be reached by shorter relative or absolute versions.
Instruction Set Overview
Table 4 lists these III instructions classified into five
groups:
AFN-Q1502A-09
2-7
inter
AP-69
(MSB)
I I
Cy
'(LSB)
AC
FO
Symbol Position
CY
PSW 7
RS1
I I
RSO
Symbol Position Name and Significance
OV
PSW2
Overflow flag.
Set/cleared by hardware during arithmetic instructions to indicate overflow
conditions.
OV
Name and Significance
Carry flag.
Set/cleared by hardware or software
during certain arithmetic and logical
PSW.I
(reserved)
PSWO
Parity flag.
Set/cleared by hardware each instruction cycle to indicate an odd/even
number of "one" bits in the accumulator. i.e .• even parity.
Note-
the contents of(RSI. RSO) enable the
instructions.
P
AC
PSW6
Auxiliary Carry flag.
Set/cleared by hardware during addition
or subtraction instructions to indicate
carry or borrow out of bit 3.
FO
PSW5
Flag 0
Set/cleared/tested by software as a
user-defined status flag.
RSI
PSW.4
RS
PSW.3
working register banks as follows:
(0.0) .. Bank
(0.1) . Bank
(I,O)---Bank
(1.1) -Bank
Register bank Select control bits I & O.
Set/cleared by software to determine
working register bank (see Note).
0
I
2
3
(OOH-07H)
(OSH-OFH)
(IOH-I7H)
(ISH-IFH)
Figure 4. PSW-Program Status Word Organization
A significant side benefit of an instruction set more
powerful than those of previous single-chip microcomputers is that it is easier to generate applications-oriented
,software. Generalized addressing modes for byte and bit
instructions reduce the number of source code lines
written and debugged for a given application. This leads
in turn to proportionately lower software costs. greater
reliability. and faster design cycles.
and rotates. The carry also serves as a "Boolean accumulator" for one-bit logical operations and bit manipulation.
instructions. The overflow flag (OV) detects when arithmetic overflow occurs on signed integer operand~, making
two's complement arithmetic possible. The parity flag
(P) is updated after every instruction cycle with the evenparity of the accumulator contents.
The CPU does not control the two register-bank select
bits, RS I and RSO. Rather, they are manipulated by
software to enable one of the four register banks. The
usage of the PSW flags is demonstrated in the Instruction Set chapter of,this Note.
Accumulator and PSW
The 8051, like its 8048 predecessor, is primarily an
accumulator-based 'architecture: an eight-bit register
called the accumulator ("A") holds a sour.ce operand and
receives the result of the arithmetic instructions (addition.
subtraction, multiplication, and division). The accumulator can be the source or destination for logical operations
and a number· of special data movement instructions.
including table look-ups and external RAM expansion.
Several functions apply exclusively to the accumulator:
rotates, parity computation, testing for zero, and so on.
Even though the architecture is accumulator-based, provisions have been made to bypass the accumulator in
common instruction situations. Data may be moved from
any location on-chip to any register. address, or indirect
address (and vice versa), any register may be loaded with
a constant, etc., all without affecting the accumulator.
Logical operations may be performed against registers or
variables to alter fields of bits-without using or affecting
the accumulator. Variables may be incremented, decremented, or tested without using the accumulator. Flags
and control bits may be manipulated and tested without
affecting anything else.
Many instructions implicitly or eXp'licitly affect (or are
affected by) several status 'flags, which are grouped
together to form the Program Status Word shown in
Figure 4.
(The period wiihin entries under the Position column is
called the "dot operator," and indicates a particular bit
position within an eight-bit byte. "PSW.5" specifies bit 5
of the PSW. Both the documentation and ASM51 use
this notation.)
Other CPU Registers
A special eight-bit register ("B") serves in the execution of
the multiply and divide instructions. This register is used
in, conjunction with the accumulator as the second input
operand and to return eight-bits of the result.
The mos!'''active'' statuS bit is called the carry flag (abbreviated "C"). This bit makes possible multiple precision
arithmetic 6perations including addition, subtraction,
The MCS-51 family processors include a hardware stack
within internal RAM, useful for subroutine linkage,
AFN-01S02A-10
2-8
infef
AP-69
passing parameters between routines, temporary variable
storage, or saving status during interrupt service routines.
The Stack Pointer (SP) is an eight-bit pointer register
which indicates the address of the last byte pushed onto
the stack. The stack pointer is automatically incremented
or decremented on all push or pop instructions and all
subroutine calls and returns. [n theory, the stack in the
8051 may be up to a full 128 bytes deep. (In practice, even
simple programs would use a handful of RAM locations
for pointers, variables, and so forth-reducing the stack
depth by that number.) The stack pointer defaults to 7 on
reset, so that the stack will start growing up from location
8,just like in the 8048. By altering the pointer contents the
stack may be relocated anywhere within internal RAM.
are addressed using the Program Counter or instructions
which generate a sixteen-bit address.
To stretch our analogy just a bit, data memory is like a
mouse: it is smaller and therefore quicker than program
memory, and it goes into a random state when electrical
power is applied. On-chip data RAM is used for variables
which are determined or may change while the program
is running.
A computer spends most of its time manipUlating variables, not constants, and a relatively small number of
variables at that. Since eight-bits is more than sufficient
to uniquely address 128 RAM locations, the on-chip
RAM address register is only one byte wide. [n contrast
to the program memory, data memory accesses need a
single eight-bit value-a constant or another variableto specify a unique location. Since this is the basic width
of the ALU and the different memory . types, those
resources can be used by the addressing mechanisms,
contributing greatly to the computer's operating efficiency.
Finally, a 16~bit register' called the data pointer (DPTR)
serves as a base register in indirect jumps, table look-up
instructions, and external data transfers. The high- and
low-order halves 'Of the data pointer may be manipulated
as separate registers (DPH and DPL, respectively) or
together using special instructions to load or increment
all sixteen bits. Unlike the 8048, look-up tables can therefore start anywhere in program memory and be of
arbitrary length.
The partitioning of program and data memory is extended
to off-chip, memory expansion. Each may be added
independently, and each uses the same address and data
busses, but with different control signals. External program memory is gated onto the external data bus by the
PSEN (Program Store Enable) control output, pin 29.
External data memory is read onto the bus by the RD
output, pin 17, and written with data supplied from the
microcomputer by the WR output, pin 16. (There is no
control pin to write external program ROM, which is by
definition Read Only.) While both types may be expanded
to up to 64K bytes, the external data memory may
optionally be expanded in 256 byte "pages" to preserve
the use of P2 as an I}O port. This is useful with a relatively
small expansion RAM (such as the [ntel® 8155) or for
addressing external peripherals.
Single-chip controller programs are finalized during the
project design cycle, and are not modified after production. [ntel's single-chip microcomputers are not "von
Neumann" architectures common among main-frame
and miniccomputer systems: the MCS-51 ,. processor
dala memory-on-chip and external-may 1101 be used
for program code. Just as there is no write-control signal
for program memory, there is no way for the CPU to
execute instruct-ions out of RAM. [n return, this concession allows an architecture optimized for efficient
controller applications: a large, fixed program located in
ROM, a hundred or so variables in RAM, and different
methoils for efficiently addressing each.
Memory Spaces
Program memory is separate and distinct from data
memory. Each memory type has a different addressing
mechanism, different control signals, and a different
function.
The program memory array (ROM or EPROM), like an
elephant, is extremely large and never forgets information, even when power is removed. Program memory is
used for information needed each time power is applied:
initiali7.ation values, calibration constants, keyboard
layout tables, etc., as well as the program itself. The program memory has a sixteen-bit address bus; its elements
(Von Neumann machines are.helpful for software development and debug. An 8051 system could be modified to
have a single off-chip memory space by gating together
the two memory-read controls (PSEN and RD) with a
two-input AND gate (Figure 5). The CPU could then
write data into the common memory array using W Rand
AFN-01S02A-l t
2-9
inter
8051
AP-69
WI!
~ 1miWII}
L-_ _ _
I'mi_IIII-I
IiEIIliII
TO
MEMORY
ARRAY
Figure 5. Combining External Program and Data
Memory Arrays
external data transfer instructions, and read instructions
or data with the AND gate output and data transfer or
program memory look-up instructions.)
In addition to the memory arrays, there is (yet) another
(albeit sparsely populated) physical address space. Connected to the internal data bus are a score of specialpurpose eight-bit registers scattered throughout the chip.
Some of these-B, SP, PSW, DPH, and DPL-have
been discussed above. Others-I/O ports and peripheral
function registers-will be introduced in the following
sections. Collectively, these registers are designated as the
"special-function register" address space. Even the accumulator is assigned a spot in the special-function register
address space for additional flexibility and uniformity.
Input/Output Ports
The MCS-SI'· I/O port structure is extremely versatile.
The 80S1 and 87S1 each have 32 I/O pins configured as
four eight-bit parallel ports (PO, PI, P2, and P3). Each pin
will 'input or output data (or both) under software control, and each may be referenced by a wide repertoire of
byte and bit operations.
Thus, the M CS-SI'· architecture supports several distinct
"physical" address spaces, functionally separated at the
hardware level by different addressing mechanisms, read
and write control signals, or both:
•
.•
•
•
•
On-chip program memory;
On-chip data memory;
Off-chip program memory;
Off-chip data memory;
On-chip special-function registers.
In various operating or expansion modes, some of these
I/O pins are also used for special input or output functions. Instructions which access external memory use'
Port 0 as a multiplexed address/data bus: at the beginning
of an external memory cycle eight bits of the address are
output on PO; later data is transferred on the same eight
pins. External data transfer instructions which supply
a sixteen-bit address, and any instruction accessing
external program memory, output the high-order eight
bits on P2 during the access cycle. (The 8031 alll'ays uses
the pins of PO and P2 for external addressing, but P I and
P3 are available for standard I/O.)
What the programmer sees, though, are "logical" address
spaces. For example, as far as the programmer is
concerned,. there is only one type of program memory,
64K bytes in length. The fact that it is formed by combining on- and off-chip arrays (split 4K/60K on the 80S1
and 87S1) is "invisible" to the programmer; the CPU
automatically fetches each byte from the appropriate
array, based on its address.
(Presumably, future microcomputers based on the
MCS-SI ,. architecture may have a different physical split,
with more or less of"the 64K total implemented on-chip.
Using the' MCS-48'· family as a precedent, the 8048's 4K
potential program address space was split I K/ 3K between
on- and off-chip arrays; the 8049's was split 2KJ2K.)
The eight pins of Port 3 (P3) each have a special function.
Two external interrupts, two counter inputs, two serial
data lines, and two timing control strobes use pIns of P3
as described in Figure 6. Port 3 pins corresponding to
functi9ns not used are available for conventional 1/0.Even within a single port, I/O functions may be combined
in many ways: input and output may be performed using
different pins at the same time, or the same pins at different
times; in parallel in some cases, and in serial in others; as
test pins, or (in the case of Port 3) as additional special
functions.
Why go into such tedious details about address spaces?
The logical addressing modes are described in the Instruction Set chapter in terms of physical address spaces.
Understanding their differences now will payoff in understanding and using the chips later.
2-10
AP-69
(MS8)
I I I
RD
WR
(LS8)
Tl
Symbol Position
1'3.7
RD
WR
1'3.6
TO l'Nn
I I I I
INTO
TXD
RXD
Name and Significance
Read data control output. Active low
pulse generated by hardware when
external data memory is read.
Symbol Position
INTI
1'3.3
Name and Significance
Interrupt I input pin. Low-level or
falling-edge triggered.
INTO
1'3.2
Interrupt 0 input pin. Low-level or
falling-edge triggered.
TXD
1'3.1
Transmit Data pin for serial port in
Write data control output. Active low
pulse generated by hardware when
external data memory b wriucn.
UART mode. Clock output in shift
Tl
1'3.5
Timer/counter I external input or test
register mode.
pin.
RXD
TO
PH
Timer/counter 0 external input or test
1'3.0
Receive Data pin fo'r serial port in
UART mode. Data I/O pin in shift
register mode.
pin.
Figure 6. P3-Alternate Special Functions of Port 3
software-accessible). These registers are called. naturally
enough. THO. TLO. TH I. and TLI. Each pair may be
independently software programmed to any of a d07en
modes with a mode register designated TMOD (Figure
7). and controlled with register TCON (Figure 8).
The timer modes can be used to measure time intervals.
determine pulse widths. or initiate events. with one-microsecond resolution. up to a maximum interval of 65.536
instruction cycles (over 65 milliseconds). Longer delays
may easily be accumulated through software. Configured
as a counter. the same hardware will accumulate external
events at frequencies from D.C. to 500 KHz. with up to
sixteen bits of precision.
Serial Port Interface
Until now, microprocessor systems needed peripheral
chips such as timer/counters. USARTs. or interrupt controllers to meet these needs. The 8051 integrates all of
these capabilities on-chip!
Each microcomputer contains a high-speed, full-duplex.
serial port which is software programmable to function
in' four basic modes: shift-register I/O expander. 8-bit
UART. 9-bit UART. or interprocessor communications
link. The UART modes will interface with standard I/O
devices (e.g. CRTs. teletypewriters. or modems) at data
rates from 122 baud to 31 kilobaud. Replacing the
standard 12 MHz crystal with a 10.7 MHz crystal allows
110 baud. Even or odd parity (if desired) can be included
with simple bit-handling software routines. Inter-processor
communications in distributed systems takes place at 187
kilobaud with hardware for automatic add.ress/data
message recognition. Simple TTL or CM OS shift registers
provide low-cost I/O expansion at a super-fast I Megabaud. The serial port operating modes are controlled by
the contents of register SCON (Figure 9).
Timer/Counters
Interrupt Capability and Control
There are two sixteen-bit multiple-mode Timer/Counters
on the 8051. each consisting of a "High" byte (corresponding to the 8048 "T" register) and a low byte (similar to· the
8048 prescaler. with the additional flexibility of being
(Interrupt capability is generally considered a CPU
function. It is being introduced here since. from an applications point of view, interrupts relate more closely to
peripheral and system interfacing.)
Special Peripheral Functions
There are a few special needs common among controloriented computer systems:
• keeping track of elapsed real-time;
• maintaining a count of signal transitions;
• measuring the precise width of input pUlses;
• communicating with other systems or people;
• closely monitoring asynchronous external events.
AFN-01S02A-13
2-11
AP-69
(MSB)
I
GATE
(LSB)
I I
CIT
M1
MO
I
GATE
I
CIT
M1
MD
I
M1
MO
o
o
~\
TIMER 1
Operating Mode
MCS-48 Timer. "TLx" serves as fivebit prescaler.
TIMER 0
o
16-bit timer· counter. "THx" and "TLx"
are cascaded~ there is 'no presca'ier.
o
GATE
Gating control. When set, Timer/counter
"x"·is enabled only while "INTx" pin is
high and "TRx" control bit is set. When
cleared, timer/counter is enabled
whenever "TRx" control bit is set.
CjT
Timer or Counter Selector. Cleared for
Timer operation (input from internal
system clock). Set for Counter operation (input from "Tx" input pin).
8-bit auto-reload timer counter. "THx"
holds a value which is to be reloaded
into ··TLx·· each time it overflows.
(Timer 0)
TLO is an eight-bit timer
counter controlled bv the
standard Timer 0 co~trol
bits.
.
THO is an eight-bit timer
only controlled by Timer I
control bits.
(Timer I)
Timer,counter I stopped.
Figure 7. TMOD-Timer/Counter Mode Register
(MSB)
I
TF1
I
TR1
TFO
I
(LSB)
TRO
IE1
IT1
lEO
I
ITO
Symbol Position Name and Significance
lEI
TCON.3 Interrupt I Edge flag. Set by hardware
when external interrupt edge detected.
Cleared when interrupt processed.
Symbol Position Name and Significance
TFI
TCON.7 Ti.mer I overflow Flag. Set by hardware
on timer/counter overflow. Cleared
when interrupt processed.
TRI
TCON.6
Timer I Run control bit. Set/cleared
by software to turn timer/counter
on/off.
TFO
TCON.5
Timer 0 overflow Flag. Set by hardware
on timer/counter overflow. Cleared
when interrupt processed.
TRO
TCON.4
Timer 0 Run control bit. Set/cleared by
software to tUTn timer/counter on/off.
ITI
TCON.2
Interrupt I Type control bit. Sct cleared
by software to specify falling edge low
level triggered external interrupts.
I Ell
TCON.I
Interrupt 0 Edge flag. Set by hardware
when external interrupt edge detected.
Cleared when interrupt processed.
ITO
TCON.O
Interrupt 0 Type control bit. Set 'cleared
by software to specify falling edge low
level lriggered external interrupts.
Figure 8. TCON-Timer/Counter Control/Status Register
AFN-01502A-14
2-12
AP-69
Symbol Posillon Name and Significance
Symbol Position Name and Significance
SMO
SCON.7
Serial port Mode control bit O.
Sct/cleared by software (sce note).
RB8
SCON.2
Receive Bit 8. Set/c1cared by hardware
to indicate stale of ninth data bil
SMI
SCON.6
Serial port Mode control bit I.
Set/cleared by software (see note).
TI
SCON.I
Scrial port Modc control bit 2. Set by
softwarc to disable reception of frames
for which bit 8 is zero.
Transmit Intcrrupt flag. Set by hardware when byte transmitted. C1cared
by software after servicing.
RI
SCON.O
Received Inlerrupt flag. Set by hardware when byte received. Cleared by
Note-
the state of (SMO.SM I) "Ieets:
(0,0) --Shift register 110 expansion
(0.1)·-8 bit UART. variable data rate.
(1.0)--9 bit UART. fixed data rate.
(1.1)--9 bit UART. variable data rate.
received.
SM2
REN
TB8
SCON.5
SCON.4
SCON.3
Receiver Enable control bit. Set/clcared
by software to enable/disable serial
data reception.
software after servicing.
Transmit Bit 8. Set/clcared by hardware to determine state of ninth data
bit transmitted in 9-bit UART modc.
Figure 9. SCON-Serial Port Control/Status Register
These peripheral functions allow special hardware to
monitor real-time signal interfacing without bothering
the CPU. For example, imagine serial data is arriving from
one CRT while being transmitted to another, and one
timer/counter is tallying high-speed input transitions
while the other measures input pulse widths. During all
of this the CPU is thinking about something else.
But how does the CPU know when a reception, transmission, count, or pulse is finished? The 8051 programmer
can choose from three approaches.
TCON and SCON contain status bits set by the hardware
when a timer overflows or a serial port operation is completed. The first technique reads the control register into
the accumulator, tests the appropriate bit, and does a
conditional branch based on the result. This "polling"
scheme (typically a three-instruction sequence though
additional instructions to save and restore the accumulator may sometimes be needed) will surely be
familiar to programmers used to multi-chip microcomputer systems and peripheral controller chips. This
process is rather cumbersome, especially when monitoring
multiple peripherals.
background task long enough to handle the appropriate
device, then return to the point where it left off.
This is the basis of the third and generally optimal solution, hardware interrupts. The 8051 has five interrupt
sources: one from the serial port when a transmission or
reception is complete, two from the timers when overflows occur, and two from input pins INTO and INTI.
Each source may be independently enabled or disabled
to allow polling on some sources or at some times, and
each may be classified as high or low priority. A high
priority source can interrupt a low priority service
routine; the manager's boss can interrupt conferences
with subordinates. These options are selected by the interrupt enable and priority control registers, IE and IP
. (Figures 10 and II).
Each source has a particular program memory address
associated with it (Table 3), starting at 0003H (as in the
8048) and continuing at .eight-.byte intervals. When an
event enabled for interrupts occurs the CPU automatically
executes an internal subroutine call to the corresponding
address. ·A us_er subroutine starting at this location (or
jumped to from this location) then performs the instructions to service that particular source. After completing
the interrupt service routine, execution returns to the
background program.
As a second approach, the 8051 can perform a conditional
branch based on the state of any control or status bit or
input pin in a single instruction; a four instruction
sequence could poll the four simultaneous happenings
mentioned above in just eight microseconds.
Table 3. 8051 Interrupt Sources and Service Vectors
Unfortunately, the CPU must still drop what it's doing
to test these bits. A manager cannot do his own work
well if he is continuously monitoring his subordinates;
they should interrupt him (or her) only when they need
attention or guidance. So it is with machines: ideally, the
CPU would not have to worry about the peripherals until
they require servicing. At that time, it would postpone the
Interrupt
Source
Service Routine
Starling Address
(Reset)
External 0
Timer/Counter 0
External I
Timer/ Counter I
Serial Port
OOOOH
0OO3H
OOOBH
OOl3H
OOIBH
0023H
AFN-01502A-1S
2-13
inter
AP-69
IMSB)
ILSB)
ES
ET1
EX1
ETO
I
EXO
I
Symbol Position Name and Significance
EA
IE.7
Enable All control bit. Cleared by
software to disable all interrupts.
independent of the stale of IE.4-IE.O.
ES
ETI
Symbol Position Name and Significance
EXI
IE.2
Enable External interrupt I control bit.
Set cleared by software to enable
disable interrupts from INTI.
IE.6
IE.5
(reserved)
(reserved)
ETO
IE.I
Enable Timer 0 control bit. Set cleared
by software to enable disable interrupts
from timer counter 0
IE.4
Enable Serial port control bit.
Set/cleared by software to enable
disable interrupts from TI or RI flags.
EXO
IE.O
Enable External interrupt 0 control bit.
Set cleared by software to enable
disable interrupts from INTO.
IE.3
Enable Timer I control bit. SeUcieared
by software to enable/disable interrupts
from timer/counter I.
Figure 10. IE-Interrupt Enable Register
IMSB)
I-
ILSB)
PS
1
Symbol Position
IP.7
IP.6
IP.5
PS
PTI
IP.4~
JP.3
PT1
I, px, 1PT. I px. I
Name and Significance
(reserved)
(reserved)
(reserved)
Symbol POSition Name and Significance
PXI
IP.2
External interrupt I Priority control
bit. Set cleared by software to specify
high low priority interrupt, for INTI.
Serial port Priority control bit.
Set/cleared by software to specify
high/low priority interrupts for Serial
port.
PTO
Timer I Priority control bit.
Set/cleared by software to specify
high/low priority interrupts for
timer/counter I.
PXO
IP.I
Timer 0 Priority control bit.
Set cleared by software to specify
high low priority interrupts for
timer counter O.
IP.O
External interrupt 0 Priority control
bit. Set cleared by software to specify
high low priority interrupts for INTO.
Figure 11. IP-Interrupt Priority Control Register
AFN-OtS02A-16
2-14
inter
AP-69
Table 4. MCS-51'" Instruction Set Description
DATA TRANSFER (conI.)
ARIIIIMHIC OPERA1IONS
!\tnernnnic
.\1)))
A.Rn
AIlD
·\.dITCct
A.lQ1RI
ADD
AD))
.\.udJta
AnnC '\.Rn
ADDC A.dlrcct
A))))C
·\.Ca1 RI
,\nlle ,\.Ud.II.1
SllBB
A.Rn
SllHB
'\,dm:cl
SllBB
A.@'Ri
A)tdata
SUnB
A
I"C
I'\;C
Rn
direct
I'C
(a\RI
I'\C
me
mc
I)fT
!lIT
I'\;C
.\1(11
I>IV
J):\
A
Rn
dllect
~I\RI
DPI R
AI!
AU
A
I),,\cription
Add rcgl'lcf 10 Ac,"umul.llnT
Add dlreCl tntc 1U ,\n.'UIl1Ulalor
Add mUlrcct"RA\11ll Acculllul,l(nr
Add Immcdl:!lC data tn Accumulator
Add regl~tcr to Accumulatnr vdth c.lrr)
Add direct h~(c (() A "Ith c.!rr~ n.lg
Add mdm'ct R,\ M III A \Hlh c.trr~ flenement ,\n:ulllul.llor
Decrement reg"ter
Decrement due!:t b\le
Dc!:remcnt Indlrct:,'RAM
Im'rement Daw P(lmter
Mu!tlpl~ A & B
1l1\ldc A h\ B
Ilct:llllal Adlu,t Accumulator
Byte C)C
I
I
I
I
I
I
I
I
I
I
I
I
Or..tinatiun
A'\;i) rel!l~ler to Accut1lul.llor
A .....·f) dl;eci h\le to Accumulator
" . . .·1> Indlrect'RAM In Accurnul.ltor
MOVX
(wDPI R.A
PliSH
POP
XCH
direct
direct
A.Rn
XCH
XCH
A,dlrt'c!
A.@lR,
X('HI)
A.@lRI
8~te ('~c
I
I
I
I
I
I
ASD Immediate datil to Accul\lul.tlnr
A \;D AccuTl1ulator 10 direct b\'le
A 'iD Immedl..lte datJ to dln!ci byte
OR rt:gl~tt'r tll Accumulator
OR dm.'ct h\te to Accumul..llor
OR mdlrelt'RAM to Accul\lul... I<)f
OR Imrncdl.Jle data 10 Act:umulator
OR Accumulator to dIrect h\'tc
OR Immcdlatc dat.1 to dlrcct h\ tc
Exc!u,,\e-OR rCJP~t~'r 10 AClllmuJatnr
Exclu'-I\e-OR duect h\le to Accumulator
Exciu"\e-OR IndirecI'RAM to A
Exclu~l\e-OR Immediate data to A
E'{clu~l\e-()R Accumulator 10 dlrccl b\te
E'(clu~ne-OR zmmcc.llate data to dlrec!
Clear Accumulator
Complement Accumulator
Ro{att· Accumulator I cit
Rotale A I.ef! through the Carr) nag
Rotate Accumulator Right
Rolate A Right through Cany nag
Swap mhhlc' Within the Accumulator
Oe ..cription
M()\e regl~ter to Accumulator
Mtl\e direct b\'te to Accunmlalor
M(J\e inum:cl'RAM 10 Accumulaltlr
MO\t! lmmedlale d.lta to Accumuloltor
Mo\e Accumulator \l) Icg"tel
Mo\e direct h~\c 10 reg"lef
Mo\e Immcdl.Jte Juta 10 regl,ler
Mme Accumulator 10 d!r~'c! h~le
Mine regl ..tef to direct hyle
Mo\t! direct h\'te to dIrect
Mo\e Indlrcct'RAM to direct b\tc
M(l\e ImmedlJlc data to dllecl inte
M(He Accumulator to mdllecl IfAM
M<)\c dlfect h\te to mdlrect RAM
MO\e Immedl:ltc data III mdlrect RAM
I.oad Data Pmnter wllh a ](I-blt comtant
De..eriplion
Clear ('arr~ nag
Clear direct hu
Set Cm~ !lag
Sel direct BII
Cumplement Carr~ tlJg
Complt'ment dln:ct hll
A'\; I) direct bll to C;.rr~ IIJ!,!
A '\;1> wmpkment ul dlfect hl1to Colrr~
OR direct hll ttl CJrr~ nag
OR cmnplemcTlt 01 direct hit tn Carr~
Mmc e ..criprion
Subroutine ('a11
long: Suhroulllle ('.til
Return from ~uhroutlllt:
Return trnm mtcrrupt
Ah,olute .lump
IOl1g.l um r
Shorl .lump (relatne Jddr)
Jump IIldlfect rc\atl\e 10 the DPT R
Jump 11 Accumulalor" Zero
.lump II A<:cumulalnr l\ "I;tlt Zero
Jump II C.. rr:. nag" ~et
.lump II !'io ('arr~ flag
.lump J! dlreCI Bit ~et
.lump d dlfect Bit \l"ot ,et
Jump tI direct Hit 1\ ~et & Ck.. r hll
Compare direct 10 A & .lump II :"oiot Equal
CUTlIP Immed to A & Jump If '\;ot Equal
Comp Immed tu reg & Jump If "iol Equal
Comp Immed In Ind & Jump if :\lot Equal
Decrcment reg,,,[er & Jumr If '\;01 Zero
l>ecremenl direct & .lum" II '\;ot I.ero
'n nper.llllln
"h~olult'
data addre.... in~ mode.. :
Wnfl.lng reg"ter RO R 7
12X Inlern:iI RAM locatlon~, an~ I 0 port. conlrol or ~Iatu~ rcgl~ter
Inthrectilltermt! RAM iocatlUn addre~~ed h~ reg"ter RII or RJ
X-bit cnn,tJnt mduded In in,tructlllll
16-hll con~tant mduded a~ h\te~ ~ &.' of In~tructmn
12X ,ottv.arc nag~. an~ I 0 pm. conlrol or ,{.tIU, hl\
'op
I
I
I
I
I
,I
:\'ote" un
Rn
dITecl
(a)RI
;idata
#datal!l
hit
C.I~E
I
2
I
I
I
I
I
I
1l.l",Z
f).I'Z
C.I'\E
eJ",E
C)C
()c
rei
hlud
hll.rcl
bll.rel
A.d.rect.rd
A.*'dJla.ld
Rn.udata.rel
(wRI.#data.rel
Rn.rel
dlrel.'t.rel
.IB
.I",n
.I Be
CJ'\;F.
8)te
B)te
I
PROGRAM A:'On MAClII:'OI: CONTROL
[)AT·\ TRA \;~FER
VJnemunic
'l0V
A,Rn
MOV
A.l.llrect
M()V
A.(aIRI
MOV
\.tidala
\10V
Rn.A
MOV
H,n.dlfect
\10\'
Rn.*'d.II.1
MOV
dlfCCt.A
."-IO\'
dlrcct.Rn
\1()V
dllcct.dlrect
dlrect,(,alRI
MOV
MOV
I.hrect.tidata
(aIRI.A
MOV
(a1Rz,dlrect
MOV
M()V
«(lIRI.tidat ••
MOV
IlP I R.#datll l!l
De\cription
B)le (')'C
MIne Code hvtc reiatl\C to [)PfR 10 A
I
2
\10\C Code ",Ie rclatl\C to PC In A
I
Mmc E'I(,lcro.il RAM (1(·011 dddrlin A
I
Mmc E'(lcrn,J1 RAM (16·bn addr) to A
I
MO\~' A In E,lernoil RAM (H-hLt aodr)
I
Mmc A ttl r,lcrnal RAM (16-bll addr)
I
Pu,h direct tl\ Ie onto ,lac\..
Pop dIrect h~ic ]rom ,tad..
[,(change rcg.'\l'r "11h Accumulalm
F,(changt' direct h~lc "11h AccumulalOr
E'(changc mdlrect RAM '\dlh A
Exch.angl' hl\\-nrdcr DIg:lIlnU RAM .... A
8()()I.EAN VARIARU: .I\IASIPt·I.ATlON
I.O(;iCAI. OPERATIONS
:\Inernonic
A\;I
A.Rn
A'\; 1
A,dlrecl
A\;/.
A.@RI
A\;I
A.Mata
A\;L
dlrect.A
A'\; 1
dlrect.#data
ORI
A.Rn
ORI
A.dlrect
A,@JRI
ORI
A.#data
ORI
ORI
duec1.A
dlrec\.*tdata
ORI
XRI
A.Rn
XRI
A.dlfl'cl
A.(fURI
.xRI
XRI
A.*"data
xRI
t.hrect.A
dlrect.#dala
.XRI
CI R
A
CPI
~
RI
A
RIC
A
A
RR
A
RRe
SWAP A
Mnemonic
MOVe A.CWA+DP"J R
Move A.@A+I'C
MOVX A.@lRo
MOVX A.@IJPrR
MOVX @RJ.A
J
:'\iote.. on program addre....in2 mode .. :
addrl!l
De'tlTl.ltmn addre~~ tm I CAlI & I.lMP ma\ he otll\v.here "!lhm
the M-Kllnh~tl' prngrJm memnr~ Jddrc" ~pac~"
.
addrll
De~t1natHln addre .. , for ACAI I & A.lMP "II! rn: "!thm tht' 'arne
2-Klioh)IC pa!!t· 01 program m~'mor~ a, the tIT" h~le 01 the Inlhmlng
IIl~trLlctltln
rei
All
3. INSTRUCTION SET AND ADDRESSING MODES
S.lMP and all condillonJI tump~ mdude an X-hll ott,et h~,e R.Jn~e
+ 127 12X h~le, rel,ltl\C to flr,t byte 01 the fnllnv.mg lil,tructllln
mnemonlc~
I~
copynghted © Intel Corpnralmn 1979
group. this chapter starts with the addressing mode
classes and builds 10 include the related instructions.
The 8051 instruction set is extremely regular. in the sense
that most instructions can operate with variables from
several different physical or logical address spaces. Before
getting deeply enmeshed in the instruction sct proper. it
is important to understand the details of the most
common data addressing modes. Whereas Table 4 summari7es Ihe instructions set broken down by functional
Data Addressing Modes
MCS-51 assembly language instructions consist of an
operalion mnemonic and 7ero to three operands separated
by commas. In two operand instructions the destination
is specified first. then the source. Many byte-wide data
AFN·01502A-17
2-15
inter
AP-69
. operations (such as ADD or MOV) inherently use the
accumulator as a source operand and/or to receive the
result. For the sake of clarity the letter "A" is specified in
the source or destination field in all such instructions.
For example, the instruction,
ADD
hardware reset enables register bank 0; to select a
different bank the programmer modifies PSW bits 4 and
3 accordingly.
Example 2-Selecting Alternate Memory B.anks
PSW ••000100008
A.