" 
" Begin include file ...... makefil.incl.alm
" Created 1/9/74 by Noel I. Morris
" Last modified 10/30/75 by Noel I. Morris

"	lda	name		name of file
"	ldq	nsect		number of sectors needed
"	tsx2	makefil		to create file and enter in directory
"	tra	error		error return
"	stx7	dir_index		com|0,7 -> directory entry
"	sta	loc		location of command on disk


makefil:	sta	mkfnam		save file name
	stq	mkfloc		and desired length
	stx2	mkfx2		save X2

	tsx2	search		search for name already in dir
	tra	mkfnew		if not, make new name

	eaq	0,al		length in QU
	qrl	18		shift to QL
	anq	=o777,dl		and mask
	cmpq	mkfloc		is it desired length?
	tmi	mkfalloc		if less, allocate new area
	stca	mkfloc,74		save sector address
	tra	mkfsave		go set up dir entry

mkfnew:	lda	0,dl		search for empty space in directory
	tsx2	search		..
	tra	nodroom		if dir full, print error

mkfalloc:	stx7	mkfx7		save directory offset
	lda	mkfloc		get desired length of file
	tsx2	getsec		try to allocate space on disk
	tra	mkferr		if unsuccessful, take error return
	sta	mkfloc		save allocated space
mkfx7:	eax7	*		restor directory index

mkfsave:	lda	mkfnam		set name of file in dir
	sta	com|0,7		..
	lda	mkfloc		set location of file in dir
	sta	com|1,7		..

mkfx2:	eax2	*		restore X2
	tra	1,2		and return

nodroom:	tsx2	erpt
	acc	"no room in directory for ^g."
	arg	mkfnam

mkferr:	ldx2	mkfx2		restore X2
	tra	0,2		take error return

mkfnam:	bss	,1
mkfloc:	bss	,1

" End of include file ...... makefil.incl.alm

"
"
"                                          -----------------------------------------------------------
"
"
"
" Historical Background
"
" This edition of the Multics software materials and documentation is provided and donated
" to Massachusetts Institute of Technology by Group Bull including Bull HN Information Systems Inc. 
" as a contribution to computer science knowledge.  
" This donation is made also to give evidence of the common contributions of Massachusetts Institute of Technology,
" Bell Laboratories, General Electric, Honeywell Information Systems Inc., Honeywell Bull Inc., Groupe Bull
" and Bull HN Information Systems Inc. to the development of this operating system. 
" Multics development was initiated by Massachusetts Institute of Technology Project MAC (1963-1970),
" renamed the MIT Laboratory for Computer Science and Artificial Intelligence in the mid 1970s, under the leadership
" of Professor Fernando Jose Corbato. Users consider that Multics provided the best software architecture for
" managing computer hardware properly and for executing programs. Many subsequent operating systems
" incorporated Multics principles.
" Multics was distributed in 1975 to 2000 by Group Bull in Europe , and in the U.S. by Bull HN Information Systems Inc., 
" as successor in interest by change in name only to Honeywell Bull Inc. and Honeywell Information Systems Inc. .
"
"                                          -----------------------------------------------------------
"
" Permission to use, copy, modify, and distribute these programs and their documentation for any purpose and without
" fee is hereby granted,provided that the below copyright notice and historical background appear in all copies
" and that both the copyright notice and historical background and this permission notice appear in supporting
" documentation, and that the names of MIT, HIS, Bull or Bull HN not be used in advertising or publicity pertaining
" to distribution of the programs without specific prior written permission.
"    Copyright 1972 by Massachusetts Institute of Technology and Honeywell Information Systems Inc.
"    Copyright 2006 by Bull HN Information Systems Inc.
"    Copyright 2006 by Bull SAS
"    All Rights Reserved
"
"