COP8SA-DM National Semiconductor, COP8SA-DM Datasheet - Page 159

no-image

COP8SA-DM

Manufacturer Part Number
COP8SA-DM
Description
MODULE DEBUGGING FOR COP8SA
Manufacturer
National Semiconductor
Datasheet

Specifications of COP8SA-DM

Module/board Type
Debugger Module
For Use With/related Products
Cop 8
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Other names
*COP8SA-DM
program memory to a two-byte SUM, and then subtracts the SUM from a two-byte total
TOT. Assume that the table is located starting a program memory address 0401, while
SUM and TOT are at RAM data memory locations 1, 0 and 3, 2, respectively. The
program is encoded as a subroutine.
MATHMEM: .DSB4
ARITH1:
LOOP:
LUP:
2.19.3 Binary Multiplication
The following program listing shows the code for a 16-by-16-bit binary multiply
subroutine. The multiplier starts in the lower 16 bits of the 32-bit result location. As the
multiplier is shifted out of the low end of the result location with the RRC instruction,
each multiplier bit is tested in the Carry flag. The multiplicand is conditionally added
(depending on the multiplier bit) into the high end of the result location, after which the
partial product is shifted down one bit position following the multiplier. Note that one
additional terminal shift cycle is necessary to align the result.
.SECT
SUMLO = MATHMEM
SUMHI = MATHMEM+1 ;Sum upper byte storage location
TOTLO = MATHMEM+2 ;Total lower byte storage location
TOTHI = MATHMEM+3 ;Total upper byte storage location
.SECT
.BYTE
.BYTE
.BYTE
.BYTE
.BYTE
LD
LD
RC
LD
LAID
ADC
X
CLR
ADC
X
DRSZ
JP
SC
LD
LD
X
SUBC
X
IFBNE
JP
RET
MATH,RAM
CODE, ROM, ABS=0401
102
41
31
26
5
X,#5
B,#SUMLO
A,X
A,[B]
A,[B+]
A
A,[B]
A,[B-]
X
LOOP
B,#2
A,[X+]
A,[B]
A,[B]
A,[B+]
#4
LUP
;CONSTANT DECLARATIONS
;Sum lower byte storage location
;ROM TABLE
;Store 102
;Store 41
;Store 31
;Store 26
;Store 5
;PERFORM ADDITION AND SUBTRACTION
;Set up ROM table pointer
;Set up sum pointer
;Reset carry flag
;Load ROM pointer into accumulator
;Read data from ROM
;Add SUMLO to ROM value
;Store result in SUMLO, point to SUMHI
;Clear accumulator
;Add SUMHI and carry bit to the accumulator
;Store result in SUMHI, point to SUMLO
;Decrement ROM pointer, If not equal to zero
;then repeat the loop
;else set the carry flag
;Load B pointer with 2 (point to TOTLO)
;Load accumulator with subtrahend
;Reverse operands for subtraction
;Subtract
;Increment minuend pointer
;If B pointer not equal to 4
;then repeat the loop
;else return
COP8SAx7 MICROCONTROLLER
2-121

Related parts for COP8SA-DM