UPI-41A/41AH/42/42AH USER’S MANUAL
operations. Both Carry and Auxiliary Carry are part of
the Program Status Word (PSW) and are stored in the
stack during subroutine calls. The F
0
and F
1
flags are
general-purpose flags which can be cleared or comple-
mented by UPI instructions. F
0
is accessible via the
Program Status Word and is stored in the stack with
the Carry flags. F
1
reflects the condition of the A
0
line,
and caution must be used when setting or clearing it.
Register Operations
The working registers can be accessed via the accumu-
lator as explained above, or they can be loaded with
immediate data constants from program memory. In
addition, they can be incremented or decremented di-
rectly, or they can be used as loop counters as explained
in the section on branch instructions.
Additional Data Memory locations can be accessed
with indirect instructions via R
0
and R
1
.
Branch Instructions
The UPI-41A/41AH/42/42AH Instruction Set in-
cludes 17 jump instructions. The unconditional allows
jumps anywhere in the 1K words of program memory.
All other jump instructions are limited to the current
page (256 words) of program memory.
Conditional jump instructions can test the following in-
puts and maching flags:
#
TEST 0 input pin
#
TEST 1 input pin
#
Input Buffer Full flag
#
Output Buffer Full flag
#
Timer flag
#
Accumulator zero
#
Accumulator bit
#
Carry flag
#
F
0
flag
#
F
1
flag
The conditions tested by these instructions are the
instantaneous values at the time the conditional jump
instruction is executed. For instance, the jump on accu-
mulator zero instruction tests the accumulator itself,
not an intermediate flag.
The decrement register and jump if not zero (DJNZ)
instruction combines decrement and branch operations
in a single instruction which is useful in implementing a
loop counter. This instruction can designate any of the
8 working registers as a counter and can effect a branch
to any address within the current page of execution.
A special indirect jump instruction (JMPP
@
A) allows
the program to be vectored to any one of several differ-
ent locations based on the contents of the accumulator.
The contents of the accumulator point to a location in
program memory which contains the jump address. As
an example, this instruction could be used to vector to
any one of several routines based on an ASCII charac-
ter which has been loaded into the accumulator. In this
way, ASCII inputs can be used to initiate various rou-
tines.
Control
The UPI-41A/41AH/42/42AH Instruction Set has six
instructions for control of the DMA, interrupts, and
selection of working registers banks.
The UPI-41A/41AH/42/42AH provides two instruc-
tions for control of the external microcomputer system.
IBF and OBF flags can be routed to PORT 2 allowing
interrupts of the external processor. DMA handshaking
signals can also be enabled using lines from PORT 2.
The IBF interrupt can be enabled and disabled using
two instructions. Also, the interrupt is automatically
disabled following a RESET input or during an inter-
rupt service routine.
The working register bank switch instructions allow the
programmer to immediately substitute a second 8 regis-
ter bank for the one in use. This effectively provides
either 16 working registers or the means for quickly
saving the contents of the first 8 registers in response to
an interrupt. The user has the option of switching regis-
ter banks when an interrupt occurs. However, if the
banks are switched, the original bank will automatically
be restored upon execution of a return and restore
status (RETR) instruction at the end of the interrupt
service routine.
Timer
The 8-bit on-board timer/counter can be loaded or read
via the accumulator while the counter is stopped or
while counting.
The counter can be started as a timer with an internal
clock source or as an event counter or timer with an
27