Monday, May 30, 2016

8051 Program - add ba to dptr

; Description:
; Add B/Acc To DPTR, Setting Carry If DPTR Overflows
;
; Entry Requirements:
; DPTR Has Value
; 'B' Has High Of Value To Add, Acc Has Low Of Value To Add
;
; On Exit:
; DPTR = DPTR + B/Acc, CY Set Accordingly
;
; Affected:
; PSW.CY, DPTR
;
; Stack:
; 1 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; Value Of CY On Entry Does Not Affect Result
;
UTIL_ADCBAD:
push acc ; Make Sure Acc Gets Saved
add a,dpl ; Add 'A' To DPL
mov dpl,a ; Move Result To DPL
mov a,dph ; Get DPH
addc a,b ; Add 'B' To DPH + CY
mov dph,a ; Move Bck To DPH
pop acc ; Recover Original 'A'
ret ; Return To Caller


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



Related topics:
8051 Program - add acc to dptr   |   8051 Program - subtract acc from dptr   |   8051 Program - subtract ba from dptr   |   8051 Program - 2s complement dptr   |   8051 Program - decrement dptr   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment