ack/mach/m68020/libem/cmi.s

30 lines
479 B
ArmAsm
Raw Normal View History

1987-01-29 22:10:18 +00:00
.define .cmi
.sect .text
.sect .rom
.sect .data
.sect .bss
.sect .text
! on entry d0: # bytes in 1 block
! on exit d0: result
.cmi:
1988-10-03 10:53:47 +00:00
move.l (sp)+, d1 ! return address
1987-01-29 22:10:18 +00:00
move.l sp, a0 ! address of top block
lea (sp,d0.l), a1 ! address of lower block
1988-10-03 10:53:47 +00:00
move.l d1,-(sp)
1987-01-29 22:10:18 +00:00
move.l d0, d1
asr.l #2, d0
1:
cmp.l (a0)+, (a1)+
bne 2f
sub.l #1, d0
bne 1b
2:
bge 3f
neg.l d0 ! less
3:
1988-10-03 10:53:47 +00:00
move.l (sp)+,a0
1987-01-29 22:10:18 +00:00
lea (sp,d1.l*2), sp ! new sp; two blocks popped
jmp (a0) ! return
.align 2