# Copyright (c) 1979 Regents of the University of California
# char sccsid[] = "@(#)28fun.s 4.1 10/10/80";
movl (sp)+,r0 #r0 has line limit
movl $0x7fffffff,r0 #non-positive indicates no limit
movl *(sp)+,r1 #r1 has file
movzwl (r10)+,r2 #r2 has size of character array
movl (sp)+,r3 #r3 has addr of character array
movl (sp)+,r4 #r4 has subscript into argv
movl *_argv[r4],r4 #r4 has pointer to argv string
locc $0,r2,(r4) #find end of string
subl3 r0,r2,r0 #calculate actual string length
movc5 r0,(r4),$blank,r2,(r3) #move with blank fill
pushal -(sp) #space for time
mull2 $50,r0 #(60ths * 1000) / 60
divl3 $3,r0,-(sp) # == (60ths * 50) / 3
divd3 $0d2.147483647e+09,r1,(sp) #div by maxint to get 0..1
movzbl (r10)+,r0 #r0 has size being disposed
movl (sp)+,r6 #r6 points to pointer
pushl (r6) #fetch pointer value
calls $1,_pfree #free space
clrl (r6) #set pointer to nil
# with: a: array[m..n] of t
# z: packed array[u..v] of t
# semantics: for j := u to v do
# 2. i+(v-u) <= n (i.e. i-m <= (n-m)-(v-u))
# on stack: lv(z), lv(a), rv(i) (len 4)
# move w(t)*(v-u+1) bytes from lv(a)+w(t)*(i-m) to lv(z)
movzwl (r10)+,r0 #r0 has size of "a" types
clrl r1 #r1 := subscript - lower_bound
cmpw r1,(r10)+ #check upper bound
mull2 r0,r1 #r1 has byte offset
movc3 (r10)+,*4(sp)[r1],*(sp) #make the move
addl2 $12,sp #clear the stack
# with: z and a as in pack
# semantics: for j := u to v do
movzwl (r10)+,r0 #r0 has size of "a" types
clrl r1 #r1 := subscript - lower_bound
cmpw r1,(r10)+ #check upper bound
mull2 r0,r1 #r1 has byte offset
movc3 (r10)+,*(sp),*4(sp)[r1] #make the move
addl2 $12,sp #clear the stack