Monday, May 30, 2016

8051 Program - sign fixup for divide

; Description:
; Does Sign Fixup For Divide
;
; Entry Requirements:
; Divisor In R4/5
; Dividend In R2/3
;
; On Exit:
; Divisor In R4/5, Sign Normalized
; Dividend In R2/3, Sign Normalized
;
; Affected:
; PSW.CY, PSW.Z, PSW.P, Acc, R2, R3, R4, R5
;
; Stack:
; 0 Bytes, Not Including Space Used By Called Routines
;
; Comments:
; Swiped From A Now Defunct 'C' Compiler
;
NEGEM:
mov a,r2;
jnb acc.7,loop1;
clr a;
clr c;
subb a,r3;
mov r3,a;
clr a;
subb a,r2;
mov r2,a;
;
loop1:mov a,r4;
jnb acc.7,loop2;
clr a;
clr c;
subb a,r5;
mov r5,a;
clr a;
subb a,r4;
mov r4,a;
loop2: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 - signed mod   |   8051 Program - divide   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment