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

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
MULTIPLY (16X16) SUBROUTINE
MULTIPLICAND IN [1,0] MULTIPLIER IN [3,2]
PRODUCT IN [5, 4, 3, 2]
CNTR:
MULT:
MLOOP:
TEST:
2.19.4 Binary Division
The following program shows a subroutine for a 16-by-16-bit binary division. A 16-bit
quotient is generated along with a 16-bit remainder. The dividend is left shifted up into
an initially-cleared 16-bit test window where the divisor is test-subtracted. If the test
subtraction generates no high-order borrow, then the real subtraction is performed with
the result stored back in the test window. At the same time, a quotient bit (equal to 1) is
inserted into the low end of the dividend window to record that a real subtraction has
taken place. The entire dividend and test window is then shifted up (left shifted) one bit
position with the quotient following the dividend.
Note that the four left shifts (LD, ADC, X) in the LSHFT section of the program are
repeated as straight-line code rather than a loop in order to optimize throughput time.
2-122
COP8SAx7 MICROCONTROLLER
.SECT
.DSB 1
.SECT
LD
LD
LD
LD
LD
RC
LD
RRC
X
LD
RRC
X
LD
RRC
X
LD
RRC
X
LD
IFNC
JP
RC
LD
LD
ADC
X
LD
ADC
X
DRSZ
JP
RET
MEMCNT, REG
CODE, ROM
CNTR,#17
B,#4
[B+],#0
[B],#0
X,#0
A,[B]
A
A,[B-]
A,[B]
A
A,[B-]
A,[B]
A
A,[B-]
A,[B]
A
A,[B]
B,#5
TEST
B,#4
A,[X+]
A,[B]
A,[B+]
A,[X-]
A,[B]
A,[B]
CNTR
MLOOP

Related parts for COP8SA-DM