; subroutine MUL8
; 8-Bit x 8-Bit to 16-Bit Product Signed Multiply
; 2's Complement format
;
; input: r0 = multiplicand X
; r1 = multiplier Y
;
; output: r1, r0 = product P = X x Y.
;
; calls: UMUL8, Cr0, Cr1, Mr0r1
;
; alters: acc, C, Bits 21H & 22H
MUL8: anl PSW, #0E7H ;Register Bank 0
acall Cr0 ;2's comp -> Mag/Sign
acall Cr1 ;2's comp -> Mag/Sign
acall UMUL8
acall Mr0r1 ;Mag/Sign -> 2's Comp
ret
Source: Maths Subroutines for the 8051 microcontroller, W.G.Marshall 2002
Related topics:
8051 Program - signed 16bit addition | 8051 Program - signed 32bit addition | 8051 Program - signed 16bit subtraction | 8051 Program - signed 32bit subtraction | 8051 Program - unsigned 8bit multiplication | 8051 Program - memory subroutines | 8051 Program - math subroutines | 8051 Program - conversion subroutines
List of topics: 8051
No comments:
Post a Comment