Monday, May 30, 2016

8051 Program - unsigned mod

; Description:
; Unsigned Modulus Of R2/3 By R4/5
;
; Entry Requirements:
; Divisor In R4/5
; Dividend In R2/3
;
; On Exit:
; Remainder In R4/5, R2/3
;
; Affected:
; PSW.CY, PSW.Z, PSW.P, Acc, B, R2, R3, R4, R5
;
; Stack:
; 4 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; None
;
UTIL_UMOD:
push 0 ; Save R0
push 1 ; Save R1
call DIVIDE ; Divide
pop 1 ; Recover R1
pop 0 ; Recover R0
mov 2,r4 ; Get Remainder High To R2
mov 3,r5 ; Get Remainder Low To R2
ret ; Return To Caller


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



Related topics:
8051 Program - count ascii decimal in string   |   8051 Program - unsigned divide   |   8051 Program - signed divide   |   8051 Program - signed mod   |   8051 Program - sign fixup for divide   |   8051 Program - divide   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment