These files are changed more or less radically from the original
sources by Hans van Staveren, Informatics staff
Vrije Universiteit Amsterdam
The changes are as follows:
The old assembler did a seek before every write, the seek address
was considered to be a 16 bit word.
This was not enough for compiled pascal-programs etc so the following
change was made:
In the init-fase of pass 2 a.out is created, and then opened three
times more for writing only.
These four file-descriptors are used as follows:
Fildes 1:	Text segment
Fildes 2:	Data segment
Fildes 3:	Text relocation
Fildes 4:	Data relocation
These filedescriptors are put to their right starting point once.
This change required two extra buffers + the increase of 1 word (fildes)
per buffer.
Furthermore txtp now is no buffer anymore but contains a pointer to
one. This adds one extra indirection at several places.
At the same time the -o filename was implemented and meaningful
exit-stati were implemented.
For full details read diff-listings behind this.













































27 Mrt 13:02 1979  diff.as11.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
3d3
< 
4a5,12
> /
> / VU: a lot of changes; warning: not all changes are marked
> / VU PATH: as2 in /ovl (not in this distributed version)
> / VU MODE: give files mode 644
> / VU MOD1: -o flag implemented
> / VU MOD2: exit with decent exit status
> / VU MOD3: handle big files (see big comment in as21.s)
> / VU MOD4: increase symbol table from 1500 to 2500
36a45
> 	movb	errflg,r0
43a53
> a.outp:	a.out
49a60
> /#ifndef PATH
50a62,65
> /#endif
> /#ifdef PATH
> /	</ovl/as:2\0>
> /#endif
55a71
> 	movb	$-1,errflg
106c122
< 	sys	exit
---
> 	jmp	aexit

































27 Mrt 13:02 1979  diff.as12.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.





























































27 Mrt 13:02 1979  diff.as13.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.





























































27 Mrt 13:02 1979  diff.as14.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.





























































27 Mrt 13:03 1979  diff.as15.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.





























































27 Mrt 13:03 1979  diff.as16.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.





























































27 Mrt 13:03 1979  diff.as17.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
31c32,33
< 	bpl	oprand
---
> 	cmp	r2,$-1		/symbol defined?
> 	bne	oprand		/if yes continue
























































27 Mrt 13:03 1979  diff.as18.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
29a31
> a.out:	<a.out\0>
40c42
< hshsiz = 1553.
---
> hshsiz = 2503.























































27 Mrt 13:04 1979  diff.as19.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
295c296,297
< 	cmpb	*2(r5),$'-
---
> 	mov	2(r5),r1
> 	cmpb	(r1)+,$'-
296a299,308
> 	cmpb	(r1)+,$'o
> 	bne	1f
> 	tstb	(r1)+
> 	bne	1f
> 	add	$4,r5
> 	sub	$2,r0
> 	mov	(r5),a.outp
> 1:
> 	cmpb	*2(r5),$'-
> 	bne	1f













































27 Mrt 13:04 1979  diff.as21.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
77c78
< 	cmp	outmod,$777
---
> 	cmp	outmod,$755
91c92
< 	inc	passno
---
> 	incb	passno
101a103,173
> /
> /	following this comment a lot of code was added by Hans van Staveren
> /
> /	This was necessary due to the error in this assembler that
> /	assumed a.out files would never grow larger than 2^16 bytes
> /	The contrary has however been experienced.
> /
> /	Since I did not understand all of the assembler I did the following:
> /	I created the a.out file, opened it 3 times more for writing,
> /	and once and for all seeked those file-descriptors to the place
> /	where they should point.
> /	I do not consider the change very nice but it seemed the only
> /	way, considering the dirty programming of the people who 
> /	wrote this assembler.
> /
> 
> 	clr	r4
> 	mov	r1,r5
> 	add	$20,r5
> 	adc	r4
> 	mov	datap+6,r0
> 	jsr	pc,doseek	/seek data-filedescriptor
> 
> 	clr	r4
> 	mov	r2,r5
> 	add	$20,r5
> 	adc	r4
> 	add	r1,r5
> 	adc	r4
> 	mov	trelp+6,r0
> 	jsr	pc,doseek	/seek text-reloc-filedescriptor
> 
> 	clr	r4
> 	mov	r2,r5
> 	add	$20,r5
> 	adc	r4
> 	add	r1,r5
> 	adc	r4
> 	add	r1,r5
> 	adc	r4
> 	mov	drelp+6,r0
> 	jsr	pc,doseek	/seek data-reloc-filedescriptor
> 
> 	br	1f
> 







27 Mrt 13:04 1979  diff.as21.s Page 2


> doseek:	mov	r0,r3		/save fildes in r3
> 	div	$1000,r4	/now r4=blockoffset,r5=byteoffset
> 	mov	r4,syssk+2
> 	mov	$3,syssk+4
> 	sys	indir;syssk	/seek blocks
> 	bes	skerr
> 	mov	r5,syssk+2
> 	mov	$1,syssk+4
> 	mov	r3,r0
> 	sys	indir;syssk	/seek bytes
> 	bes	skerr
> 	rts	pc
> 
> 
> skerr:	jsr	r5,filerr;a.outp
> 	/ no return
> 
> 	.data
> syssk:	sys	seek;..;..	/for seeks
> 	.text
> 
> /	end of added code here
> /	many instructions that follow now are probably useless
> /	I didn't dare to remove them.
> /
> 1:
124c196
< 	jsr	r5,oset; txtp
---
> 	jsr	r5,oset; textp
126c198,204
< 	jsr	r5,oset; relp
---
> 	jsr	r5,oset; trelp
> /	code added
> 	mov	datseek,r0
> 	jsr	r5,oset;datap
> 	mov	drelseek,r0
> 	jsr	r5,oset;drelp
> /	end of added code
138,139c216,219
< 	jsr	r5,flush; txtp
< 	jsr	r5,flush; relp
---
> 	jsr	r5,flush; textp
> 	jsr	r5,flush; trelp
> 	jsr	r5,flush; datap
> /	don't flush data-relocation, symbols are written after it
147,148c227
< 	mov	symseek,r0
< 	jsr	r5,oset; txtp
---
> 	mov	$drelp,relp	/write "data-relocation" now
154c233
< 	jsr	r5,putw; txtp
---







27 Mrt 13:04 1979  diff.as21.s Page 3


> 	jsr	r5,putw; relp
157c236
< 	jsr	r5,putw; txtp
---
> 	jsr	r5,putw; relp
160c239
< 	jsr	r5,putw; txtp
---
> 	jsr	r5,putw; relp
163c242
< 	jsr	r5,putw; txtp
---
> 	jsr	r5,putw; relp
165c244
< 	jsr	r5,putw; txtp
---
> 	jsr	r5,putw; relp
167c246
< 	jsr	r5,putw; txtp
---
> 	jsr	r5,putw; relp
172c251
< 	jsr	r5,flush; txtp
---
> 	jsr	r5,flush; drelp
183c262,264
< 	sys	chmod; a.out; outmod: 777
---
> 	mov	a.outp,0f
> 	sys	chmod; 0: ..; outmod: 755
> 	movb	errflg,r0
188c269
< 	mov	*(r5),r5
---
> 	mov	*(r5),r3
190c271
< 	movb	(r5)+,ch
---
> 	movb	(r3)+,ch
197a279
> 	movb	$-1,errflg






















27 Mrt 13:05 1979  diff.as22.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
21c22
< 	mov	$666,outmod		/ make nonexecutable
---
> 	mov	$644,outmod		/ make nonexecutable
96c97
< 	mov	txtp,r0
---
> 	mov	*txtp,r0
103c104,105
< 	mov	$666,outmod		/ make nonexecutable
---
> 	mov	$644,outmod		/ make nonexecutable
> 	incb	errflg
















































27 Mrt 13:05 1979  diff.as23.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.





























































27 Mrt 13:05 1979  diff.as24.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
12c13
< 	add	$6,r0
---
> 	add	$8.,r0
15c16
< 	add	$1004,r0
---
> 	add	$1006,r0
24c25
< 	mov	(r5)+,r2
---
> 	mov	*(r5)+,r2
48,53c49,54
< 	mov	r1,0f		/ seek address
< 	mov	fout,r0
< 	sys	indir; 9f
< 	.data
< 9:	sys	seek; 0:..; 0
< 	.text
---
> /	mov	r1,0f		/ seek address
> /	mov	fout,r0
> /	sys	indir; 9f
> /	.data
> /9:	sys	seek; 0:..; 0
> /	.text
55a57
> 	add	$2,r1
57a60
> 	add	$2,r0
65c68
< 	mov	fout,r0
---
> 	mov	6(r2),r0
66a70
> 	bes	wrerr
71a76,77
> wrerr:	mov	r0,r1
> 	jsr	r5,filerr;a.outp






















27 Mrt 13:06 1979  diff.as25.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.





























































27 Mrt 13:06 1979  diff.as26.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
339,340c340,341
< 	jsr	r5,flush; txtp
< 	jsr	r5,flush; relp
---
> /	jsr	r5,flush; txtp
> /	jsr	r5,flush; relp
342,349c343,354
< 	add	$txtseek-[2*25],r2
< 	mov	r2,tseekp
< 	mov	(r2),r0
< 	jsr	r5,oset; txtp
< 	add	$trelseek-txtseek,r2
< 	mov	(r2),r0
< 	mov	r2,rseekp
< 	jsr	r5,oset; relp
---
> /	add	$txtseek-[2*25],r2
> /	mov	r2,tseekp
> /	mov	(r2),r0
> /	jsr	r5,oset; txtp
> /	add	$trelseek-txtseek,r2
> /	mov	(r2),r0
> /	mov	r2,rseekp
> /	jsr	r5,oset; relp
> /	added code
> 	mov	tbufp-[2*25](r2),txtp
> 	mov	rbufp-[2*25](r2),relp
> /	end of it

































27 Mrt 13:07 1979  diff.as27.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.





























































27 Mrt 13:07 1979  diff.as28.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
7d7
< a.out:	<a.out\0>
10d9
< a.outp:	a.out
12a12
> a.outp:	0
18a19,21
> /added variables by Hans(see as21.s)
> txtp:	textp
> relp:	trelp
19a23,26
> tbufp:	textp;	datap;	datap
> rbufp:	trelp;	drelp;	drelp
> 
> 
51a59
> ibufp:	.=.+2
67,69c75,78
< ibufp:	.=.+2
< txtp:	.=.+6+512.
< relp:	.=.+6+512.
---
> textp:	.=.+8.+512.
> trelp:	.=.+8.+512.
> datap:	.=.+8.+512.
> drelp:	.=.+8.+512.
72c81,82
< passno:	.=.+2
---
> passno:	.=.+1
> errflg:	.=.+1






























27 Mrt 13:07 1979  diff.as29.s Page 1


1a2
> / copyright 1972 bell telephone laboratories inc.
252c253
< 	cmp	(sp),$4
---
> 	cmp	(sp),$5
256c257
< 	cmp	(sp)+,$5
---
> 	cmp	(sp)+,$6
263a265
> 	mov	(sp)+,a.outp
271c273,274
< 	sys	creat; a.out; 0
---
> 	mov	a.outp,0f
> 	sys	creat; 0: ..; 644
273c276
< 	jsr	r5,filerr; a.outp
---
> 7:	jsr	r5,filerr; a.outp
275c278,285
< 	movb	r0,fout
---
> 	mov	r0,textp+6
> 	mov	a.outp,0f
> 	jsr	pc,9f
> 	mov	r0,datap+6
> 	jsr	pc,9f
> 	mov	r0,trelp+6
> 	jsr	pc,9f
> 	mov	r0,drelp+6
276a287,290
> 9:
> 	sys	open;	0: ..	; 1
> 	bes	7b
> 	rts	pc
























