[net.micro.apple] Help! How to compile Aztec C progra

jenks@uiucdcsp.CS.UIUC.EDU (09/13/86)

/* Written  4:59 pm  Sep 10, 1986 by moore@mit-eddie.MIT.EDU in uiucdcsp:net.micro.apple */


> [...] Can anyone tell me how to go about editing and
> compiling a program under DOS 3.3 Aztec C?  (does Aztec have an editor,
> what are the commands, etc.?)

/* End of text from uiucdcsp:net.micro.apple */


Well, it's not easy.  First, on your DOS 3.3 disks (i hope it's a plural --
there are eight (!) sides to my Aztec C) there is a BRUN-able file called
SHELL.  Well, you BRUN it.  That brings up a UNIX-ish shell, whose commands
are (ahem):
	boot {slot}	like PR# from BASIC
	bye		jumps to DOS-less AL monitor
	call {address}	just like BASIC, only it accepts hex (call $800)
	cd {sS,dD,vV}	changes "data directory" to a disk drive
	ce {sS,dD,vV}	changes "execution directory" -- shell will search
			here if it doesn't find a command on data disk
	cp file1 file2	just like UNIX, only no options.  file names support
			slot,drive,volume notation
	load file [aN] [lN]	when aN specifies "at address N", and lN
			specifies "length N"
	lock file1 [file2] ...	DOS 3.3 LOCK -- note multiple files
	ls [sS,dD,vV]	CATALOG -- output CAN'T be redirected
	maxfiles n	like DOS 3.3 -- default n = 3
	mv [-f] file1 file2	move file1 to file2 -- if different disk,
			copy 1->2, delete 1.  if same, rename 1->2.
			-f option supresses error message & 2 deleted first.
	rm file1 [file2] ...	delete unLOCKed files
	run [argv0] [argv1] ...	JSR to start of last-loaded file.  push
			argc, argv on  C stack (different from 6502 stack)
	save file [aN] [lN]	like BSAVE
	unlock file1 [file2] ...	obvious

The shell has batch facilities in text files.  If this is in a text file named
SPUTNIK...

	set -x -a
	loop
	# This is argument number $#,$%
	c65 -a -o $%.c
	as65 -o $%.rel $%.asm
	loop

...then typing the file name from the shell prompt will cause the shell to
compile all the files named...
	% sputnik file1.c file2.c file3.c ...
The files c65, c65.2, and as65 _must_ be either on you main (data) disk, or an
"execution" disk that you have specified with "ce sS,dD,vV".  Aztec C uses a
symbolic linker.  After compiling the program to a relocatable file (file.rel,
or file.int for pseudo-code compiler), you need to link it with the libraries.  There are several libraries to choose from:

	sh65.lib	uses calls to shell for I/O etc.  The '65' means this
			is in FAST native 6502 code.  (Fast, but long.)

	shint.lib	also uses shell calls, but this is a pseudo-code
			lib.  (Slower, but shorter.)  "int" = pseudo-code.

	sa65.lib	stand-alone lib, for use without the shell in memory.

	saint.lib	obvious?

	flt65.lib	floating-point routines -- must be linked in to use
			reals, doubles, etc.

	fltint.lib	yeah, yeah.

Linking is done with the program called "ln".

	ln [-t] [-o outfile] [-r] [-b N] [-c N] [-d N] [-f infile] file.rel

Quickly,
	-t		symbol table for debug
	-b address	base address (def = $800)
	-c address	code address (def = base + 3 for JSR $xxxx)
	-d address	data address (def = end of code)
	-f filename	merge entire file with command line args

The editor for Aztec C is called ved.  It uses a subset of the commands
for vi on UNIX.  Invoke it with "ved [-tN] file" where -tN sets tab size.
Once you're in, type ? for help.

The shell allows I/O redirection (UNIX's < and > but not |), but no wildcard
file names or history commands.

There is a configuration program (called, of all things, config) to set up
your printer, your 80-column card (if any), etc.

If you are going to use Aztec C for more than just playing around, I HIGHLY
recommend that you get yourself a ram disk -- it REALLY saves on the disk-
intensive stuff like compiler, assembling, and linking.

Coincedentally, I have a 256K ram disk for sale -- cheap.  Mail me if
interested.  (Upgradable to 1 M, it's an official Apple card, works
perfectly with shell DOS.)

Good luck!  If you ever do anything interesting, please let me know.  I
taught a class last semester in how to use this thing, and might teach one
next semester too.  Any concrete uses would be appreciated!


-- Ken Jenks


	"Science is to see what everyone else has seen,
	   and to think what no one else has thought."
			-- Albert Szent-Gyorgi