Monday, May 30, 2016

8051 Program - multiply dptr by 10

; Description:
; Multiply DPTR By 10. Return CY == 1 If Overflow
;
; Entry Requirements:
; DPTR Has Value To Multiply By 10
;
; On Exit:
; DPTR = DPTR * 10
;
; Affected:
; PSW.CY, DPTR
;
; Stack:
; 3 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; None
;
UTIL_DPTRX10:
push b ; Save B
push acc ; Save Acc
mov a,dpl ; Get Low Of Value
mov b,#10 ; Multiplier
mul ab ; BA = DPL * 10
mov dpl,a ; Move Low Back To DPL
push b ; Save High Side
mov a,dph ; Get High Of Value
mov b,#10 ; Multiplier
mul ab ; BA = DPH * 10
pop b ; Recover B
add a,b ; Add To Low
mov dph,a ; Move Back To DPH
pop acc ; Recover Acc
pop b ; Recover B
ret ; Return To Caller


Source: Assorted Utilities, John C. Wren 11/23/96



Related topics:
8051 Program - multiply dptr by 100   |   8051 Program - multiply dptr by 1000   |   8051 Program - call function dptr points to   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment