Monday, May 30, 2016

8051 Program - add acc to dptr

; Description:
; Add Acc To DPTR, Setting Carry If DPTR Overflows
;
; Entry Requirements:
; DPTR Has Value
; Acc Has Value To Add
;
; On Exit:
; DPTR = DPTR + 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_ADCAD:
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,#000h ; If Carry Set, This Will Increment
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 ba 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