Franks version

This commit is contained in:
ceriel 1987-03-27 09:55:28 +00:00
parent 13c208de3b
commit 2aa64be3a6
3 changed files with 42 additions and 53 deletions

View file

@ -4,23 +4,23 @@
.sect .data .sect .data
.sect .bss .sect .bss
.sect .text
! d0 contains set size ! d0 contains set size
! on exit d0 is zero for equal, non-zero for not equal
.sect .text
.cms: .cms:
move.l (sp)+,a2 ! return address move.l (sp)+, d2 ! return address
move.l sp,a0 move.l sp, a0 ! address of top block
move.l sp,a1 lea 0(sp, d0.l), a1 ! address of lower block
add d0,a1 move.l d0, d1
move.w d0,d1 asr.l #2, d0
asr #1,d0
1: 1:
cmp (a0)+,(a1)+ cmp.l (a0)+, (a1)+
bne 2f bne 2f
sub.l #1,d0 sub.l #1, d0
bne 1b bne 1b
2: 2:
asl #1,d1 asl.l #1, d1
add d1,sp add.l d1, sp ! two blocks popped
move.l d0,-(sp) move.l d2, -(sp)
jmp (a2) rts
.align 2

View file

@ -1,32 +1,29 @@
.define .cmu .define .cmu
.sect .text .sect .text
.sect .rom .sect .rom
.sect .data .sect .data
.sect .bss .sect .bss
! d0 : # bytes of 1 block .sect .text
.sect .text ! on entry d0: # bytes of 1 block
! on exit d0: result
.cmu: .cmu:
move.l sp,a0 ! top block move.l (sp)+, d2 ! return address
add.l #4,a0 move.l sp, a0 ! address of top block
move.l a0,a1 lea 0(sp, d0.l), a1 ! address of lower block
add.l d0,a1 ! lower block move.l d0, d1
move.l d0,d2 asr.l #2, d0
asr.l #2,d0
sub.l #1,d0
move.l #1,d1 ! greater
1: 1:
cmp.l (a0)+,(a1)+ cmp.l (a0)+, (a1)+
bne 2f bne 2f
dbf d0,1b sub.l #1, d0
clr.l d1 ! equal bne 1b ! note: on equal carry is set
2: 2:
bcc 3f bcc 3f
neg.l d1 ! less neg.l d0 ! less
3: 3:
asl.l #1,d2 asl.l #1, d1
move.l (sp)+,a0 add.l d1, sp ! new sp; two blocks popped
add.l d2,sp ! new sp move.l d2, -(sp)
jmp (a0) rts
.align 2 .align 2

View file

@ -1,28 +1,20 @@
.define .exg .define .exg
.sect .text .sect .text
.sect .rom .sect .rom
.sect .data .sect .data
.sect .bss .sect .bss
.sect .text
! d0 : exchange size in bytes ! d0 : exchange size in bytes
.sect .text
.exg: .exg:
move.l (sp)+,d2 lea 4(sp, d0), a0 ! address of bottom block
move.l sp,a1 lea 4(sp), a1 ! address of top block
sub.l d0,sp asr.l #2, d0
move.l sp,a2 sub.l #1, d0
asr #1,d0
move.l d0,d1
1: 1:
move.l (a1)+,(a2)+ move.l (a1), d1
sub #1,d0 move.l (a0), (a1)+
bgt 1b move.l d1, (a0)+
move.l sp,a1 dbf d0, 1b
asr #1,d1
1:
move.l (a1)+,(a2)+
sub #1,d1
bgt 1b
move.l a1,sp
move.l d2,-(sp)
rts rts
.align 2