WD-16 Programmers Reference Manual Oct1976
WD-16 Programmers Reference Manual Oct1976
MICROCOMPUTER
WESTERN!If DIGITAL
CORPORATION
WD1600 MICROCOMPUTER
4 OCTOBER 1976
c
TABLE OF CONTENTS
PAGE
CHAPTER ONE - GENERAL 1.1
Abbreviations
Processor Status Word
Registers
The WD16~~ microcomputer is a 16 bit machine with both word and byte
addressing, an automatic push down hardware sta.ck, vectored interrupt
handling, eight 16 bit registers, and PC relative addressing. A byte is
defined as 8 bits, and a word is defined as 2 bytes. A memory address
increment of one is an increment of 1 byte. An address increment of two
is an increment of 1 word. Word addresses always start on even bytes.
For any memory location the even byte is the least significant byte.
Bit ~ is defined as the LSB of a memory location.
(MSB) 15 8 7 ~ (LSB)
I High Byte
~-----.--' .....
Low Byte
""--.(
]
Byte Address Byte Address
~ (ODD) X (EVEN) )
--....r
Word Address X (EVEN)
LEGEND OF ABBREVIATIONS
REG Register
1
x = Ones Complement of X
-x = Twos Complement of X
A = Logical And
'V = Logical Or
SL = Exclusive or
@ = Indirect
{- = Push
t = Pop
+ = Destination Direction
+ = Addition
- = Subtraction
* = Multiplication
/ = Division
= Double Precision Chain Link
2
REGISTERS
There are 8 registers in the WD1600. All are 16 bits long. Six
can be hsed as either accumulators or index registers, one is the
stack pointer (SP), and one is the program counter (PC). The registers
are numbered ~ - R7 with R6 = SP and R7 = pc. The register set is
usually referred to in the following manner: ~ - RS, SP, PC.
3
CHAPTER TWO - INTROQUCTION
ADDRESSING MODES
INTERRUPT LINES
Note that 13 is always enabled. Note also that the nonvectored inter-
rupt has priority over the vectored interrupt. The system is currently
set up so that power fail and a real time clock can be assigned to II,
and up to 16 devices assigned to I~.* The two interrupts operate as follows:
A) Nonvectored Interrupt (II)
PS and PC are pushed onto the stack. 12 is disabled. The external
status register is tested for a power fail. If power fail is true
PC is fetched from location "14". If power fail is false PC is
fetched from location "2A", and a microm state code is transmitted
to clear the line clock (see appendix 0).
B) Vectored Interrupt (I~)
PS and PC are pushed onto the stack. 12 is disabled. An Interrupt
Acknowledge is executed, and the device code of the interrupting de-
vice is read in and stripped to bits 1- 4. PC is fetched from location
*NOTE: AI though onlX ~ 4 bj. t device code ia cUJ;'l;ently used, a minor microm
change can allow a device code of from 1-15 bits.
2
"28" and the device code is added to it. The ccntents of this inter-
mediate location are read in and added to PC to form the final address.
Each intermediate location is a table entry that contains the PC rela-
tive offset from the start of the device handler routine to itself. The
absolute address of the start of the table is in location "28".
PRIORITY MASK
Bits 8-15 are don't care. Bits 5-7 are real time error conditions that
also generate a system reset (see next section). Bit 4 is the interrupt
enable status. The jumpers can be logic units, switches, or hard wired
jumpers as the user wishes. The various options associated with the 4
jumpers are discussed later.
POWER UP OPTIONS
3
A3) The Line-clock-clear state code is transmitted.
A4) 12 is reset.
A5) If power fail bit is set go to Dl.
A6) If bus error bit is set go to Cl.
A7) If parity error bit is set go to BI.
AS) Go to D2 otherwise.
For a proper initial power up either bit 7 must be set or bits 5-7 must
be reset when the system reset line is released.
The 4 power up options are as follows:
JUMPERS OPERATION
HMT OPTIONS
When the halt switch (I3) is set during program execution one of 4 halt
options is selected. 'the halt op code* and power up option #2 also select
the halt option specified. The options are as follows:
JUMPERS O:PERATION
wnen the user bootstrap routine is selected as an option the system creates
the starting address by placing address "C~~~" in pC and then replacing
bits S-13 with the contents of the 6 bit External Address Register. This
register is gated in with a microm status code (see appendix D).
4
It allows the user 64 different starting addresses in the range "C~~~"
to "FF~~".
With the exception of the major power fail error that is a function
of a system reset, all error conditions perform a common routine as outlined
below. A non-vectored interrupt and some op codes also use this routine.
The numbers in parenthesis refer to notes that follow the table.
The meaning of the wait and trace flags is discussed in chapter 3. Note
that the nonvectored interrupt power fail PC is a minor power fail condition,
not a major one. See appendix C for full detail on how to include both
major and minor power fail conditions in the hardware.
FORMAT 1 OP CODES
15 12 11 8 7 4 3 o
L I OPC
~~~~ NOP
~Illll RESET
1l1l1l2 lEN
~llfJ3 IDS
~~1l4 HALT
~~~5 XCT
ll~fJ6 BPT
1l~1l7 WFI
~~fJ8 RSVC
~~~9 RRTT
fJll~A SAVE
~~~B SAVS
~~~C REST
~~~D RRTN
~~~E RSTS
f6f6IlF RTT
NOP NO OPERATION
FORMAT: NOP
FUNCTION: No operations are performed
INDICATORS : Unchanged
FORMAT: RESET
FUNCTION: An I/O reset pulse is transmitted
INDICATORS : Unchanged
1
lEN INTERRUPT ENABLE
FORMAT: lEN
FUNCTION: The interrupt enable (I2) flag is set. Allows
one more instruction ~o execute before inter-
rupts are recognized.
INDICATORS: Unchanged
FORMAT: IDS
FUNCTION: The interrupt enable (12) flag is reset.
This instruction can honor interrupts, but
the 12 bit in the PS that is stored on the stack
is reset if an interrupt occurs.*
INDICATORS: Unchanged
HALT HALT
FORMAT: HALT
FUNCTION: Tests the status of the Power Fail bit in the
external status register. If the bit is set it
is assumed that the HALT occured in a power fail
routine, and the following operations occur:
1) The interrupt enable (12) flag is reset
2) The CPU waits until the Power Fail bit is rese"
3) PC is fetched from location "16", and program
execution begins at this new location
If the power fail bit is reset then the CPU waits
until the halt switch (13) is set. At that time
the selected halt option (see chapter 2) is execub
The interrupt enable flag is also reset.
INDICATORS : Unchanged
FORMAT: XCT
OPERATION: PC + @SP, SP t
PS +- @SP, SP t
Trace flag set, execute op code
+SP, @SP + PS
+SP, @SP + PC
Trace flag reset
PC + (loc "2~") if no error
PC + (loc "lE") if error
FUNCTION: PC and PS are popped from the stack, but 12 is no t
altered. The trace flag, which disables all inter
rupts except 13, is set. The op code is executed:
PS and PC are pushed back onto the stack)and PC
is fetched from location 2~" • The trace flag is
II
2
pushed onto the stack, and PC is fetched from location "lE" instead.
12 is also reset.
INDICATORS: Depends upon executed op code
FORMAT: BPT
OPERATION: ~ SP, @SP +PS
,.: SP, @SP +PC
PC +. (loc "2C")
FUNCTION: PS and PC are pushed onto the stack. PC is
fetched from location "2C"
INDICATORS : Unchanged
FORMAT: WFI
FUNCTION: The CPU loops internally without accessing
the data bus until an interrupt occur~. Program
execution continues with the op code that follows
the WFI after the interrupt has been serviced.
The interrupt enable flag is also set.
INDICATORS : Unchanged
FORMAT: SAVE
OPERATION: -} SP, @SP+ R5
~ SP, @SPof- R4
~ SP, @SP+ R3
~ SP, @SP+ R2
~ SP, @SP+ RI
-} SP, @SP+ Rf6
FUNCTION: Registers R5 to ~ are pushed onto the stack.
INDICATORS : Unchanged.
FORMAT: REST
OPERATION: ~ -+- ·@SP, SP +
Rl @SP, SP 1-
+-
R2 +- @SP, SP t
3
R3 +- @SP, SP of
R4 +- @SP, SP t
RS+ @SP, SP t
FORMAT: RTT
OPERATION: PC +@SP, SP t
PS +-@SP, SP t
FUNCTION: PC and PS are popped from stack
INDICATORS : N = Set per PS bit 3
Z = Set per PS bit 2
V = Set per PS bit 1
C = Set per PS bit ~
FORMAT: RRTN
OPERATION: REST
PC +- @SP, sPt
FUNCTION: Registers R~ to R5 and PC are popped
from the stack
INDICATORS : Unchanged
FORMAT: RRTT
OPERATION: REST
RTT
FUNCTION: Registers ~ to R5~ PC and PS are popped
from the stack.
INDICATORS : Set per PS bits ~ - 3
FORMAT: RSTS
OPERATION: (LOC 12E") +- @SP, SP t
MSKO
REST
RTT
FUNCTION: The priority mask is popped from the stack and
restored to locaton "2E". A MASK OUT state code
(See Appendix D) is transmitted. Registers ~
to !OJ PC and PS are popped from the stack.
INDICATORS : Set per PS bits ~ - 3
FORMAT: RSVC
OPERATION: REST
SPI-
RTT
4
FUNCTION: Registers ~ to RS, PC and PS are popped from
the stack with the saved SP bypassed.
INDICATORS : Set per PS bits ~ - 3
s
FORMAT 2 OP CODES
15 12 11 8 7 3 2 o
OPC REG
f6!ilf6 IAK
f6f1l8 RTN
flf62f6 MSKO
f6f628 PRTN
7
· ..
FORMAT 1 OP CODES
15 12 11 8 7 4 3 ~
fI , fI I OPC I ~I
There is only one op code in this class representing op codes
"flfl3f1" to "flfl3F". It is a one word op code with a 4-bit numeric argument.
LCC
8
FORMAT 4 OP CODES
15 12 11 8 7 6 5
I OPC I ARG
SVCA
SVCB
SVCC
9
PC is loaded from location ,. 24"
for SVCB or "26" for SVCC.
INDICATORS : Unchanged.
«
10
FORMAT 5 OP CODES
15 8 7 ~
OPC I DISPLACEMENT c= ,
)i11)i1)i1 BR
)i12)i1)i1 BNE
)i13~)i1 BEQ
)i14~~ BGE
)i15)i1)i1 BLT
)i16)i1)i1 BGT
)i17)i1~ BLE
8~~)i1 BPL
81~~ BMI
82~0 BHI
83~~ BLOS
84)i1~ BVC
850~ BVS
86~)i1 BCC, BHIS
87~~ BCS, BLO
BR BRANCH UNCONDITIONALLY
FORMAT: BR DEST
OPERATION: PC + PC+ (DISP *2)
FUNCTION: Twice the value of the signed displacement
is added to PC.
SIGNED BRANCHES
~,____________________~B~RA~N~C~H~I~F~E~Q~U~A~L~TO~~Z~E~RO~_________________
11
BLT BRANCH IF LESS THAN ZERO
UNSIGNED BRANCHES
12
BCS BRANCH IF CARRY SET
BLO BRANCH IF LOWER
13
FORMAT 6 OP CODES
15 9 8 6 5 4 3 o
I OPC BASE I REG I OPC I COUNT
~8f1S(IS ADDI
~81flS SUBI
flS82f1S BICI
flS83f1S MOVI
88f1SfIS SSRR
881flS SSLR
882f1S SSRA
883f1S SSLA
8Ef6f1S SDRR
8ElflS SDLR
8E2f1S SDRA
8E3f1S SDLA
14
INDICATORS : N ~ Set if bit l5 Qf ~e ~eault is set
Z = Set if the result = ~
V = Set if arithmetic underflow occurs; i.e. set
if the operands were of opposite signs and
the sign of the result is positive
C = Set if a borrow was generate from bit 15
of the result
15
SSRA SHIFT SINGLE RlGliT ARITHMETIC
16
SDRA SHIFT OOUBLE RIGHT ARITHMETIC
17
FORMAT 7 OP CODES
15 6 5 3 2 o
OPC I MODE REG I
There are 32 op codes in this class representing op codes
"~A~~" to "~DFF" and "SA~~" to nSDFF". All addressing modes from
~ to 7 are available with all registers available as index regis-
ters (see chapter two). A one word op code is generated fbr ad-
dressing modes ~ to 5. A two word op code is generated for addres-
sing modes 6 and 7 with the offset value in word two. For DM6 and
DM7 with PC as the index register PC is added to the offset from word
two af€er the offset is fetched from memory. The offset is there-
fore relative to a PC that points to the op code that follows (i.e.
current op code + 4). Codes "SA~~" to "SCC~" are BYTE ops.
WORD OPS
IS
C-Flag i~ shifted into (OST) bit ~, and (OST)
bit 15 is shifted intQ the C-Flag.
INDICATORS : N = Set if bit 15 of (OST) is set
Z = Set if (OST) = ~
V = Set to exclusive or of N and C flags
C = Set to the value of the bit shifted out of (OST)
19
INDICATORS : N = Set if (OST) bit 7 is set
Z = Set if (OST) = ~
V = Set to exclusive or of N and C flags
C = Set to the value of the bit shifted out of (OST)
COM COMPLEMENT
NEG NEGATE
INC INCREMENT
OEC OECREMENT
20
IW2 INCREMENT WORD BY TWO
21
ADC ADO CARRY
BYTE OPS
For OM~ addressing only the lower byte of the destination register
is affected by a byte op code. For DM1-DM7 addressing only the speci~
fied meIOOry byte is affected by a byte op. For even memory addresses
the lower byte is altered, and for ddd meIOOry addresses the upper byte
is altered.
22
FUNCTION: The destination operand status sets the indicators.
INDICATORS : N = Set if (DST)B bit 7 is set
Z = Set if (DST)B = ~
V = Reset
C Unchanged
23
COMB COMPLEMENT BYTE
24
FORMAT 8 OP CODES*
15 6 5 3 2 ~
OPC IS REG I D REG I
There are 8 op codes in this class representing op codes
"~E~~" to "~FFF". Only addressing mode ~ is allowed for both the
source and destination. All are one word op codes, and all are block
move instructions. The last 4 can be used as pseudo DMA ops in some
hardware configurations. In all cases the source register contains
the address of the first word or byte of memory to be moved, and the
destination register contains the address of the first word or byte
of memo17Y to receive the data being moved. The number of words or
bytes being moved is contained in R~. The count ranges from 1-65536
(~ = 65536) words or bytes. The count in ~ is an unsigned positive
integer. None of the indicators are altered by these op codes.
Each of these o~ codes is interruptable at the end of each word
or byte transfer. If no interrupt requests are active the trans-
fers continue. PC is not incremented to the next op code until the
opcode is completed. This allows for complete interruptability
as long as register integrity is maintained during the interrupt.
fJE~~ MBWU
fOE4fO MBWD
~E8~ MBBU
~EC~ MBBD
~F~~ MBWA
fOF4fO MBBA
roF8~ MABW
~FC~ MABB
25
decreasing word addresses as specified by the des-
tination register. The source and destination reg-
isters are each decremented by two after each word is
transferred. ~ is decremented by one after each
transfer, and transfers continue until ~ = ~.
INDICATORS : Unchanged
15 9 8 6 5 3 2 @
OPC I S REG I D MODE D REG I
There are 8 op codes in this class representing op codes
"7[4[4[4" to "7FFF". Source mode f6 addressing only is allowed, but des-
tination modes [4 - 7 are allowed for all op codes except 3: JSR and
LEA with DM9$ will cause an illegal instruction format trap (see chap-
ter 2), and SOB is a special format unique to itself. It is includ-
ed here only because its destination field is 6 bits long. SOB is
a branch instruction. Its 6 bit destination field is a positive
word offset from PC, which points to the op code that follows,
backwards to the desired address. Forward branching is not allowed.
SOB is always a one word op code, and it is used for fast loop con-
trol. All other op 00des are one wo~d long for DM9$ to DM5 addressing
and two words long for DM6 or DM7 addressing. The rules for PC rel-
ative addressing with DM6 or DM7 are the same as they are for the
format 7 op codes. Preliminary decoding of all these op codes ex-
cept SOB presets the indicator flags as follows: N = 1, Z = [4,
V = f6, C = 1.
7f4f4[4 JSR
72f4f4 LEA
74[4[4 ASH
76f6f4 SOB
78[4[4 XCH
7A[4f4 ASHC
7Cf4[4 MUL
7E[4f4 DIV
REG +PC
PC +DST
FUNCTION: The linkage register is pushed onto the stack; PC,
which points to the op code that follows, is placed
in the linkage re~ister; and the destination add-
ress is placed in PC. DMf4 is illegal. The assem-
bler recognizes the format "CALL DST" as, being
equivalent to "JSR PC, DST".
INDICATORS : Preset
27
FUNCTION: The destination address is placed into the source
register. DM(6 is illegal. The assembler recognizes
the format "JMP DST" as being equivalent to "LEA PC,DST" •
INDICATORS : Preset
XCH EXCHANGE
28
MOL MULTIPLY
DIV DIVIDE
29
FORMAT lOOP CODES
15 12 11 9 8 6 5 3 2
I OPC I S MODE I S REG I D MODE I D REG i
There are 12 op codes in this class representing op codes "l~~~"
to "6FFF" and "9~~~" to "EFFF". Nine of the op codes are word ops.
Three are byte ops'. Full source and destination mode addressing with
any register is allowed. A one word op code is generated for S~-
SMS and D~-DM5 addressing. A two word op code is generated for either
SM6-SM7 or DM6-DM7 addressing, but not both. For both SM6-SM7 and
DMc-DM7 addressing a three word op code is generated. For a two word
op code with word #1 at location X: X + 2 contains the source or
destination offset and PC = X + 4 if PC is the register that applies
to the offset in location X + 2. For a three word op code with word
#1 at location X: X + 2 contains the source offset and X + 4 contains
the destination offset. If the source register is PC then PC = X + 4
when added to the offset to compute the source address. If the destin-
ation register is PC then PC = X + 6 when added to the offset to compute
the destination address.
WORD OPS
ADD ADD
30
SUB SUBTRACT
AND AND
XOR EXCLUSIVE OR
31
INDICATORS : N = Set if (DST) bit 15 is set
Z = Set if (DST) = ~
V = Reset
C = Unchanged
CMP COMPARE
MOV MOVE
BYTE OPS
32
FUNCTION: The destination operand is subtracted from the
source operand, and the result sets the indicat-
ors • Neither operand is altered.
INDICATORS : N = Set if result bit 7 is set
Z = Set if result = ~
V = Set if operands were of different signs and
the sign of the result is the same as the sign
of (DST)B.
C = Set if a borrow is generated from result bit 7
33
FORMAT 11 OP CODES
12 11 8 7 6 432
1111 OPC I I
I SRC II I DST
FP,0 is the same as standard addressing mode l, and FPl is the same
as standard addressing mode 7 with an offset of zero.
and high byte of the mantissa. The next higher address contains the
middle two bytes of the mantissa, and the next higher address after
that contains the lowest two bytes of the mantissa. This format is
half way between single and double precision floating point formats,
and it represents the most efficient use of microprocessor ROM and
register space. The complete format is as follows:
1. A 1 bit sign for the entire number which is zero for positive.
(
15 8 7 g
34
True zero is represented by a field of 48 zeroes. In effect, the CPU
considers any number with an exponent of all zeroes (-128) to be a zero
during multiplication and division. For add and subtract the only legal
number with an exponent of -128 is true zero. All others cause erroneous results.
No registers are modified by any Format 11 OP Code. However, to make room
internally for computations 4 registers are saved in memory locations
"30" - "38" during the exelution of FADD, FSUB, FMUL and FDIV. These
registers are retrieved at the completion of the OP Codes. The
registers saved are: the destination address, SP, PC and~. No
Format 11 OP Code is interruptable ,(for obvious reasons). FMUL uses
location "38" for temporary storage of partial results.
Location "3E" is defined as the floating point error trap PC. When-
ever an overflow, underflow, or divide by zero occurs a standard trap
call is executed with PS and PC pushed onto the stack, and PC fetched
from location "3E". r:. is not altered. The remaining memory locations
that are reserved for the floating point option (" 3A and "3C") are
not currently used. The status of the indicator flags and destina-
tion addresses during the 3 trap conditions are defined as follows:
RESERVED TRAPS
If the third microm is in the system and the fourth is not then the
last 11 ~oa~ing point OP codes are the only ones that will cause a
reserved OP code trap if executed. If the third microm is not in the
system then all Format 8 and '11 OP Codes will cause a reserved OP code
trap if executed. However, since the Format 8 OP Codes are: interrupt-
able the PC is not advance until the completion of the moves. In
all other cases PC is advanced when the OP Code is fetched. For
these reasons the PC that is saved onto the stack will point to the
offending OP Code during a reserved OP Code trap if and only if
the offending OP Code is a Format 8 OP COde. For the Format 11 .
OP Codes the saved PC will' point to the OP Code that follows the
offending OP Code. If the User wishes to identify which OP Code
caused the reserved OP Code trap he must not preceed a FOrmat 8
OP Code with a Format 11 OP Code or a literal that looks like a
Format 11 OP Code.
FflC1f1 FADD
Fll1f1 FSUB
F2f1f1 FMUL
F3f1f1 FDIV
F41116 FCMP
FSfl16
F61116
F7f1f1
F8f1f1
F9C1f1
FAfIfI
FB16f1
FC16f1
FD1616
FE1616
FFfl16
FADD FLOATING POINT ADD
WARNING: THIS OP CODE COMPLEMENTS THE SIGN OF THE SOURCE OPERAND !!!.
MEMORY AND DOES AN FADD.
36
v = Reset
C = Reset
FMUL FLO~ING POINT MULTIPLY
37
APPENDIX A
OP CODE MNEMONIC
1
OP CODE MNEMONIC
2
OP COOE MNEMONIC
3
APPENDIX B
ASSEMBLER NOTES
FORMAT 1 OP CODES
All are one word op codes except SAVS which is a two word op
code. The second word of the SAVS op code is an absolute value.
FORMAT 2 OP CODES
FORMAT 3 OP CODE
FORMAT 4 OP CODES
FORMAT 5 OP CODES
All are one word with an 8 bit signed PC relative word o;~
placement. The displacement is relative to op code+2. Maximum
displacement from the op code is +128, -127 words.
FORMAT 6 OP CODES
All are one word with a 3 bit register and a 4 bit numeric argu-
ment. The stored numeric argument is a positive number from ~ -"F"
that equals the actual numeric argument (l-"l~") minus one.
FORMAT 7 OP CODES
All are one word op codes for DM~ - DMS addressing and two word
op codes for DM6 - DM7 addressing. For DM6- DM7 addressing the off-
set is in the second word. If the index register is PC with DM6 -
DM7 the offset is relative to op code+4.
FORMAT 8 OP CODES
All are one word with a 3 bit source and a 3 bit destination reg-
ister argument. The count register is implied to be ~.
FORMAT 9 OP CODES
1
FORMAT 10 OP CODES
All are one word op codes with a 4 bit source and a 4 bit des-
tination argument. Each argument consists of a 3 bit register ar-
gument preceeded by a I bit indirect argument.
2
APPENDIX C
PROGRAMMING NOTES
ADDRESSING MODES
SET ~
CLR @R2
INC (R3)+
DEC (PC)+
SWAB @(R4)+
1
COM -(RS)
NEG - (PC)
TST @-(RI)
ROR 4 (R4)
ROL @6(SP)
JSR RS,TAG .
2
2) SP is incremented by two.
3) The address of location X + 2 is pushed onto the stack
4) CPU register "TMPA" is moved to PC
The effect of all this is to swap the top word on the stack
with the address of location X + 2 without altering SP or stack size.
Consider the following routine.
SUBR: JSR PC,2(PC)
TAGA: JSR PC,@(PC)
TAGB:
RTN PC
The first JSR places the address of TAGA on the stack and exe-
cutes the routine starting at TAGB. The RTN PC transfers control
to location TAGA when it is executed. The second JSR places address
TAGB onto the stack-'nd into PC, effectively leaving PC unaltered.
The second time the RTN PC is executed program control passes to lo-
cation TAGB. The third time the R1~ PC is executed program control
passes back to the routine that call subroutine SUBR. Since TAGA
and TAGB are never addressed explicitly both of the labels could be
eliminated from the program. If left in then the "2(PC)" could be
replaced with "TAGB".
MOV @R2,-(R2)
BIT #2,@#4
CMP (PC)+,TAG
This won't work. The assembler generates a two word op code for this
with the destination offset in word two. The execution of the op
code, however, uses word two as a literal and word three (which does
not exist) as the destination offset. By swapping the source and
destinations around then an in-line literal could be used for word
three, and word two would contain a valid source offset.
3
JSR PC, (PC) +
The contents of R5 are pushed onto the stack, R5 gets the address of
location X + 4, and PC gets the address of location X + 2.
MOVB (SP)+,Rl
CLRB (Pc)+
BISB R¢, Rl
The lower bytes of register R¢ is logically ORED with the lower byte
of register RI. The upper byte of Rl is not altered.
MOVB @(~)+,@-(R3)
Not recommended since the value of the stack is lost. Perfectly le-
gal however.
4
POWER FAIL
Two levels of power fail are provided for in the firmware. The
hardware may use two, one, or no levels of power fail.The three
modes are discussed in increasing order of complexity.
ONE LEVEL: The detection of a power fail sets bit 7 of the exter-
nal status register and the CPU RESET line. When the
power fail disappears the CPU RESET line is reset, but
bit 7 of the external status register remains set. The
Line Clock Clear State Code (see appendix D) clears
bit 7 of the external status register (and bits 5, 6
if used). A system power up is then executed.
TWO LEVELS: This req1 ires two hardware functions, AC LOW and DC
LOW, plus two levels of power fail; AC and DC. It
all works like this: If AC power begins to deterior-
ate AC LOW is set first. This sets bit 7 of the ex-
ternal status register and generates an interrupt via
I~ or II. If AC power does not deteriorate too far then
nothing else happens except that bit 7 of the external
status register is reset when power is restored. If
AC power continues to deteriorate then eventually DC
power will begin to deteriorate. When this happens
DC LOW is set and DC LOW sets CPU RESET. AC LOW is
still set and it maintains bit 7 of the external status
register. When power is restored DC LOW is reset. This
resets CPU RESET. A power up sequence is initiated, and
the Line Clock Clear State (see appendix D) clears The
External Status Register bi~ 7 (plus 5 and 6 if they are
used). If the user wishes to be able to execute a pro-
grammed power fail routine even during a sudden and com-
plete power failure then the DC power supply must be
strong enough to run the CPU and MEMORY for at l~ast 2
milliseconds. The power fail interrupt must also be
programmed, and the interrupts enabled.
The use of the Line Clock Clear State Code to clear bits 5-7 on
a CPU RESET function (plus the line clock of course) should have no
effect on normal system operation. Should an error occur during a
non-vectored interrupt the error would be cleared momentarily and then
set again as CPU RESET obviously could not have been generated. If it
had been then the system could not be in the non-vectored interrupt
routine.
These functions are also part of the CPU RESET function along with
power fail/up. In order to get only one or the other then bit 7 of
the external status register must be reset when the CPU RESET function
5
is activated. In order to generate a valid CPU RESET the CPU
RESET line must be held active for three clock cycles. Longer is
fine, but the CPU goes into a wait state until the CPU RESET is
reset. If more than one error exists at one time then the highest
priority error is the one honored The priority, from highest to
lowest, is:
Power Fail
Bus Error
Parity Error
6
APPENDIX D
Below is a list of MICROM STATE CODE FUNCTIONS for the WD1600 with a
brief de.cription of what each does. More elaborate descriptions,
where necessary, follow the table.
SRS: Generated during a power up for a master system reset. This code
is followed by a 300 cycle wait to allow time for any reset func-
tions the hardware generates to be completed before any DAL re-
quests are generated.
RMWW: Generated d~ing an INPUT WORD micro op code with RMW active to
indicate a read-modify-write word sequence.
RMWB: Generated during an INPUT BYTE micro op code with BMW active to
indicate a read-modify-write byte sequence.
1
RLCI: Generated during a CPU RESET or a non-vectored interrupt with-
out a power fail to clear both the line clock interrupt and ex-
ternal status register bits 5-7.
EARR: Generated during an INPUT STATUS BYTE micro op code to. indicate
a request for the external address register during the user boot-
strap routine.
CODES "D" - "F": Duplicates of codes "8" - "A" respectively except that
these codes appear as a part of the READ micro op codes
instead of as a part of the INPUT micro op codes. Either
or both may be used by the hardware as is convenient.
These codes preceed the others. They are generated only
once, however, instead of repeating in the event of a
wait state as the others do.
NOTE 1: INPUT STATUS BYTE is not a function of reply and does not gen-
erate a SYNC. For these reasons the DAL must be tri-stated if
a DMA device also exists. The data is always gated onto the low-
er byte. The upper byte is ignored.
NOTE 2: Lack of state codes "8" - "A" or "D" - "F" during a READ - INPUT
sequence implies a read word operation without read-modify-write.
2
APPENDIX E
OP CODE TIMINGS
OP CODE # CYCLES
NOP l~
RESET l~
lEN l~
IDS l~
HALT 16+
XCT 44 + OP CODE EXECUTED
BPT 24
WFI 16+
RSVC 62
RRTl' 60
S.AVE 46
SAVS 65
REST 48
RRTN 52
RSTS 64
RTT 13
OP CODE # CYCLES
IAK l~
RTN 12
MSKO lSl
PRTN 22
LeC 7
SVCA 37
SVCB 73
SVCC 71
1
FORMAT SIX OP CODES
OP CODE # CYCLES
ADD I 9
SUBI 9
BICI 9
MOVI 9
SSRR 8 + (5 X # bits shifted)
SSLR 8 + (5 X # bits shifted)
SSRA 8 + (7 X # bits shifted)
SSLA 8 + (5 X # bits shifted)
SDRR 20 + (7 X # bits shifted)
SDLR 20 + (7 X # bits shifted)
SDRA 20 + (9 X # bits shifted)
SDLA 20 + (7 X 3 bits shifted)
ROR 1~ RORB 9
ROL 1~ ROLB 9
TST 1~ TSTB 9
ASL 1~ ASLB 9
SET 1~ SETB 1$6
CLR 1~ CLRB 9
ASR 12 ASRB 11
SWAB 1$6 SW:1J;) 21
COM 1~ COMB 9
NEG 1$6 NEGB 9
INC 1~ INCB 9
DEC 1~ DECB 9
IW2 1~ LSTS 15
SXT 12 SSTS 1$6
TCALL 21 ADC 11
TJMP 16 SBC 11
2
FORMAT 8 OP CODES
FORMAT 9 OP CODES - D~
OP CODE #: CYCLES
JSR* 22
LEA * 15
ASH 19 if DST = fi1; 22 + (5 X count) if DST>¢; 25+ (7 X count) if DST < ¢.
SOB lfi1 if no branch, 13 if branCh
XCH 23
ASHC 19 if DST = fi1; 38 + (7 X count) if DST>¢; 38+ (9 X count) if DST < ¢
MUL 183
DIV 29 if divisor error, 2fi12 if no divisor error
OP CODE #: CYCLES
ADD 11
SUB 11
AND 11
BIC 11
BIS 11
XOR 11
CMP 11
BIT 11
MOV 11
CMPB 11
MOVB 12
BISB 11
3
For SM1: add 3 for word ops, 1 for byte ops.
For SM2: add 4 for word ops, 2 for byte ops. *
For SM3; add 7 for word ops, 5 for byte ops.
For SM4; add 5 for word ops, 3 for byte ops. *
For SM5; add 9 for word ops, 7 for byte ops.
For SM6'; add 9 for word ops, 7 for byte ops.
For SM7; add 13 for word ops, 11 for byte ops.
*NOTE: Add 2 if SP or PC
FDIV: If divide by .0 96
If divide into fl 118
Worst Case 1596
Typical 280-1210
FCMP: 49-86
4
- NOTES -
- NOTES -