home *** CD-ROM | disk | FTP | other *** search
- * char *bzero(dest, len)
- * register char *dest;
- * register unsigned int len;
-
- .text
- .globl _bzero
- _bzero:
- move.l 4(a7),a0 ; destination
- move.w 8(a7),d1 ; number of bytes
- beq bzero4 ; skip the lot if none to zero
- move.l a1,d0
- btst #0,d0 ; odd alignment?
- beq bzero0
- clr.b (a0)+ ; zero first byte
- subq.w #1,d1 ; and reduce count
- bzero0:
- move.w d1,d2 ; save full count value
- lsr.w #2,d1 ; convert to long count
- bra bzero2
- bzero1:
- clr.l (a0)+ ; word zero loop
- bzero2:
- dbra d1,bzero1
- btst #1,d2 ; extra word to copy?
- beq bzero3
- clr.w (a0)+ ; zero residual word
- bzero3:
- btst #0,d2 ; extra odd byte to copy?
- beq bzero4
- clr.b (a0)+ ; zero last byte
- bzero4:
- move.l 4(a7),d0 ; return destination pointer
- rts
-