; Description:
; Signed Modulus Of R2/3 By R4/5
;
; Entry Requirements:
; Divisor In R4/5
; Dividend In R2/3
;
; On Exit:
; Remainder In 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:
; Swiped From A Now Defunct 'C' Compiler
;
UTIL_MOD:
push 0 ;
push 1 ;
mov a,r4 ;
xrl a,r2 ;
push acc ;
call NEGEM ;
call DIVIDE ;
mov 2,r4 ;
mov 3,r5 ;
pop acc ;
jnb acc.7,loop1 ;
clr a ;
clr c ;
subb a,r3 ;
mov r3,a ;
clr a ;
subb a,r2 ;
mov r2,a ;
loop1: pop 1 ;
pop 0 ;
ret ;
Source: Assorted Utilities, John C. Wren 11/23/96
Related topics:
8051 Program - count ascii decimal in string | 8051 Program - unsigned divide | 8051 Program - unsigned mod | 8051 Program - signed divide | 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