Thursday, May 26, 2016

8051 Program - unsigned 8bit multiplication

; subroutine UMUL8
; 8-Bit x 8-Bit to 16-Bit Product Unsigned Multiply
;
; input: r0 = multiplicand X
; r1 = multiplier Y
;
; output: r1, r0 = product P = X x Y.
;
; alters: acc

UMUL8:push b
mov a, r0 ;read X and ...
mov b, r1 ;... Y
mul ab ;multiply X and Y
mov r1, b ;save result high ...
mov r0, a ;... and low
pop b
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 - signed 8bit multiplication   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment