; Description:
; Subtract B/Acc From DPTR, Setting Carry If DPTR Underflows
;
; Entry Requirements:
; DPTR Has Value
; 'B' Has High Of Value To Subtract, Acc Has Low Of Value To Subtract
;
; 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_SUBBBAD:
push acc ; Make Sure Acc Gets Saved
clr c ; Clear For SUBB
xch a,dpl ; Swap
subb a,dpl ; Subtract
mov dpl,a ; Move Back To DPL
mov a,dph ; Get DPH
subb a,b ; Subtract + CY
mov dph,a ; Move Back 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 - add ba to dptr | 8051 Program - subtract acc 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