ReadMe for C:\apsh33x November, 2009 Foreward - The Smallest C Applications for the Apple II ------------------------------------------------------- Does size matter? When it comes to Apple II DOS 3.3 programs it does since usually DOS 3.3 programs are run from floppy or from a floppy disk image in an emulator. Despite the desire for small programs, it is still nice to write a program using the C language rather than descending into machine code or interpreted BASIC spaghetti-code with (yich!) line numbers. Fortunately it has been possible for a very long time to "have your cake and eat it too"... The smallest C applications for the Apple II as far as I know are the Aztec C programs that are written for the Aztec C DOS 3.3 Shell. (The DOS 3.3 Shell was discontinued in later Aztec C Versions in favour of their ProDOS shell.) However, these shell programs will not run outside the shell. These Aztec C DOS 3.3 Shell programs also accept commandline arguments and redirection. That's something you don't see on the Apple II every day... However they may be noticeably slower than some other C's including Aztec C native code programs that run outside the shell. But because emulators like AppleWin are so fast themselves, and Apple //e's like mine have 8 MHZ Zip Chips, speed is really not so much an issue as it may once have been. The following link can be used for more information on the DOS 3.3 shell (this document is also in the C:\apsh33x\DOCS folder [in this distribution]): http://www.aztecmuseum.ca/docs/D33Shell.txt The following link can be used to read more on "The Speed Versus Size Dilemma" (this document is also in the C:\apsh33x\DOCS folder [in this distribution] where it is called "C65DOS33manual.txt"): http://www.aztecmuseum.ca/docs/AztecC_minimanual.txt The above is also a good reference for available library functions etc. The following links can also be referenced (and additional files downloaded) for working with both the DOS 3.3 and ProDOS 8 Aztec C Shells (but you don't need those additional files to work with C:\apsh33x [this distribution]): http://www.aztecmuseum.ca/docs/AppleShell.txt http://www.aztecmuseum.ca/AppleShell.zip At the time I created the above linked project, no cross-development environment existed for the Aztec C DOS 3.3 Shell... but since that time I have been able to complete a 6502 cross-compiler bundle for MS-DOS (Windows) that produces these very small C programs for the Aztec C DOS 3.3 Shell by modifying the Aztec C Commodore 64 cross-compiler distribution and augmenting that with a library for the Apple II from another native mode Aztec C compiler of the same vintage. That is what C:\apsh33x [this distribution] is about. *BUT* I may be wrong about these being "The Smallest C Applications for the Apple II". For all I know maybe some equivalent C applications for other shells for the Apple II (like the Davex Shell or the Phade Shell) might be smaller... and this is not to even mention CP/M 80 C programs like those written in Mix C which have their own runtime and therefore don't need to be large themselves: http://www.cpm8680.com/mix/index.htm So am I right? Does this particular Aztec C produce the smallest executable C programs for the Apple II? Or what C compiler does? And oh sure! there are people who are going to say "comparing programs for size gets silly" and they are probably right. Have Fun! Bill Buckels November 2009 (The above is a slightly edited and expanded version of my comments in my recent thread "The Smallest C Applications for the Apple II" in the comp.sys.apple2.programmer newsgroup.) About This Compiler Distribution -------------------------------- This compiler distribution is quite small with a narrow focus as discussed above and was "curated" by combining the following: 1. Link Library and Headers and Shell Disk Image from: Manx Aztec C65 for Apple II DOS 3.3 C II Vers. 1.05i 6502 and INTERP (C) 1982, 1983 by Manx Software Systems http://www.aztecmuseum.ca/compilers.htm#applenative c:\apsh33x\LIB\SHINT.LIB - link library c:\apsh33x\INCLUDE\CCI\*.h - headers c:\apsh33x\SAMPLES\SHELL.dsk - "plain brown wrapper" minimal shell c:\apsh33x\SAMPLES\SAMPLES.dsk - minimal shell with sample programs Note: Sample programs are discussed further in this document. 2. Binaries from: Manx Aztec C65 Version 1.06e Target: Commodore 64 6502 Native Code Target OS: Commodore 64 (C64) BASIC 2 operating system Compiler: C II Vers. 1.05h 6502 (C) 1982, 1983 by Manx Software Systems http://www.aztecmuseum.ca/compilers.htm#commodore c:\apsh33x\BIN\ASI.EXE - assembler c:\apsh33x\BIN\CCI.EXE - compiler c:\apsh33x\BIN\LN65.EXE - linker 3. Additional Utilities from the Apple33 distribution from my website: http://www.aztecmuseum.ca/compilers.htm#applecross c:\apsh33x\TOOLS\APPIBTXT.EXE - apple <-> ibm text converter c:\apsh33x\TOOLS\MAKE.EXE - make utility c:\apsh33x\TOOLS\makeprg.exe - strips 4 byte BASIC header created by compiler Disclaimer and Conditions of Use -------------------------------- This compiler is (C) Copyright 1983 Manx Software Systems. Harry Suckow (the Copyright holder for Aztec C) has given permission to use and redistribute Manx Software Systems discontinued Aztec C compilers for now- obsolete platforms for educational purposes by researchers and enthusiasts. I herewith grant you a non-exclusive conditional licence to use any and all of my work included with this compiler for whatever use you deem fit, provided you do not take credit for my work, and that you leave my copyright notices intact in all of it. I, Bill Buckels, do not guarantee, or warranty, in whole or in part, any of this, and further do not offer support for any of this. All of this is provided as-is. Please see licence.txt for more details. Bill Buckels bbuckels@mts.net Introduction ------------ As noted above, this is an Aztec C build environment for Windows XP (MS-DOS) which will enable you to produce programs for the Aztec C Apple II DOS 3.3 shell. The flavour of C that is used is not ANSI compliant, but many of the functions that existed or still exist in ANSI C are available, or have equivalents. I am unable to provide the original documentation for this compiler, but generally speaking, the following link can be used to read more on available library functions etc.(this document is also in the C:\apsh33x\DOCS folder [in this distribution] where it is called "C65DOS33manual.txt"): http://www.aztecmuseum.ca/docs/AztecC_minimanual.txt Programs are written in C on an IBM-PC compatible computer. This compiler's first pass produces assembly language, which is assembled on the second pass and linked to other assembled code objects and libraries on the final pass to produce finished programs. It is quite a complicated environment, but I have highly simplified it for you by pre-configuring it to run under Windows XP, and by using MAKEFILE's. I have organized this environment into topical subdirectories to make it easier for you to review and use my work and to provide you with a sustainable framework for your own research. Some of this is as follows: Directory Structure ------------------- C:\apsh33x\ - startup directory - click-on WindowsXP shortcut to begin. C:\apsh33x\SAMPLES - sample programs and disk images. C:\apsh33x\TOOLS - required to build rograms provided. C:\apsh33x\INCLUDE - Aztec C headers. C:\apsh33x\LIB - Link Library. C:\apsh33x\BIN - Aztec C Binaries - Compiler, Assembler, Linker. C:\apsh33x\DOC - Reference Documents that I thought you might need. Review the contents of each directory and their subdirectories for more information. Always save a copy of your original directory if modifying or building anything. Compiler Limitations -------------------- Be sure to read C:\apsh33x\XPNotes.txt for some known problems that you may encounter and for their solutions. The compiler can't handle very many defines. It is very old and written to run in a limited memory environment. It does not as far as I know accept paths for include and lib. Instead my MAKEFILEs copy the headers and libs required to the current build directory and remove them when done. The variables as well as the constants (all symbols) are truncated and you can review the assembly pass of your programs to see what they have been truncated to. Because it is so old, rather than moan and groan about how crappy it is, I consider all of this absolutely excellent especially because it can be used effectively 25 years after it was written. There is one other thing... for whatever reason this compiler will not run in the DOSBOX emulator. So if you are running this under linux and not Windows, note that I have successfully used this compiler in DOSEmu under Ubuntu. Windows users should have no problem using a standard cmd window. Getting Started --------------- Unzip the ZIP file(s) with directories intact onto the root of your C: Drive. The Windows XP shortcut has been pre-configured to use this directory structure. Open the C:\apsh33x folder in MyComputer and click-on the shortcut. A cmd window will open, and you will be in the C:\apsh33x directory which is the parent directory for this environment. The required environment variables to build Aztec C programs are set for you, and you can build these anywhere on your computer from this cmd window. You must be somewhat familiar with DOS commands to use this build environment. You must CD (Chdir) to each program's build directory. You can test the environment by building the programs in the SAMPLES subdirectory.Each has its own MAKEFILE which will build a program simply by typing "make" and pressing [ENTER] while in each's project directory under SAMPLES. Have Fun! Bill Buckels bbuckels@mts.net November 2009 (C) Copyright Bill Buckels 2009 All Rights Reserved. End of Document