Monday, May 30, 2016

8051 Program - shift r3r4r5r6r7 4bits left

; Description:
; Shifts The 5 Byte Bank 0 Registers Group R3..R7 4 Bits Left. It Is
; Not Affected By The Register Bank In Use.
;
; Entry Requirements:
; R3/4/5/6/7 Contains The 40 Bits Value To Shift Left 4 Bits
;
; On Exit:
; R4/5/6/7 = R3/4/5/6/7 << 4
;
; Affected:
; PSW.CY, R3, R4, R5, R6, R7
;
; Stack:
; 4 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; None
;
UTIL_R3R7RL4:
push acc ; Save Acc
push 0 ; Save R0
push 1 ; Save R1
mov r0,#4 ; Number Times To Shift
loop1:mov a,#7 ; Starting Register
mov c,rs0 ; Low Of Register Select
mov acc.3,c ; Low Of Pointer
mov c,rs1 ; High Of Register Select
mov acc.4,c ; High Of Pointer
mov r1,a ; Move To R1
push 0 ; Save R0
mov r0,#5 ; Number Bytes To Shift
clr c ; Clear For Shift
loop2:mov a,@r1 ; Get Low Of DPTR
rlc a ; Shift Left
mov @r1,a ; Store Back To DPL
dec r1 ; Back One Register
djnz r0,loop2 ; Repeat For R0 Bytes
pop 0 ; Recover Total Shift Count
djnz r0,loop1 ; Repeat R0 Times
pop 1 ; Recover R1
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 - rotate dptr left 4bits   |   8051 Program - shift dptr left   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment