Monday, May 30, 2016

8051 Program - rotate dptr left 4bits

; Description:
; Rotate DPTR 4 Bits To Left, Bit 15 Moves To Bit 0
;
; Entry Requirements:
; DPTR Has Value To Rotate Left
;
; On Exit:
; DPTR = ((DPTR & 0xf000) >> 12) | (DPTR << 4)
;
; Affected:
; PSW.CY, DPTR
;
; Stack:
; 2 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; None
;
UTIL_DPTRROL4:
push acc ; Save Acc
push 0 ; Save R0
mov r0,#4 ; Number Times To Shift
loop:mov a,dph ; Get High Byte
mov c,acc.7 ; Get High Order Bit
mov a,dpl ; Get Low Of DPTR
rlc a ; Shift Left
mov dpl,a ; Store Back To DPL
mov a,dph ; Get High Of DPTR
rlc a ; Shift Left
mov dph,a ; Store Back To DPH
djnz r0,loop ; Repeat For R0 Bytes
pop 0 ; Recover R0
pop acc ; Recover Acc
ret ; Return To Caller


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



Related topics:
8051 Program - arithmetic shift right dptr   |   8051 Program - shift dptr right   |   8051 Program - shift dptr left   |   8051 Program - shift r3r4r5r6r7 4bits left   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment