Intel mcs-48 Microscope & Magnifier User Manual


 
APPLICATION EXAMPLES
BINARY MUL TIPL Y
BMPY: MOV R3,#08H ;SET COUNTER
TO
8
CLR A
;CLEAR A
CLR
C
;CLEAR CARRY
BIT
BMPI: RRC A
;DOUBLE
SHIFT
RIGHT
ACC
&
R1
XCH A,R1
;INTO
CARRY
RRC
A
XCH A,R1
JNC
BMP3
;IF CARRY=1 ADD, OTHERWISE
DON'T
ADD
A,R2
;ADD MULTIPLICAND
TO ACCUMULATOR
BMP3:
DJNZ
R3,BMPI
;DECREMENT COUNTER
AND
LOOP IF 0
RRC A
;DO A FINAL RIGHT SHIFT
AT
THE
XCH
A,R1
;END OF THE ROUTINE
RRC A
XCH A,R1
INTERRUPT HANDLING
This
interrupt
routine assumes single level
interrupt. The purpose
is
to
store the status
of
the machine
at
the time the interrupt occurs
by storing contents of
all registers, accumu-
lator, and the status word.
At
the end
of
the
interrupt the state
of
the machine
is
restored
and interrupts are enabled again.
INTRPT: SEL
MOV
RB1
@RO,A
;SAVE WORKING REGISTERS
;RO
IN ALTERNATE REGISTER
;BANK
CONTAINS
SACC
;POINTER FOR SAVING
;ACCUMULATOR
flNTERRUPT
SERVICE
lROUTINE
MOV RO,SACC ;RESTORE SACC
MOV A,@RO ;RESTORE
ACCUMULATOR
RETR ;RESTORE WORKING REGISTERS
;RESTORE PSW
AND
;RE-ENABLE INTERRUPTS
5-24