|
|
1.1 ! root 1: .file "memset.s" ! 2: # @(#)memset.s 1.5 ! 3: # Fast assembler language version of the following C-program ! 4: # memset ! 5: # which represents the `standard' for the C-library. ! 6: ! 7: # Set an array of n chars starting at sp to the character c. ! 8: # ! 9: # char * ! 10: # memset(sp, c, n) ! 11: # register char *sp, c; ! 12: # register int n; ! 13: # { ! 14: # register char *sp0 = sp; ! 15: # ! 16: # while (--n >= 0) ! 17: # *sp++ = c; ! 18: # return (sp0); ! 19: # } ! 20: .globl _memset ! 21: .text ! 22: .align 2 ! 23: _memset: ! 24: .word 0x00c0 # pgm uses regs 0,1,2,3,4,5,6,7 ! 25: movl 12(ap),r6 # n in r6 ! 26: bleq L2 # should be > 0 ! 27: movq 4(ap),r3 # s1 in r3; `c' in r4 ! 28: movl r4,r7 # r0 to r5 are clobbered by movc5 ! 29: L0: ! 30: cmpl $65535,r6 # is len VERY large? ! 31: bgeq L1 # hop if not ! 32: movc5 $0,(ap),r7,$65535,(r3) # copy `c' into this BLOCK ! 33: subl2 $65535,r6 # compute remaining len ! 34: jbr L0 # go back to fill some more ! 35: L1: ! 36: movc5 $0,(ap),r7,r6,(r3) # copy `c' into this BLOCK ! 37: L2: ! 38: movl 4(ap),r0 # we're done - return s1 ! 39: ret
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.