From 2aa64be3a6928f79e445a73eb4998de6497b53b9 Mon Sep 17 00:00:00 2001 From: ceriel Date: Fri, 27 Mar 1987 09:55:28 +0000 Subject: [PATCH] Franks version --- mach/m68k4/libem/cms.s | 28 ++++++++++++++-------------- mach/m68k4/libem/cmu.s | 37 +++++++++++++++++-------------------- mach/m68k4/libem/exg.s | 30 +++++++++++------------------- 3 files changed, 42 insertions(+), 53 deletions(-) diff --git a/mach/m68k4/libem/cms.s b/mach/m68k4/libem/cms.s index b6f4a5109..fa6d1b6b4 100644 --- a/mach/m68k4/libem/cms.s +++ b/mach/m68k4/libem/cms.s @@ -4,23 +4,23 @@ .sect .data .sect .bss +.sect .text ! d0 contains set size - - .sect .text + ! on exit d0 is zero for equal, non-zero for not equal .cms: - move.l (sp)+,a2 ! return address - move.l sp,a0 - move.l sp,a1 - add d0,a1 - move.w d0,d1 - asr #1,d0 + move.l (sp)+, d2 ! return address + move.l sp, a0 ! address of top block + lea 0(sp, d0.l), a1 ! address of lower block + move.l d0, d1 + asr.l #2, d0 1: - cmp (a0)+,(a1)+ + cmp.l (a0)+, (a1)+ bne 2f - sub.l #1,d0 + sub.l #1, d0 bne 1b 2: - asl #1,d1 - add d1,sp - move.l d0,-(sp) - jmp (a2) + asl.l #1, d1 + add.l d1, sp ! two blocks popped + move.l d2, -(sp) + rts +.align 2 diff --git a/mach/m68k4/libem/cmu.s b/mach/m68k4/libem/cmu.s index 9f2051598..5228ed056 100644 --- a/mach/m68k4/libem/cmu.s +++ b/mach/m68k4/libem/cmu.s @@ -1,32 +1,29 @@ -.define .cmu +.define .cmu .sect .text .sect .rom .sect .data .sect .bss - ! d0 : # bytes of 1 block - .sect .text +.sect .text + ! on entry d0: # bytes of 1 block + ! on exit d0: result .cmu: - move.l sp,a0 ! top block - add.l #4,a0 - move.l a0,a1 - add.l d0,a1 ! lower block - move.l d0,d2 - asr.l #2,d0 - sub.l #1,d0 - move.l #1,d1 ! greater + move.l (sp)+, d2 ! return address + move.l sp, a0 ! address of top block + lea 0(sp, d0.l), a1 ! address of lower block + move.l d0, d1 + asr.l #2, d0 1: - cmp.l (a0)+,(a1)+ + cmp.l (a0)+, (a1)+ bne 2f - dbf d0,1b - clr.l d1 ! equal + sub.l #1, d0 + bne 1b ! note: on equal carry is set 2: bcc 3f - neg.l d1 ! less + neg.l d0 ! less 3: - asl.l #1,d2 - move.l (sp)+,a0 - add.l d2,sp ! new sp - jmp (a0) - + asl.l #1, d1 + add.l d1, sp ! new sp; two blocks popped + move.l d2, -(sp) + rts .align 2 diff --git a/mach/m68k4/libem/exg.s b/mach/m68k4/libem/exg.s index 396893b6e..18fd7c176 100644 --- a/mach/m68k4/libem/exg.s +++ b/mach/m68k4/libem/exg.s @@ -1,28 +1,20 @@ -.define .exg +.define .exg .sect .text .sect .rom .sect .data .sect .bss +.sect .text ! d0 : exchange size in bytes - .sect .text .exg: - move.l (sp)+,d2 - move.l sp,a1 - sub.l d0,sp - move.l sp,a2 - asr #1,d0 - move.l d0,d1 + lea 4(sp, d0), a0 ! address of bottom block + lea 4(sp), a1 ! address of top block + asr.l #2, d0 + sub.l #1, d0 1: - move.l (a1)+,(a2)+ - sub #1,d0 - bgt 1b - move.l sp,a1 - asr #1,d1 -1: - move.l (a1)+,(a2)+ - sub #1,d1 - bgt 1b - move.l a1,sp - move.l d2,-(sp) + move.l (a1), d1 + move.l (a0), (a1)+ + move.l d1, (a0)+ + dbf d0, 1b rts +.align 2