masscomp-request@soma.UUCP (06/07/87)
Here is an assembler routine to use in place of bcopy(). If you have assembler routines you'd like to share, please send them to masscomp@soma.uucp. Stan Barber -------------------------------------------------------- | bcopy | call from c just like the | regular bcopy library routine. | hopefully this one is much faster | | $Header: bcopy.s,v 1.1 87/06/06 17:35:10 sim Exp $ | | By Stan Barber | Copyright 1987 Stan Barber | All Right Reserved. This code may be distributed freely | as long as this copyright notice remains intact. | .text | bcopy.c .globl _bcopy _bcopy: link.w a6,#0 | move.l (8,a6),a0 | load first pointer into a0 move.l (12,a6),a1 | load second pointer into a1 move.l (16,a6),d0 | load counter into d0 _bcp1: move.b (a0)+,(a1)+ | copy a byte from on to the other | and increment the pointer dbra d0,_bcp1 | decrement the count and test | if still greater than zero | branch back to the label unlk a6 rts .data .bss
jbuck@epimass.EPI.COM (Joe Buck) (06/15/87)
In article <3130@soma.bcm.tmc.edu>, sob@soma.bcm.tmc.edu (Stan Barber) writes: > Here is an assembler routine to use in place of bcopy(). It's fine as long as the number of bytes to copy is greater than zero. If given a zero length argument, it will copy 2^32 bytes! The fix is easy: add a conditional branch after copying the length argument to d0. -- - Joe Buck jbuck@epimass.EPI.COM (in the brave new world of domains!) {seismo,ucbvax,sun,decwrl,<smart-site>}!epimass.epi.com!jbuck [ARRGH! Thanks Joe. I forgot that....It has been a long time since I write assembly... sigh-- sob]