diff --git a/AppleX/AZTEC.BAT b/AppleX/AZTEC.BAT
new file mode 100644
index 0000000..d7d0e44
--- /dev/null
+++ b/AppleX/AZTEC.BAT
@@ -0,0 +1,8 @@
+@echo off
+if "%1" == "" set PATH=C:\WINDOWS\system32;C:\WINDOWS
+set CROOT=%1
+if "%1" == "" set CROOT=C:\APPLEX
+set CLIB65=%CROOT%\LIB\
+set INCL65=%CROOT%\INCLUDE
+set CR65=%CROOT%\R\
+set PATH=%CROOT%;%CROOT%\BIN;%CROOT%\TOOLS;%PATH%;
diff --git a/AppleX/Aztec Apple C6502 Command Prompt.lnk b/AppleX/Aztec Apple C6502 Command Prompt.lnk
new file mode 100644
index 0000000..a66dc8a
Binary files /dev/null and b/AppleX/Aztec Apple C6502 Command Prompt.lnk differ
diff --git a/AppleX/Aztec Apple C6502 DOSBox Prompt.lnk b/AppleX/Aztec Apple C6502 DOSBox Prompt.lnk
new file mode 100644
index 0000000..07fc17b
Binary files /dev/null and b/AppleX/Aztec Apple C6502 DOSBox Prompt.lnk differ
diff --git a/AppleX/BIN/ARCV.COM b/AppleX/BIN/ARCV.COM
new file mode 100644
index 0000000..080ddd8
Binary files /dev/null and b/AppleX/BIN/ARCV.COM differ
diff --git a/AppleX/BIN/AS65.EXE b/AppleX/BIN/AS65.EXE
new file mode 100644
index 0000000..23ea1fc
Binary files /dev/null and b/AppleX/BIN/AS65.EXE differ
diff --git a/AppleX/BIN/ASI.EXE b/AppleX/BIN/ASI.EXE
new file mode 100644
index 0000000..01cc2f1
Binary files /dev/null and b/AppleX/BIN/ASI.EXE differ
diff --git a/AppleX/BIN/C65.EXE b/AppleX/BIN/C65.EXE
new file mode 100644
index 0000000..bcfacc9
Binary files /dev/null and b/AppleX/BIN/C65.EXE differ
diff --git a/AppleX/BIN/CCI.EXE b/AppleX/BIN/CCI.EXE
new file mode 100644
index 0000000..58fba88
Binary files /dev/null and b/AppleX/BIN/CCI.EXE differ
diff --git a/AppleX/BIN/LB.EXE b/AppleX/BIN/LB.EXE
new file mode 100644
index 0000000..1e62e38
Binary files /dev/null and b/AppleX/BIN/LB.EXE differ
diff --git a/AppleX/BIN/LN65.EXE b/AppleX/BIN/LN65.EXE
new file mode 100644
index 0000000..e6ced10
Binary files /dev/null and b/AppleX/BIN/LN65.EXE differ
diff --git a/AppleX/DOCS/A2TechNotes.pdf b/AppleX/DOCS/A2TechNotes.pdf
new file mode 100644
index 0000000..8ded4f1
Binary files /dev/null and b/AppleX/DOCS/A2TechNotes.pdf differ
diff --git a/AppleX/DOCS/ERRCODES.TXT b/AppleX/DOCS/ERRCODES.TXT
new file mode 100644
index 0000000..b541503
--- /dev/null
+++ b/AppleX/DOCS/ERRCODES.TXT
@@ -0,0 +1,35 @@
+
+ ProDOS Error Codes
+
+hex code Meaning
+------- --------------------------------
+ 00 No error
+ 01 Invalid number for system call
+ 04 Invalid param count for system call
+ 25 Interrupt vector table full
+ 27 I/O Error
+ 28 No device connected/detected
+ 2b Disk write protected
+ 2e Disk switched
+ 40 Invalid characters in pathname
+ 42 File control block table full
+ 43 Invalid reference number
+ 44 Directory not found
+ 45 Volume not found
+ 46 File not found
+ 47 Duplicate file name
+ 48 Volume Full
+ 49 Volume directory full
+ 4a Incompatible file format
+ 4b Unsupported storage type
+ 4c End of file encountered
+ 4d Position out of range
+ 4e File Access error; eg, file locked
+ 50 File is open
+ 51 Directory structure damaged
+ 52 Not a ProDOS disk
+ 53 Invalid system call parameter
+ 55 Volume control block table full
+ 56 Bad buffer address
+ 57 Duplicate volume
+ 5a Invalid address in bit map
diff --git a/AppleX/DOCS/ReadMe.txt b/AppleX/DOCS/ReadMe.txt
new file mode 100644
index 0000000..013c969
--- /dev/null
+++ b/AppleX/DOCS/ReadMe.txt
@@ -0,0 +1,99 @@
+
+ Aztec C65 for the Apple // ProDOS
+ Version 3.2b
+ Additional Information, Ed 2
+ 15 July 1986
+
+
+ This document contains information about the 3.2b version of Aztec
+C65, information that was added since the release document was
+printed.
+
+1. Version numbers
+
+ The signon message of some Aztec C65 programs say that they are
+version 3.2a. Don't worry, you have the correct software: even
+though individual programs are at version 3.2a, the product as a
+whole is at version 3.2b.
+
+
+2. End of Beta mode
+
+ With this release, Aztec C65 is no longer in beta mode, so for
+technical support, please call our technical support department at 201-
+542-1795, or call our electronic bulletin board at 201-542-2793,
+or send us a letter.
+
+ No changes have been made in going from version 3.2a, which was the
+last beta update, to version 3.2b.
+
+
+3. Compiler bugs
+
+ The 6502 compiler (named cc on native versions of Aztec C65, c65
+on cross development versions) doesn't allow char-to-pointer casts. At
+present, you can accomplish this by first casting the char to an int, then
+casting the int to a pointer. For example,
+
+ char c, *cp;
+ cp = (char *)(int)c;
+
+
+4. Problems with the Apple // Parallel printer card
+
+ When a parallel printer is opened on an Apple // that's in 40
+column mode, the ROM on the Apple // parallel printer card writes an
+inverse @ character to the screen.
+
+ When screen echo is off and the parallel printer ROM writes a
+character to the printer, the ROM resets the CH byte in memory, (ie,
+location $24, the byte that defines the horizontal position of the screen
+cursor); thus, if a program alternately writes to the printer and to the
+screen, the characters that are written to the screen will overwrite one
+another.
+
+
+5. convert bug
+
+ It's been reported (but not verified by us here at Manx) that the
+ProDOS convert program can't convert programs larger than 27K.
+
+
+6. Using the ROM graphics routines
+
+ It's been reported (but not verified by us here at Manx) that some
+of the ROM graphics routines (HPLOT, LINE) won't work when called
+by an Aztec C-generated program.
+
+
+7. get_time() bug
+
+ The get_time() function causes a program to crash. The problem is
+that get_time calls the time function without passing it an argument
+that's needed by time.
+
+
+8. Don't use the same names for variables and functions
+
+ Using the same name for a variable and a function can lead to
+hard-to-detect problems. For example, index is the name of a library
+function that is pulled into most programs. If you use this as the name
+of an uninitialized global variable, the linker will assign the variable the
+same address as the function. And if you use this as the name of an
+initialized global variable, the linker will assume that the index function
+begins at the index variable and will not pull in the index function.
+
+9. System programs
+
+ Many ProDOS system programs created using Aztec C65 will crash
+if they're started from the SHELL. There is no problem if they are
+started from the Basic Interpreter or automatically upon system start-up.
+
+ The problem arises from the facts that
+(1) the section of memory used by the SHELL's environment pages
+(0xbc00-0xbf00) is still allocated when a system program is started,
+and (2) a system program's pseudo stack grows down through the
+SHELL's environment pages. If the ProDOS MLI is told to perform an operation
+and return information on the pseudo stack,
+the MLI will not perform the operation if the information would be
+placed in the SHELL's still-allocated environment pages.
diff --git a/AppleX/DOCS/ReadMeFirst.txt b/AppleX/DOCS/ReadMeFirst.txt
new file mode 100644
index 0000000..71c9252
--- /dev/null
+++ b/AppleX/DOCS/ReadMeFirst.txt
@@ -0,0 +1,11 @@
+This Directory contains the two original Aztec C docs from Manx.
+
+The ReadMe is essentially a bug list.
+
+For additional information, you should get a copy of the Aztec C Manual which
+is available online at
+
+http://www.clipshop.ca/Aztec/cat1.htm and http://www.clipshop.ca/Aztec/cat2.htm
+
+This will provide you with the original text of the printed manual for the C65
+compiler
diff --git a/AppleX/DOCS/a2map.txt b/AppleX/DOCS/a2map.txt
new file mode 100644
index 0000000..66d11c1
--- /dev/null
+++ b/AppleX/DOCS/a2map.txt
@@ -0,0 +1,231 @@
+The comp.sys.apple2 Usenet newsgroup Apple II FAQs originate from
+the II Computing Apple II site, 1997-2012.
+
+Csa2 FAQs resource file: R032MMAP128.TXT
+
+128K Apple IIe Memory Map
+
+
+Note: To correctly view tables and diagrams on a super-res display,
+ use a mono-spaced Font such as CoPilot or PCMononspaced.
+
+____________________________
+
+
+
+
+128K Apple IIe Memory Map
+
+by David Empson
+
+
+
+
+ MAIN RAM AUX RAM I/O ROM
+
+ ______________ ______________
+0000 |Main zero page| |Aux zero page |
+ |______________| |______________|
+0100 | Main stack | | Aux stack |
+ |______________| |______________|
+0200 | | | |
+ | | | |
+0300 | | | |
+ |______________| |______________|
+0400 | | | |
+ | | | |
+ | Main text/GR | | Aux text/GR |
+ | | | |
+ | page 1 | | page 1X |
+ | | | |
+ | | | |
+ |______________| |______________|
+0800 | | | |
+ | | | |
+ | Main text/GR | | Aux text/GR |
+ | | | |
+ | page 2 | | page 2X |
+ | | | |
+ | | | |
+ |______________| |______________|
+0C00 | | | |
+ | | | |
+ ... ...
+ | | | |
+ |______________| |______________|
+2000 | | | |
+ | | | |
+ | Main Hi-res | | Aux Hi-res |
+ | | | |
+ | page 1 | | page 1X |
+ | | | |
+ | | | |
+ |______________| |______________|
+4000 | | | |
+ | | | |
+ | Main Hi-res | | Aux Hi-res |
+ | | | |
+ | page 2 | | page 2X |
+ | | | |
+ | | | |
+ |______________| |______________|
+6000 | | | |
+ | | | |
+ | | | |
+ ... ...
+ | | | |
+ | | | |
+BFFF |______________| |______________| _____________
+C000 | Motherboard |
+ | I/O |
+ |_____________|
+C090 | Slot I/O |
+ | (DEVSEL) |
+ |_____________| _____________
+C100 | | | |
+ | Slot CX ROM | | Int CX ROM |
+ | (IOSEL) | | |
+ | | | |
+ |_____________| |_____________|
+C300 | Slot C3 ROM | | Int C3 ROM |
+ | (IOSEL) | | |
+ |_____________| |_____________|
+C400 | | | |
+ | | | |
+ | Slot CX ROM | | Int CX ROM |
+ | (IOSEL) | | |
+ | | | |
+ | | | |
+ | | | |
+ |_____________| |_____________|
+C800 | | | |
+ | Slot ROM | | |
+ | (IOSTROBE) | | Int C3 ROM |
+ | | | |
+ | shared | | |
+ | between | | |
+ | slots | | |
+CFFF ______ ______ ______ ______ |_____________| |_____________|
+D000 | || | | || | | |
+ | Main || Main | | Aux || Aux | | |
+ | || | | || | | |
+ | LC || LC | | LC || LC | | |
+ | || | | || | | |
+ | bank || bank | | bank || bank | | |
+ | 1 || 2 | | 1 || 2 | | Applesoft |
+ |______||______| |______||______| | |
+E000 | | | | | BASIC |
+ | | | | | |
+ | | | | | ROM |
+ | | | | | |
+ | | | | | |
+ | Main | | Aux | | |
+ | | | | | |
+ | Language | | Language | | |
+ | | | | | |
+ | Card | | Card | | |
+ | | | | | |
+ | | | | |.............|
+F800 | | | | | Monitor |
+ | | | | | |
+ | | | | | ROM |
+FFFF |______________| |______________| |_____________|
+
+(If you have a RAMWorks or similar bank-switched card in the auxiliary
+slot, then any 64K bank on the card can be switched into the auxiliary
+memory space. "Normal" auxiliary memory, which contains the video
+buffers, is bank 0 on the card.)
+
+
+The major soft-switches for bank switching control areas as follows:
+
+AUXZP/MAINZP selects main or auxiliary RAM in 0000-01FF (zero page and
+stack), and in D000-FFFF (language card), for read/write access. The
+language card area is further affected by language card soft-switches
+(see later).
+
+RDMAIN/RDAUX selects main or auxiliary RAM in 0200-BFFF for read access
+only. Text page 1/1X and Hi-res page 1/1X may be excluded depending on
+the state of the 80STORE and HIRES soft-switches.
+
+WRMAIN/WRAUX selects main or auxiliary RAM in 0200-BFFF for write access
+only. Text page 1/1X and Hi-res page 1/1X may be excluded depending on
+the state of the 80STORE and HIRES soft-switches.
+
+80STORE enables 80-column switching of text/lo-res page 1 (0400-07FF).
+The active page (main or auxiliary) is determined by the PAGE1/PAGE2
+soft switch. 80STORE gives read/write access to whichever page is
+active.
+
+If 80STORE and HIRES are both enabled, then PAGE1/PAGE2 also control
+switching of hi-res page 1 (2000-3FFF).
+
+There is no special bank switching support for text or hi-res page 2/2X.
+Using the double resolution modes with these pages requires using
+another bank switching technique.
+
+SLOTCXROM/INTCXROM determines whether the slot address space or
+motherboard ROM is enabled for $C100-$C2FF and $C400-$C7FF.
+
+SLOTC3ROM/INTC3ROM determines whether the slot address space or
+motherboard ROM is enabled for $C300-$C3FF.
+
+The $C800-$CFFF area (I/O Stobe) is shared between all slots, and may be
+used by the internal ROM if INTC3ROM is active. An access to the
+$CN00-$CNFF page (N=1 to 7) enables the expansion ROM space for slot N,
+if supported by that card. An access to $CFFF disables the expansion
+ROM space for all cards.
+
+
+There are eight language card soft-switches to control selection of RAM
+bank 1 or 2, read enable for RAM or ROM, and write enable for RAM.
+
+Handy stub routines to access the auxiliary language card area are as
+follows:
+
+RDAUX1 SEI ; No interrupts!
+ LDX C088 ; Read-enable language card bank 1
+ STA C009 ; Switch in auxiliary language card, etc.
+ LDA xxxx ; Read target location (patched)
+ STA C008 ; Switch in main language card, etc.
+ LDX C08A ; Switch the ROM back in
+ CLI ; Enable interrupts
+ RTS
+
+WRAUX1 SEI ; No interrupts!
+ LDX C08B ; Read/write language card bank 1
+ LDX C08B ; (must access twice)
+ STA C009 ; Switch in auxiliary language card, etc.
+ STA xxxx ; Write target location (patched)
+ STA C008 ; Switch in main language card, etc.
+ LDX C08A ; Switch the ROM back in
+ CLI ; Enable interrupts
+ RTS
+
+RDAUX2 SEI ; No interrupts!
+ LDX C080 ; Read-enable language card bank 2
+ STA C009 ; Switch in auxiliary language card, etc.
+ LDA xxxx ; Read target location (patched)
+ STA C008 ; Switch in main language card, etc.
+ LDX C082 ; Switch the ROM back in
+ CLI ; Enable interrupts
+ RTS
+
+WRAUX2 SEI ; No interrupts!
+ LDX C083 ; Read/write language card bank 2
+ LDX C083 ; (must access twice)
+ STA C009 ; Switch in auxiliary language card, etc.
+ STA xxxx ; Write target location (patched)
+ STA C008 ; Switch in main language card, etc.
+ LDX C082 ; Switch the ROM back in
+ CLI ; Enable interrupts
+ RTS
+
+The C008/C009 switch controls both read and write access, unlike the
+switches for the main $0200-$BFFF area, but note the different
+instruction sequences needed to control read enable and read/write
+enable for the language card area. (You could set up the language card
+for write-only access using C081 or C089 instead of C083 or C08B, but it
+won't make the code any shorter.)
+
+
diff --git a/AppleX/DOCS/cat1.htm b/AppleX/DOCS/cat1.htm
new file mode 100644
index 0000000..cea49bc
--- /dev/null
+++ b/AppleX/DOCS/cat1.htm
@@ -0,0 +1,3210 @@
+
+
+
+Alphabetical Functions - Manx Aztec C 6502 for Apple II ProDOS
+
+
+
+
+Manx Aztec C 6502 for Apple II ProDOS
+
Alphabetical (more or less) Functions
+
+
+Introduction
+
+access
+assert
+atof, atoi, atol, ftoa
+black, blue, green, violet
+circle, set_asp
+close
+creat
+ctop, ptoc
+draw, bdrw, gdrw, rdrw, vdrw, lineto, blineto, glineto, rlineto, vlineto
+execl, execv, execlp, execvp
+exit, _exit
+exp, log, log10, pow, sqrt
+fabs, floor, ceil
+fclose, fflush
+feof, ferror, clearerr, fileno
+fixnam
+fopen, freopen, fdopen
+frexp, ldexp, modf
+fseek, ftell
+getenv
+ioctl, isatty
+isalpha, isupper, islower, isdigit, isalnum, isspace, ispunct, isprint, iscntrl, asascii
+lseek
+malloc, calloc, realloc, free
+mkdir
+mktemp
+movmem, setmem, swapmem
+open
+page1, page2
+perror, errno
+plot, bplot, gplot, rplot, vplot
+printf, fprintf, sprintf, format
+puts, fputs
+qsort
+ran
+read
+rename
+
+
+sbrk, brk, rsvstk
+scanf, fscanf, sscanf
+scr_beep, scr_bs, scr_tab, scr_lf, scr_cursup, scr_cursrt, scr_cr,
+scr_clear, scr_home, scr_eol, scr_linsert, scr_ldelete, scr_cinsert,
+scr_cdelete, scr_curs
+setjmp, longjmp
+sinh, cosh, tanh
+strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen,
+index, rindex
+_system
+text, hgr, fscreen, mscreen
+time, get_time, ctime, localtime, gmtime, asctime
+tmpnam
+toupper, tolower
+ungetc
+unlink
+write
+
+
+
+Introduction
+
+
+This is an HTML version of the electronic manual for Manx Aztec C for Apple II
+ProDOS released as freeware by Phade Software December 1999. The release notes
+for the electronic manual
+indicate that the electronic manual contains the same information as the paper
+manual distributed by Manx Software Systems with the compiler. However, they
+also indicate that if you are using the AZTEC PLUS release you should use the
+electronic manual rather than the paper manual supplied by Manx. Welcome to the
+wonderfully confusing World of Aztec C!
+
+
+The release notes for the electronic manual also indicate that the following
+notation in the synopsis part of a
+manual page only means that the function or utility is available both in UNIX and on
+the Apple II, but despite that fact, the description for that function or utility may differ
+between the Apple II and UNIX versions:
+
+ /* Apple // and UNIX function */ or
+ /* Apple // and UNIX utility */
+
+The contact information in the release notes for the electronic manual is as follows, but
+Manx Software Systems have apparently since faded from existence:
+
+
+Manx Software Systems
+P.O. Box 55
+Shrewsbury, N.J 07701
+
+
+Phade Software
+Inh. Frank Gadegast
+Schierker Strasse 39
+1000 Berlin 44 - Germany
+
+
+The HTML version (this document and others) was produced by Canadian Software Developer
+Bill Buckels by reformatting
+the Phade Software UNIX style man pages from the elctronic manual into consolidated HTML
+documents after converting these from Apple II text to IBM text. The original format has been
+preserved as much as practically possible, and the content of the Phade Software electronic
+manual remains apparently intact and unaltered in its transition to HTML.
+
+
+The main benefits of the HTML version are that you can view the information in the man pages
+on a single HTML document
+using a web browser in the relative comfort of a modern user interface and can use your
+web browsers "Find on this Page" feature to search through the content to easily locate
+information using your own search criteria. This is much easier than using the unix style
+man utility which can only search on key topics and will only display a single topic at a time.
+
+
+Licence and Disclaimer
+
+
+This is a derivative work and as such the licencing by the original authors applies. Bill Buckels
+makes no claims of ownership whatsoever for the content of this document, and further assumes no
+liability for the results its use.
+
+
+You may use the information in this document in any way you find useful (subject to the
+original authors restrictions and apparently there aren't any),
+provided that you agree that Bill Buckels has no warranty obligations or
+liability resulting from said use in any way whatsoever. If you
+don't agree, don't use this document.
+
+
+<< Back to Top
+
+
+
+
+
+
+ NAME access
+access - determine accessibility of a file or directory
+
+ SYNOPSIS
+
+int access (filename, mode) /* Apple // function */
+char *filename;
+int mode;
+
+ DESCRIPTION
+
+access determines whether a file or directory can be accessed in the way
+that the calling function wants to access it. It can also be used to just
+test for the existence of a file or directory.
+
+filename points to the name of the file or directory; this name optionally
+contains the drive and path of directories that must be passed through to
+get to the file or directory. If the drive component isn't specified, the
+file or directory is assumed to reside on the default drive. If the path
+component isn't specified, the file or directory is assumed to reside in
+the current directory on the specified drive.
+
+mode is an int that specifies the type of access desired:
+
+ mode meaning
+
+ 4 read
+ 2 write
+ 1 execute (if a file) or search (if a directory)
+ 0 check existence of the file or directory.
+
+If the existence of the file or directory is being checked (ie, mode=0),
+access returns 0 if the file exists and -1 if it doesn't. In the latter
+case, access also sets the symbolic value ENOENT in the global integer
+errno.
+
+When access is called to determine if a file can be accessed in a certain
+way (ie, mode isn't 0). access returns 0 if the file can be accessed in the
+desired manner; otherwise, it returns -1 and sets a code in the global
+integer errno that defines why the access is not permitted.
+
+When asked, access says that a directory can be read or written; this means
+that a program can create and delete files on the directory, not that it
+can directly read or write the directory itself.
+
+The symbolic values that access may set in errno when it's called with a
+non-zero mode parameter are:
+
+ errno meaning
+
+ ENOTDIR A component of the path prefix is not a directory.
+ ENOENT The file or directory doesn't exist.
+ EACCES The file or directory can't be accessed in the desired
+ manner.
+
+ SEE ALSO
+errno
+
+
+<< Back to Top
+
+
+
+
+ NAME assert
+assert - verify program assertion
+
+ SYNOPSIS
+
+#include <assert.h> /* Apple // function */
+
+assert (expr)
+int expr;
+
+ DESCRIPTION
+
+assert is usefull for putting diagnostic messages in a program. When
+executed, it will determine whether the expression expr is true or false.
+If false, it prints the message
+
+ Assertion failed: expr, file fff line lnnn
+
+where fff is the name of the source file and nnn is the line number of the
+assert statement.
+
+To prevent assertion statements from being compiled in a program, compile
+the program with the option -DNDEBUG, or place the statement #define NDEBUG
+ahead of the statement #include <assert.h>.
+
+<< Back to Top
+
+
+
+
+ NAME atof, atoi, atol, ftoa
+atof, atoi, atol - convert ASCII to numbers
+
+ftoa - convert floating point to ASCII
+
+ SYNOPSIS
+
+double atof (cp) /* Apple // and UNIX functions */
+char *cp;
+
+atoi (cp)
+char *cp;
+
+long atol (cp)
+char *cp;
+
+ftoa (val, buf, precision, type)
+double val;
+char *buf;
+int precision;
+int type;
+
+ DESCRIPTION
+
+atof, atoi, and atol convert a string of text characters pointed at by the
+argument cp to double, integer, and long represantations.
+
+atof recognizes a string containing leading blanks and tabs, which it
+skips, then an optional sign, then a string of digits optionally containing
+a decimal point, then an optional 'e' or 'E' followed be an optional signed
+integer.
+
+atoi and atol recognize a string containing leading blanks and tabs, which
+are ignored, then an optional sign, then a string of digits.
+
+ftoa converts a double precision floating point number to ASCII. val is the
+number to be converted and buf points to the buffer where the ASCII string
+will be placed. precision specifies the number of digits to the right of
+the decimal point. type specifies the format: 0 for 'E' format, 1 for 'F'
+format, 2 for 'G' format.
+
+atof and ftoa are in the library m.lib, the other functions are in c.lib.
+
+<< Back to Top
+
+
+
+
+ NAME black, blue, green, violet
+black, blue, green, violet - color selection functions
+
+ SYNOPSIS
+
+black() /* Apple // functions */
+
+blue()
+
+green()
+
+violet()
+
+ DESCRIPTION
+
+Each of these functions sets the screen in Hi-res, full-screen graphic
+mode, using the primary graphics page, and clears the screen.
+
+The entire screen will be a single color, as determined by the function
+that is called. For example, calling green makes the entire screen green.
+
+ SEE ALSO
+circle, line, mode, page, plotchar, point
+
+
+<< Back to Top
+
+
+
+
+ NAME circle, set_asp
+circle, set_asp - circle-drawing functions
+
+ SYNOPSIS
+
+circle (x, y, rad) /* Apple // functions */
+int x, y, rad;
+
+set_asp (xasp, yasp)
+int xasp, yasp;
+
+ DESCRIPTION
+
+circle draws an oval on the primary hi-res graphics page, with center at
+(x,y). By default, the horizontal and vertical radii of the oval are both
+rad, resulting in circle drawing a circle.
+
+set_asp controls the eccentricity (ie, the "ovalness") of the figure drawn
+by circle: circle draws an oval whose horizontal radius is rad * xasp and
+whose vertical radius is rad * yasp, where xasp and yasp have the values
+defined by the last call to set_asp. If set_asp isn't called, circle will
+use the value 1 for xasp and yasp, resulting in a circle of radius rad
+being drawn.
+
+ SEE ALSO
+color, line, mode, page, plotchar, point
+
+
+<< Back to Top
+
+
+
+
+ NAME close
+close - close a device or file
+
+ SYNOPSIS
+
+close (fd) /* Apple // and UNIX function */
+int fd;
+
+ DESCRIPTION
+
+close closes a device or disk file which is opened for unbuffered i/o.
+
+The parameter fd is the file descriptor associated with the file or device.
+If the device or file was explicity opened by the program by calling open
+or creat, fd is the file descriptor returned by open or creat.
+
+ DIAGNOSTICS
+
+If close fails, it returns -1 and sets an error code in the global integer
+errno. Otherwise it returns 0 as its value.
+
+ SEE ALSO
+open, creat, errno
+
+
+<< Back to Top
+
+
+
+
+ NAME creat
+creat - creat a new file
+
+ SYNOPSIS
+
+creat (name, pmode) /* Apple // and UNIX function */
+char *name;
+int pmode;
+
+ DESCRIPTION
+
+There are two descriptions of this function: The one you're now reading
+describes its implementation on the Apple //.
+
+creat creates a file and opens it for unbuffered, write-only access. If the
+file already exists, it is truncated so that nothing is in it (this is done
+by erasing and then creating the file).
+
+creat returns as its value an integer called a "file descriptor". Whenever
+a call is made to one of the unbuffered i/o functions to access the file,
+its file descriptor must be included in the function's parameters.
+
+name is a pointer to a character string which is the name of the device or
+file to be opened.
+
+For most systems, pmode is optional: if specified, it's ignored. It should
+be included, however, for programs for which UNIX-compatibility is
+required, since the UNIX creat function requires it. Int this case, pmode
+should have the ocal value 0666.
+
+For ProDOS programs, the pmode parameter of the creat function is the
+file's access mode. The meanings of the bits in this parameter (bit 0 is
+the least significant bit, bit 15 is the most significant):
+
+ Bit number Meaning
+
+ 0 File can be read
+ 1 File can be written
+ 2-4 Reserved
+ 5 File modified since last backup
+ 6 File can be renamed
+ 7 File can be deleted
+ 8-15 Unused
+
+Thus, to create a file on which all types of operations are permitted, set
+its mode parameter to 0xC3.
+
+For DOS 3.3 programs, pmode is the file's type. Type codes:
+
+ Param3,hex File type
+
+ 00 Text
+ 01 Integer basic
+ 02 Applesoft basic
+ 04 Binary
+ 08 Relocatable
+ 10 S-type file
+ 20 A-type file
+ 40 B-type file
+
+ DIAGNOSTICS
+
+If creat fails, it returns -1 as its value and sets a code in the global
+integer errno.
+
+<< Back to Top
+
+
+
+
+ NAME ctop, ptoc
+ctop, ptoc - C <-> Pascal string functions
+
+ SYNOPSIS
+
+char *ctop (str) /* Apple // functions */
+char *str;
+
+char *ptoc (str)
+char *str;
+
+ DESCRIPTION
+
+ProDOS expects character strings to be in Pascal format, in which a string
+consists of a leading byte containing the number of characters in the
+string, followed by the characters in the string. In C, on the other hand,
+a character string consists of the characters followed by a null character.
+
+ctop and ptoc convert a string from C form to Pascal form and from Pascal
+form to C form, respectively. The converted string overlays the original
+string, and the function returns a pointer to the converted string.
+
+<< Back to Top
+
+
+
+
+ NAME draw, bdrw, gdrw, rdrw, vdrw, lineto, blineto, glineto, rlineto, vlineto
+draw, bdrw, gdrw, rdrw, vdrw,
+lineto, blineto, glineto, rlineto, vlineto - line-drawing functions
+
+ SYNOPSIS
+
+drw (x1, y1, x2, y2) /* Apple // functions */
+bdrw (x1, y1, x2, y2)
+gdrw (x1, y1, x2, y2)
+rdrw (x1, y1, x2, y2)
+vdrw (x1, y1, x2, y2)
+
+lineto (x, y)
+blineto (x, y)
+glineto (x, y)
+rlineto (x, y)
+vlineto (x, y)
+
+ DESCRIPTION
+
+These functions draw straight lines on the primary Hi-res graphics page.
+The "drw" functions (ie, the first five functions) draw a line from the
+point whose coordinates are (x1, y1) to (x2, y2), differing in the color of
+the line, as follows:
+
+ Function Color
+
+ drw white
+ bdrw blue
+ gdrw green
+ rdrw red
+ vdrw violet
+
+The "drw" functions set the global variables _oldx and _oldy to x2 and y2,
+respectively.
+
+The "lineto" functions (ie, the last five functions) draw a line from the
+point whose coordinates are (_oldx, _oldy) to the point (x, y), and then
+set _oldx and _oldy to x and y, respectively. These functions differ in the
+color of the drawn line like above.
+
+ SEE ALSO
+circle, color, mode, page, plotchar, point
+
+
+<< Back to Top
+
+
+
+
+ NAME
+execl, execv, execlp, execvp - program activation functions
+
+ SYNOPSIS
+
+execv (name, argv) /* UNIX function */
+char *name, *arg[];
+
+execvp (name, argv) /* Apple // functions */
+char *name, *arg[];
+
+execl (name, arg0, arg1, arg2, ..., argn, 0)
+char *name, *arg0, *arg1, *arg2, ...;
+
+execlp (name, arg0, arg1, arg2, ..., argn, 0)
+char *name, *arg0, *arg1, *arg2, ...;
+
+ DESCRIPTION
+
+These functions load, and transfer control to another program. The called
+program is loaded on top of the calling program; thus, if the exec function
+succeeds, it doesn't return to the caller.
+
+The functions can be called by PRG programs: that is, by programs that can
+only be run in the SHELL environment. The functions can start any type of
+program, including those that have not been created using the Aztec
+software.
+
+The functions can also be called by BIN programs, when the programs are
+running in the SHELL environment. However, unlike BIN programs, these
+functions can't be used outside the SHELL environment; thus, you should be
+wary about using these functions in a BIN program.
+
+The Parameters:
+
+name is the name of the file containing the program to be loaded. It can
+optionally specify, using the standard ProDOS syntax, the complete or a
+partial path of directories that must be passed through to get to the file.
+
+The exec functions can pass arguments to the called program. execl and
+execlp build a command line by containing the string pointed at by arg1,
+arg2, and so on. If a C program is being called, its main function will see
+arg0 as argv[0], arg1 as argv[1], and so on. By convention, arg0 is the
+name of the program being called.
+
+execv and execvp built a command line by concatenating the strings pointed
+at by argv[0], argv[1], and so on. The argv array must be have a null
+pointer as its last entry. If a C program is being called, its main
+function will see the calling function's argv[i] as its argv[i]. By
+convention argv[0] is the name of the program being called.
+
+The Functions:
+
+execl and execv load a program from the specified file: execl is usefull
+when a fixed number of arguments are being passed to a program. execv is
+usefull for programs which are passed a variable number of arguments.
+
+execlp and execvp search a list of directories for the program to be
+loaded, beginning with the current directory. If the program isn't there,
+the directories specified in the PATH environment variable are searched.
+
+Passing Open Files and Devices:
+
+When both the calling and the called programs are of type PRG, the
+following comments describe the passing of open file and devices between
+the programs:
+
+ * File that are left open for unbuffered i/o in the calling program
+ will be open for unbuffered i/o in the called program, and will
+ have the same file descriptors.
+
+ * Except for files that are associated with the stdin, stdout, and
+ stderr standard i/o devices, file left open for standard i/o in
+ the calling program won't be open for standard i/o in the called
+ program, although they will be open for unbuffered i/o: thus,
+ before a PRG program activates another using an exec function, it
+ should cause the buffered data for files opened for standard i/o
+ to be written to disk, using either the fclose or fflush
+ functions.
+
+ * The standard input, standard output, and standard error devices
+ are open in the called program to the same devices or files as in
+ the calling program. For the reasons discussed above, care is
+ needed when either the calling or called program accesses these
+ logical devices using standard i/o calls.
+
+When both programs are not of type PRG, open files and devices can not be
+passed between the programs.
+
+ DIAGNOSTICS
+
+If an exec function call fails, for example because the file doesn't exist,
+it will return -1 as its value.
+
+ BUGS
+
+You can have problems, if the called program is half-loaded and a for
+example BAD MEDIA error occurs, cause it will damage the calling program.
+To prevent this verify the called program before you use one of these exec
+functions.
+
+<< Back to Top
+
+
+
+
+ NAME exit, _exit
+exit, _exit
+
+
+ SYNOPSIS
+
+exit (code) /* Apple // and UNIX functions */
+
+_exit (code)
+
+ DESCRIPTION
+
+exit and _exit terminate the execution of a program and restart the
+operating system-type program that activated the program (that is, the
+SHELL or the Basic Intepreter). exit closes files opened for both standard
+and unbuffered i/o, calling fclose to close each file opened for standard
+i/o, and then calling close to close any files opened for unbuffered i/o.
+_exit doesn't close any standard or unbuffered i/o.
+
+ DIAGNOSTICS
+
+For a PRG program, code is its return code. The return code is set to 0 for
+a PRG program that terminates by either explicity or implicity returning
+from its main function. An exec file that starts a PRG program can test the
+program's return code and act accordingly.
+
+The return code of a BIN program is always 0, regardless of the value
+specified in the call to exit or _exit.
+
+<< Back to Top
+
+
+
+
+ NAME exp, log, log10, pow, sqrt
+exp, log, log10, pow, sqrt
+
+
+ SYNOPSIS
+
+#include <math.h> /* Apple // and UNIX functions */
+
+double exp (x)
+double x;
+
+double log (x)
+double x;
+
+double log10 (x)
+double x;
+
+double pow (x, y)
+double x;
+double y;
+
+double sqrt (x)
+double x;
+
+ DESCRIPTION
+
+exp returns the exponential function of x.
+
+log returns the natural logarithm of x; log10 returns the base 10
+logarithm.
+
+pow returns x ** y (x to the y-th power).
+
+sqrt returns the square root of x.
+
+ DIAGNOSTICS
+
+If a function can't perform the computation, it sets an error code in the
+global integer errno and returns an arbitrary value; otherwise it returns
+the computed value without modifying errno. The symbolic values wich a
+function can place in errno are EDOM, signifying that the argument was
+invalid, and ERANGE, meaning that the value of the function couldn't be
+computed. These codes are defined in the file errno.h.
+
+The following table lists, for each function, the error codes that can be
+returned, the function value for that error, and the meaning of the error.
+The symbolic values are defined in the file math.h.
+
+ Funtion Error f(x) Meaning
+
+ exp ERANGE HUGE x > LOGHUGE
+ exp ERANGE 0.0 x < LOGTINY
+ log EDOM -HUGE x <= 0
+ log10 EDOM -HUGE x <= 0
+ pow EDOM -HUGE x < 0, x = y = 0
+ pow ERANGE HUGE y * log (x) > LOGHUGE
+ pow ERANGE 0.0 y * log (x) < LOGTINY
+ sqrt EDOM 0.0 x < 0.0
+
+ SEE ALSO
+errno
+
+
+<< Back to Top
+
+
+
+
+ NAME fabs, floor, ceil
+fabs, floor, ceil - absolute value, floor, ceiling routines
+
+ SYNOPSIS
+
+#include <math.h> /* Apple // and UNIX functions */
+
+double fabs (x)
+double x;
+
+double floor (x)
+double x;
+
+double ceil (x)
+double x;
+
+ DESCRIPTION
+
+fabs returns the absolute value of x.
+
+floor returns the largest integer not greater than x.
+
+ceil returns the smallest integer not less than x.
+
+<< Back to Top
+
+
+
+
+ NAME fclose, fflush
+fclose, fflush - close or flush a stream
+
+ SYNOPSIS
+
+#include <stdio.h> /* Apple // and UNIX functions */
+
+fclose (stream)
+FILE *stream;
+
+fflush (stream)
+FILE *stream;
+
+ DESCRIPTION
+
+fclose informs the system that the user's program has completed its
+buffered i/o operations on a device or file which it had previously opened
+(by calling fopen), fclose releases the control blocks and buffers which
+had allocated to device or file. Also, when a file is being closed, fclose
+writes any internally buffered information to the file.
+
+fclose is automatically called by exit
+
+fflush causes any buffered information for the named output stream to be
+written to that file. The stream remains open.
+
+ DIAGNOSTICS
+
+If fclose or fflush is successful, it returns 0 as its value. Otherwise
+they return -1, and an error code is set in the global integer errno.
+
+ SEE ALSO
+errno, exit
+
+
+<< Back to Top
+
+
+
+
+ NAME feof, ferror, clearerr, fileno
+feof, ferror, clearerr, fileno - stream status inquiries
+
+ SYNOPSIS
+
+#include <stdio.h> /* Apple // and UNIX functions */
+
+feof (stream)
+FILE *stream;
+
+ferror (stream)
+FILE *stream;
+
+clearerr (stream)
+FILE *stream;
+
+fileno (stream)
+FILE *stream;
+
+ DESCRIPTION
+
+feof returns non-zero when end-of-file is reached on the specified input
+stream, and zero otherwise.
+
+ferror returns non-zero when an error has occured on the specified stream,
+and zero otherwise. Unless cleared be clearerr, the error indication
+remains set until the stream is closed.
+
+clearerr resets an error indication on the specified stream.
+
+fileno returns the file descriptor associated with the stream.
+
+These functions are defined as macros in the file "stdio.h".
+
+ SEE ALSO
+open, error
+
+
+<< Back to Top
+
+
+
+
+ NAME fixnam
+fixnam - convert file name to fully-qualified name
+
+ SYNOPSIS
+
+fixnam (in_name, buf) /* Apple // ProDOS function */
+char *in_name;
+char *buf;
+
+ DESCRIPTION
+
+fixnam converts the file name pointed at by in_name into a fully-qualified
+name consisting of the file name itself prefixed by the directories that
+must be passed through to get to the file. in_name can use "." to refer to
+the current directory, and ".." to refer to a parent directory.
+
+ EXAMPLES
+
+For example, suppose that the current directory being /work/source/input.
+The first call to fixnam that follows places /work/source/input/indvr.c in
+input. The second places /work/source/output/outdvr.c in outbuf.
+
+ fixnam ("indevr.c", input)
+ fixnam ("../output/outdvr.c", outbuf)
+
+ DIAGNOSTICS
+
+fixnam returns 0 if successful. If the input file name contains so many
+".." references that the resultant directory is above the root directory,
+fixnam sets EINVAL in the global integer errno and returns -1 as its
+value.
+
+<< Back to Top
+
+
+
+
+ NAME fopen, freopen, fdopen
+fopen, freopen, fdopen - open a stream
+
+ SYNOPSIS
+
+#include <stdio.h> /* Apple // and UNIX functions */
+
+FILE *fopen (filename, mode)
+char *filename;
+char *mode;
+
+FILE *freopen (filename, mode, stream)
+char *filename;
+char *mode;
+FILE *stream;
+
+FILE *fopen (fd, mode)
+int fd;
+char *mode;
+
+ DESCRIPTION
+
+These functions prepare a device or disk file for access by the standard
+i/o functions; this is called "opening" the device or file. A file or
+device which has been opened by one of these functions is called a stream.
+
+fopen is the most basic of these functions: it simply opens the device or
+file specified by the filename parameter for access specified by the mode
+parameter. These parameters are described below.
+
+freopen substitutes the named device or file for the device or file which
+was previously associated with the specified stream. It closes the device
+or file which was originally associated with the stream. It is typically
+used to associate devices and files with the preopened stream stdin,
+stdout, and stderr.
+
+fdopen opens a device or file for unbuffered i/o which has been previously
+opened by one of the unbuffered open functions open and creat.
+
+The parameter filename is a pointer to a character string which is the name
+of the device or file to be opened.
+
+mode points to a character string which specifies how the user's program
+intends to access the stream. The choices are as follows:
+
+ Mode Meaning
+
+ r Open for reading only. If a file is opened, it is positioned at
+ the first character in it. If the file or device does not
+ exist, NULL is returned.
+
+ w Open with writing only. If a file is opened which already
+ exist, it is truncated to zero length. If the file does not
+ exist, it is created.
+
+ a Open for appending. The calling program is granted write-only
+ access to the stream. The current file position is the
+ character after the last character in the file. If the file
+ does not exist, it is created.
+
+ x Open for writing. The file must not previously exist. This
+ option is not supported by UNIX.
+
+ r+ Open for reding and writing. Same as "r", but the stream may
+ also be written to.
+
+ w+ Open for writing and reading. Same as "w", but the stream may
+ also be read: different from "r+" in the creation of a new file
+ and loss of any previous one.
+
+ a+ Open for appending and reading. Same as "a", but the stream may
+ also be read; different from "r+" in file positioning and
+ creation.
+
+ x+ Open for writing and reading. Same as "x", but the file can
+ also be read.
+
+On system which don't keep track of the last character in a file (for
+example CP/M and Apple DOS), not all files can be correctly positioned when
+opened in append mode.
+
+ DIAGNOSTICS
+
+If the file or device is successfully opened, these functions return a
+pointer, called a "file pointer" to a structure of type FILE. This pointer
+is included in the list or parameters to buffered i/o functions, such as
+getc or putc, which the user's program calls to access the stream.
+
+freopen returns stream as its value.
+
+If the file or device cannot be opened, NULL is returned and an error code
+is set in the global integer errno.
+
+ SEE ALSO
+creat, errno, open
+
+
+ EXAMPLES
+
+The following example demonstrates how fopen can be used in a program:
+
+ #include <stdio.h>
+
+ main (argc, argv)
+ char *argv[];
+ {
+ FILE *fopen();
+ FILE *fp;
+
+ if ((fp = fopen (argv[1], argv[2])) == NULL)
+ {
+ printf ("You asked me to open %s", argv[1]);
+ printf (" in the %s mode", argv[2]);
+ printf (" but I can't !\n");
+ }
+ else printf ("%s is open\n", argv[1]);
+
+ ...
+
+ }
+
+Here is a program which uses freopen:
+
+ #include <stdio.h<
+
+ main()
+ {
+ FILE *fp;
+
+ fp = freopen ("dskfile", "w+", stdout);
+ printf ("This message is going to dskfile\n");
+ }
+
+Here is a program which uses fdopen:
+
+ #include <stdio.h>
+
+ dopen_it (fd)
+ int fd; /* value returned by call to open */
+ {
+ FILE *fp;
+
+ if ((fp = fdopen (fd, "r+")) == NULL)
+ printf ("can't open file for r+\n");
+ else return (fp);
+ }
+
+<< Back to Top
+
+
+
+
+ NAME frexp, ldexp, modf
+frexp, ldexp, modf - build and rebuild real numbers
+
+ SYNOPSIS
+
+#include <math.h> /* Apple // and UNIX functions */
+
+double frexp (value, eptr)
+double value;
+int *eptr;
+
+double ldexp (value, exp)
+double value;
+
+double modf (value, iptr)
+double value;
+double *iptr;
+
+ DESCRIPTION
+
+Given value, frexp computes integers x and n such that value = x * 2** x. x
+is returned as the value of frexp, and n is stored in the int field pointed
+at by eptr.
+
+ldexp returns the double quantity value * 2** exp.
+
+modf returns as its value the positive fractional part of value and stores
+the integer part in the double field pointed at by iptr.
+
+<< Back to Top
+
+
+
+
+
+ NAME fseek, ftell
+fseek, ftell - reposition a stream
+
+ SYNOPSIS
+
+#include <stdio.h> /* Apple // and UNIX funcions */
+
+int fseek (stream, offset, origin)
+FILE *stream;
+long offset;
+int origin;
+
+long ftell (stream)
+FILE *stream;
+
+ DESCRIPTION
+
+fseek sets the "current position" of a file which has been opened for
+unbuffered i/o. The current position is the byte location at which the next
+input or output will begin.
+
+stream is the stream identifier associated with the file, and was returned
+by fopen when the file was opened.
+
+offset and origin together specify the current position: the new position
+is at the signed distance offset bytes from the beginning, current
+position, or end of the file, depending on whether origin is 0, 1, or 2,
+respectively.
+
+offset can be positive or negative, to position after or before the
+specified origin, respectively, with the limitation that you can't seek
+before the beginning or the file.
+
+ftell returns the number of bytes from the beginning to the current
+position of the file associated with stream.
+
+For some operating systems (for example, CP/M and Apple DOS) a file may not
+be able to be correctly posioned relative to its end.
+
+ DIAGNOSTICS
+
+If fseek is successful, it will return zero. Otherwise it will return -1
+for improper seeks. In this case, an error code is set in the global
+integer errno.
+
+ SEE ALSO
+errno, lseek
+
+
+ EXAMPLES
+
+The following routine is equivalent to opening a file in "a+" mode:
+
+ a_plus (filename)
+ char *filename;
+ {
+ FILE *fp;
+ FILE *fopen ();
+
+ if ((fp = fopen (filename, "r+")) == NULL)
+ fp = fopen (filename, "w+");
+ fseek (fp, 0L,2);
+
+ /* position 1 byte past last character */
+
+ }
+
+To set the current position back 5 characters before the present current
+position, the following call can be used:
+
+ fseek (fp, -5L, 1);
+
+<< Back to Top
+
+
+
+
+ NAME getenv
+getenv - get value of environment variable
+
+ SYNOPSIS
+
+char *getenv (name) /* Apple // ProDOS SHELL function */
+char *name;
+
+ DESCRIPTION
+
+getenv, returns a pointer to the character string associated with the
+environment variable name, or 0 if the variable isn't in the environment.
+
+The character string is in a dynamically-alocated buffer; this buffer will
+be released when the next call is made to getenv.
+
+getenv can be called by PRG programs: that is, by programs that can only be
+run in the SHELL environment. It can also be called by BIN programs that
+are running in the SHELL environment. However, unlike BIN programs, getenv
+cannot be used outside of the SHELL environment, thus, you should be wary
+of calling getenv in a BIN program.
+
+<< Back to Top
+
+
+
+
+
+ NAME ioctl, isatty
+ioctl, isatty - device i/o utilities
+
+ SYNOPSIS
+
+#include <sgtty.h> /* Apple // and UNIX functions
+
+ioctl (fd, cmd, stty)
+FILE *fd,
+char *cmd;
+struct sgttyb *stty;
+
+isatty (fd)
+
+ DESCRIPTION
+
+ioctl sets and determines the mode of the console.
+
+The parameter fd is a file decriptor associated with the console. On UNIX,
+this parameter defines the file decriptor associated with the device to
+which the ioctl call applies.
+
+The parameter cmd defines the action to be performed by ioctl. It can have
+these values:
+
+ Value Meaning
+
+ TIOCGETP Fetch the console parameters and store them in the
+ structure pointed at by stty.
+
+ TIOCSETP Set the console parameters according to the structure
+ pointed at by stty.
+
+ TIOCSETN Equivalent to TIOCSETP.
+
+The argument stty points to a structure named sgttyb that contains the
+following fields:
+
+ int sg_flags;
+ char sg_erase;
+ char sg_kill;
+
+The order of these fields is system-dependent.
+
+The sg_flags is supported be all systems, while the other fields are not
+supported be some systems.
+
+ Value Meaning of sg-flags
+
+ RAW Set raw mode (turns off the other options). By default, raw
+ mode is disabled.
+
+ CBREAK Return each character as soon as typed. By default, CREAK is
+ disabled.
+
+ ECHO Echo input characters to the display. By default echo mode is
+ enabled.
+
+ CRMOD Map CR to LF on input; convert LF to CR-LF on output. By
+ default crmod is enabled.
+
+More than one flag can specified in a single call to ioctl; the values are
+simply 'or'ed together. If the RAW mode option is selected, none of the
+other options have any effect.
+
+isatty returns non-zero if the file descriptor fd is associated with the
+console, and zero otherwise.
+
+<< Back to Top
+
+
+
+
+ NAME isalpha, isupper, islower, isdigit, isalnum,
+isspace, ispunct, isprint, iscntrl, asascii
+isalpha, isupper, islower, isdigit, isalnum,
+isspace, ispunct, isprint, iscntrl, asascii - character test functions
+
+ SYNOPSIS
+
+#include <ctype.h> /* Apple // and UNIX functions */
+
+isalpha (c)
+char c;
+
+...
+
+ DESCRIPTION
+
+These macros classify ASCII-coded integer values by table lookup, returning
+nonzero if the integer is in the catagory, zero otherwise. isascii is
+defined for all integer values. The others are defined only when isascii is
+true and on the single non-ASCII value EOF (-1).
+
+ isascii c is an ASCII character, code less then 0x100
+ isalpha c is a letter
+ isupper c is an upper case letter
+ islower c is a lower case letter
+ isdigit c is a digit
+ isalnum c is an alphanumeric character
+ isspace c is a space, tab, carriage return, newline or formfeed
+ ispunct c is a punctuation character
+ isprint c is a printing character, valued 0x20 (space) through 0x7e
+ (tilde)
+ iscntrl c is a delete character (0xFF) or ordinary control character
+ (value less than 0x20)
+
+<< Back to Top
+
+
+
+
+ NAME lseek
+lseek - change current position within file
+
+ SYNOPSIS
+
+long lseek (fd, offset, origin) /* Apple // and UNIX functions */
+int fd;
+long offset;
+int origin;
+
+ DESCRIPTION
+
+lseek sets the current prosition of a file which has been opened for
+unbuffered i/o. This position determines where the next character will be
+read or written.
+
+fd is the file descriptor associated with the file.
+
+The current position is set to the location specified by the offset and
+origin parameters, as follows:
+
+ * If origin is 0, the current position is set to offset bytes from
+ the beginning of the file.
+
+ * If origin is 1, the current position is set to the current
+ position plus offset.
+
+ * If origin is 2, the current position is set to the end of the file
+ plus offset.
+
+The offset can be positive or negative, to position after or before the
+specified origin, respectively.
+
+Positioning of a file relative to its end (that is, calling lseek with
+origin set to 2) cannot always be correctly done on all systems (for
+example, CP/M and Apple DOS).
+
+ DIAGNOSTICS
+
+If lseek is successful, it will return the new position in the file (in
+bytes from the beginning of the file). Otherwise, it will return -1 as its
+value and set an error code in the global integer errno. errno is set to
+EBADF if the file descriptor is invalid. It will be set to EINVAL if the
+offset parameter is invalid or if the requested position if before the
+beginning of the file.
+
+ SEE ALSO
+errno, fseek
+
+
+ EXAMPLES
+
+1. To seek to the beginning of a file:
+
+ lseek (fd, 0L, 0);
+
+ lseek will return the value zero (0) since the current position in the
+ file is character (or byte) number zero.
+
+2. To seek to the character following the last character in the file:
+
+ pos = lseek (fd, 0L, 2);
+
+ The variable pos will contain the current position of the end of the
+ file, plus one.
+
+3. To seek backwards five bytes:
+
+ lseek (fd, -5L, 1);
+
+ The third parameter, 1, sets the origin at the current position in the
+ file, The offset is -5. The new position will be the origin plus the
+ offset. So the effect of this call is to move backward a total of five
+ characters.
+
+4. To skip characters when reading in a file:
+
+ read (fd, buf, count);
+ lseek (fd, 5L, 1);
+ read (fd, buf, count);
+
+<< Back to Top
+
+
+
+
+ NAME malloc, calloc, realloc, free
+malloc, calloc, realloc, free - memory allocation
+
+ SYNOPSIS
+
+char *malloc (size) /* Apple // and UNIX functions */
+unsigned size;
+
+char *calloc (nelem, elemsize)
+unsigned nelem;
+unsigned elemsize;
+
+char *realloc (ptr, size)
+char *ptr;
+unsigned size;
+
+free (ptr)
+char *ptr;
+
+ DESCRIPTION
+
+These functions are used to allocate memory from the "heap", that is, the
+section of memory for dynamic storage allocation.
+
+malloc allocates a block of size bytes, and returns a pointer to it.
+
+calloc allocates a single block of memory which can contain nelem elements,
+each elemsize bytes big, and returns a pointer to the beginning of the
+block. Thus, the allocated block will contain (nelem * elemsize) bytes. The
+block is initialized to zeroes.
+
+realloc changes the size of the block pointed at by ptr to size bytes,
+returning a pointer to the block. If necessary, a new block will be
+allocated of the requested size, and the data from the original block moved
+into it. The block passed to realloc can have been freed, provided that no
+intervening calls to calloc, malloc, or realloc have been made.
+
+free deallocates a block of memory which was previously allocated by
+malloc, calloc, or realloc, this space is the available for reallocation.
+The argument ptr to free is a pointer to the block.
+
+malloc and free maintain a circular list of free blocks. When called,
+malloc searches this list beginning with the last block freed or allocated
+coalescing adjacent free blocks as it searches. It allocates a buffer from
+the list large enough free block that it encounters. If this search fails,
+it calls sbrk to get more memory for use by these functions.
+
+ DIAGNOSTICS
+
+malloc, calloc and realloc return a null pointer (0) if there is no
+available block of memory. free returns -1 if it's passed an invalid
+pointer.
+
+<< Back to Top
+
+
+
+
+ NAME mkdir
+mkdir - make directory
+
+ SYNOPSIS
+
+mkdir (name) /* Apple // ProDOS and UNIX function */
+char *name;
+
+mkdir dir [dir ...] /* Apple // ProDOS SHELL utility */
+
+ DESCRIPTION
+
+mkdir creates the directory named name.
+
+name can optionally specify, using the standard ProDOS syntax, the complete
+or partial sequence of directories that must be passed through to get to
+the directory that is to be the parent of the directory.
+
+ DIAGNOSTICS
+
+If no error occurs, mkdir returns 0 as its value. If an error occurs, it
+sets a code in the global int errno and returns -1 as its value.
+
+<< Back to Top
+
+
+
+
+ NAME mktemp
+mktemp - make a unique file name
+
+ SYNOPSIS
+
+char *mktemp (template) /* Apple // function */
+char *template;
+
+ DESCRIPTION
+
+mktemp replaces the character string pointed at by template with the name
+of a non-existent file, and returns as its value a pointer to the string.
+
+The string pointed at by template should look like a file name whose last
+few characters are Xs with an optional imbedded period.
+
+mktemp repaces the Xs with the letter followed by digits. The digits are
+set to the address of the programs _main function. The letter will be
+between 'A' and 'Z', and will be chosen such that the resulting character
+string isn't the name of an existsting file.
+
+ DIAGNOSTICS
+
+For a given character string, mktemp will try to convert the string into
+one of 26 file names. If all of these files exist, mktemp will repace the
+first character pointed at by template with a null character.
+
+ SEE ALSO
+tmpfile, tmpname
+
+
+ EXAMPLES
+
+The following program calls mktemp to get a chracter string that it can use
+as a file name. If the program's _main function begins at decimal address
+1234, the generated name will be on of the strings abcA001.234,
+abcB001.234, ... abcZ001.234. If all the strings that mktemp considers are
+names of existing files, mktemp will replace the first character of the
+string passed to it, a in this case, with 0.
+
+ #include <stdio.h>
+
+ main()
+ {
+ char *fname, *mktemp();
+ FILE *fp, fopen();
+
+ fname = mktemp ("abcXXX.XXX") == 0)
+ if (!*fname)
+ {
+ printf ("mktemp failed");
+ exit (-1);
+ }
+ else fp = fopen (fname, "w");
+
+ ...
+
+ }
+
+<< Back to Top
+
+
+
+
+ NAME movmem, setmem, swapmem
+movmem, setmem, swapmem
+
+ SYNOPSIS
+
+movmem (src, dest, length) /* Apple // functions */
+char *src;
+char *dest;
+int length;
+
+setmem (area, length, value)
+char *area;
+int length;
+int value;
+
+swapmem (s1, s2, length)
+char *s1;
+char *s2;
+int length;
+
+ DESCRIPTION
+
+movmem copies length characters from the block of memory pointed at by src
+to that pointed at by dest.
+
+movmem copies in such a way that the resulting block of characters at dest
+equals the original block at src.
+
+setmem sets the character value in each byte of the block of memory which
+begins at area and continues for length bytes.
+
+swapmem swaps the block of memory pointed at by s1 and s2. The blocks are
+length bytes long.
+
+<< Back to Top
+
+
+
+
+ NAME open
+open
+
+ SYNOPSIS
+
+#include <fcntl.h> /* Apple // and UNIX function */
+
+open (name, mode, param3)
+char *name;
+
+ DESCRIPTION
+
+open opens a device or file for unbuffered i/o. It returns an integer value
+called a file descriptor wich is used to identify the file or device in
+subsequent calls to unbuffered i/o functions.
+
+name is a pointer to a character string wich is the name of the device or
+file to be opened.
+
+mode specifies how the user's program intends to access the file. The
+choices are as follows:
+
+ Mode Meaning
+
+ O_RDONLY read only
+ O_WRONLY write only
+ O_RDWR read and write
+ O_CREAT creat file, then open it
+ O_TRUNC truncate file, the open it
+ O_EXCL cause open to fail if file already exists; used with
+ O_CREAT
+ O_APPEND positions file for appending data
+
+These open modes are integer constants defined in the file "fcntl.h".
+Altough the true values of these constants can be used in a given call to
+open, use of the symbolic names ensures compatibility with UNIX and other
+systems.
+
+The calling program must specify the type of access desired by including
+exactly one of O_RDONLY, O_WRONLY, and O_RDWR in the mode parameter. The
+three remaining values are optional. They may be included by adding them to
+the mode parameter, as in the examples below.
+
+By default the open will fail if the file to be opened does not exist. To
+cause the file to be created when it does not already exist, specify the
+O_CREAT option. If O_EXCL is given in addition to O_CREAT, the open will
+fail if the file already exists; otherwise, the file is created.
+
+If the O_TRUNC option is pecified, the file will be truncated so that
+nothing is in it. The truncation is performed by simply erasing the file,
+if it exists, and then creating it. So it is not an error to use this
+option when the file does not exist.
+
+Note that when O_TRUNC is used, O_CREAT is not needed.
+
+If O_APPEND is specified, the current position for the file (that is, the
+position at which the next data transfer begin) is set to the end of the
+file. For systems which don't keep track of the last character written to a
+file (for example, CP/M and Apple DOS), this positioning cannot always be
+correctly done. Also this option is not supported by Unix.
+
+When open is used to create a file under ProDOS, param 3 is the file's
+access mode. The meanings of the param3 bits, where bit 0 is the least
+significant bit, bit 15 is the most significant:
+
+ Bit number Meaning
+
+ 0 File can be read
+ 1 File can be written
+ 2-4 Reserved
+ 5 File modified since last backup
+ 6 File can be renamed
+ 7 File can be deleted
+ 8-15 Unused
+
+Thus, to create a file on which all types of operations are permitted, set
+its mode parameter to 0xC3.
+
+When open is used to creat a file under DOS 3.3, param3 is the file's type:
+
+ Param3,hex File type
+
+ 00 Text
+ 01 Integer basic
+ 02 Applesoft basic
+ 04 Binary
+ 08 Relocatable
+ 10 S-type file
+ 20 A-type file
+ 40 B-type file
+
+If open does not detect an error, it returns an integer called a "file
+descriptor". This value is used to identify the open file during unbuffered
+i/o operations. The file descriptor is very different from the file pointer
+which is returned by fopen for use with buffered i/o functions.
+
+ SEE ALSO
+errno
+
+
+ DIAGNOSTICS
+
+If open encounters an error, it returns -1 and sets the global integer
+errno to a symbolic value which identifies the error.
+
+ EXAMPLES
+
+1. To open the file testfile for read-only access:
+
+ fd = open ("testfile", O_RDONLY, 0);
+
+ The third parameter of open is not important in this case, since open
+ won't create the file. If testfile does not exist open will just return
+ -1 and set errno to ENOENT.
+
+2. To open the file sub1 on ProDOS in read-write mode, allowing it to be
+ deleted, read, written and renamed:
+
+ fd = open ("sub1", O_RDWR + O_CREAT, 0xC3);
+
+ If the file does not exist, it will be created and then opened.
+
+3. The following program opens a ProDOS file whose name is given on the
+ command line. The file must not already exist.
+
+ main (argc, argv)
+ char **argv;
+ {
+ int fd;
+
+ fd = open (*++argv, O_WRONLY + O_CREAT + O_EXCL, 0xC3);
+ if (fd == -1)
+ {
+ if (errno == EEXIST) printf ("file already exist\n");
+ else if (errno == ENOENT) printf ("unable to open file\n");
+ else printf ("open error\n");
+ }
+
+ ...
+
+ }
+
+<< Back to Top
+
+
+
+
+ NAME page1, page2
+page1, page2 - page-selection functions
+
+ SYNOPSIS
+
+page1() /* Apple // functions */
+
+page2()
+
+ DESCRIPTION
+
+page1 and page2 enable the primary and secondary pages, respectively.
+
+ SEE ALSO
+circle, color, line, mode, plotchar, point
+
+
+<< Back to Top
+
+
+
+
+ NAME perror, errno
+perror, errno - system error messages
+
+ SYNOPSIS
+
+int perror (s) /* Apple // and UNIX functions */
+char *s;
+
+#include <errno.h>
+
+extern int errno;
+
+ DESCRIPTION
+
+When a library function detects an error, it will generally set an error
+code, which is a positive integer, in the global integer errno and return
+an appropriate, function-dependent value.
+
+The extern declaration of errno is in "errno.h".
+
+When an error occurs, perror can be called to write a message describing
+the error on the standard error device. The message consists of the
+following:
+
+ * s, the string pointed at by the argument to perror,
+ * a colon and a blank,
+ * the sys_errlist message corresponding to the current value of
+ errno,
+ * a newline chracter.
+
+ DIAGNOSTICS
+
+perror returns 0 if errno contains a valid value, otherwise, it returns -1
+without printing a message.
+
+<< Back to Top
+
+
+
+
+ NAME plotchar
+plotchar - plot character
+
+ SYNOPSIS
+
+plotchar (c, x, y) /* Apple // function */
+int c, x, y;
+
+ DESCRIPTION
+
+plotchar displays the printable char c on the primary Hi-res graphic page,
+at the location having coordinates (x, y).
+
+ SEE ALSO
+circle, color, line, mode, page, point
+
+
+<< Back to Top
+
+
+
+
+ NAME plot, bplot, gplot, rplot, vplot
+plot, bplot, gplot, rplot, vplot - point-plotting functions
+
+ SYNOPSIS
+
+plot (x, y) /* Apple // functions */
+bplot (x, y)
+gplot (x, y)
+rplot (x, y)
+vplot (x, y)
+
+ DESCRIPTION
+
+These functions plot a point on the primary Hi-res page, at the location
+(x, y). They differ in the color of the point:
+
+ Function Color
+
+ drw white
+ bdrw blue
+ gdrw green
+ rdrw red
+ vdrw violet
+
+ SEE ALSO
+circle, color, line ,mode, page, plotchar
+
+
+<< Back to Top
+
+
+
+
+ NAME printf, fprintf, sprintf, format
+printf, fprintf, sprintf, format - formatted output conversion functions
+
+ SYNOPSIS
+
+#include <stdio.h> /* Apple // and UNIX funcions */
+
+printf (fmp [,arg] ... )
+char *fmt;
+
+fprintf (stream, fmp [,arg] ... )
+FILE *stream;
+char *fmt;
+
+sprintf (buffer, fmp [,arg] ... )
+char *buffer;
+char *fmt;
+
+format (func, fmt, argptr)
+int (*func)();
+char *fmt;
+unsigned *argptr;
+
+ DESCRIPTION
+
+These functions convert and format their arguments (arg or argptr)
+according to the format specification fmt. They differ in what they do with
+the formatted result:
+
+printf outputs the result to the standard output stream, stdout.
+
+fprintf outputs the result to the stream specified in its first argument,
+stream.
+
+sprintf palaces the result in the buffer pointed at by its first argument,
+buffer, and terminates the result with the null character, ' '.
+
+format calls the function func with each character of the result. In fact,
+printf, fprintf, and sprintf call format with each character that they
+generate.
+
+These functions are in both c.lib and m.lib, the difference being that the
+c.lib version don't support floating point conversions. Hence, if floating
+point conversion is required, the m.lib version must be used. If floating
+point conversion isn't required, either version can be used. To use m.lib's
+version, m.lib must be specified before c.lib at the time the program is
+linked.
+
+The character string pointed at by the fmt parameter, which directs the
+print functions, contains two types of items: Ordinary characters, which
+are simply output, and conversion specifications, each of which causes the
+conversion and ouput of the next successive arg.
+
+A conversion specification begins with the character % and continues with:
+
+ * An optional minus sign (-) which specifies left adjustment of the
+ converted value in the output field.
+
+ * An optional digit string specifying the 'field width' for the
+ conversion. If the converted value has fewer characters than this,
+ enough blank characters will be output to make the total number of
+ characters output equals the field width. If the converted value
+ has more characters than the field width, it will be truncated.
+ The blanks are output before or after the value, depending on the
+ presence or absence of the left adjustment indicator. If the field
+ width digits have a leading 0, 0 is used as a pad character rather
+ than blank.
+
+ * A optional period, '.', which seperates the field width from the
+ following field.
+
+ * An optional digit string specifying a precision, for floating
+ point conversions, this specifies the number of digits to appear
+ after the decimal point; for character string conversions, this
+ specifies the maximum number of characters to be printed from a
+ string.
+
+ * Optionally, the character L, which specifies that a conversion
+ which normally is performed on an int is to be performed on a
+ long. This applies to the d, o, and x conversions.
+
+ * A character which specifies the type of conversion to be
+ performed.
+
+A field width or precision may be * instead of a number, specifying that
+the next available arg, which must be an int, supplies the field width or
+precision:
+
+The conversion character are:
+
+ d, o, x The int in the corresponding arg is converted to decimal,
+ octal, or hexadeciaml notation, respectively, and output.
+
+ u The unsigned integer arg is converted to decimal notation.
+
+ c The character arg is output. Null characters are ignored.
+
+ s The characters in the string pointed at by arg are output
+ until a null character or the number of characters indicates
+ by the precision is reached. If the precision is zero or
+ missing, all characters in the string, up to the terminating
+ null, are output.
+
+ f The float or double arg is converted to decimal notation in
+ the style '[-]ddd.ddd'. The number of d's after the decimal
+ point is equal to the precision given in the conversion
+ specification. If the precision is missing, it defaults to
+ six digits. If the precision is explicitly 0, the decimal
+ point is also not printed.
+
+ e The float or double arg is converted to the style
+ '[-]d.ddde[-]dd', where there is one digit before the
+ decimal point and the number after is equal to the precision
+ given. If the precision is missing, it defaults to six
+ digits.
+
+ g The float or double arg is printed in style d, f, or e,
+ whichever gives full precision in minimum space.
+
+ % Output a %. No argument is converted.
+
+ DIAGNOSTICS
+
+All functions return -1 as their value, if the conversion fails.
+
+ EXAMPLES
+
+1. The following program fragment:
+
+ char *name;
+ float amt;
+
+ printf ("Your total, %s, is $%f\n", name, amt);
+
+ will print a message of the form
+
+ Your total, Alfred, is $3.120000
+
+ Since the precision of the %f conversion wasn't specified, it defaulted
+ to six digits to the rigth of the decimal point.
+
+2. This example modifies example 1 so that the field width for the %s
+ conversion is three characters, and the field width and precision of
+ the %f conversion are 10 and 2, respectively. The %f conversion will
+ also use 0 as a pad character, rather than blank.
+
+ char *name;
+ float amt;
+
+ printf "Your total ,%3s, is $%10.2f\n", name, amt);
+
+4. This example demonstrates how to use the format function by listing
+ printf, which calls format with each character that it generates:
+
+ printf (fmt, args)
+ char *fmt;
+ unsigned args;
+ {
+ extern int putchar ();
+ format (putchar, fmt, &args);
+ }
+
+<< Back to Top
+
+
+
+
+ NAME puts, fputs
+puts, fputs - put a character string on a stream
+
+ SYNOPSIS
+
+#include <stdio.h> /* Apple // and UNIX funcions */
+
+puts (s)
+char *s;
+
+fputs (s, stream)
+char *s;
+FILE *stream;
+
+ DESCRIPTION
+
+puts writes the null-terminated string s to the standard output stream,
+stdout, and then an end-of-line sequence. It returns a non-negative value
+if no error occur.
+
+fputs copies the null-terminated string s to the specified output stream.
+It returns 0 if no error occur.
+
+Both functions write to the stream using aputc on an Apple //. Thus, they
+can only be used to write text.
+
+Note that puts and fputs differ in this way: On encountering a newline
+character, puts writes an end-of-line sequence and fputs doesn't.
+
+ DIAGNOSTICS
+
+If an error occur, these functions return EOF (-1) and set an error code in
+the global integer errno.
+
+ SEE ALSO
+aputc, errno, putc
+
+
+<< Back to Top
+
+
+
+
+
+ NAME qsort
+qsort - sort an array of records in memory
+
+
+ SYNOPSIS
+
+qsort (array, number, width, func) /* Apple // and UNIX function */
+char *array;
+unsigned number;
+unsigned width;
+int (*func)();
+
+ DESCRIPTION
+
+qsort sorts an array of elements using Hoare's Quicksort algorithm.
+
+array is a pointer to the array to be sorted. number is the number of
+records to be sorted. width is the size in bytes of each array element.
+func is a pointer for a comparision of two array elements.
+
+func is passed pointers to the two elements being compared. It must return
+an integer less than, equal to, or greater than zero, depending on whether
+the first argument is to be considered less than, equal to, or greater than
+the second.
+
+ EXAMPLES
+
+The Aztec linker, LN, can generate a file of text containing a symbol table
+for a program. Each line of the file contains an address at which a symbol
+is located, followed by a space, followed by the symbol name. The following
+program reads such a symbol table from the standard input, sorts it by
+address, and writes it to standard output.
+
+ #include <stdio.h>
+
+ #define LINESIZE 16
+ #define MAXLINES 2000
+
+ char *lines[MAXLINES];
+ char *malloc;
+
+ main()
+ {
+ int i;
+ int numlines;
+ int cmp();
+ char buf[LINESIZE];
+
+ for (numlines=0; numlines<MAXLINES; ++numlines)
+ {
+ if (gets (buf) == NULL) break;
+ lines[numlines] = malloc (LINESIZE);
+ strcpy (lines[numlines], buf);
+ }
+ qsort (lines, numlines, 2, cmp);
+ for (i=0; i<numlines; ++i) printf ("%s\n", lines[i]);
+ }
+
+ cmp (a, b)
+ char **a, **b;
+ {
+ return strcmp (*a, *b);
+ }
+
+
+<< Back to Top
+
+
+
+
+ NAME ran
+ran - random number generator
+
+ SYNOPSIS
+
+double ran () /* Apple // and UNIX function */
+
+double randl (x)
+double x;
+
+ DESCRIPTION
+
+ran returns as its value a random number between 0.0 and 1.0 .
+
+randl returns as its value a random number beteen 0.0 and x .
+
+<< Back to Top
+
+
+
+
+ NAME read
+read - read from device or file without buffering
+
+ SYNOPSIS
+
+read (fd, buf, bufsize) /* Apple // and UNIX function */
+int fd;
+char *buf;
+int bufsize;
+
+ DESCRIPTION
+
+read reads characters from a device or disk file which has been previously
+opened by a call to open or creat. In most cases, the information is read
+directly into the caller's buffer buf.
+
+fd is the file descriptor which was returned to the caller when the device
+or file was opened.
+
+buf is a pointer to the buffer into which the information is to be placed.
+
+bufsize is the number of characters to be transferred.
+
+ DIAGNOSTICS
+
+If read is successful, it returns as its value the number of characters
+transferred. If the returned value is zero, then end-of-file has been
+reached, immediately, with no bytes read. If the operation isn't
+successful, read returns -1 and places a code in the global integer errno.
+
+ SEE ALSO
+errno, close, fread, open
+
+
+<< Back to Top
+
+
+
+
+ NAME rename
+rename - rename a disk file
+
+ SYNOPSIS
+
+rename (oldname, newname) /* Apple // function */
+char *oldname;
+char *newname;
+
+ DESCRIPTION
+
+rename changes the name of a file (and volume or directory under ProDOS).
+
+oldname is a pointer to a character string containing the old file name,
+and newname is a pointer to a character string containing to new name of
+the file.
+
+ DIAGNOSTICS
+
+If successful, rename returns 0 as its value, if not it returns -1. If a
+file with the new name already exist, rename sets E_EXIST in the global
+integer errno and returns -1 as its value without renaming the file.
+
+ SEE ALSO
+errno
+
+
+<< Back to Top
+
+
+
+
+ NAME sbrk, brk, rsvstk
+sbrk, brk, rsvstk - heap management functions
+
+
+ SYNOPSIS
+
+void *sbrk (size) /* Apple // functions */
+
+brk (ptr)
+void *ptr;
+
+rsvstk (size)
+
+ DESCRIPTION
+
+sbrk and brk provide an elementary means of allocating and deallocating
+space from the heap. More sophisticated buffer management schemes can be
+built using these functions; for example, the standard functions malloc,
+free, etc call sbrk to get heap space, wich they then manage for the
+calling functions.
+
+sbrk increments a pointer, called the 'heap pointer', by size bytes, and,
+if successful, returns the value that the pointer had on entry. Initially,
+the heap pointer points to the base of the heap. size is a signed int; if
+it is negative, the heap pointer is decremented by the specified amount and
+the value that it had on entry is returned. Thus, you must be careful when
+calling sbrk: if you try to pass it a value greater than 32K, sbrk will
+interpret it as a negative number, and decrement the heap pointer instead
+of incrementing it.
+
+brk sets the heap pointer tp ptr, and returns 0 if successful.
+
+rsvstk sets the heap-stack boundary size bytes below the current tock of
+stack, thus changing the amount of space allocated to the stack and heap.
+
+ EXAMPLES
+
+If an sbrk or brk request would make the heap space pointer go past the end
+of the heap, the function will return -1 as its value, without modifying
+the heap space pointer.
+
+ SEE ALSO
+The functions malloc, free, etc implement a dynamic buffer- alloction
+scheme using the sbrk function.
+
+
+The standard i/o functions usally call malloc and free to allocate and
+release buffers for use by i/o streams.
+
+
+Your program can safely mix calls to the malloc functions, standard i/o
+calls, and calls to sbrk and brk, as long as your calls to sbrk and brk
+don't decrement the heap pointer. Mixing sbrk and brk calls that decrement
+the heap pointer with calls to the malloc functions and/or the stadard i/o
+functions is dangerous and probably shouldn't be done by normal programs.
+
+
+<< Back to Top
+
+
+
+
+
+ NAME scanf, fscanf, sscanf
+scanf, fscanf, sscanf - formatted input conversion
+
+
+ SYNOPSIS
+
+#include <stdio.h> /* Apple // and UNIX functions */
+
+scanf (format [,pointer] ... )
+char *format;
+
+fscanf (stream, format [,pointer] ... )
+FILE *stream;
+char *format;
+
+sscanf (buffer, format [,pointer] ... )
+char *buffer;
+char *format;
+
+ DESCRIPTION
+
+These functions convert a string or stream of text characters, as directed
+by the control string pointed at by the format parameter, and place the
+results in the field pointed at by the pointer parameters.
+
+scanf gets text from the standard input stream, stdin.
+
+fscanf gets text from the stream specified in its first parameter, stream.
+
+sscanf gets text from the buffer pointed at by its first parameter, buffer.
+
+These functions are in both c.lib and m.lib, the difference being that the
+c.lib version don't support floating point conversions. Hence, if floating
+point conversion is required, the m.lib version must be used. If floating
+point conversion isn't required, either version can be used. To use m.lib's
+version, m.lib must be specified before c.lib at the time the program is
+linked.
+
+The control string pointed at by format contains the following control
+items:
+
+ * Conversion specifications.
+
+ * 'White space' characters (space, tab, newline).
+
+ * Ordinary characters; that is, characters which aren't part of a
+ conversion specification and which aren't white space.
+
+A scan function works its way through a control string, trying to match
+each control item to a portion of the input stream or buffer. During the
+matching process, it fetches characters one at a time from the input. When
+a character is fetched which isn't appropriate for the control item being
+matched, the scan function pushes it back into the input stream or buffer
+and finishes processing the current control item. This is pushing back
+frequently gives unexpected results when a stream is being accessed by
+other i/o functions, such as getc, as well as the scan function. The
+examples below demonstrates some of the problems that can occur.
+
+The scan function terminates when it first fails to match a control item or
+when the end of the input stream or buffer is reached. It returns as its
+value the number of matched conversion specifications, or EOF (-1) if the
+end of the input stream or buffer was reached.
+
+Matching 'white space' characters:
+
+ When a white space character is encountered in the control string, the
+ scan function fetches input characters until the first non-white-space
+ character is read. The non-white-space character is pushed back into
+ the input and the scan function proceeds to the next item in the
+ control string.
+
+Matching ordinary characters:
+
+ If an ordinary character is encountered in the control string, the scan
+ function fetches the next input character, If it matches the ordinary
+ character, the scan function simply proceeds to the next control string
+ item. If it doesn't match, the scan function terminates.
+
+Matching conversion specification:
+
+ When a conversion specification is encountered in the control string,
+ the scan function first skips leading white space on the input stream
+ or buffer. It then fetches characters from the stream or buffer until
+ encountering one that is inappropriate for the conversion
+ specification. This character is pushed back into the input.
+
+ If the conversion specification didn't request assignment suppression
+ (discussed below), the character string which was read is converted to
+ the format specified by the conversion specification, the result is
+ placed in the location pointed at by the current pointer argument, and
+ the next pointer argument becomes current. The scan function then
+ proceeds to the next control string item.
+
+ If assignment suppression was requested by the conversion
+ specification, the scan function simply ignores the fetched input
+ characters and proceeds to the next control item.
+
+Details of input conversion:
+
+ A conversion specification consists of:
+
+ * The character '%', which tells the scan function that it has
+ encountered a conversion specification.
+
+ * Optionally, the assignment suppression character '*'.
+
+ * Optionally, a field width; that is, a number specifying the
+ maximum number of characters to be fetched for the conversion.
+
+ * A conversion character, specifying the type of conversion to
+ be performed.
+
+ If the assignment suppression character is present in a conversion
+ specification, the scan function will fetch characters as if it was
+ going to perform the conversion, ignore them, and proceed to the next
+ control string item.
+
+ The following conversion characters are supported:
+
+ % A single '%' is exepted in the input; no assignment is done.
+
+ d A decimal integer is expected; the input digit string is
+ converted to binary and the result placed in the int field
+ pointed at by the current pointer argument.
+
+ o An octal integer is expected; the corresponding pointer should
+ point to an int field in which the converted result will be
+ placed.
+
+ x A hexadeciaml integer is expected; the converted value will be
+ placed in the int field pointed at by the current pointer
+ argument.
+
+ s A sequence of characters delimited by white space characters
+ is expected; they, plus a terminating null character, are
+ placed in the character string pointed at by the current
+ pointer argument.
+
+ c A character is expected. It is placed in the char field
+ pointed at by the current pointer. The normal skip over
+ leading white space is not done; to read s single char after
+ skipping leading white space, use '%1s'. The field width
+ parameter is ignored, so this conversion can be used only to
+ read a single character.
+
+ [ A sequence of characters, optionally preceded by white space
+ but not terminated by white space is expected. The input
+ characters, plus a terminating null character, are placed in
+ the character string pointed at by the current pointer
+ argument. The left bracket is followed by:
+
+ * Optionally, a '^' or '~' character.
+ * A set of characters.
+ * A rigth bracket, ']'.
+
+ If the first character in the set isn't ^ or ~, the set
+ specifies characters which are allowed; characters are fetched
+ from the input until one is read which isn't in the set.
+
+ If the first character in the set is ^ or ~, the set specifies
+ characters which aren't allowed; characters are fetched from
+ the input until one is read which is in the set.
+
+ e A floating point number is expected. The input string is
+ converted to floating point format and stored in the float
+ field pointed at by the current pointer argument. The input
+ format for floating point numbers consists of an optionally
+ signed string of digits, possibly containing a decimal point,
+ optionally followed by an exponent filed consisting of an E or
+ e followed by an optionally signed digit.
+
+ EXAMPLES
+
+1. In this program fragment, scanf is used to read values for the int x,
+ the float y, and a character string into the char array z:
+
+ int x;
+ float y;
+ char z[50];
+
+ scanf ("%d%f%s", &x, &y, z);
+
+ The input line
+
+ 32 75.36e-1 rufus
+
+ will assign 32 to x, 7.536 to y, and "rufus" to z. scanf will return 3
+ as its value, signifying that three conversion specifications wree
+ matched.
+
+ The three input strings must be delimited by 'white space' characters;
+ that is, by blank, tab, and newline characters. Thus, the three values
+ could also be entered on seperate lines, with the white space character
+ newline used to seperate the values.
+
+2. This example discusses the problem which may arise when mixing scanf
+ and other input operations on the same stream.
+
+ In the previous example, the character string entered for the third
+ variable, z, must also be delimited by white space characters. In
+ particular, it must be terminated by a space, tab, or newline
+ character. The first such character read by scanf while getting
+ characters for z will be 'pushed back' into the standard input stream.
+ When another read of stdin is made later, the first character returned
+ will be the white space character which was pushed back.
+
+ This 'pushing back' can lead to unexpected results for programs that
+ read stdin with functions in addition to scanf. Suppose that the
+ program in the first example wants ot issue a gets call to read a line
+ from stdin, following the scanf to stdin. scanf will have left on the
+ input stream the white space character which terminated the third value
+ read by scanf. If this character is a newline, then gets will return a
+ null string, because the first character it reads is the pushed back
+ newline, the character which terminates gets. This is most likely not
+ what the program had in mind when it called gets.
+
+ It is usally unadvisable to mix scanf and other input operations on a
+ single stream.
+
+3. This example discusses the behavior of scanf when there are white space
+ characters in the control string.
+
+ The control string in the first example was "%d%f%s". It doesn't
+ contain any white space, since scanf, when attempting to match a
+ conversion specification, will skip leading white space. There's no
+ harm in having white space before the %d, between the %d and %f, or
+ between the %f and %s. However, placing a white space character after
+ the %s can have unexpected results. In this case, scanf will, after
+ having read a character string for z, keep reading characters until a
+ non-white-space character is read. This forces the operator to enter,
+ after the three values for x, y, and z, a non-white space character;
+ until this is done, scanf will not terminate.
+
+ The programmer might place a newline character at the end of the
+ control string, mistakenly thinking that this will circumvent the
+ problem discussed in example 2. One migth think that scanf will treat
+ the newline as it would an ordinary character in the control string;
+ that is, that scanf will search for, and remove, the terminating
+ newline character from the input stream after it has matched the z
+ variable. However, this is incorrect, and should be remembered as a
+ common misinterpretation.
+
+4. scanf only reads input it can match. If, for the first example, the
+ input had been
+
+ 32 rufus 75.36e-1
+
+ scanf would have returned with value 1, signifying that only one
+ conversion specification had been matched. x would have the value 32, y
+ and z would be unchanged. All characters in the input stream following
+ the 32 would still be in the input stream, waiting to be read.
+
+5. One common problem in using scanf involves mismatching conversion
+ specifications and their corresponding arguments. If the first example
+ had declared y to be a double, then one of the following statements
+ would have been required:
+
+ scanf ("%d%1f%s", &x, &y, z);
+
+ or
+
+ scanf ("%d%F%s", &x, &y, z);
+
+ to tell scanf that the floating point variable was a double rather than
+ a float.
+
+6. Another common problem in using scanf involves paasing scanf the value
+ of a variable rather than its address. The following call to scanf is
+ incorrect:
+
+ int x;
+ float y;
+ char z[50];
+
+ scanf ("%d%f%s", x, y, z);
+
+ scanf has been passed the value containing in x and y, and the address
+ of z, but it requires the address of all three variables. The "address
+ of" operator, &, is requiered as a prefix to x and y. Since z is an
+ array, its address is automatically passed to scanf, so z doesn't need
+ the & prefix, although it won't hurt if it is given.
+
+7. Consider the following program fragment:
+
+ int x;
+ float y;
+ char z[50];
+
+ scanf ("%2d%f%*d%[1234567890]", &x, &y, z);
+
+ When given the following input:
+
+ 12345 678 90a65
+
+ scanf will assign 12 to x, 345.0 to y, skip 678, and place the string
+ '90' in z. The next call to getchar will return 'a' and that IS a
+ problem.
+
+
+<< Back to Top
+
+
+
+
+
+ NAME scr_beep, scr_bs, scr_tab, scr_lf, scr_cursup, scr_cursrt, scr_cr,
+scr_clear, scr_home, scr_eol, scr_linsert, scr_ldelete, scr_cinsert,
+scr_cdelete, scr_curs
+scr_beep, scr_bs, scr_tab, scr_lf, scr_cursup, scr_cursrt, scr_cr,
+scr_clear, scr_home, scr_eol, scr_linsert, scr_ldelete, scr_cinsert,
+scr_cdelete, scr_curs - screen manipulation functions
+
+
+ SYNOPSIS
+
+scr_beep() /* Apple // functions */
+scr_bs()
+scr_tab()
+scr_lf()
+scr_cursup()
+scr_cursrt()
+scr_cr()
+scr_clear()
+scr_home()
+scr_eol()
+scr_linsert()
+scr_ldelete()
+scr_cinsert()
+scr_cdelete()
+scr_curs (lin, col)
+int lin, col;
+
+ DESCRIPTION
+
+These functions can be called by command programs to manipulate screens of
+text. For example, there are functions to clear the screen, position the
+cursor, and insert and delete characters and lines.
+
+These functions can be used in conjunction with the normal standard i/o und
+unbuffered i/o functions to diplay characters on the console.
+
+scr_beep rings the keyboard bell.
+
+scr_bs moves the cursor back one character space, without modifying the
+character that was backspaced over.
+
+scr_tab moves the cursor right one tab stop.
+
+scr_lf moves the cursor down on line, scolling if at the bottom of the
+screen.
+
+scr_cursup moves the cursor up without changing its column location.
+
+scr_cursrt moves the cursor right one character space, without modifying
+the character that was spaced over.
+
+scr_cr causes a carriage return.
+
+scr_clear clears the screen and homes the cursor.
+
+scr_home homes the cursor to the upper left hand corner of the screen.
+
+scr_eol erases the line at which the cursor is located, from the current
+cursor prosition to the end of the line.
+
+scr_linsert inserts a blank line at the cursor location, moving the lines
+below the cursor down one line.
+
+scr_ldelete deletes the line at the cursor location, moving the lines blow
+the cursor up one line and placing a blank line at the bottom of the
+screen.
+
+scr_cinsert inserts a space at the cursor location, shifting right one
+character the characters in the line wich are on the right of the cursor.
+
+scr_cdelete deletes the character at the cursor location, shifting left one
+character the characters in the line which are on the right of the cursor.
+
+scr_curs moves the cursor to the line and column specified by the lin and
+col parameters, respectively.
+
+
+<< Back to Top
+
+
+
+
+
+ NAME setjmp, longjmp
+setjmp, longjmp - non-local goto
+
+
+ SYNOPSIS
+
+#include <setjmp.h> /* Apple // and UNIX funcion */
+
+setjmp (env)
+jmp_buf env;
+
+longjmp (env, val)
+jmp_buf env;
+int val;
+
+ DESCRIPTION
+
+These functions are useful for dealing with errors encountered by the
+low-level funcions of a program.
+
+setjmp saves its stack environment in the memory block pointed at by env
+and return 0 as its value.
+
+longjmp causes execution to continue as if the last call to setjmp was just
+terminating with value val. val cannot be zero.
+
+The parameter env is a pointer to a block of memory which can be used be
+setjmp and longjmp. The block must be defined using the typedef jmp_buf.
+
+WARNING:
+
+ longjmp must not be called without env having been initialized by a
+ call to setjmp. It also must not be called if the function that called
+ setjmp has since returned.
+
+ EXAMPLES
+
+In the following example, the function getall builds a record pertaining to
+a customer and returns the pointer to the record if no errors were
+encountered and 0 otherwise.
+
+getall calls other functions which actually build the record. These
+functions in turn call other functions, which in turn ...
+
+getall defines, by calling setjmp, a point to which these functions can
+branch if an unrecoverable error occurs. The low level functions abort by
+calling longjmp with a non-zero value.
+
+If a low level function aborts, execution continues in getall as if its
+call to setjmp had just terminated with a non-zero value. Thus by testing
+the value returned by setjmp getall can determine whether setjmp is
+terminating because a low level function aborted.
+
+ #include <setjmp.h>
+
+ jmp_buf envbuf; /* environment saved here by setjmp */
+
+ getall (ptr)
+ char *ptr; /* ptr to record to be build */
+ {
+ if (setbuf (envbuf)) /* a low level function has aborted */
+ return 0;
+ getfield1 (ptr);
+ getfield2 (ptr);
+ getfield3 (ptr);
+
+ return ptr;
+ }
+
+Here's one of the low level functions:
+
+ getsubfld21 (ptr)
+ char *ptr;
+ {
+ ...
+
+ if (error) longjmp (envbuf, -1);
+
+ ...
+
+ }
+
+
+<< Back to Top
+
+
+
+
+ NAME sinh, cosh, tanh
+sinh, cosh, tanh - hyperbolic functions
+
+
+ SYNOPSIS
+
+#include <math.h> /* Apple // and UNIX functions */
+
+double sinh (x)
+double x;
+
+double cosh (x)
+double x;
+
+double tanh (x)
+double x;
+
+ DESCRIPTION
+
+These functions compute the hyperbolic of their arguments.
+
+ DIAGNOSTICS
+
+If the absolute value of the argument to sinh or cosh is greater than
+348.6, the function sets the symbolic value ERANGE in the global integer
+errno and returns a huge value. This code is defined in the file "errno.h".
+
+If no error occurs, the function returns the computed value without
+modifying errno.
+
+ SEE ALSO
+errno
+
+
+<< Back to Top
+
+
+
+
+
+ NAME strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen,
+index, rindex
+strcat, strncat, strcmp, strncmp, strcpy, strncpy, strlen,
+index, rindex - string operations
+
+
+ SYNOPSIS
+
+char *strcat (s1, s2) /* Apple // and UNIX functions */
+char *s1;
+char *s2;
+
+char *strncat (s1, s2, n)
+char *s1;
+char *s2;
+int n;
+
+char *strcmp (s1, s2)
+char *s1;
+char *s2;
+
+char *strncmp (s1, s2, n)
+char *s1;
+char *s2;
+int n;
+
+char *strcpy (s1, s2)
+char *s1;
+char *s2;
+
+char *strncpy (s1, s2, n)
+char *s1;
+char *s2;
+int n;
+
+int strlen (s)
+char *s;
+
+char *index (s, c)
+char *s;
+char c;
+
+char *rindex (s, c);
+char *s;
+char c;
+
+ DESCRIPTION
+
+These functions operate on null-terminated strings, as follows:
+
+strcat appends a copy of string s2 to string s1. strncat copies at most n
+characters. Both terminate the resulting string with the null character
+('\0') and return a pointer to the first character of the resulting string.
+
+strcmp compares its two arguments and returns an integer greater than,
+equal, of less than zero, according as s1 is lexicographically greater
+than, equal to, or less then s2. strncmp makes the same comparison but
+looks at n characters at most.
+
+strcpy copies string s2 to s1 stopping after the null character has been
+moved. strncpy copies exactly n characters: if s2 contains less than n
+characters, null characters will be appended to the resulting string until
+n characters have been moved; if s2 contains n or more characters, only the
+first n will be moved, and the rsulting string will be null terminated.
+
+strlen returns the number of characters which occur in s up to the first
+null character.
+
+index returns a pointer to the first occurance of the character c in string
+s, or zero if c isn't in the string.
+
+rindex returns a pointer to the last occurance of the character c in string
+s, or zero if c isn't in the string.
+
+
+<< Back to Top
+
+
+
+
+ NAME _system
+_system - issues ProDOS function call
+
+
+ SYNOPSIS
+
+#include <sysfunc.h> /* Apple // ProDOS function */
+
+_system (func)
+int func;
+ DESCRIPTION
+_system issues the function call whose number is func, using as the
+parameter area the globally-accessible character array named _sys_parm.
+
+ DIAGNOSTICS
+
+_system returns as its value the value that ProDOS returned in register A.
+
+
+<< Back to Top
+
+
+
+
+
+ NAME text, hgr, fscreen, mscreen
+text, hgr, fscreen, mscreen - mode-selection functions
+
+
+ SYNOPSIS
+
+text() /* Apple // functions */
+
+hgr()
+
+fscreen()
+
+mscreen()
+
+ DESCRIPTION
+
+text sets the screen in text mode.
+
+hgr sets the screen in Hi-res graphic mode. Unlike the Color functions, hgr
+doesn't clear the screen. Note, that the 80-column-card mode is better
+stopped before you use this function, otherwise you will get the
+double-hires page.
+
+fscreen gives a full screen to work with in the graphics mode. This means
+that you have a 280 by 192 matrix to work with.
+
+mscreen sets the screen in mixed text and Hi-res modes. In this mode, the
+four lines at the bottom of the screen are used to display text, and the
+remainder of the screen (a 280 by 160 matrix) is in Hi-res mode.
+
+ SEE ALSO
+circle, color, line, page, plotchar, point
+
+
+<< Back to Top
+
+
+
+
+ NAME time, get_time, ctime, localtime, gmtime, asctime
+time, get_time, ctime, localtime, gmtime, asctime - time functions
+
+
+ SYNOPSIS
+
+long time (tloc) /* Apple // and UNIX functions */
+long *tloc;
+
+get_time (buf)
+struct tm *buf;
+
+char *ctime (clock)
+long *clock;
+
+#include <time.h>
+
+struct tm *localtime (clock)
+long *clock;
+
+struct tm *gmtime (clock)
+long *clock;
+
+char *asctime (tm)
+struct tm *tm;
+
+ DESCRIPTION
+
+time and get_time return the date and time, which they get from the
+operating system. The other functions convert the date and time, which are
+passed as arguments, to another format.
+
+time returns the current date and time packed into a long int. If its
+argument tloc is a non-null, the return value is also stored in the field
+pointed at by the argument. The format of the value returned by time is
+described below.
+
+get_time returns the current date and time in the buffer pointed at by its
+argument, buf. The format of this buffer is described below.
+
+ctime, localtime, and gmtime convert a date and time pointed at by their
+argument, which is in a format such as returned by time to another format:
+
+ ctime converts the time to a 26-chracter ASCII string of the form
+
+ Mon Apr 30 10:04:52 1984\n\0
+
+ localtime and gmtime unpack the date and time into a structure and
+ return a pointer to it. The structure, named tm, is described below and
+ defined in the header file "time.h".
+
+ asctime converts a date and time pointed at by its argument, which is
+ in a structure such as returned by localtime and gmtime, to a
+ 26-character ASCII string in the same form as returned by ctime.
+
+ The long int returned by time and passed to ctime, localtime, and
+ gmtime has the following form (bit 0 is the least significant bit in
+ the field, bit 31 the most significant):
+
+ Bits Meaning
+
+ 00-07 minute
+ 08-15 hour
+ 16-20 day
+ 21-24 month
+ 25-31 year
+
+The structure returned by get_time, localtime and gmtime, and passed to
+asctime, has the following format:
+
+ struct tm
+ {
+ short tm_sec; /* seconds */
+ short tm_min; /* minutes */
+ short tm_hour; /* hours */
+ short tm_mday; /* day of the month */
+ short tm_mon; /* month */
+ short tm_year; /* year since 1900 */
+ short tm_wday; /* day of the week (0 = Sunday) */
+ short tm_yday; /* day of year */
+ short tm_isdst; /* not used */
+ short tm_hsec; /* hundredths of seconds */
+ };
+
+
+<< Back to Top
+
+
+
+
+ NAME tmpnam
+tmpnam - create a name for a temporary file
+
+
+ SYNOPSIS
+
+char *tmpnam (s) /* Apple // function */
+char *s;
+
+ DESCRIPTION
+
+tmpnam creates a character string that can be used as the name of a
+temporary file. The generated string is not the name of an existing file.
+
+s optionally points to an area into which the name will be generated. This
+must contain at least L-tmpnam bytes, where L_tmpnam is a constant defined
+in "stdio.h".
+
+s can also be a NULL pointer. In this case, the name will be generated in
+an internal array. The contents of this array are destroyed each time
+tmpnam is called with a NULL argument.
+
+The generated name is prefixed with the string that is associated with the
+symbol P_tmpnam; this symbol is defined in "stdio.h". In the distribution
+version of "stdio.h", P_tmpnam is a null string; this results in the
+generated name specifying a file that will be allocated in the current
+directory.
+
+ DIAGNOSTICS
+
+tmpnam returns as its value a pointer to the resulting string.
+
+ SEE ALSO
+tmpfile, mktemp
+
+
+<< Back to Top
+
+
+
+
+ NAME toupper, tolower
+toupper, tolower - char conversion functions
+
+
+ SYNOPSIS
+
+toupper (c) /* Apple // and UNIX functions */
+char c;
+
+tolower (c)
+char c;
+
+#include <ctype.h>
+
+_toupper (c)
+int c;
+
+_tolower (c)
+int c;
+
+ DESCRIPTION
+
+toupper converts a lower case character to upper case: if c is a lower case
+character, toupper returns its upper case equivalent as its value,
+otherwise c is returned.
+
+tolower converts an upper case character to lower case: if c is an upper
+case character, tolower returns its lower case equivalent, otherwise c is
+returned.
+
+toupper and tolower do not require the header file "ctype.h".
+
+_toupper and _tolower are macro versions of toupper and tolower,
+respectively. They are defined in "ctype.h". The difference between the two
+sets of functions is that the macro version will sometimes translate
+non-alphabetic characters, whereas the function versions don't.
+
+
+<< Back to Top
+
+
+
+
+ NAME ungetc
+ungetc - push a character back into input stream
+
+
+ SYNOPSIS
+
+#include <stdio.h> /* Apple // and UNIX function */
+
+ungetc (c, stream)
+int c;
+FILE *stream;
+
+ DESCRIPTION
+
+ungetc pushes the character c back into the input stream. That character
+will be returned by the next getc call on that stream.
+
+Only one character of pushback is quaranteed. EOF cannot be pushed back.
+
+ DIAGNOSTICS
+
+ungetc returns c as its value, otherwise it returns EOF (-1).
+
+
+<< Back to Top
+
+
+
+
+ NAME unlink
+unlink - remove a file
+
+
+ SYNOPSIS
+
+unlink (name) /* Apple // function */
+char *name;
+
+ DESCRIPTION
+
+unlink erases a file.
+
+name is a pointer to a character string containing the name of the file to
+be erased.
+
+ DIAGNOSTICS
+
+unlink returns 0 if successful, otherwise -1 if it couldn't erase the file
+and places a code in the global integer errno decribing the error.
+
+ SEE ALSO
+errno
+
+
+<< Back to Top
+
+
+
+
+ NAME write
+write - unbuffered access to device or file
+
+
+ SYNOPSIS
+
+write (fd, buf, bufsize) /* Apple // and UNIX function */
+int fd;
+char *buf;
+int bufsize;
+
+ DESCRIPTION
+
+write writes characters to a device or disk file which has been previously
+opened be a call to open or creat. The characters are written to the device
+or file directly from the caller's buffer.
+
+fd is the file despriptor which was returned to the caller when the device
+or file was opened.
+
+buf is a pointer to the buffer containing the characters to be written.
+
+bufsize is the number of characters to be written.
+
+ DIAGNOSTICS
+
+If the operation was successful, write returns as its value the number of
+characters written, otherwise write returns -1 and places a code in the
+global integer errno.
+
+ SEE ALSO
+close, creat, errno, open, read
+
+
+<< Back to Top
+
+
+
+
+
+© Copyright Phade Software 1999
+Released as FreeWare December 1999
+
+
+
+
+
+
+
+
+
diff --git a/AppleX/DOCS/cat2.htm b/AppleX/DOCS/cat2.htm
new file mode 100644
index 0000000..912075a
--- /dev/null
+++ b/AppleX/DOCS/cat2.htm
@@ -0,0 +1,3314 @@
+
+
+
+Alphabetical Utility Commands - Manx Aztec C 6502 for Apple II ProDOS
+
+
+
+
+Manx Aztec C 6502 for Apple II ProDOS
+
Alphabetical (more or less) Utility Commands
+
+
+
+
+
+Introduction
+
+
+This is an HTML version of the electronic manual for Manx Aztec C for Apple II
+ProDOS released as freeware by Phade Software December 1999. The release notes
+for the electronic manual
+indicate that the electronic manual contains the same information as the paper
+manual distributed by Manx Software Systems with the compiler. However, they
+also indicate that if you are using the AZTEC PLUS release you should use the
+electronic manual rather than the paper manual supplied by Manx. Welcome to the
+wonderfully confusing World of Aztec C!
+
+
+The release notes for the electronic manual also indicate that the following
+notation in the synopsis part of a
+manual page only means that the function or utility is available both in UNIX and on
+the Apple II, but despite that fact, the description for that function or utility may differ
+between the Apple II and UNIX versions:
+
+ /* Apple // and UNIX function */ or
+ /* Apple // and UNIX utility */
+
+The contact information in the release notes for the electronic manual is as follows, but
+Manx Software Systems have apparently since faded from existence:
+
+
+Manx Software Systems
+P.O. Box 55
+Shrewsbury, N.J 07701
+
+
+Phade Software
+Inh. Frank Gadegast
+Schierker Strasse 39
+1000 Berlin 44 - Germany
+
+
+The HTML version (this document and others) was produced by Canadian Software Developer
+Bill Buckels by reformatting
+the Phade Software UNIX style man pages from the elctronic manual into consolidated HTML
+documents after converting these from Apple II text to IBM text. The original format has been
+preserved as much as practically possible, and the content of the Phade Software electronic
+manual remains apparently intact and unaltered in its transition to HTML.
+
+
+The main benefits of the HTML version are that you can view the information in the man pages
+on a single HTML document
+using a web browser in the relative comfort of a modern user interface and can use your
+web browsers "Find on this Page" feature to search through the content to easily locate
+information using your own search criteria. This is much easier than using the unix style
+man utility which can only search on key topics and will only display a single topic at a time.
+
+
+Licence and Disclaimer
+
+
+This is a derivative work and as such the licencing by the original authors applies. Bill Buckels
+makes no claims of ownership whatsoever for the content of this document, and further assumes no
+liability for the results its use.
+
+
+You may use the information in this document in any way you find useful (subject to the
+original authors restrictions and apparently there aren't any),
+provided that you agree that Bill Buckels has no warranty obligations or
+liability resulting from said use in any way whatsoever. If you
+don't agree, don't use this document.
+
+
+<< Back to Top
+
+
+
+
NAME arcv, mkarcv
+arcv, mkarcv - source dearchiver and archiver
+
SYNOPSIS
+arcv arcfile /* Apple // Utility */
+
+mkarcv arcfile
+
DESCRIPTION
+arcv extracts the source from the archive arcfile, which has been prevously
+created be mkarcv, placing the results in seperated files in the current
+directory.
+
+mkarcv creates the archive file arcfile, placing it in the files whose
+names it reads from its standard input. Only on file name is read from a
+standard input line.
+
EXAMPLE
+For example, the file header.arc contains the source for all the header
+files. To create these header files, enter:
+
+ arcv header.arc
+
+The files will be created in the current directory.
+
+The following command creates the archive myarc.arc containing the file
+in.c, out.c, and hello.c:
+
+ mkarcv myarc < myarc.bld
+
+The names of the three files are contained in the file myarc.bld:
+
+ in.c
+ out.c
+ hello.c
+
BUGS
+It's not possible to archive whole subdirectories and arcv can't find files
+with the complete pathname (that means the files for the archive have to be
+in the current directory).
+
+
+<< Back to Top
+
+
NAME as, asi, as65
+as, asi, as65 - Aztec C assemblers
+
SYNOPSIS
+as [-options] prog.asm /* Apple // ProDOS utility */
+
+asi [-options] prog.asm
+
+The 6502 assembler is named as on native versions of Aztec C65 and as65 on
+cross development versions.
+
+Relocatable object files are named .r on the MS-DOS cross development version
+of Aztec C65.
+
+
DESCRIPTION
+as and asi are relocating assemblers that translate an assembly language
+source program into relocatable object code. The two assemblers support
+different machines: as accepts assembly language for a 6502 or 65C02; asi
+accepts assembly language for a "pseudo machine".
+
+In an executable program, an asi-assembled module must be interpreted by a
+routine that is in the Aztec libraries.
+
+An executable program can contain both modules that have been assembled
+with as and modules that have been assembled with asi.
+
+This description has three sections: the first describes how to operate the
+assembler; the second describes the assembler's options; and the third
+presents information of interest to those writing assembly language
+programs.
+
+ 1. OPERATING INSTRUCTIONS
+
+Operationally, the two assemblers are very similar. In the following
+paragraphs, we will use the name as when referring to features that are
+common to both assemblers. When the two assemblers differ, we will say so.
+
+as is started with a command line of the form
+
+ as [-options] prog.asm
+
+where [-options] are optionally parameters and prog.asm is the name of the
+file to be assembled. as reads the source code from the specified file,
+translates it into object code, and writes the object code to another file.
+
+1.1 The Source File
+
+The extension on the source file name is optional. If not specified, it's
+assumed to be .asm . For example, with the following command, the assembler
+will assume that the file is test.asm:
+
+ as test
+
+as will append .asm to the source file name only if it doesn't find a
+period in the file name. So if the name of the source file really doesn't
+have an extension, you must assemble it like this:
+
+ as filename.
+
+The period tells the assembler not to append .asm to the name.
+
+1.2 The Object File
+
+By default, the name of the file to which as writes object code is derived
+from the name of the source code file, by changing its extension to .o (or
+to .i, if asi is used). Also by default, the object code file is placed in
+the directory that contains the source code file. For example, the command
+
+ as test.asm
+
+writes object code to the file test.o (or to test.i, if asi is used),
+placing this file in the current directory.
+
+You can explicitly specify the name of the object code file, using the -O
+option. The name of the object code file follows the -O, with spaces
+between the -O and the file name. For example, the following command
+assembles test.asm, writing the object code to the file prog.out:
+
+ as -o prog.out test.asm
+
+1.3 The Listing File
+
+The -L option causes the assembler to create a file containing a listing of
+the program beeing assembled. The file is placed in the directory that
+contains the object file; its derived from that of the object file by
+changing the extension to .lst .
+
+1.4 Searching for instxt files
+
+The instxt directive tells as to suspend assembly of one file and assemble
+another; when assembly of the second file is completed, assembly of the
+first continues.
+
+You can make the assembler search for instxt file in a sequence of
+directories, thus allowing source files and instxt files to be in different
+directories.
+
+Directories that are to be searched are defined just as for the compilers;
+that is, using the -I assembler option or the INCLUDE environment
+variable. Optionally, the compiler can also serach the current directory.
+
+Directory search for a particular instxt directive can be disabled by
+specifying a directory name in the directive. In this case, just the
+specified directory is searched.
+
+1.4.1 The -I option
+
+A -I option defines a single directory to be searched. The directory name
+follows the -I, with no intervening blanks. For example, the following -I
+option tells the assembler to search the include directory on the ram
+volume:
+
+ -I/ram/include
+
+1.4.2 The INCLUDE environment variable
+
+The INCLUDE environment variable defines a directory to be searched for
+instxt files. The example sets INCLUDE so that the assembler will search
+for instxt files in the directory /ram/include :
+
+ set INCLUDE=/ram/include
+
+1.4.3 The search order
+
+Directories are searched in the following order:
+
+ 1. If the instxt directive delimited the file name with the double
+ quote character, ", the current directory on the default drive is
+ searched. If delimited by angle brackets, < and >, this directory
+ isn't automatically searched.
+
+ 2. The directories defined in -I option are searched, in the order
+ listed on the command line.
+
+ 3. The directory defined in the INCLUDE environment varibale is
+ searched.
+
+ 2. ASSEMBLER OPTIONS
+
+The assembler supports the following options:
+
+ Option Meaning
+
+ -O objname Send object code to objname.
+ -L Generate listing.
+ -C Disable assembly of 65C02 instructions. Not supported by
+ asi.
+ -ZAP Delete the source file after assembling it.
+
+ 3. PROGRAMMING INFORMATION
+
+This section discusses the assembly language that is supported by as. A
+description of the assembly language supported by asi is not available.
+
+as supports the standard MOS Technology syntax: a program consist of
+sequence of statements, each of which is in the standard MOS Tech form; and
+the assembler supports the MOS Tech mnemonics for the standard
+instructions. as supports some of the MOS Tech directives and their
+mnemonics; it also supports others, as defined below.
+
+The following paragraphs define in more detail the language supported by
+as.
+
+3.1 Statement Syntax
+
+ [label] [opcode] [arguments] [[;]comment]
+
+where the brackets "[...]" indicate an optional element.
+
+3.2 Labels
+
+A statement's label field defines a symbol to the assembler and assigns it
+a value. If present, the symbol name begins in column one. If a statement
+is not labeled, then column one must be blank, tab, or asterisk. An
+asterisk denotes a comment line.
+
+Normally, the symbol in a label field is assigned as its value the address
+at which the statement's code will be placed. However, the equ directive
+can be used to create a symbol and assign it some other value, such as a
+constant.
+
+A label can contain up to 32 characters. Its first character must be an
+alphabetic character or one of the special characters '_' or '.' . Its
+other characters can be alphabetic characters, digits, '_', or '.' . A
+label followed by '#' is declared external.
+
+The cc compiler places a '_' character at the end of all labels that it
+generates.
+
+3.3 Opcodes
+
+The assembler supports the standard MOS Tech instruction mnemonics for both
+the 6502 and 65C02 processors. The directives it supports are defined
+below.
+
+3.4 Arguments
+
+A statement's argument can specify a register, a memory location, or a
+constant.
+
+A memory location can be referenced using any of the standard 6502 or 65C02
+addressing modes, and using the standard MOS Tech syntax.
+
+A memory location reference or a constant can be an expression containing
+any of the following operators:
+
+ * multiply
+ / divide
+ + add
+ - substract
+ # constant
+ = constant
+ < low byte of expression
+ > high byte of expression
+
+Expression are evaluated from left to right with no precedence as to
+oprator or parantheses.
+
+3.5 Constants
+
+The default base for numeric constants is decimal. Other bases are
+specified by the following prefixes or suffixes:
+
+ Base Prefix Suffix
+
+ 2 % b,B
+ 8 @ o,O,q,Q
+ 10 null,& null
+ 16 $ h,H
+
+A character constant consist of the character, preceded by a single quote.
+For example: 'A .
+
+3.6 Directives
+
+The following paragraphs describe the directives that are supported by the
+assembler.
+
+END end
+
+ The end directive defines the end of the source statements.
+
+
+CSEG cseg
+
+ The cseg directive selects a module's code segment: information
+ generated by statements that follow a cseg directive is placed in the
+ module's code segment, until another segment-selection directive is
+ encountered.
+
+
+DSEG dseg
+
+ The dseg directive selects a module's data segment: information
+ generated by statements that follow a dseg directive is placed in the
+ module's data segment, until another segment-selection directive is
+ encountered.
+
+
+EQU symbol equ
+
+ The equ directive creates a symbol named symbol (if it doesn't already
+ exist), and assigns it the value of the expression expr.
+
+
+PUBLIC public [,...]
+
+ The public directive identifies the specified symbols as having
+ external scope. If a specified symbol was created within the module
+ that's being assembled (by being defined in a statement's label field),
+ this directive allows it to be accessed by other modules. If a symbol
+ was not created within the module that's being assembled, this
+ directive tells the assembler that the symbol was created and made
+ public in another module.
+
+
+BSS bss ,
+
+ The bss directive creates a symbol named symname and reserves size
+ bytes of space for it in the uninitialized data segment. The symbol
+ cannot be accessed by other modules.
+
+
+GLOBAL global ,
+
+ The global directive creates a symbol named symname that other modules
+ can access using the global and public directives.
+
+ If other modules create symnam using just the global directives, then
+ symnam will be located in a program's uninitialized data area. In this
+ case, the amount of space reserved in this area for symnam will equal
+ the largest value specified by the size fields in the global statements
+ that define symnam.
+
+ If other modules define in a public statement, but none of them create
+ symnam (by specifying it in a label field), then symnam will still be
+ located in the uninitialized data segment and space will be reserved
+ for it as defined above.
+
+ If one of the modules both define symnam using a public statement and
+ creates the symbol by specifying it in a label field, then symnam will
+ be located in the program's code or data segment and no space will be
+ reserved for it in the uninitialized data segment.
+
+
+ENTRY entry
+
+ The entry directive defines the symbol symnam as being a program's
+ entry point.
+
+ When a program is linked, the linker normally places a jump instruction
+ at the program's data base address. If the linker found a module
+ containing an entry directive, it sets the target of the jump to the
+ location that was specified in the last entry directive that it found;
+ otherwise, it sets the target to the beginning of the program's code
+ segment.
+
+
+FCB [label] fcb <value>[,<value>...]
+
+ Each value in an fcb directive causes one or more bytes of memory to be
+ allocated and then initialized to the specified value. The memory is
+ allocated in the currently active segment (code, or data, as defined by
+ the last segement-selection directive).
+
+
+FCC [label] fcc "string"
+
+ The fcc directive allocates a filed that has the same number of
+ characters as are in string, and places string in it. The field is
+ placed in the currently-active segment.
+
+
+RMB [label] rmb <expr>
+
+ The rmb directive reserves a lield containing expr bytes in the
+ currently-active segment. The contents of the field is not defined.
+
+
+INSTXT instxt <file>
+ instxt "file"
+ instxt /file/
+
+ The instxt directive causes the assembler to suspend assembly of the
+ current source file and to assemble the source that's in file. When
+ done, the assembler will continue assembling the original file.
+
+ The assembler can serach for a file in several directories. If file is
+ surrounded by quotes or by slashes, the assembler will begin the search
+ at the current directory; it will search the directories specified in
+ the -I option and the INCLUDE environment variable. If file is
+ surrounded by <>, the assembler will search just the -I and INCLUDE
+ directories.
+
DIAGNOSTICS
+If the assembler fails they return -1 as there value that, for example,
+tells shell-scripts to stop immediatly.
+
SEE ALSO
+cc, ln, set
+
+
+
+<< Back to Top
+
+
NAME bye
+bye - exit to monitor
+
SYNOPSIS
+bye /* Apple // utility */
+
DESCRIPTION
+bye tranfers control of the processor to the Apple monitor program that's
+in ROM, by jumping to location $FF65. To return to the SHELL from the
+monitor, enter the command
+
+ 3D0G
+
+On machines having the autostart ROM, you can also reenter the SHELL by
+hitting the reset key.
+
+
+<< Back to Top
+
+
NAME cat
+cat - catenate and print
+
SYNOPSIS
+cat [file] [file] ... /* Apple // and UNIX utility */
+
DESCRIPTION
+cat reads each file in sequence and writes it to its standard output
+device. If no files are specified, cat reads from its standard input
+device.
+
+Each argument can specify a complete or partial file name, in the normal
+manner.
+
+By default, cat's standard input and output devices are assigned to the
+console. Either or both can also be redirected to another device or file,
+if desired, in the normal fashion.
+
+cat is a built-in SHELL command.
+
EXAMPLE
+cat hello.c
+ Writes hello.c to the screen.
+
+cat hello.c input.c > cat.out
+ Writes hello.c and input.c to cat.out.
+
+cat
+ Copies typed characters to the screen.
+
+cat > ../newfile
+ Copies typed characters to ../newfile.
+
+cat < /stdio/printf.c > tmp.c
+ Equivalent to cat /stdio/printf.c > tmp.c
+
SEE ALSO
+cp
+
+
+<< Back to Top
+
+
NAME cc, cci, c65
+cc, cci, c65 - Aztec C compilers
+
SYNOPSIS
+cc [-options] filename.c /* Apple // ProDOS utility */
+
+cci [-options] filename.c
+
+The 6502 compiler is named cc on native versions of Aztec C65 and c65 on
+cross development versions.
+
+Relocatable object files are named .r on the MS-DOS cross development version
+of Aztec C65.
+
+
DESCRIPTION
+cc translates C source code into native 6502 assembly language source code.
+cci translates C source code into assembly language source for a "pseudo
+machine"; in an executable program, cci-compiled code must be interpreted
+by a special Aztec C routine.
+
+The compilers were implemented according to the language description in the
+Kernighan and Ritchie book "The C Programming Language".
+
+This description of the compilers is divided into three subsections: which
+describe how to use the compilers, compiler options and error processing.
+
+To the operator and programmer, the two compilers are very similar. In the
+discussion that follows, we will use the name cc when describing features
+that are common to both compilers. Where differences exist, we will say so.
+
+ 1. COMPILER OPERATING INSTRUCTIONS
+
+cc is invoked by a command of the form:
+
+ cc [-options] filename.c
+
+where [-options] specify optional parameters, and filename.c is the name of
+the file containing the C source program. Options can appear either or
+after the name of the C source file.
+
+The compiler reads C source statements from the input file, translates them
+to assembly language source, and writes the result to another file.
+
+When the compiler is done, it by default activates the as assembler (cci by
+defaults starts the asi assembler). The assemblers translates the assembly
+language source to relocatable object code, writes the result to another
+file, and deletes the assembly language source file. The -A option tells
+the compiler not to start the assembler.
+
+1.1 The C source file
+
+The extension on the source file name is optional. If not specified, it's
+assumed to be .c . For example, with the following command, the compiler
+will assume the file name is text.c :
+
+ cc text
+
+The compiler will append .c to the source file name only if it does find a
+period in the file name. So if the name of the source file really doesn't
+have an extension, you must compile it like this:
+
+ cc filename.
+
+The period in the name prevents the compiler from appending .c to the name.
+
+1.2 The ouput files
+
+1.2.1 Creating an object code file
+
+Normally, when you compile a C program you are interested in the
+relocatable object code for the program, and not in its assembly language
+source. Because of this, the compiler by defaults writes the assembly
+language source for a C program to an intermediate file and then
+automatically starts the assembler. The assembler then translates the
+assembly language source to relocatable object code, writes this code to a
+file, and erases the intermediate file.
+
+By default, the object code generated by a cc-started assembly is sent to a
+file whose name is derived from that of the file containing the C source by
+changing its extension to .o (the default extension for a cci-started
+assembly is .i). This file is placed in the directory that contains the
+source file. For example, if the compiler is started with the command
+
+ cc prog.c
+
+the file prog.o will be created, containing the relocatable object code for
+the program.
+
+The name of the file containing the object code created by a
+compiler-started assembler can also be explicitly specified when the
+compiler is started, using the compiler's -O option. For example, the
+command
+
+ cc -O myobj.rel prog.c
+
+compiles and assembles the C source that's in the file prog.c, writing the
+object code to the file myobj.rel .
+
+When the compiler is going to automatically start the assembler, it by
+default writes the assembly language source to a temporary file named
+ctmpxxx.xxx, where the x's are replaced by digits in such a way that the
+name becomes unique. This temporary file is placed in the directory
+specified by the environment variable CCTEMP. If this variable doesn't
+exist, the file is placed in the directory specified by the current default
+prefix.
+
+When CCTEMP exist, the fully-qualified name of the temporary file is
+generated by simply prefixing its value to the ctmpxxx.xxx name. For
+example if CCTEMP has the value
+
+ /RAM/TEMP/
+
+then the temporary file is placed in the TEMP directory on the RAM volume.
+
+If you are interested in the assembly language source, but still want the
+compiler to start the assembler, specify the option -T when you start the
+compiler. This will cause the compiler to send the assembly language source
+to a file whose name is derived from that of the file containing the C
+source by changing its extension to .asm . The C source statements will be
+included as commanets in the assembly language source. For example, the
+command
+
+ cc -T prog.c
+
+compiles and assembles prog.c, creating the file prog.asm and prog.o .
+
+1.2.2 Creating just an assembly language file
+
+There are some programs for which you don't want the compiler to
+automatically start the assembler. For example, you may want to modify the
+assembly language generated by the compiler for a particular program. In
+such cases, you can use the compiler's -A option to prevent the compiler
+from starting the assembler.
+
+When you compile a program using the -A option, you can tell the compiler
+name and location of the file to which it should write the assembly
+language source, using the -O option.
+
+If you don't use the -O option but the -A option, the compiler will send
+the assembly language source to a file whose name is derived from that of
+the C source file changing the extension to .asm and place this file in the
+same directory as the one that contains the C source file. For example, the
+command
+
+ cc -A prog.c
+
+compiles, without assembling, the C source that's in prog.c, sending the
+assembly language source to prog.asm . As another example, the command
+
+ cc -A -O temp.a65 prog.c
+
+compiles, without assembling, the C source that's in prog.c, sending the
+assembly language source to the file temp.a65 .
+
+When the -A option is used, the -T option causes the compiler to include
+the C source statements as comments in the assembly language source.
+
+1.3 Searching for #include files
+
+You can make the compiler search for #include files in a sequence of
+directories, thus allowing source files and #include files to be contained
+in different directories.
+
+Directories can be specified with the -I compiler option, and with the
+INCLUDE environment variable. The compiler itself also selects a few areas
+to search. The maximum number of searched areas is eight.
+
+If the file name in the #include statement specifies a directory, just that
+directory is searched.
+
+1.3.1 The -I option
+
+A -I option defines a single directory to be searched. The area descriptor
+follow the -I, with no intervening blanks. For example, the following -I
+option tells the compiler to search the include directory on the ram
+volume:
+
+ -I/ram/include
+
+1.3.2 The INCLUDE environment variable
+
+The INCLUDE environment variable also defines a directory to be searched
+for #include files. For example, the following command sets INCLUDE so that
+the compiler will search for include files in the directory /ram/include:
+
+ set INCLUDE=/ram/include
+
+1.3.3 The search order for include files
+
+Directories are searched in the following order:
+
+ 1. If the #include statement delimited the file name with the double
+ quota character (") the current directory on the default drive is
+ searched. If delimited by angle brackets (< >) this area isn't
+ automatically searched.
+
+ 2. The directories defined in -I options are searched, in the order
+ listed on the command.
+
+ 3. The directory defined in the INCLUDE environment variable is
+ searched.
+
+ 2. COMPILER OPTIONS
+
+There are two types of options in Aztec C compilers: machine independent
+and machine dependent. The machine-independent options are provided on all
+Aztec C compilers. They are identified by a leading minus sign.
+
+The Aztec C compiler for each target has its own, machine-dependent,
+options. Such are identified by a leading plus sign.
+
+The following paragraphs first summarize the compiler options and then
+describe them in detail.
+
+2.1 Summary of options
+
+ 2.1.1 MACHINE-INDEPENDENT OPTIONS
+
+ -A Don't start the assembler when compilation is done.
+
+ -Dsymbol[=value] Define a symbol to the preprocessor.
+
+ -I dir Search a directory named dir for #include files.
+
+ -O file Send output to file.
+
+ -S Don't print warning messages.
+
+ -T Include C source statements in the assembly language
+ code output as comments. Each source statement
+ appears before the assembly code it generates.
+
+ -B Don't pause after every fifth error to ask if the
+ compiler should continue. See the Errors subsection
+ for details.
+
+ -Enum Use an expression table having num entries.
+
+ -Lnum Use an local table having num entries.
+
+ -Ynum Use a case table having num entries.
+
+ -Znum Use a literal table having num bytes.
+
+2.1.2 Special Options for the ProDOS compilers
+
+ +C Generate 65C02 code (cc only).
+
+ +B Don't generate the statement "public .begin".
+
+ +L Turn automatic variables into statics (cc only).
+
+2.2 Detailed description of the options
+
+2.2.1 Machine-independent options
+
+2.2.1.1 The -D option (Define a macro)
+
+The -D option defines a symbol in the same way as the preprocessor
+directive, #define. It's usage is as follows:
+
+ cc -Dmacro[=text] prog.c
+
+For example,
+
+ cc -DMAXLEN=1000 prog.c
+
+is equivalent to inserting the following line at the beginning of the
+program:
+
+ #define MAXLEN 1000
+
+Since the -D option causes a symbol to be defined for the preprocessor,
+this can be used in conjunction with the preprocessor directive, #ifdef, to
+selectively include code in a compilation. A common example is code such as
+following:
+
+ #ifdef DEBUG
+ printf ("value: %d\n", i);
+ #endif
+
+This debugging code would be included in the compiled source by following
+command:
+
+ cc -DDEBUG prog.c
+
+When no substitution text is specified, the symbol is defined to have the
+numerical value 1.
+
+2.2.1.2 The -I Option (Include another source file)
+
+The -I option causes the compiler to search in a specified directory for
+files included in the source code. The name of the directory immediately
+follows the -I, with no intervening spaces. For more details, see the
+Compiler Operating Instructions, above.
+
+2.2.1.3 The -S Option (Be silent)
+
+The compiler considers some errors to be genuine errors and others to be
+possible errors. For the first type of error, the compiler always generates
+an error message. For the second, it generates a warning message. The -S
+option causes the compiler to not print warning messages.
+
+2.2.1.4 The Local Symbol Table and the -L Option
+
+When the compiler begins processing a compound statement, such as the body
+function or the body of a for loop, it makes entries about the statement's
+local symbols in the local symbol table, and removes the entries when it
+finishes processing the statement. If the table overflows, the compiler
+will display a message and stops.
+
+Be default, the local symbol table contains 40 entries. Each entry is 26
+bytes long, thus by default the table contains 640 bytes.
+
+You can explicitly define the number of entries in the local symbol table
+using the -L option. The number of entries immediately follows the -L, with
+no intervening spaces. For example, the following compilation will use a
+table of 75 entries, or almost 2000 bytes:
+
+ cc -L75 prog.c
+
+2.2.1.5 The Expression Table and the -E Option
+
+The compiler uses the expression table to process an expression. When the
+compiler completes its processing of an expression, it frees all space in
+this table, thus making the entire table available for the processing of
+the next expression. If the expression table overflows, the compiler will
+generate error number 36, "no more expression space", and halt.
+
+By default, the expression table contains 80 entries. Each entry is 14
+bytes long, thus by default the table contains 1120 bytes.
+
+You can explicitly define the number of entries in the expression table
+using the -E option. The number of entries immediately follows the -E, with
+no intervening spaces. For example, the following compilation will use a
+table of 20 entries:
+
+ cc -E20 prog.c
+
+2.2.1.6 The Case Table and the -Y Option
+
+The compiler uses the case table to process a switch statement, making
+entries in the table for the statement's cases. When it completes its
+processing of a switch statement, it frees up the entries for that switch.
+If this table overflows, the compiler will display error 76 and halt.
+
+For example, the following will use a maximum of four entries in the case
+table:
+
+ switch (a)
+ {
+ case 0: a += 1; /* one */
+ break;
+ case 1: switch (x) /* two */
+ {
+ case 'a': func1 (a); /* three */
+ break;
+ case 'b': func2 (b); /* four */
+ break;
+ } /* release the last two */
+ a = 5;
+ case 3: func2 (a); /* total ends at three */
+ break;
+ } /* release all entries */
+
+By default, the table contains 100 entries. Each entry is four bytes long,
+thus by default, the table occupies 400 bytes.
+
+You can explicitly define the number of entries in the case table using the
+compiler's -Y option. The number of entries immediately follows the -Y,
+with no intervening spaces. For example, the following compilation uses a
+case table having 50 entries:
+
+ cc -Y50 file
+
+2.2.1.7 The String Table and the -Z Option
+
+When the compiler encounters a "literal" (that is, a character string), it
+places the string in the literal table. If this table overflow, the
+compiler will display error 2, "string space exhausted", and halt.
+
+By default, the literal table contains 2000 bytes.
+
+You can explicitly define the number of bytes in this table using the
+compiler's -Z option. The number of bytes immediately follows the -Z, with
+no intervening spaces. For example, the following command will reserve 3000
+bytes for the string table:
+
+ cc -Z3000 prog.c
+
+2.2.1.8 The Macro/Global Symbol Table
+
+The compiler stores information about a program's macro and global symbols
+in the Macro/Global Symbol Table. This table is located in memory above
+all the other tables used by the compiler. Its size is set after all the
+other tables have been set. and hence can't be set by you. If this table
+overflows, the compiler will display the message "Out of Memory!" and halt.
+You must recompile, using smaller sizes for the other tables or split your
+C source code.
+
+ 2.2.2 PRODOS OPTIONS
+
+2.2.2.1 The +C Option (Generate 65C02 code - cc only)
+
+The +C option causes cc to generate source for a 65C02 processor. If this
+option isn't used, cc will generate code for a 6502 processor.
+
+2.2.2.2 The +B Option (Don't generate reference to .begin)
+
+Normally when compiling a module, the compilers generate a reference to the
+entry point named .begin . Then when the module is linked into a program,
+the reference causes the linker to include in the program the library
+module that contains .begin .
+
+The +B option prevents the compilers from generating this reference.
+
+For example, if you want to provide your own entry point for a program, and
+its name isn't begin, you should compile the program's modules with the +B
+option. If you don't, then the program will be bigger than necessary, since
+it will contain your entry point module and the standard entry point
+module. In addition, the linker by default sets at the program's base
+adress a jump instruction to the program's entry points in several module,
+it will set the jump to the last encountered.
+
+2.2.2.3 The +L Option (Turn Autos into Statics - cc only)
+
+The +L option causes the compiler to change the class of variables whose
+class is automatic to static. This can cause a significant increase in
+execution speed, since it is faster to adress static variables, which are
+directly addressable, than automatic variables, which are on the stack and
+must be indirectly addressed.
+
+Automatic variables that are declared using the auto keyword, (for example
+auto int i), aren't affected by the +L option: they will remain automatic.
+
+Also, if a register is available for an automatic variable that is declared
+using the register keyword (for example, register int i), the variable will
+be placed in a register and will not be turned into a static. If a register
+is not available, however, such a variable will be turned into a static
+variable.
+
+Like any other static data, an auto-turned-static is initialized to zero
+before the program begins.
+
+A function that recursively calls itself may not work correcty when it is
+compiled with the +L option. For example, the following program will print
+1 when compiled without the +L option, and 100 when compiled with the +L
+option.
+
+ main ()
+ {
+ printf ("%d", qtest ());
+ }
+
+ qtest ()
+ {
+ int i;
+
+ if (++i < 100) qtest (i);
+ return (i);
+ }
+
+ 3. ERROR CHECKING
+
+Compiler errors come in two varieties - fatal and not fatal. Fatal errors
+cause the compiler to make a final statement and stop. Running out of
+memory and finding no input are examples of fatal errors. The non-fatal
+sort are introduced below.
+
+The compiler will report any error it finds in the source file. It will
+first print out a line of code, followed by a line containing the up-arrow
+(caret) character. The up-arrow in this line indicates where the compiler
+was in the source line when it detected the error. The compiler will then
+display a line containing the following:
+
+ * The name of the source file containing the line;
+ * The number of the line within the file;
+ * An error code;
+ * The symbol with causes the error, when appropriate.
+
+The compiler writes error messages to its standard output. Thus, error
+messages normally go to the console, but they can be associated with
+another device or a file by redirecting standard output in the usual
+manner. For example,
+
+ cc prog.c errors sent to the console;
+ cc prog.c > outerr errors sent to the file outerr.
+
+The compiler normally pauses after every fifth error, and sends a message
+to its standard output asking you want to continue. The compiler will
+continue only if you enter a line beginning with the character 'y'. If you
+don't want the compiler to pause in this manner, (if, for example, the
+compiler's standard output has been redirected to a file) specify the -B
+option when you start the compiler.
+
+The compiler is not always able to give a precise description of an error.
+Usally, it must proceed to the next item in the file to ascertain that an
+error was encountered. Once an error is found, it is not obvious how to
+interpret the subsequent code, since the compiler cannot second-guess the
+programmer's intentions. This may cause it to flag perfectly good syntax as
+an error.
+
+If errors arise at compile time, it is a general rule of thumb that the
+first error should be corrected first. This may clear up some of the errors
+which follow. If the compiler detects more error with the same symbol, it
+maybe is only one error (for example, a variable is not declared).
+
+The best way to attack an error is first to look up the meaning of the
+error code.
+
DIAGNOSTICS
+If the compilation fails the compilers return -1 as there value that, for
+example, tells shell-scripts to stop immediatly.
+
SEE ALSO
+as, err, ln, set
+
+
+
+<< Back to Top
+
+
+
NAME cd
+cd - change current directory
+
SYNOPSIS
+cd [directory] /* Apple // and UNIX utility */
+
DESCRIPTION
+cd makes cirectory the current directory. If directory isn't specified, the
+current directory is set to the directory that's defined in the HOME
+environment variable, if this variable exist.
+
+If the specified directory doesn't exist, the current directory is
+unchanged.
+
+The directory argument defines the path of directories which must be passed
+trough to reach the new directory. The path can define a complete path from
+the root directory or it can define a partial path, which is assumed to
+begin at the current directory.
+
+cd is a built-in SHELL command.
+
EXAMPLE
+cd /work/io
+ The directory /work/io is made the current directory.
+
+cd subs/io
+ The directory io, which is reached from the current directory by
+ passing through the subdirectory subs of the current directory and then
+ into io, is made the current directory. For example, if /work was the
+ current directory, then after this command /work/subs/io is the new
+ current directory.
+
+cd ..
+ The current directory is set to the parent directory of the directory
+ which was the current before the issuance of this command.
+
+cd ../include
+ The current directory is set to the directory which is reached by
+ passing through the parent directory of the directory which was current
+ before the issuance of this command and then its include subdirectory.
+
+cd ../..
+ The current directory is set to the directory which is reached by
+ passing through the parent directory of the directory which was current
+ before the issuance of this command and then to its parent directory.
+
+
+<< Back to Top
+
+
NAME cmp
+cmp - file comparison utility
+
SYNOPSIS
+cmp [-l] file1 file2 /* Apple // and UNIX utility */
+
DESCRIPTION
+cmp compares two files an a character-by-character basis. When it finds a
+difference, it displays a message, giving the offset from the beginning of
+the file.
+
+If the -l option isn't specified, the program will stop after the first
+difference, displaying a message in the format:
+
+ Files differ: character 10
+
+If the -l option is specified, cmp will list all differences, in the
+format:
+
+ decimal-offset hex-offset file1-value file2-value
+
EXAMPLE
+cmp otst ntst
+ Files differ: character 10
+
+cmp -l otst ntst
+ 10 a: 00 45
+ 100 64: 1A 23
+
+
+<< Back to Top
+
+
NAME cnm
+cnm - display object file info
+
SYNOPSIS
+cnm [-sol] file [file ...] /* Apple // utility */
+
DESCRIPTION
+cnm displays the size and symbols of its object file arguments. The files
+can be object modules created by the as or asi assemblers, libraries of
+object modules created by the lb librarian, and 'rsm' files created by the
+ln linker during the linking of an overlay root.
+
+For example, the following displays the size and symbols for the object
+module sub1.o, the library c.lib, and the 'rsm' file root.rsm:
+
+ cnm sub1.o c.lib root.rsm
+
+By default, the information is sent to the console. It can be redirected to
+a file or device in the normal way. For example, the following commands
+send information about sub1.o to the display and to the file dispfile:
+
+ cnm sub1.o
+ cnm sub1.o > dispfile
+
+The first line listed by cnm for an object module has the following format:
+
+ file (module): code:cc data:dd udata:uu total:tt(0xhh)
+
+where
+
+ * file is the name of the file containing the module.
+ * module is the name of the module; if the module is unamed, this
+ field and its surrounding parentheses aren't printed.
+ * cc is the number of bytes in the module's code segment, in
+ decimal.
+ * dd is the number of bytes in the module's initialized data
+ segment in decimal. * uu is the number of bytes in the module's
+ uninitialized data segment, in decimal.
+ * tt is the total number of bytes in the module's three segments,
+ in decimal.
+ * hh is the total number of bytes in the module's three segments,
+ in hexadecimal.
+
+If cnm displays information about more than one module, it displays four
+totals just before it finishes, listing the sum of the sizes of the
+modules' code segments, initialized data segments, and uninitialized data
+segments, and the sum of the sizes of all segments of all modules. Each sum
+is in decimal, the total of all segments is also given in hexadecimal.
+
+The -s option tells cnm to display just the sizes of the object modules. If
+the option isn't specified, cnm also displays information about each named
+symbol in the object modules.
+
+When cnm displays information about the module's named symbols, the -l
+option tells cnm to display each symbol's information on a seperate line
+and to display all of the characters in a symbol's name. If this option
+isn't used, cnm displays the information about several symbols on a line
+and only displays the first eight characters of a symbol's name.
+
+The -o option tells cnm to prefix each line generated for an object module
+with the name of the file containing the module and the module name in
+parentheses (if the module is named). If this option isn't specified, this
+information is listed just once for each module: prefixed to the first line
+generated for the module.
+
+The -o option is useful when using cnm in combination with grep. For
+example, the following commands will display all information about the
+module perror in the library c.lib:
+
+ cnm -o c.lib > tmp
+ grep perror tmp
+
+cnm displays information about an module's named symbols, that is, about
+the symbols that begin with something other than a dollar sign followed by
+a digit. For example, the symbol quad is named, so information about it
+would be displayed, the symbol .0123 is unnamed, so information about it
+would not be displayed.
+
+For each named symbol in a module, cnm displays its name, a two- character
+code specifying its type, and an associated value. The value displayed
+depends on the type of the symbol.
+
+If the first character of a symbol's type code is lower case, the symbol
+can only be accessed by the module, that is, it's local to the module. If
+this character is upper case, the symbol is global to the module: either
+the module has defined the symbol and is allowing other modules to access
+it ar the module needs to access the symbol, which must be defined as a
+global or public symbol in another module. The type codes are:
+
+ ab The symbol was defined using the assembler's EQUATE
+ directive, The value listed is the equated value of its
+ symbol.
+
+ The compile doesn't generate symbols of this type.
+
+ pg The symbol is in the code segment. The value is the offset of
+ the symbol within the code segment.
+
+ The compiler generates this type symbol for function names.
+ Static functions are local to the function, and so have type
+ pg, all other functions are global, that is, callable from
+ other programs, and hence have type Pg.
+
+ dt The symbol is in the initialized data segment. The value is
+ the offset of the symbol from the start of the data segment.
+
+ The compiler generates symbols of this type for initialized
+ variables which are declared outside any function. Static
+ variables are local to the program and so have type dt, all
+ other variables are global, that is, accessable from other
+ programs, and hence have type Dt.
+
+ ov When an overlay is being linked and that overlay itself calls
+ another overlay, this tpe of symbols can appear in the 'rsm'
+ file for the overlay that is being linked. It indicates that
+ the symbol is defined in the program that is going to call
+ the overlay that is being linked.
+
+ The value is the offset of the symbol from the beginning of
+ the physical segment that contains it.
+
+ un The symbol is used but not defined within the program. The
+ value has no meaning.
+
+ In assembly language terms, a type of Un (the U is
+ capitalized) indicates that the symbol is the operand of a
+ public directive and that it is perhaps referenced in the
+ operand field of some statements, but that the program didn't
+ create the symbol in a statement's label field.
+
+ The compiler generates Un symbols for functions that are
+ called but not defined within the program, for variables that
+ are declared to be extern and that are actually used within
+ the program, and for uninitialized, global dimensionless
+ arrays. Variables which are declared to be extern but which
+ are not used within the program aren't mentioned in the
+ assembly language source file generated by the compiler and
+ hence don't appear in the object file.
+
+ bs The symbol is in the uninitialized data segment. The value is
+ the space reserved for the symbol.
+
+ The compiler generates bs symbols for static, uninitialized
+ variables which are declared outside all functions and which
+ aren't dimensionless arrays.
+
+ The assembler generates bs symbols for symbols defined using
+ the bss assembler directive.
+
+ Gl The symbol is in the uninitialized data segment. The value is
+ the space reserved for the symbol.
+
+ The compiler generates Gl symbols for non-static,
+ uninitialized variables which are declared outside all
+ functions and which aren't dimensionless arrays.
+
+ The assembler generates Gl symbols for variables declared
+ using the global directive which have a non- zero size.
+
+
+<< Back to Top
+
+
NAME cp
+cp - copy files
+
SYNOPSIS
+cp [-f] infile outfile /* Apple // and UNIX utility */
+
+cp [-f] file1 [file2 ...] dir
+
DESCRIPTION
+cp copies files, and their attributes. The first form of the command, as
+shown above, copies infile to outfile. The second copies file1, file2, ...
+into the directory named dir.
+
+The -f option causes cp to automatically overwrite any existing files. If
+this option isn't specified and if a file to be created already exists, cp
+will ask if you want it overwritten.
+
+On an Apple // cp is a built-in SHELL command.
+
EXAMPLE
+The following command copies the file hello.c that is in the current
+directory to the file newfile.c in the /source directory:
+
+ cp hello.c /source/newfile.c
+
+The next command copies all ".c" files in the /arc directory to the current
+(ie, the ".") directory:
+
+ cp /arc/*.c .
+
+ SEE ALSO
+chmod, lock, unlock
+
+
+
+ BUGS
+cp doesn't copy read-protected files. It only creates them.
+
+
+<< Back to Top
+
+
NAME crc
+crc - Utility for generating the CRC for files
+
SYNOPSIS
+crc file1 file2 ... /* Apple // and UNIX utility */
+
DESCRIPTION
+crc computes a number, called the CRC, for the specified files.
+
+The CRC for a file is entirely dependent on the file's contents, and it is
+very unlikely that two files whose contents are different will have the
+same CRCs. Thus, crc can be used to determine whether a file has the
+expected contents.
+
EXAMPLE
+As an example of the usage of crc, the following command computes the crc
+of all files whose extension is .c:
+
+ crc *.c
+
+
+<< Back to Top
+
+
NAME date
+date - display date and time
+
SYNOPSIS
+date /* Apple // utility */
+
DESCRIPTION
+Displays the date and time.
+
+date is a built-in SHELL command.
+
+
+<< Back to Top
+
+
NAME debug
+debug - set debug mode
+
SYNOPSIS
+debug /* Apple // utility */
+
DESCRIPTION
+To debug a SHELL-activated program using the monitor program That's in ROM,
+first enter the debug command, and then enter the command to start the
+program. The SHELL will load the program, perform i/o redirection and pass
+arguments to it if necessary, then, when it sees that the debug command was
+entered, it will jump to the monitor.
+
+When you're done debugging return to the SHELL by entering the command:
+
+ 3D0G
+
+The debug command affects only the next program that the SHELL starts. That
+is, for each program that you want to debug, you must first enter the debug
+command and then enter the command to start the program.
+
+debug is a built-in SHELL command.
+
+
+<< Back to Top
+
+
NAME df
+df - display volume info
+
SYNOPSIS
+df [/vol] /* Apple // utility */
+
DESCRIPTION
+Displays information about disk space utilization.
+
+The optional parameter /vol defines the disk of interest. It can be the
+name of a file or directory. In this case, information is displayed about
+the disk that contains the specified file or directory.
+
+/vol can also be the single character '/' (ie, specify the SHELL's
+simulated root directory of the entire file system). In this case,
+information is displayed about all on-line disks.
+
+If /vol isn't specified, and if the current directory isn't the simulated
+root directory of the file system, information is displayed about the disk
+that contains the current directory.
+
+If /vol isn't specified, and if the current directory is the simulated root
+directory of the file system, information is displayed about all on-line
+disks.
+
EXAMPLE
+The following command displays information about the disk that contains the
+current directory:
+
+ df
+
+The next command displays information about the /ram disk:
+
+ df /ram
+
+The next command displays information about all on-line disks:
+
+ df /
+
+
+<< Back to Top
+
+
NAME diff
+diff - source file comparison utility
+
SYNOPSIS
+diff [-b] file1 file2 /* Apple // and UNIX utility */
+
DESCRIPTION
+diff is a program, similar to the UNIX program of the same name, hat
+determines the difference between two files containing text. file1 and
+file2 are the names of the files to be compared.
+
+ 1. THE -B OPTION
+
+ The -b option causes diff to ignore trailing blanks (spaces and tabs)
+ and to consider strings of blanks to be identical. If this option isn't
+ specified, diff considers two lines to be the same only if they match
+ exactly.
+
+ diff will never consider blanks to match a null string, regardless of
+ whether -b was used or not.
+
+ 2. THE CONVERSION LIST
+
+ diff writes, to its standard output, a "conversion list" that describes
+ the changes that need to be made to file1 to convert it into file2. The
+ list is organized into a sequence of items, each of which describes one
+ operation that must be performed on file1.
+
+2.1 Conversion Items
+
+ There are three types of operations that can be specified in a
+ conversion list item:
+
+ * adding lines to file1 from file2;
+ * deleting lines from file1;
+ * replacing (changing) file1 lines with file2 lines.
+
+ A conversion list item consists a letter describing the operation to be
+ performed: 'a' for adding lines, 'd' for deleting line, and 'c' for
+ changing lines.
+
+ Preceding and following the letter are the numbers of the lines in
+ file1 and file2, respectively, that are affected by the command. If a
+ range of lines in a file are affected, just the beginning and ending
+ line numbers are listed, seperated by a comma.
+
+ So one line of the output of diff will look like
+
+ file1line [,file1to] [letter] file2line [,file2to]
+ [><] diffline
+
+2.1.2 The affected lines
+
+ As mentioned above, the lines affected by a conversion item's operation
+ are listed after the item's command line. The affected lines from file1
+ are listed first, flagged with a preceding '<'. The come the affected
+ lines from file2, flagged with a preceding '>'. The file1 and file2
+ lines are seperated by the line ---.
+
+ Since no lines from file1 are affected by an 'add' conversion item,
+ only the file2 lines that will be added to file1 are listed, and the
+ seperator line '---' is omitted.
+
+ 3. DIFFERENCES BETWEEN THE UNIX AND MANX VERSION OF DIFF
+
+ The Manx und UNIX versions of diff are actually most similar when the
+ latter program is invoked with the -h option. As with the UNIX diff
+ when used with the -h option, the Manx diff works best when changed
+ stretches are short and well sperated, and works with files of
+ unlimited length.
+
+ Unlike the UNIX diff, the Manx diff doesn't support the options e, f,
+ or h and requires that both operands to diff be actual files. Because
+ of this, the Manx version of diff doesn't support the features of the
+ UNIX version which allows one operand to be a directory name, (to
+ specify a file in that directory having the same name as the other
+ operand), and which allows one operand to be '-' (to specify diff's
+ standard input instead of a file).
+
+
+<< Back to Top
+
+
NAME echo
+echo - echo arguments
+
SYNOPSIS
+echo [arg1] [arg2] ... /* Apple // utility */
+
DESCRIPTION
+echo writes its arguments, seperated by blanks and terminated by a newline,
+to its standard output device.
+
+The ouput thus goes, by default, to the screen. It can also be redirected
+to another device or file in the normal manner.
+
+echo is a built-in SHELL command.
+
+
+<< Back to Top
+
+
+
NAME grep
+grep - pattern-matching program
+
SYNOPSIS
+grep [-cflnv] pattern [files] /* Apple // and UNIX utility */
+
DESCRIPTION
+grep is a program, similar to the UNIX program of the same name, that
+searches files for lines containing a pattern. By default, such lines are
+written to grep's standard output.
+
+ 1. INPUT FILES
+
+ The files parameter is a list of files to be searched. If no files are
+ specified, grep searches its standard input. Each file name can specify
+ a single file to be searched.
+
+ 2. OPTIONS
+
+ The following options are supported:
+
+ v print all lines that don't match the pattern
+
+ c print just the name of each file and the number of matching
+ lines that it contained
+
+ l print the names of just the files that contain matching lines
+
+ n precede each matching line that's printed by its relative line
+ number within the file that contains it
+
+ f a character in the pattern will match both its upper and lower
+ case equivalent
+
+ 3. PATTERNS
+
+ A pattern consists of a limited form of regular expression. It
+ describes a set of character strings, any of whose members are said to
+ be matched by the regular expression.
+
+ Some patterns match just a single character, others, which match
+ strings, can be constructed from those that match single characters. In
+ the following paragraphs, we'll first describe the patterns that match
+ a single character, and then describe patterns that match strings of
+ characters.
+
+3.1 Matching single characters
+
+ The patterns that match a single character are these:
+
+ * an ordinary character (that is, one other than the special
+ characters described below) matches itself
+
+ * a period (.) is a pattern that matches any character except
+ newline.
+
+ * a non-empty string of characters enclosed in square brackets,
+ [], matches aby one character in that string
+
+ If the string begins with the caret character,(^), the regular
+ expression matches any character except the other enclosed
+ characters and newline. The '^' has this special meaning only
+ if its the first character of the string.
+
+ The minus character, (-), can be used to indicate a range of
+ consecutive ASCII characters ( [0-9] is equivalent to
+ [0123456789] ).
+
+ * A backslash, (\), followed by a special character matches the
+ special character itself. The special characters are:
+
+ ., *, [, and \, which are always special, except when they
+ appear in square backets, ([]).
+
+ caret, (^), which is special when it is at the beginning of
+ an entire regular expression (as discussed in 3.4) and when
+ it immediately follows the left of a pair of square
+ brackets.
+
+ $, which is special at the end of an entire regular
+ expression (discussed in 3.4).
+
+3.2 Matching character string
+
+ Patterns can be concatenated. In this case, the resulting pattern
+ matches strings whose substrings match each of the concatenated
+ patterns.
+
+3.3 Matching repeating characters
+
+ A pattern can be built by appending an asterick, (*), to a pattern that
+ match a single character. The resulting pattern matches zero or more
+ occurences of the single-character pattern.
+
+3.4 Matching strings that begin or end lines
+
+ An entire pattern may be constrained to match only character strings
+ that occur at the beginning or the end of a line, by beginning or
+ ending the pattern with the character '^' or '$', respectively.
+
EXAMPLE
+4.1 Simple string matching
+
+ The following command will search the files file1.txt and file2.txt and
+ print the lines containing the word heretofore:
+
+ grep heretofore file1.txt file2.txt
+
+ If you aren't interested in the specific lines of these files, but just
+ want to know the names of the file containing the word heretofore, you
+ could enter
+
+ grep -l heretofore file1.txt file2.txt
+
+ The above two examples ignore lines in which heretofore contains
+ capital letters, such as when it begins a sentence. The following
+ command will cover this situation:
+
+ grep -lf heretofore file1.txt file2.txt
+
+ grep processes all option at once, so multiple options must be
+ specified in one dash parameter. For example, the command
+
+ grep -l -f heretofore file1.txt file2.txt
+
+ won't work.
+
+4.2 The special character '.'
+
+ Suppose you want to find all lines in the file prog.c that contain a
+ four-character string whose first and last characters are 'm' and 'n',
+ respectively, and whose other characters you don't care about. The
+ command
+
+ grep m..n prog.c
+
+ will do the trick, since the special character '.' matches any single
+ character.
+
+4.3 The backslash character
+
+ There are occasions when you want to find the character '.' in a file,
+ and don't want grep to consider it to be special. In this case, you can
+ use the backslash character, (\), to turn off the special meaning of
+ the next character.
+
+ For example, suppose you want to find all lines containing .PP.
+ Entering
+
+ grep .PP prog.doc
+
+ isn't adequate, because it will find lines such as THE APPLICATION OF
+ since the '.' matches the letter 'A'. But if you enter
+
+ grep /.PP prog.doc
+
+ grep will print just what you want.
+
+ The backslash character can be used to turn off the special meaning of
+ any special character. For example,
+
+ grep \\n prog.c
+
+ finds all lines in prog.c containing the string '\n'.
+
+4.4 The dollar sign and caret ($ and ^)
+
+ Suppose you want to find the number of the line on which the definition
+ of the function add occure in the file arith.c. Entering
+
+ grep -n add arith.c
+
+ isn't good, because it will print lines in which add is called in
+ addition to the line you're interested in. Assuming that you begin all
+ function definitions at the beginning of a line, you could enter
+
+ grep ^add arith.c
+
+ to accomplish purpose.
+
+ The character '$' is a companion to '^', and stands for 'the end of the
+ line'. So if you want to file all lines in file.doc that end in the
+ string time, you could enter
+
+ grep time$ file.doc
+
+ And the following will finds all lines that contain just .PP:
+
+ grep ^\.PP$
+
+4.5 Using brackets
+
+ Suppose that you want to find all lines in the file file.doc that
+ begins with a digit. The command
+
+ grep ^[0123456789] file.doc
+
+ will do just that. This command can be abbreviated as
+
+ grep ^[0-9] file.doc
+
+ And if you wanted to print all lines that don't begin with a digit, you
+ could enter
+
+ grep ^[^0-9] file.doc or
+ grep -v ^[0-9] file.doc
+
+4.6 Repeated characters
+
+ Suppose you want to find all lines in the file prog.c that contain
+ strings whose first character is 'e' and whose last character is 'z'.
+ The command
+
+ grep e.*z prog.c
+
+ will do that. The 'e' matches an 'e', the '.*' matches zero or more
+ arbitrary characters, and the 'z' matches a 'z'.
+
+ 5. DIFFERENCES BETWEEN THE MANX AND UNIX VERSION OF GREP
+
+ The Manx and UNIX version of grep differ in the options they accept and
+ the patterns they match.
+
+5.1 Option differences
+
+ The option -f is supported only by the Manx grep.
+ The option -b and -s are supported only by the UNIX grep.
+
+5.2 Pattern differences
+
+ Basically, the patterns accepted by the Manx grep are a subset of those
+ accepted by the UNIX grep.
+
+ The Manx grep doesn't allow a regular expression to be surrounded by
+ '\(' and '\)'.
+
+ The Manx grep doesn't accept the construct '\{m\}'.
+
+ The Manx grep doesn't allow a right bracket, ']', to be specified
+ within brackets.
+
+ Quoted strings can't be passed to the Manx grep. For example, the Manx
+ grep won't accept
+
+ grep 'this is a fine kettle of dish' file.doc
+
+
+<< Back to Top
+
+
NAME hd
+hd - hex dump utility
+
SYNOPSIS
+hd [-r] [+n[.]] file1 ... /* Apple // utility */
+
DESCRIPTION
+hd displays the contents of one or more files in hex and ascii to its
+standard output.
+
+file1, file2, ... are the names of the files to be displayed.
+
++n specifies the offset into the file where the display is to start, and
+defaults to the beginning of the file.
+
+if +n is followed by a period, n is assumed to be a decimal number,
+otherwise, it's assumed to be hexdecimal. Each file will be displayed
+beginning at the last specified offset.
+
EXAMPLE
+hd +16b oldtest newtest +0 junk
+
+ Displays the data forks of the files oldtest and newtest, beginning at
+ offset 0x16b, and of the file names junk beginning at its first byte.
+
+hd -r +1000. tstfil
+
+ Displays the contents of the resource fork of tstfil, beginning at byte
+ 1000.
+
+
+<< Back to Top
+
+
NAME lb
+lb - object file librarian
+
+ SYNOPSIS
+lb library [options] [mod1 mod2 ...] /* Apple // utility */
+
+Relocatable object files are named .r on the MS-DOS cross development version
+of Aztec C65.
+
+
DESCRIPTION
+lb is a program that creates and manipulates libraries of object modules.
+The modules must have been created by the Manx assembler.
+
+ 1 THE ARGUMENTS TO LB
+
+1.1 The library arguments
+
+ When started, lb acts upon a single library file. The first argument to
+ lb (library, in the synopsis) is the name of this file. The filename
+ extension for library is optional, if not specified, it's assumed to be
+ .lib.
+
+1.2 The option argument
+
+ There are two types of option argument: function code options, and
+ qualifier options. These options will be summarized in the following
+ paragraphs, and then described in detail below.
+
+1.2.1 Function code options
+
+ When lb is started, it performs one function on the specified library,
+ as defined by the options argument. The functions that lb can perform,
+ and their corresponding option code, are:
+
+ Function Code
+
+ create a library (no code)
+ add modules to a library -a, -i, -b
+ list library modules -t
+ move library within a library -m
+ replace modules -r
+ delete modules -d
+ extract modules -x
+ ensure modules uniqueness -u
+ help -h
+
+ In the synopsis, the options argument is surrounded by square brackets.
+ This indicates that the argument is optional, if a code isn't
+ specified, lb assumed that a library is to be created.
+
+1.2.2 Qualifier options
+
+ In addition to a functions code, the options argument can optionally
+ specify a qualifier, that modifies lb's behavior as it is performing
+ the requested function. The qualifiers and their codes are:
+
+ verbose -v
+ silent -s
+
+ The qualifier can be included in the same argument as the function
+ code, or as a seperate argument.
+
+1.3 The mode arguments
+
+ The arguments mod1, mod2, etc are the names of the object modules, or
+ the files contianing these modules, that lb is to use. For some
+ functions, lb requires an object module name, and for others it
+ requires the name of a file containing and object module. In the latter
+ case, the file's extension is optional, if not specified, lb assumes
+ that it's .o.
+
+1.4 Reading arguments from another file
+
+ lb has a special argument, -f filename, that causes it to read command
+ line arguments from the specified file. When done, it continues reading
+ arguments from the command line. Arguments can be read from more than
+ one file, but the file specified in a -f filename argument can't itself
+ contain a -f filename argument.
+
+ 2. BASIC FEATURES OF LB
+
+ In this section we want to describe tha basic features of lb. With this
+ knowledge in hand, you can start using lb, and then read about the rest
+ of the features of lb at your leisure.
+
+ The basic things you need to know about lb, and which thus are
+ described in this section, are:
+
+ * How to create a library
+ * How to list the name of modules in a library
+ * How modules get their names
+ * Order of modules in a library
+ * Getting lb arguments from a file
+
+2.1 Creating a library
+
+ A library is created by starting lb with a command line that specifies
+ the name of the library file to be created and the names of the files
+ whose object modules are to be copied into the library. It doesn't
+ contain a function code, and it's this absence of a function code that
+ tells lb that it is to create a library.
+
+ An object module file from which modules are read into a new library
+ can itself be a library created by lb. In this case, all the modules in
+ the library are copied into the new library.
+
+2.1.1 The temporary library
+
+ When lb creates a library or modifies an existing library, it first
+ creates a new library with a temporary name. If the function was
+ successful performed, lb erases the file having the same name as the
+ specified library, and then renames the new library, giving it the name
+ of the specified library. Thus, lb makes sure it can create a library
+ before erasing an existing one.
+
+ Note that there must be room on the disk for both the old library and
+ the new.
+
+2.2 Getting the table of contents for a library
+
+ To list the names of the modules in a library, use lb's -t option. The
+ list will include some **DIR** entries. These identify blocks within
+ the library tthat contain control information. They are created and
+ deleted automatically as needed, and cannot be changed by you.
+
+2.3 How modules get their names
+
+ When a module is copied into a library from a file containing a single
+ object module (that is, from object module generated by the Manx
+ assembler), the name of the module within the library is derived from
+ the name of the input file by deleting the input file's volume, path
+ and extension components. An input file can itself be a library. In
+ this case, a module's name in the new library is the same as its name
+ in the input library.
+
+2.4 Order in a library
+
+ The order of modules in a library is important, since the linker makes
+ only a single pass through a library when it is searching for modules.
+ When lb creates a library, it places modules in the library in the
+ order in which it reads them.
+
+ The ord utility program can be used to create a library whose modules
+ are optionally sorted.
+
+
+2.5 Getting lb arguments from a file
+
+ For libraries containing many modules, it is frequently inconvenient,
+ if not impossible, to enter all the arguments to lb on a single command
+ line. In this case, lb's -f filename feature can be of use: when lb
+ finds this option, it opens the specified file and starts reading
+ command arguments from it. After finshing the file, it continues to
+ scan the command line.
+
+ Arguments in a -f file can be seperated by any sequence of whitespace
+ characters ('whitespace' being blanks, tabs, and newlines). Thus,
+ arguments in a -f file can be on seperate lines, if desired.
+
+ The lb command line can contain multiple -f arguments, allowing lb
+ arguments to be read from several files. A -f file can contain any
+ valid lb argument, except another -f. That is, -f files can't be
+ nested.
+
+ 3. ADVANCED LB FEATURES
+
+3.1 Adding modules to a library
+
+ lb allows you to add modules to an existing library. The modules can be
+ added before or after a specified module in the library or can be added
+ to the beginning or end of the library.
+
+ The options that select lb's add function are:
+
+ Option Function
+
+ -b target add modules before the module target
+ -i target same as -b target
+ -a target add modules after the module target
+ -b+ add modules to the beginning of the library
+ -i +same as -b+
+ -a +add modules to the end of the library
+
+ In any lb command that selects the add function, the name of the files
+ containing modules to be added follows the add option code (and the
+ target module name, when appropriate). A file can contain a single
+ module or a library of modules.
+
+ Modules are addes in the order that they are specified. If a library is
+ to be added, its modules are added in the order they occur in the input
+ library.
+
+3.2 Moving modules within a library
+
+ Modules which already exist in a library can be easily moved about,
+ using the move option, -m.
+
+ As with the option for adding modules to an existing library, there are
+ several forms of move functions:
+
+ Option Meaning
+
+ -mb target move modules before the module target
+ -ma target move modules after the module target
+ -mb+ move modules to the beginning of the library
+ -ma+ move modules to the end of the library
+
+ In the lb command, the names of the modules to be moved follows the
+ 'move' option code.
+
+ The modules are moved in the order in which they are found in the
+ original library, not in the order in which they are listed in the lb
+ command.
+
+3.3 Deleting modules
+
+ Modules can be deleted from a library using lb's -d option. The command
+ for deletion has the form
+
+ lb libname -d mod1 mod2 ...
+
+ where mod1, mod2, ... are names of the modules to be deleted.
+
+3.4 Replacing modules
+
+ The lb option 'replace' is used to replace one module in a library with
+ one or more other modules.
+
+ The 'replace' option has the form
+
+ lb libname -r target
+
+ where target is the name of the module being replaced. In a command
+ that uses the 'replace' option, the names of the files whose modules
+ are to replace the target module follow the 'replace' option and its
+ associated target module. Thus, an lb command to replace a module has
+ the form:
+
+ lb library -r target mod1 mod2 ...
+
+3.5 Uniqueness
+
+ lb allows libraries to be created containing duplicate modules, where
+ one module is a duplicate of another if it has the same name.
+
+ The option -u causes lb to delete duplicate modules in a library,
+ resulting in a library in which each module name is unique. In
+ particular, the -u option causes lb to scan through a library, looking
+ at module names. Any modules found that are duplicates of previous
+ modules are deleted.
+
+3.6 Extracting modules from a library
+
+ The lb option -x extracts modules from a library and puts them in
+ sperated files, without modifying the library.
+
+ The names of the modules to be extracted follows the -x option. If no
+ modules are specified, all modules in the library are extracted.
+
+ When a module is extracted, it's wriiten to a new file, the file has
+ the same name as the module and extension .o.
+
+3.7 The 'verbose' option
+
+ The 'verbose' option, -v, causes lb to be verbose, that is, to tell you
+ what it's doing. This option can be specified as part of another
+ option, or all by itself.
+
+3.8 The 'silence' option
+
+ The 'silence' option, -s, causes lb to not display its signon message.
+ This option is especially useful when redirecting the output of a list
+ command to a disk file, as described below.
+
+3.9 Rebuilding a library
+
+ The following commands provide a convenient way to rebuild a library:
+
+ lb exmpl -st > tfil
+ lb exmpl -f tfil
+
+ The first command writes the names of the modules in exmpl.lib to the
+ file tfil. The second command then rebuilds the library, using as
+ arguments the listing generated by the first command.
+
+ The -s option to the first command prevents lb from sending information
+ to tfil that would foul up the second command. The names send to tfil
+ entries for the directory blocks, **DIR**, but these are ignored by lb.
+
+3.10 Help
+
+ The -h option is provided for brief lapses of memory, and will generate
+ a summary of lb functions and options (same as calling lb without any
+ argument). It is producing an output like:
+
+ append/insert: -[+/-] target
+ move module: -m[+/-] target
+ replace module: -r target
+ delete module: -d target
+ uniqueness: -u
+ extract module: -x [target]
+ table listing: -t
+ specify obj extension: -e
+
+ usage: lb libraryname -[key][position] [posname] [modules] ...
+
+
+<< Back to Top
+
+
NAME ln, ln65
+ln, ln65 - Aztec C Linker /* Apple // ProDOS utility */
+
+
SYNOPSIS
+ln [-options] file.o [file.o ...] [lib.lib ...]
+
+
+The 6502 linker is named ln on native versions of Aztec C65 and ln65 on
+cross development versions.
+
+Relocatable object files are named .r on the MS-DOS cross development version
+of Aztec C65.
+
+
DESCRIPTION
+The ln linker has two functions:
+
+ * It ties together the pieces of a program which have been compiled
+ and assembled separately;
+
+ * It converts the linked pieces to a format which can be loaded and
+ executed.
+
+The pieces must have been created by the Manx assembler.
+
+The first section of this chapter presents a brief introduction to linking
+and what the linker does. If you have previous experience with linkage
+editors, you may wish to continue reading with the second section, entitled
+"Using the Linker". There you will find a concise description of the
+command format for the linker.
+
+ 1. INTRODUCTION TO LINKING
+
+1.1 Relocatable Object Files
+
+The object code produced by the assembler is "relocatable" because it can
+be loaded anywhere in memory. One task of the linker is to assign specific
+addresses to the parts of the program. This tells the operating system
+where to load the program when it is run.
+
+1.2 Linking hello.o
+
+It is very unusual for a C program to consist of a single, self-contained
+module. Let's consider a simple program which prints "hello, world" using
+the function, printf. The terminology here is precise; printf is a function
+and not an intrinsic feature of the language. It is a function which you
+might have written, but it already happens to be provided in the file
+c.lib . This file is a library of all the standard i.o functions. It also
+contains many support routines which are called in the code generated by
+the compiler. These routines aid in integer arithmetic, operating system
+support, etc.
+
+When the linker sees that a call to printf was made, it pulls the function
+from the library and combines it with the "hello, world" program. The link
+command would look like this:
+
+ ln hello.o c.lib
+
+When hello.c was compiled, calls were made to some invisible support
+functions in the library. So linking without the standard library will
+cause some unfamiliar symbols to be undefined.
+
+All programs will need to be linked with one of the versions of c.lib .
+Initially, you can use c.lib itself. Later on, if you find that c.lib
+doesn't suit your requirements, you can use one of the other versions.
+
+1.3 The Linking Process
+
+Since the standard library contains only a limited number of general
+purpose functions, all but the most trivial programs are certain to call
+user-defined functions. It is up to the linker to connect a function call
+with the definition of the function somewhere in the code.
+
+In the example given below, the linker will find two function calls in
+file 1. The reference to func1 is "resolved" when the definition of func1
+is found in the same file. The following command
+
+ ln file1.o c.lib
+
+will cause an error indicating that func2 is an undefined symbol. The
+reason is that the definition of func2 is in another file, namely file2.o .
+The linkage has to include this file in order to be successful:
+
+ ln file1.o file2.o c.lib
+
+
+ file1 file2
+
+ func1 () func2 ()
+ { {
+ printf ("hello, "); printf ("world");
+ return; return;
+ } }
+
+ main ()
+ {
+ func1 ();
+ func2 ();
+ }
+
+1.4 Libraries
+
+A library is a collection of object files put together by a librarian.
+Libraries intended for use with ln must be built with the Manx librarian,
+lb.
+
+All the object files specified to the linker will be "pulled into" the
+linkage; they are automatically included in the final executable file.
+However, when a library is encountered, it is searched. Only those modules
+in the library which satisfy a previous function call are pulled in.
+
+1.5 For example
+
+Consider the "hello, world" example. Having looked at the module, hello.o,
+the linker has built a list of undefined symbols. This list includes all
+the global symbols that have been referenced but not defined. Global
+variables and all function names are considered to be global symbols.
+
+The list of undefined's for hello.o includes the symbol printf. When the
+linker reaches the standard library, this is one of the symbols it will be
+looking for. It will discover that printf is defined in a library module
+whose name also happens to be printf. (There is not any necessary relation
+between the name of a library module and the functions defined within it.)
+
+The linker pulls in the printf module in order to resolve the reference to
+the printf function.
+
+Files are examined in the order in which they are specified on the command
+line. So the following linkages are equivalent:
+
+ ln hello.o
+
+ ln c.lib hello.o
+
+Since no symbols are undefined when the linker searches c.lib in the second
+line, no modules are pulled in. It is good practice to leave all libraries
+at the end of the command line, with the standard library last of all.
+
+1.6 The Order of Library Modules
+
+For the same reason, the order of the modules within a library is
+significant. The linker searches a library once, from beginning to end. If
+a module is pulled in at any point, and that module introduces a new
+undefined symbol, then that symbol is added to the running list of
+undefined's. The linker will not search the library twice to resolve any
+references which remain unresolved. A common error lies in the following
+situation:
+
+ module of program references (function calls)
+
+ main.o getinput, do_calc
+ input.o gets
+ calc.o put_value
+ output.o printf
+
+Suppose we build a library to hold the last three modules of this program.
+Then our link step will look like this:
+
+ ln main.o proglib.lib c.lib
+
+But it is important that proglib.lib is built in the right order. Let's
+assume that main() calls to functions, getinput () and do_calc().
+getinput() is defined in the module input.o. It in turn calls the standard
+library function gets(). do_calc() is in calc.o and calls put_value().
+put_value() is in output.o and calls printf(). What happens at link time if
+proglib.lib is built as follows?
+
+ proglib.lib input.o
+ output.o
+ calc.o
+
+After main.o, the linker has getinput and do_calc undefined (as well as
+some other support functions in c.lib). Then it begins the search of
+proglib.lib. It looks at the library module, input, first. Since that
+module defines getinput, that symbol is taken off the list of undefined's.
+But gets is added to it.
+
+The symbols do_calc and gets are undefined when the linker examines the
+module, output. Since neither of these symbols are defined there, that
+module is ignored. In the next module, calc, the reference to do_calc is
+resolved but put_value is a new undefined symbol.
+
+The linker still has gets and put_value undefined. It then moves on to
+c.lib, where gets is resolved. But the call to put_value is never
+satisfied. The error from the linker will look like this:
+
+ Undefined symbol: put_value_
+
+This means that the module defining put_value was not pulled into the
+linkage. The reason, as we saw, was that put_value was not an undefined
+symbol when the output module was passed over. This problem would not occur
+with the library built this way:
+
+ proglib.lib input.o
+ calc.o
+ output.o
+
+The standard libraries were put together with much care so that this kind
+of problem would not arise.
+
+Occasionally it becomes difficult or impossible to build a library so that
+all references are resolved. In the example, the problem could be solved
+with the following command:
+
+ ln main.o proglib.lib proglib.lib c.lib
+
+The second time through proglib.lib, the linker will pull in the module
+output. The reason this is not the most satisfactory solution is that the
+linker has to search the library twice; this will lengthen the time needed
+to link.
+
+ 2. USING THE LINKER
+
+The general form of a linkage is as follows:
+
+ ln [-options] file.o [file.o ...] [lib.lib ...]
+
+The linker can create programs having the following types:
+
+ * PRG programs, which can only be executed in the SHELL environment;
+
+ * BIN programs, which can be executed in either in the SHELL or the
+ Basic Interpreter environments;
+
+ * SYS programs, which are ProDOS system programs.
+
+By default, the linker creates a PRG program. The +B option makes it create
+a BIN program, and the +S option make it create a SYS program. When
+creating a BIN or SYS program, you will also have to include the startup
+routine samain.o in the program.
+
+2.1 The executable file
+
+The name of the executable output file can be selected using the -O linker
+option. If this option isn't used, the linker will derive the name of the
+output file from that of the first object file listed on the command line,
+by deleting its extension. In the default case, the executable file will be
+located in the directory in which the first object file is located. For
+example,
+
+ ln prog.o c.lib
+
+will produce the file prog. The standard library, c.lib, will have to be
+included in most linkages.
+
+A different output file can be specified with the -O option, as in the
+following command:
+
+ ln -O program mod1.o mod2.o c.lib
+
+This command also shows how several individual modules can be linked
+together. A "module", in this sense, is a section of a program containing a
+limited number of functions, usally related. These modules are compiled and
+assembled separately and linked together to produce an executable file.
+
+2.2 Libraries
+
+Several libraries of object modules are provided with the Aztec C65. The
+most freqently-used of these are c.lib, which contains 6502 versions of the
+non-floating point functions, and m.lib, which contains 6502 versions of
+the floating point functions. Other libraries are provided with some
+versions of Aztec C65.
+
+All programs must be linked with one of the versions of c.lib. In addition
+to containing 6502 versions of all the non-floating point functions it
+contains internal functions which are called by compiler-generated code,
+such as functions to perform long arithmetic.
+
+Programs that perform floating point operations must be linked with one of
+the version of m.lib, in addition to a version of c.lib. The floating point
+library must be specified on the linker command line before c.lib .
+
+Libraries of user modules can also be searched by the linker. These are
+created with the Manx lb program, and must be listed on the linker command
+line before the Manx libraries.
+
+For example, the following links the module program.o, searching the
+libraries mylib.lib, new.lib, m.lib and c.lib for needed modules:
+
+ ln program.o mylib.lib new.lib m.lib c.lib
+
+Each of the libraries will be searched once in the order in which they
+appear on the command line.
+
+Libraries can be conveniently specified using the -L option. For example,
+the following command is equivalent to the one above:
+
+ ln -O program.o -lmylib -lnew -lm -lc
+
+For more information, see the description of the -L option below.
+
+ 3. LINKER OPTIONS
+
+3.1 Summary of options
+
+3.1.1 General Purpose Options
+
+ -O file Write executable code to the file named file.
+
+ -Lname Search the library name.lib for needed modules.
+
+ -F file Read common arguments from file.
+
+ -T Generate a symbol table file.
+
+ -M Don't issue warning messages.
+
+ -N Don't abort if there are undefined symbols.
+
+ -V Be verbose.
+
+3.1.2 Options for Segment Address Specification
+
+ -B addr Set the program's base address to the hex value addr.
+
+ -C addr Set the starting address of the program's code segment to
+ the hex value addr.
+
+ -D addr Set the starting address of the program's data segment to
+ the hex value addr.
+
+ -U addr Set the starting offset of the program's uninitialized data
+ segment to the hex value addr.
+
+3.1.3 Option for Overlay Usage
+
+ -R Create a symbol table to be used when linking overlays.
+
+ +C size Reserve size bytes at end of the program's code segment (the
+ overlay's code segment is loaded here). size is a hex value.
+
+ +D size Reserve size bytes at end of the program's code and
+ uninitialized data segements (the overlay's data is loaded
+ here). size is a hex value.
+
+3.1.4 Special Options for ProDOS
+
+ +B Create a BIN program.
+
+ +S Create a SYS program.
+
+ +H start,end Define a hole in the program, whose beginning and ending
+ addresses are hex values start and end.
+
+3.2 Detailed description of the options
+
+3.2.1 General Purpose Options:
+
+3.2.1.1 The -O option
+
+The -O option can be used to specify the name of the file to which the
+linker is to write the executable program. The name of this file is in the
+parameter that follows the -O. For example, the following command writes
+the executable program to the file progout:
+
+ ln -O progout prog.o c.lib
+
+If this option isn't used, the linker derives the name of the executable
+file from that of the first input file, by deleting its extension.
+
+3.2.1.2 The -L option
+
+The -L option provides a convenient means of specifying to the linker a
+library that is should search, when the extension of the library is .lib.
+
+The name of the library is derived by concatenating the value of the
+environment varibale CLIB, the letters that immediately follow the -L
+option, and the string .lib. For example, with the libraries subs.lib,
+io.lib, m.lib and c.lib in a directory specified by CLIB, you can link the
+module prog.o, and have the linker search the libraries for needed modules
+by entering
+
+ ln prog.o -lsubs -lio -lm -lc
+
+CLIB is set using the SHELL's set command. For example, the following
+command defines CLIB when the libraries are in the directory /ln/lib:
+
+ set CLIB=/ln/libs/
+
+Note the terminating slash on the CLIB variable: this is required since the
+linker simply prepends the value of the CLIB variable to the -L string.
+
+3.2.1.4 The -F option
+
+-F file causes the linker to merge the contents of the given file with the
+command line arguments. For example, the following command causes the
+linker to create an executable program in the file myprog. The linker
+includes the modules myprog.o, mod1.o and mod2.o in the program, and
+searches the libraries mylib.lib and c.lib for needed modules.
+
+ ln myprog.o -F argfile c.lib
+
+where the file argfile, contains the following:
+
+ mod1.o mod2.o mylib.lib
+
+The linker arguments in argfile can be seperated by tabs, spaces, or
+newlines. There are several uses for the -F option. The most obvious is to
+supply the names of modules that are frequently linked together. Since all
+the modules named are automatically pulled into the linkage, the linker
+does not spend any time in searching, as with a library. Furhermore, any
+linker option except -F can be given in a -F file. -F can appear on the
+command line more than once, and in any order. The arguments are processed
+in the order in which they are read, as always.
+
+3.2.1.5 The -T option
+
+The -T option creates a disk file which contains a symbol table for the
+linkage. This file is just a text file which lists each symbol with a
+hexadecimal address. This address is either the entry point for a function
+or the location in memory of a data item. A perusal of this file will
+indicate which functions were actually included in the program.
+
+The symbol table file will have the same name as that of the file
+containing the executable program, with extension changed to .sym .
+
+3.2.1.6 The -M option
+
+The linker issues the message "multiply defined symbol" when it finds a
+symbol that is defined with the assembly language directives global or
+public in more than one module. The -M option causes the linker to supress
+this message unless the symbol is defined in more than one public
+directive.
+
+To maintain compability with the previous versions of Aztec C, the linker
+will generate code for a variable that is defined in multiple global
+statements and in at most one public statement, and also issue the
+"multiply defined symbol" message. Thus, if you use the global and public
+directives in this way, and don't want to get this message, use the -M
+option to supress them.
+
+The definition of a symbol in more that one public directives is never
+valid, so the -M option doesn't supress messages in this case.
+
+3.2.1.7 The -N option
+
+Normally, the linker halts without generating an executable program if
+there are undefined symbols. The -N option causes the linker to go ahead
+and generate an executable program anyway.
+
+3.2.1.8 The -V option
+
+The -V option causes the linker to send a progress report of the linkage to
+the screen as each input file is processed. This is useful in tracking down
+undefined symbols and errors which may occur while linking.
+
+
+3.2.2 Option for segment address specification
+
+The linker organizes a program into three segments: code, initialized data,
+and uninitialized data areas. You can define the starting address of these
+segments using the -C, -D, and -U linker options, respectively. A fourth
+option, -B, will set the "base address" of the program. These options are
+followed by the desired offset, in hex.
+
+By default, the base address of a PRG or BIN program is 0x800, while the
+base address of a SYS program is 0x2000. Also by default, a program's code
+segment starts three bytes after the base address, its initialized data
+segment follows the code, and its uninitialized data follows the
+initialized data.
+
+A file created by the linker contains a memory image of the program, from
+its base address through the end of its code or initialized data segments
+(whichever is higher). This image is loaded into memory, with the first
+byte in the file loaded at the program's base address.
+
+By default, a program is expected to begin execution at its base address.
+Most programs have a startup routine, which performs initialization
+activities and then calls the program's main function. This entry point to
+the startup routine is usually somewhere in the middle of the program, so
+at the base address the linker will normally set a jump instruction to the
+entry point.
+
+You can explicitly specify that a label in a module is an entry point by
+placing the label in the operand field of the module's assembly language
+entry directive. For example, the crt0 module in c.lib contains the
+function .begin . This label is dclared in a public directive and also in
+the module's entry directive. When a C module is compiled, the compiler
+always generates a reference to .begin; thus, when the program is linked,
+ln will include the crt0() module from c.lib and place a jump to .begin at
+the program's base address.
+
+If the linker doesn't find a startup routine when it links a program, it
+won't set the jump instruction at the program's base address. In this case,
+if you don't specify a starting offset for the program's code segment, it
+will right at the base address.
+
+For example, the following command sets the base address of prog to 0x4000:
+
+ ln -B 4000 -O prog prog.o -lc
+
+Because none of the other segment selection options were used in this
+example, the program's code will begin at offset 0x4003, followed by its
+initialized data, followed by its uninitialized data.
+
+In the next example, the program's base address is set to 0x900 the offset
+of its code, initialized data, and uninitialized data segments to 0x2000,
+0x2800, and 0x3000, respectively.
+
+ ln -B 900 -C 2000 -D 2800 -U 3000 prog.o -lc
+
+3.2.3 Options for Overlay Usage
+
+The -R option causes the linker to generate a file containing the symbol
+table. It's used when linking a program which calls overlays.
+
+The name of the symbol table file is derived from that of the executable
+file by changing the extension to .rsm . The file is placed in the same
+directory as the executable file.
+
+The linker reserves space in a program between its uninitialized data area
+and its heap, into which the program's overlay will be loaded. The amount
+of space equals the sum of the values that you define using the +C and +D
+options. For example,
+
+ ln +C 3000 +D 1000 prog.o -lc
+
+will reserve 0x400 bytes for overlays.
+
+3.2.4 Special Option for ProDOS
+
+3.2.4.1 The +B Option
+
+The +B option causes the linker to set the type of a file containing a
+created program to BIN.
+
+3.2.4.2 The +S Option
+
+The +S option causes the linker to set the type of a file containing a
+created program to SYS and to set the default base address for the program
+to 0x2000.
+
+3.2.4.3 The +H option
+
+The +H option defines a "hole", that is an area of memory into which the
+linker should not place a program's code or data. You can create at most
+four holes in a program using +H options.
+
+The option has the following form:
+
+ +H start,end
+
+where start and end are the addresses, in hex, of the hole's starting and
+ending addresses.
+
+For example, suppose you want to create a program, line, that uses the
+primary graphics page (between addresses 0x2000-0x4000) and that begins at
+address 0x800. The following command will link the program:
+
+ ln +H 2000,4000 line.o -lc
+
+The linker will place as much of the program's code and data as possible in
+the area between 0x800-0x2000, and place any additional code and data in
+the area above 0x4000.
+
+The linker creates a program's code segment by concatenating module code
+segments, until and unless a module's code overlaps a reserved area. If
+this occurs, the linker moves the module's entire code segment above the
+reserved area, in the first non-reserved area in which it will entirely
+fit, and then continues the concatenation of module code segments.
+
+The linker creates a program's initialized data segement in the same way:
+it concatenates module initialized data segments as much as possible,
+without overlapping a reserved area and without breaking a module's
+initialized data segment into discontigous pieces.
+
+Because the linker won't break up a module's code segment or data segment,
+it's likely that some space below a hole will be left unused by the linker.
+
DIAGNOSTICS
+If the linker fails it return -1 as its value that, for example, tells
+shell-scripts to stop immediatly.
+
SEE ALSO
+as, cc, lb, set
+
+
+
+<< Back to Top
+
+
NAME lock, unlock
+lock, unlock - lock and unlock files
+
SYNOPSIS
+lock file1 file2 ... /* Apple // utility */
+
+unlock file1 file2 ...
+
DESCRIPTION
+These commands lock and unlock the specified files. When locked, a file
+can't be removed, renamed, or written to.
+
+lock and unlock are built-in SHELL commands.
+
+
+<< Back to Top
+
+
NAME ls
+ls - list directory contents
+
SYNOPSIS
+ls [-option] [name1 name2 ...] /* Apple // and UNIX utility */
+
DESCRIPTION
+ls displays information about the files and directories name1, name2, ...
+If no names are specified, ls displays information about all the files and
+directories in the current directory.
+
+A name can optionally specify multiple files, using the "wildcard
+characters" * and ?. These have their standard meaning: * matches one or
+more characters, and ? matches a single character.
+
+ls sends the information to its standard output. This information thus by
+default is sent to the console, but can be redirected to a file or other
+device in the normal way.
+
+ls by default displays information in 'short form', listing just the names
+of the specified files and directories. You can also specify the -l option
+to cause ls to display information in 'long form', listing lots of
+information.
+
+When ls sends information in short form to the console, the names are in
+columns on the screen, with a dash preceding directory names. When the
+information is sent to a file or other device, the names are listed one per
+line, and a directory name isn't by default preceded by a dash.
+
+ls usally sorts the list it's going to display. By default, the list is
+sorted alphabetically, you can also specify options to cause ls to sort
+based on other the list such 'last modified' time and file size, and, for a
+given criteria, to sort in the reverse of the normal order.
+
+ls supports the following options:
+
+ -l list in long form.
+ -p When listing in short form, and redirected, precede directory
+ names with a dash.
+ -t sort by 'last-modified' time.
+ -s sort by file size.
+ -r reverse the order of the sort.
+ -x don't sort the file list.
+
+ LONG FORMAT
+
+ The -l option causes the listing to be made in 'long format', in which
+ additional information is displayed for each file. In this case, the
+ listing for a file or directory has the following format:
+
+ flags type (aux_type) size date name
+
+ where:
+
+ * name is the name of the file or directory.
+ * date is the date and time at which it was last modified.
+ * size is the number of bytes that have been written to it.
+ * aux_type is its aux_type field (for a program, this is its
+ load adress).
+ * type defines the contents of the file or directory.
+ * flags defines other attributes of the file or directory.
+
+ FLAGS FIELD
+
+ The flags field consists of five characters, each defines whether or
+ not the file has a certain attribute. If the file or directory has all
+ these attributes, the falgs field will be "debwr". If the file or
+ directory doesn't have a particular attribute, the attribute's
+ characters is replaced in the list by a dash, '-'.
+
+ The meanings of the characters are:
+
+ d deletable.
+ e erasable.
+ b needs to be backed up.
+ w writable.
+ r readable.
+
+ TYPE FIELD
+
+ The type field defines the type of the file. Possible values are:
+
+ PRG File conatins a program that can only be run in the SHELL
+ environment.
+ BIN File contains a type program that can be run in the SHELL or
+ Basic environment.
+ SYS File contains a ProDOS system file.
+ DIR Directory.
+ TXT This is the only other type of file created by the Aztec
+ programs. fopen, open, and related functions also create
+ files or type TXT.
+
+ MOUNTED VOLUMES
+
+ The SHELL pretends that the file system has a root directory, and that
+ all volume directories are subdirectories of this root directory. So to
+ diplay the names of all mounted volumes, enter the command
+
+ ls /
+
+ And to display the names of all mounted volumes along with the numbers
+ of the slot and drives that contain them, enter the command
+
+ ls -l /
+
+
+<< Back to Top
+
+
NAME mkdir
+mkdir - make directory
+
SYNOPSIS
+mkdir dirname1 dirname2 ... /* Apple // and UNIX utility */
+
DESCRIPTION
+mkdir creates one or more directories, named dirname1, dirname2, ...
+
+An empty directory can be removed with the rm command on an Apple // and
+with rmdir command under UNIX.
+
SEE ALSO
+rm
+
+
+
+<< Back to Top
+
+
NAME mv
+mv - move files
+
SYNOPSIS
+mv [-f] infile outfile /* Apple // and UNIX utility */
+
+mv [-f] file1 [file2 ...] dir
+
DESCRIPTION
+mv moves files, and their attributes. The original files then cease to
+exist.
+
+The first form of the command, as shown above, copies infile to outfile.
+The second copies file1, file2, ... into the directory named dir.
+
+The -f option causes mv to automatically overwrite any existing files. If
+this option isn't specified and if a file to be created already exists, mv
+will ask if you want it overwritten.
+
+In both forms, mv will simply change the name of the original file to that
+of the target file if the two files are in the same directory. It
+physically copies a file and then deletes the original only when the
+directories of the two files differ.
+
+mv is a built-in SHELL command on an Apple //.
+
EXAMPLE
+The following command moves the file hello.c that is in the current
+directory to the file newfile.c in the /source directory:
+
+ mv hello.c /source/newfile.c
+
+The next command moves all ".lib" files in the /ln directory to the /pl/lib
+directory:
+
+ mv /ln/*.lib /pl/lib
+
+
+<< Back to Top
+
+
+
NAME obd
+obd - list object code
+
SYNOPSIS
+obd objfile /* Apple // utility */
+
DESCRIPTION
+obd lists the loader items in an object file. It has a single parameter,
+which is the name of the object file.
+
+
+<< Back to Top
+
+
NAME ord
+ord - sort object module list
+
SYNOPSIS
+ord [-v] [infile [outfile]] /* Apple // utility */
+
DESCRIPTION
+ord sorts a list of object file names. A library of the object modules that
+is generated from the sorted list by object module librarian, lb, will have
+a minimum number of 'backward references', that is, global symbols that are
+defined in one module and referenced in a later module.
+
+Since the specification of a library to the linker causes it to search the
+library just once, a library having no backward references need be
+specified just once when linking a program, and a library having backward
+references may need to be specified multiple times.
+
+infile is the name of a file containing an unordered list of file names.
+These files contain the object modules that are to be put into a library.
+If infile isn't specified, this list is read from ord's standard input. The
+file names can be seperated be space, tab, or newline characters.
+
+outfile is the name of the file to which the sorted list is written. If
+it's not specified, the list is written to ord's standard output. outfile
+can only specified if infile is also specified.
+
+The -v option causes ord to be verbose, sending messages to its standard
+error device as it proceeds.
+
SEE ALSO
+lb, ln
+
+
+
+<< Back to Top
+
+
NAME pr
+pr - initialize devices
+
SYNOPSIS
+pr s1 [s2 ...] /* Apple // utility */
+
DESCRIPTION
+pr initializes the devices that are in slots s1, s2, ..., by calling each
+device's ROM.
+
+pr is a built-in SHELL command.
+
EXAMPLE
+The following command initializes the card in slot 2 by calling address
+0xC200:
+
+ pr 2
+
+
+<< Back to Top
+
+
NAME pwd
+pwd - print working directory
+
SYNOPSIS
+pwd /* Apple // and UNIX utility */
+
DESCRIPTION
+pwd prints the name of the current directory.
+
+The name is written to pwd's standard output device. Hence, the name is
+printed on the screen, by default, and can be redirected to another device
+or file, if desired.
+
+pwd is a built-in SHELL command.
+
SEE ALSO
+cd
+
+
+
+<< Back to Top
+
+
NAME rm
+rm - removes files or directories
+
SYNOPSIS
+rm file [file ...] /* Apple // and UNIX utility */
+
DESCRIPTION
+rm removes the specified files or directories.
+
+rm will not remove locked files or non-empty directories.
+
+Under UNIX rm doesn't remove directories. Locking is handled different.
+
+ EXAMPLE
+The following command removes the files file1.bak and file2.bak from the
+current directory:
+
+ rm file1.bak file2.bak
+
+
+<< Back to Top
+
+
NAME set
+set - environment variable and exec utility
+
SYNOPSIS
+set /* Apple // utility */
+
+set VAR=string
+
+set VAR=
+
+set [-+x] [-+e] [-+n]
+
DESCRIPTION
+set is used to examine and set environment variables, to set exec file
+options, and to enable the trapping of errors by the SHELL.
+
+set is a built-in SHELL command.
+
+Displaying and setting of environment variables:
+
+ The first form listed for set causes set to display the name and value
+ of each environment variable.
+
+ The second form assigns string to the environment variable VAR.
+
+ The third form removes the variable VAR from the SHELL environment.
+
+Setting Exec file options:
+
+ x Command line logging. With this option enabled, before a command
+ line in an exec file is executed, it's logged to the screen. By
+ default, this option is disabled.
+
+ e Exit prematurely. With this option enabled, a command which
+ terminates with a non-zero return code causes the exec file to be
+ aborted. By default, this option is enabled.
+
+ n Non-execution. With this option enaabled, commands in the exec
+ file aren't executed. By default, this option is disabled.
+
+ Preceding an option's character with a minus sign enables the
+ option, and preceding it with a plus sign disables it.
+
+
+<< Back to Top
+
+
NAME shift
+shift - shift exec file variables
+
SYNOPSIS
+shift [n] /* Apple // utility */
+
DESCRIPTION
+shift causes the values assigned to an exec file variable to be reassigned
+to the next lower-numbered exec file variable. n is the number of the
+lowest-numbered variable whose value is to be reassigned, and defaults to
+1.
+
+Thus, shift causes the exec file variable $1 to be assigned with the value
+of $2, $2 to be assigned with $3, and so on. The original value assigned to
+$1 is lost. When all arguments to the exec file have been shifted out, $1
+is assigned to the null-string.
+
+shift is a built-in SHELL command.
+
EXAMPLE
+The following exec file, del, is passed a directory as its first argument
+and the names of files within the directory that are to be removed:
+
+ set j=$1
+ shift
+ loop i in $*
+ rm $j/$i
+ eloop
+
+In this example, j is an environment variable. The first two statements in
+the exec file save the name of the directory and then shift the directory
+name out of the exec file variables.
+
+The loop then repeatedly calls rm to remove one of the specified files from
+the directory.
+
+Entering
+
+ del . file1.bak file2.bak
+
+will remove the files file1.bak and file2.bak from the current directory.
+
+
+<< Back to Top
+
+
NAME sqz
+sqz - sqeeze an object library
+
SYNOPSIS
+sqz file [outfile] /* Apple // utility */
+
DESCRIPTION
+sqz compresses an object module that was created by the Manx assembler.
+
+The first parameter is the name of the file containing the module to be
+compressed. The second parameter, which is optional, is the name of the
+file to which the compressed module will be written.
+
+If the output file is specified, the original file isn't modified or
+erased.
+
+If the output file isn't specified, sqz creates the compressed module in a
+file having a temporary name, erases the original file, and renames the
+output file to have the name of the original file. The temporary name is
+different from the input file name by having the extent .sqz.
+
+If the output file isn't specified and an error occurs during the creation
+of the compressed module, the original file isn't erased or modified.
+
+
+<< Back to Top
+
+
NAME tty
+tty - terminal emulation program
+
SYNOPSIS
+tty -sy -bxx /* Apple // utility */
+
DESCRIPTION
+tty is a terminal emulaion program that allows an Apple // operator to talk
+to another computer. To the other system, the Apple // will appear to be a
+terminal that supports some of the special features of the ADM-3A terminal.
+
+tty reads characters from the keyboard and writes them to a serial
+interface. It also reads characters characters from this interface and
+writes them to the console. This interface must be compatible with the
+Super Serial Card.
+
+The -s option defines the number of the slot containing the interface. The
+number immediately follows the -s, with no intervening spaces. If this
+option isn't specified, the interface is assumed to be in slot 2.
+
+The -b option defines the baud rate of the serial interface. The baud rate
+immediately follows the -b option, with no intervening spaces. If this
+option isn't specified, the baud rate is assumed to be 9600.
+
+To exit tty, type control-2 (ie, type the '2' key while holding down the
+control key).
+
+
+<< Back to Top
+
+
+
NAME ved
+ved - vi-like text editor
+
SYNOPSIS
+ved [-tn] [-gprog] file [+1,c msg] /* Apple // utility */
+
DESCRIPTION
+ved is a screen oriented text editor that has some of the features of the
+UNIX vi editor.
+
+If ved is invoked with a file name, that file will be loaded into the
+memory buffer, otherwise it will be empty. ved will only edit text files:
+binary files cannot be edited. ved does all its editing in memory and is
+thus limited in the size of files that it will edit. In ved, the memory
+buffer is never completely empty. There will always be at least one newline
+in the buffer.
+
+ THE SCREEN
+
+ ved has a 1000 character limit on the size of a line. If a line is
+ longer than the width of the screen, it will wrap to the next line. If
+ a line starts at the bottom of the screen, and its too wide to fit, the
+ line will not be displayed. Instead, the '@' character will be
+ displayed. Likewise, at the end of the file, all lines beyond the end
+ will consist only of a single '-' on each line.
+
+ A number of commands take a numeric prefix. This prefix is echoed on
+ the status line as it is typed.
+
+ MOVING AROUND IN THE FILE
+
+ The normal mode of ved is command mode. During command mode, there are
+ a number of ways to move the cursor around the screen and around the
+ whole file.
+
+ newline - move to beginning of the next line.
+ - - move to the start of the previous line.
+ space - move to the next character of the line.
+ backspace - move to the previous character.
+ 0 - move to the first character of this line.
+ $ - move to the last character of this line.
+ h - move to the top line of the screen.
+ l - move to the bottom line of the screen.
+ b - move to the first line of the file.
+ g - move to the n'th line of the file.
+ /string - move to hte next occurence of 'string'.
+
+ DELETING TEXT
+
+ When the cursor is in the appropriate spot, there are two commands used
+ to delete existing text.
+
+ x - delete characters on the current line, beginning at the
+ cursor and continuing up to, but not including the newline.
+ dd - delete lines starting with the current line.
+
+ The x and dd commands can be prefixed with a number, which defines the
+ number of characters or lines to be deleted. If a number isn't
+ specified, just one character or line is deleted.
+
+ Note that deleting the last character of the line (newline character)
+ causes the following line to be appended to the current line.
+
+ INSERTING TEXT
+
+ To add new text, hitting 'i' key will cause the top line of the screen
+ to indicated that you are now in mode. To exit insert mode,
+ type ESCAPE. To insert a control character which means something
+ special to ved into a text file, first type control-v followed be the
+ control character itself. Control characters are displayed as '^X',
+ where X is the appropiate character.
+
+ Typing 'o' will cause a new line to be created below the current line,
+ and the cursor will be placed on that line and the editor placed into
+ mode.
+
+ MOVING TEXT AROUND
+
+ There are three commands used for moving text around. These commands
+ make use of a 1000 character yank buffer. The contents of this buffer
+ is retained across files.
+
+ yy - yank lines starting with the current line into the yank
+ buffer.
+ yd - yank lines starting with the current line and then delete
+ them.
+ p - "put" the lines in the yank buffer after the current line.
+ The yank buffer is not modified.
+
+ A number can be prefixed to the yank commands, defining the number of
+ lines to be yanked. If a number isn't specified, just one line is
+ yanked.
+
+ MISCELLANEOUS COMMANDS
+
+ The 'z' command redraws the screen with the current line in the center
+ of the screen.
+
+ The 'r' command repalaces the character under the cursor with the next
+ character typed.
+
+ FILE-RELATED COMMANDS
+
+ When in command mode, if the ':' key is hit, a ':' will be displayed on
+ the status line. At this point, a number of special file-related
+ commands may be given.
+
+ :f - displays info about the current file.
+ :w file - writes the buffer to the specified file name.
+ :w - writes the buffer to the last specfied file.
+ :e[!] file - clears the buffer and prepares file for editing.
+ :r file - reads the named file into the buffer.
+ :q[!] - exits the editor.
+
+ In the above table, square brackets surrounding a character indicate
+ that the character is optional. The exclamation mark tells ved to
+ execute the commands in which it's specified, even if the file that's
+ currently being edited has been modified since it was last written to
+ disk.
+
+ APPLE RELATED INFORMATION
+
+ In order to use VED on older Apple //'s, which don't have a full ASCII
+ keyboard, you need to have the single wire switch key modification
+ installed. You can then enter upper and lower case alphabetic
+ characters using the SHIFT key. You can enter special character used by
+ C programs by typing a control character, that is, by holding down the
+ control key and then typing another key. The following table lists
+ these control characters and the characters to which they are
+ translated. In this table, ^X is an abbreviation for "type X while
+ holding the control key down". The first column identifies control
+ codes that you type, the second identifies the characters to which
+ control codes are translated when the keyboard is in lower case mode
+ (that is, when the SHIFT key is off). The last column identifies the
+ characters to which control codes are translated when the keyboard is
+ in upper case mode.
+
+ Press: To get (lower): To get (upper):
+
+ ^P ` @
+ ^A { [
+ ^E | \
+ ^R } ]
+ ^N ~ ^
+ ^C DEL _
+ ^Q ESC
+ ^U TAB
+
+ ^U is generated by typing the 'right arrow key'.
+
+ To exit insert mode, type is ESC key. In addition to the ESC key, you
+ can type control-Q to exit VED's mode. This is usefull on some
+ older Apple //e's, for which ESC is intercepted by the ROM and never
+ gets back to VED. Out of insert mode, the cursor can be moved around
+ using the space bar to move rigth and the left arrow to move left.
+
+
+<< Back to Top
+
+
+
+
+
+
+© Copyright Phade Software 1999
+Released as FreeWare December 1999
+
+
+
+
+
diff --git a/AppleX/DOCS/pcxman.txt b/AppleX/DOCS/pcxman.txt
new file mode 100644
index 0000000..f276566
--- /dev/null
+++ b/AppleX/DOCS/pcxman.txt
@@ -0,0 +1,586 @@
+ZSoft PCX File Format Technical Reference Manual
+
+
+
+Introduction 2
+Image File (.PCX) Format 3
+ZSoft .PCX FILE HEADER FORMAT 4
+Decoding .PCX Files 6
+Palette Information Description 7
+EGA/VGA 16 Color Palette Information 7
+VGA 256 Color Palette Information 7
+24-Bit .PCX Files 8
+CGA Color Palette Information 8
+CGA Color Map 8
+PC Paintbrush Bitmap Character Format 9
+Sample "C" Routines 10
+FRIEZE Technical Information 14
+General FRIEZE Information 14
+7.00 and Later FRIEZE 14
+FRIEZE Function Calls 15
+FRIEZE Error Codes 18
+
+
+
+
+
+Introduction
+
+This booklet was designed to aid developers and users in understanding
+the technical aspects of the .PCX file format and the use of FRIEZE.
+Any comments, questions or suggestions about this booklet should be
+sent to:
+
+ ZSoft Corporation
+ Technical Services
+ ATTN: Code Librarian
+ 450 Franklin Rd. Suite 100
+ Marietta, GA 30067
+
+
+
+Technical Reference Manual information compiled by:
+Dean Ansley
+
+
+Revision 5
+
+To down load additional information and the source for a complete
+Turbo Pascal program to show .PCX files on a CGA/EGA/VGA graphics
+display, call our BBS at (404)427-1045. You may use a 9600 baud
+modem or a 2400 baud standard modem. Your modem should be set for
+8 data bits, 1 stop bit, and NO parity.
+
+Image File (.PCX) Format
+
+If you have technical questions on the format, please do not call
+technical support. ZSoft provides this document as a courtesy to
+its users and developers. It is not the function of Technical Support
+to provide programming assistance. If something is not clear, leave a
+message on our BBS, Compuserve, or write us a letter at the above address.
+
+The information in this section will be useful if you want to write a
+program to read or write PCX files (images). If you want to write a
+special case program for one particular image format you should be able
+to produce something that runs twice as fast as "Load from..." in
+PC Paintbrush.
+
+Image files used by PC Paintbrush product family and FRIEZE (those with a
+.PCX extension) begin with a 128 byte header. Usually you can ignore this
+header, since your images will probably all have the same resolution. If
+you want to process different resolutions or colors, you will need to
+interpret the header correctly. The remainder of the image file consists
+of encoded graphic data. The encoding method is a simple byte oriented
+run-length technique. We reserve the right to change this method to
+improve space efficiency. When more than one color plane is stored in
+the file, each line of the image is stored by color plane (generally ordered
+red, green, blue, intensity), As shown below.
+
+Scan line 0: RRR... (Plane 0)
+ GGG... (Plane 1)
+ BBB... (Plane 2)
+ III... (Plane 3)
+Scan line 1: RRR...
+ GGG...
+ BBB...
+ III... (etc.)
+
+The encoding method is:
+ FOR each byte, X, read from the file
+ IF the top two bits of X are 1's then
+ count = 6 lowest bits of X
+ data = next byte following X
+ ELSE
+ count = 1
+ data = X
+
+Since the overhead this technique requires is, on average, 25% of
+the non-repeating data and is at least offset whenever bytes are repeated,
+the file storage savings are usually considerable.
+
+ZSoft .PCX FILE HEADER FORMAT
+
+Byte Item Size Description/Comments
+ 0 Manufacturer 1 Constant Flag, 10 = ZSoft .pcx
+ 1 Version 1 Version information
+ 0 = Version 2.5 of PC Paintbrush
+ 2 = Version 2.8 w/palette information
+ 3 = Version 2.8 w/o palette information
+ 4 = PC Paintbrush for Windows(Plus for
+ Windows uses Ver 5)
+ 5 = Version 3.0 and > of PC Paintbrush
+ and PC Paintbrush +, includes
+ Publisher's Paintbrush . Includes
+ 24-bit .PCX files
+ 2 Encoding 1 1 = .PCX run length encoding
+ 3 BitsPerPixel 1 Number of bits to represent a pixel
+ (per Plane) - 1, 2, 4, or 8
+ 4 Window 8 Image Dimensions: Xmin,Ymin,Xmax,Ymax
+12 HDpi 2 Horizontal Resolution of image in DPI*
+14 VDpi 2 Vertical Resolution of image in DPI*
+16 Colormap 48 Color palette setting, see text
+64 Reserved 1 Should be set to 0.
+65 NPlanes 1 Number of color planes
+66 BytesPerLine 2 Number of bytes to allocate for a scanline
+ plane. MUST be an EVEN number. Do NOT
+ calculate from Xmax-Xmin.
+68 PaletteInfo 2 How to interpret palette- 1 = Color/BW,
+ 2 = Grayscale (ignored in PB IV/ IV +)
+70 HscreenSize 2 Horizontal screen size in pixels. New field
+ found only in PB IV/IV Plus
+72 VscreenSize 2 Vertical screen size in pixels. New field
+ found only in PB IV/IV Plus
+74 Filler 54 Blank to fill out 128 byte header. Set all
+ bytes to 0
+
+NOTES:
+
+All sizes are measured in BYTES.
+
+All variables of SIZE 2 are integers.
+
+*HDpi and VDpi represent the Horizontal and Vertical resolutions which the
+image was created (either printer or scanner); i.e. an image which was
+scanned might have 300 and 300 in each of these fields.
+
+Decoding .PCX Files
+
+First, find the pixel dimensions of the image by calculating
+[XSIZE = Xmax - Xmin + 1] and [YSIZE = Ymax - Ymin + 1]. Then calculate
+how many bytes are required to hold one complete uncompressed scan line:
+
+TotalBytes = NPlanes * BytesPerLine
+
+Note that since there are always an even number of bytes per scan line,
+there will probably be unused data at the end of each scan line. TotalBytes
+shows how much storage must be available to decode each scan line, including
+any blank area on the right side of the image. You can now begin decoding
+the first scan line - read the first byte of data from the file. If the
+top two bits are set, the remaining six bits in the byte show how many times
+to duplicate the next byte in the file. If the top two bits are not set,
+the first byte is the data itself, with a count of one.
+
+Continue decoding the rest of the line. Keep a running subtotal of how
+many bytes are moved and duplicated into the output buffer. When the
+subtotal equals TotalBytes, the scan line is complete. There should always
+be a decoding break at the end of each scan line. But there will not be a
+decoding break at the end of each plane within each scan line. When the
+scan line is completed, there may be extra blank data at the end of each
+plane within the scan line. Use the XSIZE and YSIZE values to find where
+the valid image data is. If the data is multi-plane, BytesPerLine shows
+where each plane ends within the scan line.
+
+Continue decoding the remainder of the scan lines (do not just read to
+end-of-file). There may be additional data after the end of the image
+(palette, etc.)
+
+Palette Information Description
+
+EGA/VGA 16 Color Palette Information
+
+In standard RGB format (IBM EGA, IBM VGA) the data is stored as 16 triples.
+Each triple is a 3 byte quantity of Red, Green, Blue values. The values can
+range from 0-255, so some interpretation may be necessary. On an IBM EGA,
+for example, there are 4 possible levels of RGB for each color. Since
+256/4 = 64, the following is a list of the settings and levels:
+
+Setting Level
+ 0-63 0
+ 64-127 1
+128-192 2
+193-254 3
+
+VGA 256 Color Palette Information
+
+ZSoft has recently added the capability to store palettes containing more
+than 16 colors in the .PCX image file. The 256 color palette is formatted
+and treated the same as the 16 color palette, except that it is substantially
+longer. The palette (number of colors x 3 bytes in length) is appended to
+the end of the .PCX file, and is preceded by a 12 decimal. Since the VGA
+device expects a palette value to be 0-63 instead of 0-255, you need to
+divide the values read in the palette by 4.
+
+To access a 256 color palette:
+
+First, check the version number in the header; if it contains a 5 there is
+a palette.
+
+Second, read to the end of the file and count back 769 bytes. The value
+you find should be a 12 decimal, showing the presence of a 256 color palette.
+
+24-Bit .PCX Files
+
+24 bit images are stored as version 5 or above as 8 bit, 3 plane images.
+
+24 bit images do not contain a palette.
+
+Bit planes are ordered as lines of red, green, blue in that order.
+
+CGA Color Palette Information
+
+NOTE: This is no longer supported for PC Paintbrush IV/IV Plus.
+
+For a standard IBM CGA board, the palette settings are a bit more complex.
+Only the first byte of the triple is used. The first triple has a valid
+first byte which represents the background color. To find the background,
+take the (unsigned) byte value and divide by 16. This will give a result
+between 0-15, hence the background color. The second triple has a valid
+first byte, which represents the foreground palette. PC Paintbrush supports
+8 possible CGA palettes, so when the foreground setting is encoded between
+0 and 255, there are 8 ranges of numbers and the divisor is 32.
+
+CGA Color Map
+
+Header Byte #16
+
+Background color is determined in the upper four bits.
+
+Header Byte #19
+
+Only upper 3 bits are used, lower 5 bits are ignored. The first three bits
+that are used are ordered C, P, I. These bits are interpreted as follows:
+
+c: color burst enable - 0 = color; 1 = monochrome
+
+p: palette - 0 = yellow; 1 = white
+
+i: intensity - 0 = dim; 1 = bright
+
+PC Paintbrush Bitmap Character Format
+
+NOTE: This format is for PC Paintbrush (up to Vers 3.7) and PC Paintbrush
+Plus (up to Vers 1.65)
+
+The bitmap character fonts are stored in a particularly simple format. The
+format of these characters is as follows:
+
+
+Header
+
+font width byte 0xA0 + character width (in pixels)
+font height byte character height (in pixels)
+
+Character Width Table
+
+char widths (256 bytes) each char's width + 1 pixel of kerning
+
+Character Images
+
+(remainder of the file) starts at char 0 (Null)
+
+The characters are stored in ASCII order and as many as 256 may be provided.
+Each character is left justified in the character block, all characters take
+up the same number of bytes.
+
+Bytes are organized as N strings, where each string is one scan line of the
+character.
+
+For example, each character in a 5x7 font requires 7 bytes. A 9x14 font
+uses 28 bytes per character (stored two bytes per scan line in 14 sets of
+2 byte packets). Custom fonts may be any size up to the current maximum of
+10K bytes allowed for a font file. There is a maximum of 4 bytes per scan
+line.
+
+Sample "C" Routines
+
+The following is a simple set of C subroutines to read data from a .PCX file.
+
+/* This procedure reads one encoded block from the image file and stores a
+count and data byte.
+
+Return result: 0 = valid data stored, EOF = out of data in file */
+
+encget(pbyt, pcnt, fid)
+int *pbyt; /* where to place data */
+int *pcnt; /* where to place count */
+FILE *fid; /* image file handle */
+{
+int i;
+ *pcnt = 1; /* assume a "run" length of one */
+ if (EOF == (i = getc(fid)))
+ return (EOF);
+ if (0xC0 == (0xC0 & i))
+ {
+ *pcnt = 0x3F & i;
+ if (EOF == (i = getc(fid)))
+ return (EOF);
+ }
+ *pbyt = i;
+ return (0);
+}
+/* Here's a program fragment using encget. This reads an entire file and
+stores it in a (large) buffer, pointed to by the variable "bufr". "fp" is
+the file pointer for the image */
+
+int i;
+long l, lsize;
+ lsize = (long )hdr.BytesPerLine * hdr.Nplanes * (1 + hdr.Ymax - hdr.Ymin);
+ for (l = 0; l < lsize; ) /* increment by cnt below */
+ {
+ if (EOF == encget(&chr, &cnt, fp))
+ break;
+ for (i = 0; i < cnt; i++)
+ *bufr++ = chr;
+ l += cnt;
+ }
+
+The following is a set of C subroutines to write data to a .PCX file.
+
+/* Subroutine for writing an encoded byte pair (or single byte if it
+doesn't encode) to a file. It returns the count of bytes written, 0 if error */
+
+encput(byt, cnt, fid)
+unsigned char byt, cnt;
+FILE *fid;
+{
+ if (cnt) {
+ if ((cnt == 1) && (0xC0 != (0xC0 & byt)))
+ {
+ if (EOF == putc((int )byt, fid))
+ return(0); /* disk write error (probably full) */
+ return(1);
+ }
+ else
+ {
+ if (EOF == putc((int )0xC0 | cnt, fid))
+ return (0); /* disk write error */
+ if (EOF == putc((int )byt, fid))
+ return (0); /* disk write error */
+ return (2);
+ }
+ }
+ return (0);
+}
+
+/* This subroutine encodes one scanline and writes it to a file.
+It returns number of bytes written into outBuff, 0 if failed. */
+
+encLine(inBuff, inLen, fp)
+unsigned char *inBuff; /* pointer to scanline data */
+int inLen; /* length of raw scanline in bytes */
+FILE *fp; /* file to be written to */
+{
+unsigned char this, last;
+int srcIndex, i;
+register int total;
+register unsigned char runCount; /* max single runlength is 63 */
+ total = 0;
+ runCount = 1;
+ last = *(inBuff);
+
+/* Find the pixel dimensions of the image by calculating
+[XSIZE = Xmax - Xmin + 1] and [YSIZE = Ymax - Ymin + 1].
+Then calculate how many bytes are in a "run" */
+
+ for (srcIndex = 1; srcIndex < inLen; srcIndex++)
+ {
+ this = *(++inBuff);
+ if (this == last) /* There is a "run" in the data, encode it */
+ {
+ runCount++;
+ if (runCount == 63)
+ {
+ if (! (i = encput(last, runCount, fp)))
+ return (0);
+ total += i;
+ runCount = 0;
+ }
+ }
+ else /* No "run" - this != last */
+ {
+ if (runCount)
+ {
+ if (! (i = encput(last, runCount, fp)))
+ return(0);
+ total += i;
+ }
+ last = this;
+ runCount = 1;
+ }
+ } /* endloop */
+ if (runCount) /* finish up */
+ {
+ if (! (i = encput(last, runCount, fp)))
+ return (0);
+ return (total + i);
+ }
+ return (total);
+}
+
+FRIEZE Technical Information
+
+General FRIEZE Information
+
+FRIEZE is a memory-resident utility that allows you to capture and save
+graphic images from other programs. You can then bring these images into
+PC Paintbrush for editing and enhancement.
+
+FRIEZE 7.10 and later can be removed from memory (this can return you up
+to 90K of DOS RAM, depending on your configuration). To remove FRIEZE from
+memory, change directories to your paintbrush directory and type the word
+"FRIEZE".
+
+7.00 and Later FRIEZE
+
+The FRIEZE command line format is:
+
+FRIEZE {PD} {Xn[aarr]} {flags} {video} {hres} {vres} {vnum}
+Where:
+{PD} Printer driver filename (without the .PDV extension)
+{Xn[aarr]}
+ X=S for Serial Printer, P for Parallel Printer, D for disk file.
+ (file is always named FRIEZE.PRN)
+ n = port number
+ aa = Two digit hex code for which return bits cause
+ an abort (optional)
+ rr = Two digit hex code for which return bits cause
+ a retry (optional)
+ NOTE: These codes represent return values from serial or
+ parallel port BIOS calls. For values see and IBM
+ BIOS reference (such as Ray Duncan's Advanced MS-DOS
+ Programming).
+{flags}Four digit hex code
+ First Digit controls Length Flag
+ Second Digit controls Width Flag
+ Third Digit controls Mode Flag
+ Fourth Digit controls BIOS Flag
+ 0 - None
+ 1 - Dual Monitor Present
+ 2 - Use internal (true) B/W palette for dithering
+ 2 color images
+ 4 - Capture palette along with screen IN VGA ONLY
+ Frieze 8.08 & up ONLY)
+
+NOTE: The length, width and mode flags are printer driver specific.
+See PRINTERS.DAT on disk 1 (or Setup Disk) for correct use. In general
+width flag of 1 means wide carriage, and 0 means standard width. Length
+flag of 0 and mode flag of 0 means use default printer driver settings.
+
+If you need to use more than one BIOS flag option, add the needed flag values
+and use the sum as the flag value.
+
+{video} Video driver combination, where the leading digit signifies the
+ high level video driver and the rest signifies the low
+ level video driver
+ Example = 1EGA - uses DRIVE1 and EGA.DEV
+{hres} Horizontal resolution of the desired graphics mode
+{vres} Vertical resolution of the desired graphics mode
+{vnum} Hardware specific parameter (usually number of color planes)
+
+Note: The last four parameters can be obtained from the CARDS.DAT file,
+in your PC Paintbrush product directory.
+
+
+FRIEZE Function Calls
+
+FRIEZE is operated using software interrupt number 10h (the video interrupt
+call).
+
+To make a FRIEZE function call, load 75 (decimal) into the AH register and
+the function number into the CL register, then either load AL with the
+function argument or load ES and BX with a segment and offset which point
+to the function argument. Do an int 10h. FRIEZE will return a result code
+number in AX. All other registers are preserved. In general, a result
+code of 0 means success and other values indicate errors. However, function
+20 (get Frieze Version) behaves differently; see below.
+No. Definition Arguments
+0 Reserved
+1 Load Window
+ ES:BX - string (filename to read from)
+2 Save Window
+ ES:BX - string (filename to write to)
+3 Reserved
+4 Reserved
+6 Reserved
+7 Set Window Size
+ ES:BX - 4 element word vector of window settings:
+ Xmin, Ymin, Xmax, Ymax
+8 Reserved
+9 Set Patterns
+ ES:BX - 16 element vector of byte values
+ containing the screen-to-printer color correspondence
+10 Get Patterns
+ ES:BX - room for 16 bytes as above
+11 Set Mode
+12,13,14 Reserved
+15 Get Window
+ ES:BX - room for 4 words of the current window
+ settings
+16 Set Print Options
+ ES:BX - character string of printer options.
+ Same format as for the FRIEZE command.
+17, 18, 19 Reserved
+20 Get FRIEZE Version.
+ AH gets the whole number portion and AL gets the
+ decimal portion of the version number. (eg. for
+ Freize vesion 7.41, AH will contain 7 and AL will
+ contain 41. If AH =0, you are calling a pre-7.0
+ version of FRIEZE).
+21 Set Parameters
+ ES:BX points to an 8 word table (16 bytes) of
+ parameter settings: TopMargin, LeftMargin,
+ HSize,VSize, Quality/Draft Mode, PrintHres,
+ PrintVres, Reserved.
+ Margins and sizes are specified in hundredths
+ of inches.
+ Q/D mode parameter values:
+ 0 - draft print mode
+ 1 - quality print mode
+ Print resolutions are specified in DPI.
+ Any parameter which should be left unchanged may
+ be filled with a (-1) (0FFFF hex). The reserved
+ settings should be filled with a (-1).
+22 Get Parameters
+ ES:BX points to an 8 word table (16 bytes) where
+ parameter settings are held.
+23 Get Printer Res
+ ES:BX points to a 12 word table (24 bytes) that
+ holds six printer resolution pairs.
+24 Reserved (versions 8.00 & up)
+
+FRIEZE Error Codes
+
+When FRIEZE is called using interrupt 10 hex, it will return an error code
+in the AX register. A value of zero shows that there was no error. A
+nonzero result means there was an error. These error codes are explained
+below.
+
+ 0 No Error
+ 1 Printout was stopped by user with the ESC key
+ 2 Reserved
+ 3 File read error
+ 4 File write error
+ 5 File not found
+ 6 Invalid Header - not an image, wrong screen mode
+ 7 File close error
+ 8 Disk error - usually drive door open
+ 9 Printer error - printer is off or out of paper
+10 Invalid command - CL was set to call a nonexistent FRIEZE function
+11 Can't create file - write protect tab or disk is full
+12 Wrong video mode - FRIEZE cannot capture text screens.
+
+Technical Reference Manual
+
+Including information for:
+Publisher's Paintbrushr
+PC Paintbrush IVTM
+PC Paintbrush IV PlusTM
+PC Paintbrush PlusTM
+PC Paintbrushr
+FRIEZETM Graphics
+PaintbrushTM
+Revision 5
+
+ZSoft Corporation
+450 Franklin Rd. Suite 100
+Marietta, GA 30067
+(404) 428-0008
+(404) 427-1150 Fax
+(404) 427-1045 BBS
+
+Copyright c 1985, 1987, 1988, 1990, 1991, ZSoft Corporation
+All Rights Reserved
+
+
+
+
diff --git a/AppleX/GRAPHICS/Aztec Apple C6502 Command Prompt.lnk b/AppleX/GRAPHICS/Aztec Apple C6502 Command Prompt.lnk
new file mode 100644
index 0000000..3b6de46
Binary files /dev/null and b/AppleX/GRAPHICS/Aztec Apple C6502 Command Prompt.lnk differ
diff --git a/AppleX/GRAPHICS/BARS.C b/AppleX/GRAPHICS/BARS.C
new file mode 100644
index 0000000..c3b5a61
--- /dev/null
+++ b/AppleX/GRAPHICS/BARS.C
@@ -0,0 +1,73 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : bars.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: June 6, 2008
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* Copyright Bill Buckels 2008 */
+
+/* the following array is based on blue
+ and an even column. subscript 1 must be
+ used if the destination is an odd column.
+
+ the reverse holds true for an orange
+ block.
+
+ I am dealing only with the blue-orange
+ palette for this version.
+
+ since either subscript 0 or 1 will be
+ used and the screen is 40 bytes wide
+ the array only needs to be 41 bytes.
+
+ black and white are not alternating
+ bytes so don't require a preformatted
+ block like blue and orange.
+
+ see code below.
+
+ */
+
+unsigned char _bars[41] = {
+213,170,213,170,213,170,213,170,213,170,
+213,170,213,170,213,170,213,170,213,170,
+213,170,213,170,213,170,213,170,213,170,
+213,170,213,170,213,170,213,170,213,170,213};
+
+extern unsigned HB[];
+
+hbar(row,col, color,width,height)
+int row, col, color, width, height;
+{
+ int bos=row+height;
+ char *ptr;
+ int temp;
+
+ ptr = (char *)&_bars[0];
+
+ switch(color) {
+ case 3: color = 255; break;
+ case 2: if (col%2 == 0) ptr = (char *)&_bars[1]; break;
+ case 1: if (col%2 != 0) ptr = (char *)&_bars[1]; break;
+ default: color = 128;
+
+ }
+
+ while (row < bos) {
+ temp=HB[row] + col;
+ if (color < 128) movmem(ptr,temp,width);
+ else setmem(temp,width,color);
+ row++;
+
+ }
+
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/BARS.R b/AppleX/GRAPHICS/BARS.R
new file mode 100644
index 0000000..e8ed491
Binary files /dev/null and b/AppleX/GRAPHICS/BARS.R differ
diff --git a/AppleX/GRAPHICS/BLOAD.C b/AppleX/GRAPHICS/BLOAD.C
new file mode 100644
index 0000000..57caeb5
--- /dev/null
+++ b/AppleX/GRAPHICS/BLOAD.C
@@ -0,0 +1,35 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : bload.c
+Description : G2 Library Routine
+ For Hi-Res Mode
+
+Written by : Bill Buckels
+Creation Date: June 6, 1991
+Revised : January 2013
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+
+extern unsigned HB[];
+
+int bload(name)
+char *name;
+{
+ int fh, c=-1;
+ if ((fh = open(name,O_RDONLY,0xc3))!=-1) {
+ c = read(fh,(char *)HB[0],0x2000);
+ close(fh);
+ if (c > 8183 && c < 8193) c = 0;
+ else c = -2;
+ }
+ return c;
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/BLOAD.R b/AppleX/GRAPHICS/BLOAD.R
new file mode 100644
index 0000000..64116f9
Binary files /dev/null and b/AppleX/GRAPHICS/BLOAD.R differ
diff --git a/AppleX/GRAPHICS/BOPEN.C b/AppleX/GRAPHICS/BOPEN.C
new file mode 100644
index 0000000..9bffab5
--- /dev/null
+++ b/AppleX/GRAPHICS/BOPEN.C
@@ -0,0 +1,114 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : bopen.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: May 31, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* bopen.c binary open */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+bopen(uname, flags, mode)
+char *uname;
+{
+ register int dev, err, fd;
+ register struct _fil_buf *fb;
+ register char *iobuf;
+ register struct _name_dev *dp;
+ int mflg = 0;
+ char name[64];
+ struct finfo f;
+ char *_get_iob();
+
+ for (fb=_fil_tab;fb<_fil_tab+MAXFILES;fb++)
+ if (fb->unit == 0)
+ goto found;
+ errno = EMFILE;
+ return(-1);
+found:
+ fb->flags = flags & 0x03;
+ fd = fb - _fil_tab;
+
+ for (dp=&_dev_info->dev_con;dp<=&_dev_info->dev_ser;dp++) {
+ if (strequ(uname, dp->dev_nam) == 0) {
+ dev = dp->dev_num;
+ goto gotdev;
+ }
+ }
+ if (uname[3] == 0 && uname[2] == ':' && toupper(uname[0]) == 'S') {
+ dev = uname[1] - '0';
+gotdev:
+ if ((dev&0x40) == 0)
+ _slot_open(&_dev_info->slots[dev&7]);
+ fb->unit = dev | 0x80;
+ return(fd);
+ }
+
+ if ((iobuf = _get_iob(fd)) == 0)
+ return -1;
+
+ if (_fixnam(uname, name))
+ return(-1);
+ ctop(name);
+again:
+ *_sys_parm = 3;
+ *(char **)(_sys_parm + 1) = name;
+ *(char **)(_sys_parm + 3) = iobuf;
+ if (err = _system(SYS_OPEN)) {
+ if (err != 0x44 && err != 0x46) {
+ xerr:
+ errno = err;
+ return(-1);
+ }
+ if ((flags&O_CREAT) == 0) {
+ err = ENOENT;
+ goto xerr;
+ }
+
+ *_sys_parm = 7;
+ *(char **)(_sys_parm + 1) = name;
+ *(_sys_parm + 3) = 0xc3; /* enable everything */
+ *(_sys_parm + 4) = 6; /* binary type file */
+ *(int *)(_sys_parm + 5) = 0;
+ *(_sys_parm + 7) = 1; /* file, not directory */
+ *(long *)(_sys_parm + 8) = 0;
+ if (err = _system(SYS_CREAT))
+ goto xerr;
+ flags &= ~(O_EXCL|O_CREAT|O_TRUNC);
+ mflg = 1;
+ goto again;
+ }
+
+ fb->unit = _sys_parm[5];
+ if ((flags&(O_CREAT|O_EXCL)) == (O_CREAT|O_EXCL)) {
+ close(fd);
+ err = EEXIST;
+ goto xerr;
+ }
+ if (flags & O_TRUNC)
+ _seteof(fd, 0L);
+ else if (flags & O_APPEND)
+ lseek(fd, 0L, 2);
+ if (mflg) {
+ _getfinfo(uname, &f);
+ f.access = mode;
+ _setfinfo(uname, &f);
+ }
+ return(fd);
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/BOPEN.R b/AppleX/GRAPHICS/BOPEN.R
new file mode 100644
index 0000000..4b4e7c2
Binary files /dev/null and b/AppleX/GRAPHICS/BOPEN.R differ
diff --git a/AppleX/GRAPHICS/BOTTOM.C b/AppleX/GRAPHICS/BOTTOM.C
new file mode 100644
index 0000000..f382b10
--- /dev/null
+++ b/AppleX/GRAPHICS/BOTTOM.C
@@ -0,0 +1,92 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : bottom.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Jan 9, 2010
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* some functions to output text directly to the screen */
+
+
+extern int textbase[24];
+
+clear_text(ch, page,bottom,reverse)
+char ch;
+int page, bottom,reverse;
+{
+ char *crt;
+ int row, col;
+ int offset = 0;
+ int r1 = 0;
+
+ if (page !=0)offset = 1024;
+ if (bottom != 0)r1 = 20;
+
+ ch = ch &0x7f;
+ if (reverse == 0) ch += 128;
+
+ for (row = r1; row < 24; row++) {
+ crt = (char *)(textbase[row] + offset);
+ for (col = 0; col < 40; col++) {
+ *crt++ = ch;
+ }
+ }
+}
+
+clear_top()
+{
+ clear_text(' ',1,0,0);
+}
+
+clear_bottom()
+{
+ clear_text(' ',1,1,0);
+}
+
+
+/* row = 0,0 to 3,39 in split screen mode */
+/* I am just going directly to the text screen address */
+/* and outputting a raw ascii value */
+print_bottom(str,row,col)
+char *str;
+int row, col;
+{
+ print_text(str,row,col,1,1,0);
+}
+
+print_top(str,row,col)
+char *str;
+int row, col;
+{
+ print_text(str,row,col,1,0,0);
+}
+
+print_text(str,row,col,page,bottom,reverse)
+char *str;
+int row,col,page,bottom,reverse;
+{
+ char *crt;
+ char c;
+ int offset = 0;
+
+ if (col > 39) {
+ col-=40;
+ reverse = 1;
+ }
+ if (bottom != 0)row+=20;
+ if (page !=0) offset = 1024;
+ if (reverse != 0)reverse = 0;
+ else reverse = 128;
+
+ crt = (char *)(textbase[row]+offset+col);
+
+ while((c=*str++)!=0)*crt++=(c+reverse);
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/BOTTOM.R b/AppleX/GRAPHICS/BOTTOM.R
new file mode 100644
index 0000000..6917e8f
Binary files /dev/null and b/AppleX/GRAPHICS/BOTTOM.R differ
diff --git a/AppleX/GRAPHICS/BSAVE.C b/AppleX/GRAPHICS/BSAVE.C
new file mode 100644
index 0000000..58d3233
--- /dev/null
+++ b/AppleX/GRAPHICS/BSAVE.C
@@ -0,0 +1,38 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : bsave.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: July 9, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* bsave a file from hires screen 2 */
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+bsave(savex)
+char *savex;
+{
+ int fh;
+
+ if((fh=bopen(savex, O_WRONLY|O_TRUNC|O_CREAT,0xc3)) != -1)
+ {
+ write(fh,(char *)0x4000,0x2000);
+ close(fh);
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/BSAVE.R b/AppleX/GRAPHICS/BSAVE.R
new file mode 100644
index 0000000..30d6031
Binary files /dev/null and b/AppleX/GRAPHICS/BSAVE.R differ
diff --git a/AppleX/GRAPHICS/CALL33.C b/AppleX/GRAPHICS/CALL33.C
new file mode 100644
index 0000000..e0bc4c8
--- /dev/null
+++ b/AppleX/GRAPHICS/CALL33.C
@@ -0,0 +1,63 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : call33.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Jan 1, 2010
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+catalog()
+{
+#asm
+ clc
+ jsr $a56e
+#endasm
+}
+
+reboot()
+{
+#asm
+ clc
+ jsr $faa6
+#endasm
+}
+
+bell()
+{
+#asm
+ clc
+ jsr $ff3a
+#endasm
+}
+
+bellerr()
+{
+#asm
+ clc
+ jsr $ff2d
+#endasm
+}
+
+scr_apple()
+{
+#asm
+ clc
+ jsr $fb60
+#endasm
+}
+
+loclear()
+{
+#asm
+ clc
+ jsr $f832
+#endasm
+}
+
diff --git a/AppleX/GRAPHICS/CALL33.R b/AppleX/GRAPHICS/CALL33.R
new file mode 100644
index 0000000..0fe8211
Binary files /dev/null and b/AppleX/GRAPHICS/CALL33.R differ
diff --git a/AppleX/GRAPHICS/CIRCLE.C b/AppleX/GRAPHICS/CIRCLE.C
new file mode 100644
index 0000000..de312b0
--- /dev/null
+++ b/AppleX/GRAPHICS/CIRCLE.C
@@ -0,0 +1,58 @@
+int __x_aspect=1, __y_aspect=1;
+
+circle(cx,cy,r)
+int cx,cy,r;
+{
+
+ int x,y,a,b,c,d,f,m,n;
+ /* replaced double z=1.16 with long integer 116
+ so fake floating point and divide product by 100
+
+ February 2013 */
+ long z=116L;
+
+ x=r; y=0; b=1; f=0;
+
+ a=(-2)*x+1;
+ m=__x_aspect;
+ n=__y_aspect;
+
+point:
+
+
+ /* replaced double z=1.16 with long integer 116
+ so fake floating point and divide product by 100
+
+ February 2013 */
+
+ c= (int)((z*x)/100);
+ d= (int)((z*y)/100);
+
+
+ plot(c*m+cx,y*n+cy);
+ plot(d*m+cx,x*n+cy);
+ plot(-d*m+cx,x*n+cy);
+ plot(-c*m+cx,y*n+cy);
+ plot(-c*m+cx,-y*n+cy);
+ plot(-d*m+cx,-x*n+cy);
+ plot(d*m+cx,-x*n+cy);
+ plot(c*m+cx,-y*n+cy);
+
+ if(b>= -a)
+ goto fin;
+
+ y+=1; f+=b;
+ b+=2;
+
+ if(f>r)
+ {
+ f+=a;
+ a+=2;
+ x-=1;
+ }
+ goto point;
+
+fin:
+ ;
+}
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/CIRCLE.R b/AppleX/GRAPHICS/CIRCLE.R
new file mode 100644
index 0000000..b90d78a
Binary files /dev/null and b/AppleX/GRAPHICS/CIRCLE.R differ
diff --git a/AppleX/GRAPHICS/CLEAR.ASM b/AppleX/GRAPHICS/CLEAR.ASM
new file mode 100644
index 0000000..8c7a072
--- /dev/null
+++ b/AppleX/GRAPHICS/CLEAR.ASM
@@ -0,0 +1,92 @@
+;/* ------------------------------------------------------------------------
+;System : Manx Aztec C65 Version 3.2b
+; MS-DOS cross-development environment
+;Platform : Apple IIe 128K PRODOS 8
+;Program : clear.asm
+;Description : G2 Library Routine
+;
+; HGR routine from original Aztec C distribution
+; Modified by me to use Page 2 for compatibility with
+; ProDOS SYS programs.
+;
+;Original : Dec 30, 1990
+;Probably by : Jim Goodnow
+;
+;Modified by : Bill Buckels
+;Revision Date : January 2013
+;
+;Licence : You may use this code for whatever you wish as long
+; as you agree that Bill Buckels has no warranty or
+; liability obligations whatsoever from said use.
+;------------------------------------------------------------------------ */
+
+R0 equ 8
+SP equ 2
+
+clr lda #0 ;store ptr in R0
+ sta R0
+ lda #$40
+ sta R0+1
+ ldy #0
+loop
+ lda R0+2
+ sta (R0),Y
+ iny
+ lda R0+3
+ sta (R0),Y
+ iny
+ bne loop
+ ldx R0+1
+ inx
+ stx R0+1
+ txa
+ cmp #$60
+ bcc loop
+ lda $c057 ;high res
+ lda $c055 ;page 2
+ lda $c052 ;full graphics
+ lda $c050 ;graphics
+ rts
+
+ public black_
+black_
+ lda #0
+ sta R0+2
+ sta R0+3
+ jmp clr
+ public blue_
+blue_
+ lda #$d5
+ sta R0+2
+ lda #$aa
+ sta R0+3
+ jmp clr
+ public violet_
+violet_
+ lda #$55
+ sta R0+2
+ lda #$2a
+ sta R0+3
+ jmp clr
+ public green_
+green_
+ lda #$2a
+ sta R0+2
+ lda #$55
+ sta R0+3
+ jmp clr
+ public red_
+red_
+ lda #$aa
+ sta R0+2
+ lda #$d5
+ sta R0+3
+ jmp clr
+ public white_
+white_
+ lda #$7f
+ sta R0+2
+ lda #$7f
+ sta R0+3
+ jmp clr
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/CLEAR.R b/AppleX/GRAPHICS/CLEAR.R
new file mode 100644
index 0000000..54d9fa9
Binary files /dev/null and b/AppleX/GRAPHICS/CLEAR.R differ
diff --git a/AppleX/GRAPHICS/CLEAR1.ASM b/AppleX/GRAPHICS/CLEAR1.ASM
new file mode 100644
index 0000000..0739083
--- /dev/null
+++ b/AppleX/GRAPHICS/CLEAR1.ASM
@@ -0,0 +1,93 @@
+;/* ------------------------------------------------------------------------
+;System : Manx Aztec C65 Version 3.2b
+; MS-DOS cross-development environment
+;Platform : Apple IIe 128K PRODOS 8
+;Program : clear1.asm
+;Description : G2 Library Routine
+;
+; HGR routine from original Aztec C distribution
+; Slightly Modified by me
+; Compatibility with Aztec C Programs that use
+; Page 1 HGR (shell programs, DOS 3.3 programs)
+;
+;Original : Dec 30, 1990
+;Probably by : Jim Goodnow
+;
+;Modified by : Bill Buckels
+;Revision Date : February 2013
+;
+;Licence : You may use this code for whatever you wish as long
+; as you agree that Bill Buckels has no warranty or
+; liability obligations whatsoever from said use.
+;------------------------------------------------------------------------ */
+
+R0 equ 8
+SP equ 2
+
+sclr lda #0 ;store ptr in R0
+ sta R0
+ lda #$20
+ sta R0+1
+ ldy #0
+loop
+ lda R0+2
+ sta (R0),Y
+ iny
+ lda R0+3
+ sta (R0),Y
+ iny
+ bne loop
+ ldx R0+1
+ inx
+ stx R0+1
+ txa
+ cmp #$40
+ bcc loop
+ lda $c057 ;high res
+ lda $c054 ;page 1
+ lda $c052 ;full graphics
+ lda $c050 ;graphics
+ rts
+
+ public sblack_
+sblack_
+ lda #0
+ sta R0+2
+ sta R0+3
+ jmp sclr
+ public sblue_
+sblue_
+ lda #$d5
+ sta R0+2
+ lda #$aa
+ sta R0+3
+ jmp sclr
+ public sviolet_
+sviolet_
+ lda #$55
+ sta R0+2
+ lda #$2a
+ sta R0+3
+ jmp sclr
+ public sgreen_
+sgreen_
+ lda #$2a
+ sta R0+2
+ lda #$55
+ sta R0+3
+ jmp sclr
+ public sred_
+sred_
+ lda #$aa
+ sta R0+2
+ lda #$d5
+ sta R0+3
+ jmp sclr
+ public swhite_
+swhite_
+ lda #$7f
+ sta R0+2
+ lda #$7f
+ sta R0+3
+ jmp sclr
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/CLEAR1.R b/AppleX/GRAPHICS/CLEAR1.R
new file mode 100644
index 0000000..b603d3f
Binary files /dev/null and b/AppleX/GRAPHICS/CLEAR1.R differ
diff --git a/AppleX/GRAPHICS/CRT80.R b/AppleX/GRAPHICS/CRT80.R
new file mode 100644
index 0000000..8b26fb8
Binary files /dev/null and b/AppleX/GRAPHICS/CRT80.R differ
diff --git a/AppleX/GRAPHICS/CRT80.c b/AppleX/GRAPHICS/CRT80.c
new file mode 100644
index 0000000..670d9ba
--- /dev/null
+++ b/AppleX/GRAPHICS/CRT80.c
@@ -0,0 +1,23 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : crt80.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Jan 1, 2010
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+crt80()
+ {
+#asm
+ clc
+ jsr $c300
+#endasm
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/D2CIRC.C b/AppleX/GRAPHICS/D2CIRC.C
new file mode 100644
index 0000000..013dd43
--- /dev/null
+++ b/AppleX/GRAPHICS/D2CIRC.C
@@ -0,0 +1,85 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2circ.c
+Description : G2 Library Routine
+
+ Double Hi-Res 140 x 192 x 16 color circle routine
+ Using Bresenham Algorithm with crude aspect modification
+ in the xterm only. 1 x 2 aspect for a circle.
+
+ for ProDOS 8 Sys Programs
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+d2circle(x1, y1, radius, drawcolor, xmult, xdiv)
+{
+ int f = 1 - radius;
+ int ddfx = 1;
+ int ddfy = -2 * radius;
+ int x = 0;
+ int y = radius;
+ int xxaspect, xyaspect;
+
+ /* top and bottom */
+ d2plot(x1, y1 + radius, drawcolor);
+ d2plot(x1, y1 - radius, drawcolor);
+
+ /* sides */
+ /* a 1 x 2 aspect */
+ /* compresses the xterm for a circle */
+ if (xmult > 0 && xdiv > xmult) xyaspect = (y * xmult)/xdiv;
+ else xyaspect = y;
+
+ d2plot(x1 + xyaspect, y1, drawcolor);
+ d2plot(x1 - xyaspect, y1, drawcolor);
+
+ while(x < y)
+ {
+ if(f >= 0)
+ {
+ y--;
+ ddfy += 2;
+ f += ddfy;
+ }
+ x++;
+ ddfx += 2;
+ f += ddfx;
+
+ if (xmult > 0 && xdiv > xmult) {
+ /* a 1 x 2 aspect */
+ /* compresses the xterm for a circle */
+ xxaspect = (x * xmult)/xdiv;
+ xyaspect = (y * xmult)/xdiv;
+ }
+ else {
+ xxaspect = x;
+ xyaspect = y;
+ }
+
+ /* top and bottom */
+ d2plot(x1 + xxaspect, y1 + y, drawcolor); /* bottom right */
+ d2plot(x1 - xxaspect, y1 + y, drawcolor); /* bottom left */
+
+ d2plot(x1 + xxaspect, y1 - y, drawcolor); /* top right */
+ d2plot(x1 - xxaspect, y1 - y, drawcolor); /* top left */
+
+ /* sides */
+ d2plot(x1 + xyaspect, y1 + x, drawcolor); /* mid bottom right */
+ d2plot(x1 - xyaspect, y1 + x, drawcolor); /* mid bottom left */
+
+ d2plot(x1 + xyaspect, y1 - x, drawcolor); /* mid top right */
+ d2plot(x1 - xyaspect, y1 - x, drawcolor); /* mid top left */
+
+ }
+
+ return;
+}
diff --git a/AppleX/GRAPHICS/D2CIRC.R b/AppleX/GRAPHICS/D2CIRC.R
new file mode 100644
index 0000000..7b15aec
Binary files /dev/null and b/AppleX/GRAPHICS/D2CIRC.R differ
diff --git a/AppleX/GRAPHICS/D2FBOX.C b/AppleX/GRAPHICS/D2FBOX.C
new file mode 100644
index 0000000..25f0b85
--- /dev/null
+++ b/AppleX/GRAPHICS/D2FBOX.C
@@ -0,0 +1,131 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2fbox.c
+Description : G2 Library Routine
+
+ for ProDOS 8 Sys Programs
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+ Double Hi-Res 140 x 192 x 16 color routine
+ Draws a filled box to the color specified
+ using double hi-res colors 0-15.
+
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern unsigned HB[];
+extern unsigned char dhrbytes[16][4];
+
+int d2fbox(x1,y1,x2,y2,drawcolor)
+int x1,y1,x2,y2,drawcolor;
+{
+ unsigned int src1,src2,dest;
+ int y, x, packet, xorg, xend, prefix, postfix, idx, xoff;
+ unsigned char mainbuf[40], auxbuf[40];
+
+
+ /* swap coordinates if out of order */
+ if (x1 > x2) {
+ x = x1;
+ x1 = x2;
+ x2 = x;
+ }
+
+ if (y1 > y2) {
+ y = y1;
+ y1 = y2;
+ y2 = y;
+ }
+
+ if (x1 < 0 || x2 > 139 || y1 < 0 || y2 > 191)return 0;
+
+ /* convert pixels to 4 byte blocks and
+ calculate pixels before blocks */
+
+ prefix = x1;
+ while ((prefix%7)!=0) prefix++; /* advance to left side */
+
+ xorg = ((prefix / 7) * 4);
+
+ idx = x2 + 1;
+ xend = ((idx/7) * 4);
+
+ /* assign packet length */
+ idx = (xend-xorg);
+
+ /* if box width does not include a full 4 byte block
+ draw a filled box using a series of vertical lines */
+ if(idx < 4) {
+ x2 += 1;
+ for (x = x1; x < x2; x++)d2vline(x,y1,y2,drawcolor);
+ return 0;
+ }
+
+ packet = idx / 2;
+ xoff = (xorg / 2);
+
+ switch (drawcolor)
+ {
+
+ case 15: /* white or black set the memory... */
+ setmem(auxbuf,packet,(unsigned char)0x7f);
+ setmem(mainbuf,packet,(unsigned char)0x7f);
+ break;
+ case 0: setmem(auxbuf,packet,(unsigned char)0);
+ setmem(mainbuf,packet,(unsigned char)0);
+ break;
+
+ default:
+ /* other colors */
+ /* expand byte pairs to build scanline buffers */
+ /* interleaf 7 pixels between main and aux memory */
+ for (idx = 0; idx < packet; idx++) {
+ auxbuf[idx] = dhrbytes[drawcolor][0];
+ mainbuf[idx] = dhrbytes[drawcolor][1];
+ idx++;
+ auxbuf[idx] = dhrbytes[drawcolor][2];
+ mainbuf[idx] = dhrbytes[drawcolor][3];
+ }
+ }
+
+ /* now write the pixels */
+ src1 = (unsigned int)&auxbuf[0];
+ src2 = (src1 + packet) - 1;
+
+ /* first write the horizontal pixel blocks */
+ y = y1;
+ y2++;
+ while(y x1; x--) d2vline(x,y1,y2,drawcolor);
+ }
+
+ postfix = ((xend / 4) * 7) - 1;
+ if (postfix != x2) {
+ x2++;
+ for (x = postfix;x < x2; x++) d2vline(x,y1,y2,drawcolor);
+ }
+
+return 0;
+}
+
diff --git a/AppleX/GRAPHICS/D2FBOX.R b/AppleX/GRAPHICS/D2FBOX.R
new file mode 100644
index 0000000..cb729c2
Binary files /dev/null and b/AppleX/GRAPHICS/D2FBOX.R differ
diff --git a/AppleX/GRAPHICS/D2FLOOD.C b/AppleX/GRAPHICS/D2FLOOD.C
new file mode 100644
index 0000000..edeea33
--- /dev/null
+++ b/AppleX/GRAPHICS/D2FLOOD.C
@@ -0,0 +1,104 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2flood.c
+Description : G2 Library Routine
+
+ for ProDOS 8 Sys Programs
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+ Double Hi-Res 140 x 192 x 16 color routine
+ Draws a filled box to the color specified
+ using double hi-res colors 0-15.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* consider using d2fbox instead of this routine unless you are not doing
+ other plotting and you want to do something like clear the screen which
+ does not require pixel level accuracy */
+
+extern unsigned HB[]; /* page 2 scanline origins */
+extern unsigned char dhrbytes[16][4];
+
+int d2flood(x1,y1,x2,y2,drawcolor)
+int x1,y1,x2,y2,drawcolor;
+{
+
+ /* draws a filled box to the color specified */
+ /* using double hi-res colors 0-15 */
+ unsigned int src1,src2,dest;
+ int x, packet, xorg, xend, idx, xoff;
+ unsigned char *ptr, mainbuf[40], auxbuf[40];
+
+
+ if (x1 < 0 || x2 > 139 || y1 < 0 || y2 > 191)return 0;
+
+ /* convert pixels to 4 byte blocks - for now */
+
+ x = x1;
+ while ((x%7)!=0) x ++; /* advance to left side of box */
+
+ xorg = ((x / 7) * 4);
+
+ idx = x2 + 1;
+ xend = ((idx/7) * 4);
+
+ /* assign packet length */
+ idx = (xend-xorg);
+
+ if(idx < 4) return 0;
+
+ packet = idx / 2;
+ xoff = (xorg / 2);
+
+ if (drawcolor < 1 || drawcolor > 16) drawcolor = 0;
+
+ switch (drawcolor)
+ {
+
+ case 15: /* white or black set the memory... */
+ setmem(auxbuf,packet,0x7f);
+ setmem(mainbuf,packet,0x7f);
+ break;
+ case 0: setmem(auxbuf,packet,0);
+ setmem(mainbuf,packet,0);
+ break;
+
+ default:
+ /* other colors */
+ /* expand byte pairs to build scanline buffers */
+ /* interleaf 7 pixels between main and aux memory */
+ for (idx = 0; idx < packet; idx++) {
+ auxbuf[idx] = dhrbytes[drawcolor][0];
+ mainbuf[idx] = dhrbytes[drawcolor][1];
+ idx++;
+ auxbuf[idx] = dhrbytes[drawcolor][2];
+ mainbuf[idx] = dhrbytes[drawcolor][3];
+ }
+
+
+ }
+
+ /* now write the pixels */
+ src1 = (unsigned int)&auxbuf[0];
+ src2 = (src1 + packet) - 1;
+
+ y2++;
+ while(y1 2)scale = 1;
+ if (pitch != 6)pitch = 7;
+
+ target = strlen(str);
+
+ for (byte=0;byte 191)break;
+ r2 = r + 1;
+
+ /* run the string 8 times
+ if scale = 2 then print a double line
+ each time which gives us a font of 16 high */
+ spaces = 0;
+ for (byte=0;byte 139)continue;
+
+ d = str[byte]&0x7f;
+ if (d < 32)d = 32;
+ if (d == 32 || d == 'l' || d == '1'|| d == '.'||d == '!')spaces +=1;
+
+ if (d == 32 && bg < 0)continue;
+
+ offset = ((d-32) * 8) + scanline;
+ ch = __chr[offset];
+
+ if (ch == 0 && bg < 0)continue;
+
+ for (nibble=0;nibble 139)break;
+
+ if (ch & d2msk[nibble]){
+ if (scale > 1 && r2 < 192)
+ d2vline(x,r,r2,fg);
+ else
+ d2vline(x,r,r,fg);
+
+ }
+ else {
+ if (bg < 0)continue;
+ if (scale > 1 && r2 < 192)
+ d2vline(x,r,r2,bg);
+ else
+ d2vline(x,r,r,bg);
+
+ }
+
+ }
+
+ }
+ }
+ return 0;
+
+}
diff --git a/AppleX/GRAPHICS/D2FONT.R b/AppleX/GRAPHICS/D2FONT.R
new file mode 100644
index 0000000..62543ce
Binary files /dev/null and b/AppleX/GRAPHICS/D2FONT.R differ
diff --git a/AppleX/GRAPHICS/D2INIT.C b/AppleX/GRAPHICS/D2INIT.C
new file mode 100644
index 0000000..a787112
--- /dev/null
+++ b/AppleX/GRAPHICS/D2INIT.C
@@ -0,0 +1,63 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2init.c
+Description : G2 Library Routine
+ Double Hi-Res Routines
+
+ for ProDOS 8 Sys Programs
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use these routines for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+/*
+ CLR80VID = $C00C ;disable 80-column display mode (WR-only)
+ SET80VID = $C00D ;enable 80-column display mode (WR-only)
+
+unsigned char *clr80vid = (unsigned char *)0xc00c;
+unsigned char *set80vid = (unsigned char *)0xc00d;
+
+ SET80STORE=$C001 ;80STORE On- enable 80-column memory mapping (WR-only)
+ CLR80STORE=$C000 ;80STORE Off- disable 80-column memory mapping (Write)
+
+unsigned char *set80store = (unsigned char *)0xc001;
+unsigned char *clr80store = (unsigned char *)0xc000;
+
+*/
+
+
+d2hireson()
+{
+
+ /* page 2 hires */
+#asm
+ jsr $c300 ; TURN ON 80-COLUMN MODE
+ sta $c000 ; TURN OFF 80 STORE
+ sta $c050 ; GRAPHICS
+ sta $c055 ; PAGE TWO
+ sta $c052 ; GRAPHICS ONLY, NOT MIXED
+ sta $c057 ; HI-RES
+ sta $c05e ; TURN ON DOUBLE RES
+ #endasm
+
+}
+
+d2hiresoff()
+{
+#asm
+ sta $c051 ; TEXT - HIDE GRAPHICS
+ sta $c05f ; TURN OFF DOUBLE RES
+ sta $c054 ; PAGE ONE
+ sta $c001 ; TURN ON 80 STORE
+ jsr $c300 ; TURN ON 80-COLUMN MODE
+#endasm
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/D2INIT.R b/AppleX/GRAPHICS/D2INIT.R
new file mode 100644
index 0000000..734a4ba
Binary files /dev/null and b/AppleX/GRAPHICS/D2INIT.R differ
diff --git a/AppleX/GRAPHICS/D2LINE.C b/AppleX/GRAPHICS/D2LINE.C
new file mode 100644
index 0000000..b44a795
--- /dev/null
+++ b/AppleX/GRAPHICS/D2LINE.C
@@ -0,0 +1,65 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2line.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color
+ Bresenham Algorithm line drawing routine
+
+ for ProDOS 8 Sys Programs
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+d2line(x1, y1, x2, y2, drawcolor)
+int x1, y1, x2, y2, drawcolor;
+{
+
+ int dx, dy, sx, sy, err, err2;
+
+ if(x1 < x2) {
+ dx = x2 - x1;
+ sx = 1;
+ }
+ else {
+ sx = -1;
+ dx = x1 - x2;
+ }
+
+ if(y1 < y2) {
+ sy = 1;
+ dy = y2 - y1;
+ }
+ else {
+ sy = -1;
+ dy = y1 - y2;
+ }
+
+ err = dx-dy;
+
+ for (;;) {
+ d2plot(x1,y1,drawcolor);
+
+ if(x1 == x2 && y1 == y2)break;
+
+ err2 = err*2;
+
+ if(err2 > (0-dy)) {
+ err = err - dy;
+ x1 = x1 + sx;
+ }
+
+ if(err2 < dx) {
+ err = err + dx;
+ y1 = y1 + sy;
+ }
+ }
+ return;
+}
diff --git a/AppleX/GRAPHICS/D2LINE.R b/AppleX/GRAPHICS/D2LINE.R
new file mode 100644
index 0000000..e0b6369
Binary files /dev/null and b/AppleX/GRAPHICS/D2LINE.R differ
diff --git a/AppleX/GRAPHICS/D2LODE.C b/AppleX/GRAPHICS/D2LODE.C
new file mode 100644
index 0000000..7769cd7
--- /dev/null
+++ b/AppleX/GRAPHICS/D2LODE.C
@@ -0,0 +1,84 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2lode.c
+Description : G2 Library Routine
+
+ for ProDOS 8 Sys Programs
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+ Double Hi-Res 140 x 192 x 16 color Image Loader
+ Loads two common non-compressed bsaved graphics
+ image formats associated with double hires mode.
+
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+
+/* The convention of calling the second image a .AUX file is
+ supported in this loader when loading a 2 part file... the load is
+ split in the middle after loading the first half into auxiliary
+ memory */
+
+extern unsigned HB[]; /* page 2 scanline origins */
+
+int d2lode(name)
+char *name;
+{
+ int fh, status=-2;
+ int c, fa = 0, fl = 8192, jdx, idx;
+ char name2[64];
+
+ jdx = 999;
+ for (idx = 0; name[idx] != 0; idx++) {
+ name2[idx] = name[idx];
+ if (name[idx] == '.') jdx = idx;
+ }
+ name2[idx] = 0;
+
+ if (jdx != 999) name2[jdx] = 0;
+ strcat(name2,".AUX");
+
+ fl = 8192;
+ fh = open(name2,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) {
+ fl = 16384;
+ fh = open(name,O_RDONLY,0x3C);
+ if (fh == -1)return -1;
+ }
+
+
+ switch(fl) {
+ case 16384:
+ case 8192:
+ /* read to main memory */
+ c = read(fh,(char *)HB[0],8192);
+ if (c != 8192)break;
+ /* move to auxiliary memory */
+ maintoaux(HB[0],HB[0]+8191,HB[0]);
+
+ if (fl == 8192) {
+ close(fh);
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1)return -1;
+
+ }
+ /* read to main memory */
+ c = read(fh,(char *)HB[0],8192);
+ if (c != 8192)break;
+ status=0;
+ break;
+ }
+
+ close(fh);
+
+ return status;
+}
diff --git a/AppleX/GRAPHICS/D2LODE.R b/AppleX/GRAPHICS/D2LODE.R
new file mode 100644
index 0000000..ddf5c67
Binary files /dev/null and b/AppleX/GRAPHICS/D2LODE.R differ
diff --git a/AppleX/GRAPHICS/D2PLD.C b/AppleX/GRAPHICS/D2PLD.C
new file mode 100644
index 0000000..2bdb292
--- /dev/null
+++ b/AppleX/GRAPHICS/D2PLD.C
@@ -0,0 +1,174 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2pld.c
+Description : G2 Library Routine
+
+ for ProDOS 8 Sys Programs ONLY!
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+ Double Hi-Res 140 x 192 x 16 color Image Loader
+ for dhx and dhr images.
+
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+extern unsigned HB[];
+
+#define BLOCK_SIZE 3840
+
+int d2pld(name)
+char *name;
+{
+ unsigned int src, src2, target;
+ int fh,x,x1=0,x2=0,xcnt,y1=0,offset=0,bytes=0,bank=0;
+ unsigned char *ptra,*ptrm,ch,*buf,*mainbuf,*auxbuf;
+
+ /* point to unused memory below SYS programs */
+ buf = (unsigned char *)4192;
+ mainbuf = (unsigned char *)&buf[BLOCK_SIZE];
+ auxbuf = (unsigned char *)&mainbuf[40];
+
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+
+ x = read(fh,buf,5);
+ if (x!= 5) {
+ close(fh);
+ return -1;
+ }
+
+ if (buf[0] == 'D' && buf[1] == 'H' && buf[3] == 80 && buf[4] == 192 && (buf[2] == 'R' || buf[2] == 'X')) {
+ ch = buf[2];
+ }
+ else {
+ close(fh);
+ return -2;
+ }
+
+ /* raster oriented raw data */
+ if (ch == 'R') {
+ /* read 4 blocks of 48 scanlines */
+ for (x = 0; x < 4; x++) {
+ if (read(fh,buf,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+ /* display */
+ for (x1 = 0, x2=40; x1 < BLOCK_SIZE; x1+=80,x2+=80) {
+
+ /* read the keyboard buffer */
+ /* stop if keypress */
+ ptra = (unsigned char*)0xC000;
+ if (ptra[0] > 127) {
+ x = 4;
+ break;
+ }
+
+ src = (unsigned int)&buf[x1];
+ src2 = src+39;
+ ptrm = (unsigned char *)&buf[x2];
+ target = HB[y1];
+ maintoaux(src,src2,target);
+ movmem(ptrm,target,40);
+ y1++;
+ }
+ }
+ close(fh);
+ return 0; /* done and outa' here */
+ }
+
+
+ /* 1280 is an arbitrary number borrowed from the shell version
+ of this program... it is conceivable that a simple file
+ could encode to some small size but I doubt if it would
+ ever be below a 12th of the size of its uncompressed counterpart */
+ if (read(fh,buf,BLOCK_SIZE) < 1280) {
+ close(fh);
+ return -3;
+ }
+
+ /* raster oriented run-length encoded raw data */
+ target = HB[0];
+ src = (unsigned int)&auxbuf[0];
+ src2 = src+39;
+
+ do{
+
+ ch = buf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,buf,BLOCK_SIZE);
+ bytes = 0;
+ }
+
+ /* check to see if its raw */
+ /* if its not, run encoded */
+ if(0xC0 == (ch & 0xc0)){
+ xcnt = 0x3f & ch;
+ ch = buf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,buf,BLOCK_SIZE);
+ bytes = 0;
+ }
+ }
+ else
+ xcnt = 1;
+
+ for(x=0;x= 80) {
+ maintoaux(src,src2,target);
+ movmem(mainbuf,target,40);
+ x1 = x2 = bank = 0;
+ y1++;
+ if (y1 >= 192)break;
+ target = HB[y1];
+
+ /* read the keyboard buffer */
+ /* stop if keypress */
+ ptra = (unsigned char*)0xC000;
+ if (ptra[0] > 127) {
+ y1 = 192;
+ offset = 15360;
+ break;
+ }
+
+ }
+ }
+ else break;
+
+ offset++;
+ }
+ if (y1 >= 192)break;
+
+ } while(offset<15360);
+
+ close(fh);
+
+ return 0;
+}
diff --git a/AppleX/GRAPHICS/D2PLD.R b/AppleX/GRAPHICS/D2PLD.R
new file mode 100644
index 0000000..020469e
Binary files /dev/null and b/AppleX/GRAPHICS/D2PLD.R differ
diff --git a/AppleX/GRAPHICS/D2PLOT.C b/AppleX/GRAPHICS/D2PLOT.C
new file mode 100644
index 0000000..680539d
--- /dev/null
+++ b/AppleX/GRAPHICS/D2PLOT.C
@@ -0,0 +1,64 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2plot.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color plot routine
+
+ for ProDOS 8 Sys Programs
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+
+extern struct dhrpixel dhrx;
+
+extern unsigned HB[]; /* page 2 scanline origins */
+
+int d2plot(x,y,drawcolor)
+int x, y, drawcolor;
+{
+ unsigned char *pmain, auxbuf[1];
+ unsigned int dest;
+
+ /* bi-directional wrap supported for one scanline only
+ for vector line drawing */
+ if (x < 0) x+= 140;
+ if (x > 139) x-=140;
+
+ /* other than that... */
+ /* plotting is not supported outside viewing window */
+ if (x < 0 || x > 139 || y < 0 || y > 191)return 0;
+
+ /* initialize plotting values */
+ dhrcalc(x, drawcolor);
+
+ /* erase old color then slide new color into place */
+
+ /* auxiliary memory */
+ if (dhrx.pattern != 2 && dhrx.pattern != 6) {
+ dest = HB[y] + dhrx.xaux;
+ auxtomain(dest,dest,&auxbuf[0]);
+ auxbuf[0] = (auxbuf[0] & dhrx.mska) | dhrx.caux;
+ maintoaux(&auxbuf[0],&auxbuf[0],dest);
+ }
+
+ /* main memory */
+ if (dhrx.pattern != 0 && dhrx.pattern != 4) {
+ pmain = (unsigned char *) (HB[y] + dhrx.xmain);
+ *pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
+ }
+
+return 0;
+
+}
diff --git a/AppleX/GRAPHICS/D2PLOT.R b/AppleX/GRAPHICS/D2PLOT.R
new file mode 100644
index 0000000..a4adcd4
Binary files /dev/null and b/AppleX/GRAPHICS/D2PLOT.R differ
diff --git a/AppleX/GRAPHICS/D2SAVE.C b/AppleX/GRAPHICS/D2SAVE.C
new file mode 100644
index 0000000..d29e4a1
--- /dev/null
+++ b/AppleX/GRAPHICS/D2SAVE.C
@@ -0,0 +1,220 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2save.c
+Description : G2 Library Routine
+ DHGR Save for ProDOS SYS Programs
+ Saves 3 formats from DHGR Page 2:
+
+ 0 - BIN/AUX BSaved Pairs
+ 1 - A2FC BSaved Chunks
+ 2 - DHR Raw Raster Images
+
+ Overwrites existing file if it exists.
+ Danger Will Robinson! If a write error
+ occurs the damaged file(s) will be
+ removed and all will be lost.
+
+ Does Not Save Run-Length Encoded DHX
+ XPacked Images nor XCrunched XCC and
+ XRC color indices which take altogether
+ too long to uncrunch to make them
+ practical for most things at time of
+ this writing.
+
+Written by : Bill Buckels
+Revision Date: February 2013
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* save a file from double hires screen 2
+ in 2 formats - A2FC or DHR */
+#include
+#include
+
+extern unsigned HB[];
+
+#define BLOCK_SIZE 3840
+
+int d2save(basename,ftype)
+char *basename;
+int ftype;
+{
+ unsigned int src,src2,target;
+ int fh,i=0,j=0,status=-2,y,x,x1,x2;
+ char hdr[5], binfile[20], auxfile[20], *workbuf = (char *)4192, *ptr;
+ struct fileinfo *fi = (struct fileinfo *)4192;
+
+ /* allow filetype to be specified by ascii numeric value to
+ simplify calls using keyboard input logic */
+ if (ftype > 47 && ftype < 58) ftype -= 48;
+
+
+ /* create output names for save from basename */
+ for (;;) {
+ auxfile[i] = binfile[i] = basename[i];
+ if (binfile[i] == 0 || binfile[i] == '.') {
+ auxfile[i] = '.'; binfile[i++] = '.';
+ break;
+ }
+ i++;
+ }
+
+ /* remove any existing extension and add our standard
+ 3 character extension for the filetype specified */
+ if (ftype == 0) {
+ auxfile[i] = 'A'; binfile[i++] = 'B';
+ auxfile[i] = 'U'; binfile[i++] = 'I';
+ auxfile[i] = 'X'; binfile[i++] = 'N';
+ }
+ else if (ftype == 1) {
+ auxfile[i++] = '2';
+ auxfile[i++] = 'F';
+ auxfile[i++] = 'C';
+ }
+ else {
+ /* also create DHR header */
+ hdr[j++] = auxfile[i++] = 'D';
+ hdr[j++] = auxfile[i++] = 'H';
+ hdr[j++] = auxfile[i++] = 'R';
+ hdr[j++] = 80;
+ hdr[j] = 192;
+ }
+ auxfile[i] = binfile[i] = 0;
+
+ /* when Aztec C creates a file in ProDOS the filetype is set to 4 (text file).
+ in the past I modified the code for open to create binary files (filetype 6)
+ and called my function bopen which is part of the G3 library.
+ however the bopen code duplicates the aztec c code for open with this one
+ small change and therefore creates a larger program when open is also used
+ in the same program.
+
+ an alternative method to work around this is to create the file, close it,
+ modify the filetype from text to binary using setfinfo and then re-open the
+ file and write to it. See below. Since I wanted to set the load address
+ anyway I kill two birds with one stone by using setfinfo.
+
+ I have no idea why the Aztec C developers did not use a bitmask like
+ microsoft did to specify a binary or text file.
+ */
+
+ if((fh=open(auxfile, O_WRONLY|O_TRUNC|O_CREAT,0xc3)) == -1) return -1;
+ close(fh);
+
+ /* call ProDOS to set the file type to binary and
+ the subtype to the load address */
+ /* set load address to screen 1 for AUX file
+ BASIC programs may expect this */
+
+ if (getfinfo (auxfile, fi) != -1) {
+ fi->file_type = 6;
+ if (ftype == 0) fi->aux_type = 0x2000; /* screen 1 */
+ else fi->aux_type = 0x4000; /* screen 2 */
+ setfinfo(auxfile,fi);
+ }
+ if((fh=open(auxfile, O_WRONLY,0xc3)) == -1) {
+ unlink(auxfile);
+ return -1;
+ }
+
+
+ /* save screen based on filetype specified */
+
+ /* write AUX or A2FC file */
+ if (ftype == 0 || ftype == 1) {
+ /* move 8192 bytes from auxiliary screen memory and write to file */
+ src = 0x4000;
+ auxtomain(src,src+3999,4192);
+ for (;;) {
+ if (write(fh,workbuf,4000) != 4000) break;
+ src+=4000;
+ auxtomain(src,src+3999,4192);
+ if (write(fh,workbuf,4000) != 4000) break;
+ src+=4000;
+ auxtomain(src,src+191,4192);
+ if (write(fh,workbuf,192) != 192) break;
+ /* add 8192 bytes to A2FC from main screen memory */
+ if (ftype == 1) {
+ if (write(fh,(char *)0x4000,0x2000) != 0x2000) break;
+ }
+ status =0;
+ break;
+ }
+ }
+ else if (write(fh,hdr,5) == 5) {
+ /* write DHR file - if no error from writing the header
+ write the image data */
+ status = 0;
+ y = 0;
+ /* write 4 blocks of 48 scanlines */
+ for (x = 0; x < 4; x++) {
+
+ /* move 48 scanlines into write buffer area at 4192
+ interleaving auxmem with mainmem rasters */
+ for (x1 = 0, x2=40; x1 < BLOCK_SIZE; x1+=80,x2+=80) {
+
+ /* move a scanline from auxiliary screen memory
+ every even 40 bytes in the buffer */
+ src = HB[y];
+ src2 = src+39;
+ target = (unsigned int)&workbuf[x1];
+ auxtomain(src,src2,target);
+
+ /* interleaf a scanline from main screen memory
+ for the following 40 bytes */
+ ptr = (char *)src;
+ target = (unsigned int)&workbuf[x2];
+ movmem(ptr,target,40);
+ y++;
+ }
+
+ /* write the block and check for errors */
+ if (write(fh,workbuf,BLOCK_SIZE) < BLOCK_SIZE) {
+ status = -2;
+ break;
+ }
+ }
+ }
+
+ close(fh);
+
+ /* if a write error has occurred remove
+ the partial file and outa' here */
+ if (status != 0) {
+ unlink(auxfile);
+ return status;
+ }
+
+ if (ftype != 0) return 0;
+
+ /* if writing BIN/AUX file pairs save main screen memory
+ directly to the BIN file - for the other filetypes
+ there is no second file */
+ status = -3;
+ for(;;) {
+ if((fh=open(binfile, O_WRONLY|O_TRUNC|O_CREAT,0xc3)) == -1) break;
+ close(fh);
+ if (getfinfo (binfile, fi) != -1) {
+ fi->file_type = 6;
+ fi->aux_type = 0x2000;
+ setfinfo(binfile,fi);
+ }
+ if((fh=open(binfile, O_WRONLY,0xc3)) == -1) break;
+ status = 0;
+ if (write(fh,(char *)0x4000,0x2000) != 0x2000) status = -4;
+ close(fh);
+ break;
+ }
+
+ if (status != 0) {
+ unlink(auxfile);
+ unlink(binfile);
+ }
+
+ return status;
+
+}
diff --git a/AppleX/GRAPHICS/D2SAVE.R b/AppleX/GRAPHICS/D2SAVE.R
new file mode 100644
index 0000000..c62ba74
Binary files /dev/null and b/AppleX/GRAPHICS/D2SAVE.R differ
diff --git a/AppleX/GRAPHICS/D2VLINE.C b/AppleX/GRAPHICS/D2VLINE.C
new file mode 100644
index 0000000..12f8874
--- /dev/null
+++ b/AppleX/GRAPHICS/D2VLINE.C
@@ -0,0 +1,74 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2vline.c
+Description : G2 Library Routine
+
+ for ProDOS 8 Sys Programs
+ Uses Page 2 Double Hi-Res to avoid
+ ProDOS Sys Program Load Address at 0x2000
+
+ Double Hi-Res 140 x 192 x 16 color
+ vertical line drawing routine.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+extern struct dhrpixel dhrx;
+
+extern unsigned HB[];
+
+int d2vline(x,y1,y2,drawcolor)
+int x, y1, y2, drawcolor;
+{
+ int y;
+ unsigned char *pmain,auxbuf[1];
+ unsigned int dest;
+
+ /* swap co-ordinates if out of order */
+ if (y2 < y1) {
+ y = y2;
+ y2 = y1;
+ y1 = y;
+ }
+
+ /* plotting is not supported outside viewing window */
+ if (x < 0 || x > 139 || y1 < 0 || y2 > 191)return 0;
+
+ /* initialize plotting values */
+ dhrcalc(x, drawcolor);
+
+ /* plot a vertical line in the color selected */
+ y = y1;
+ y2++;
+ while (y< y2) {
+ /* run the yterm for each pixel */
+ /* erase old color then slide new color into place */
+
+ /* auxiliary memory */
+ if (dhrx.pattern != 2 && dhrx.pattern != 6) {
+ dest = HB[y] + dhrx.xaux;
+ auxtomain(dest,dest,&auxbuf[0]);
+ auxbuf[0] = (auxbuf[0] & dhrx.mska) | dhrx.caux;
+ maintoaux(&auxbuf[0],&auxbuf[0],dest);
+ }
+
+ /* main memory */
+ if (dhrx.pattern != 0 && dhrx.pattern != 4) {
+ pmain = (unsigned char *) (HB[y] + dhrx.xmain);
+ *pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
+ }
+ y++;
+ }
+
+
+return 0;
+
+}
diff --git a/AppleX/GRAPHICS/D2VLINE.R b/AppleX/GRAPHICS/D2VLINE.R
new file mode 100644
index 0000000..3b43bd3
Binary files /dev/null and b/AppleX/GRAPHICS/D2VLINE.R differ
diff --git a/AppleX/GRAPHICS/DHCIRC.C b/AppleX/GRAPHICS/DHCIRC.C
new file mode 100644
index 0000000..1a4dbef
--- /dev/null
+++ b/AppleX/GRAPHICS/DHCIRC.C
@@ -0,0 +1,79 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dhcirc.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color circle routine
+ Using Bresenham Algorithm with crude aspect modification
+ in the xterm only. 1 x 2 aspect for a circle.
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+dhrcircle(x1, y1, radius, drawcolor, xmult, xdiv)
+{
+ int f = 1 - radius;
+ int ddfx = 1;
+ int ddfy = -2 * radius;
+ int x = 0;
+ int y = radius;
+ int xxaspect, xyaspect;
+
+ /* top and bottom */
+ dhrplot(x1, y1 + radius, drawcolor);
+ dhrplot(x1, y1 - radius, drawcolor);
+
+ /* sides */
+ /* a 1 x 2 aspect */
+ /* compresses the xterm for a circle */
+ if (xmult > 0 && xdiv > xmult) xyaspect = (y * xmult)/xdiv;
+ else xyaspect = y;
+
+ dhrplot(x1 + xyaspect, y1, drawcolor);
+ dhrplot(x1 - xyaspect, y1, drawcolor);
+
+ while(x < y)
+ {
+ if(f >= 0)
+ {
+ y--;
+ ddfy += 2;
+ f += ddfy;
+ }
+ x++;
+ ddfx += 2;
+ f += ddfx;
+
+ if (xmult > 0 && xdiv > xmult) {
+ /* a 1 x 2 aspect */
+ /* compresses the xterm for a circle */
+ xxaspect = (x * xmult)/xdiv;
+ xyaspect = (y * xmult)/xdiv;
+ }
+ else {
+ xxaspect = x;
+ xyaspect = y;
+ }
+
+ /* top and bottom */
+ dhrplot(x1 + xxaspect, y1 + y, drawcolor); /* bottom right */
+ dhrplot(x1 - xxaspect, y1 + y, drawcolor); /* bottom left */
+
+ dhrplot(x1 + xxaspect, y1 - y, drawcolor); /* top right */
+ dhrplot(x1 - xxaspect, y1 - y, drawcolor); /* top left */
+
+ /* sides */
+ dhrplot(x1 + xyaspect, y1 + x, drawcolor); /* mid bottom right */
+ dhrplot(x1 - xyaspect, y1 + x, drawcolor); /* mid bottom left */
+
+ dhrplot(x1 + xyaspect, y1 - x, drawcolor); /* mid top right */
+ dhrplot(x1 - xyaspect, y1 - x, drawcolor); /* mid top left */
+
+ }
+
+ return;
+}
diff --git a/AppleX/GRAPHICS/DHCIRC.R b/AppleX/GRAPHICS/DHCIRC.R
new file mode 100644
index 0000000..b6a5acb
Binary files /dev/null and b/AppleX/GRAPHICS/DHCIRC.R differ
diff --git a/AppleX/GRAPHICS/DHDISC.C b/AppleX/GRAPHICS/DHDISC.C
new file mode 100644
index 0000000..5e537e8
--- /dev/null
+++ b/AppleX/GRAPHICS/DHDISC.C
@@ -0,0 +1,72 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dhdisc.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color filled circle routine
+ Using Bresenham Algorithm with crude aspect modification
+ in the xterm only. 1 x 2 aspect for a circle.
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+dhrdisc(x1, y1, radius, drawcolor, xmult, xdiv)
+{
+ int f = 1 - radius;
+ int ddfx = 1;
+ int ddfy = -2 * radius;
+ int x = 0;
+ int y = radius;
+ int xxaspect, xyaspect;
+
+ /* top and bottom */
+ dhrplot(x1, y1 + radius, drawcolor);
+ dhrplot(x1, y1 - radius, drawcolor);
+
+ /* sides */
+ /* a 1 x 2 aspect */
+ /* compresses the xterm for a circle */
+ if (xmult > 0 && xdiv > xmult) xyaspect = (y * xmult)/xdiv;
+ else xyaspect = y;
+
+ dhrfbox(x1 - xyaspect, y1, x1 + xyaspect, y1, drawcolor);
+
+ while(x < y)
+ {
+ if(f >= 0)
+ {
+ y--;
+ ddfy += 2;
+ f += ddfy;
+ }
+ x++;
+ ddfx += 2;
+ f += ddfx;
+
+ if (xmult > 0 && xdiv > xmult) {
+ /* a 1 x 2 aspect */
+ /* compresses the xterm for a circle */
+ xxaspect = (x * xmult)/xdiv;
+ xyaspect = (y * xmult)/xdiv;
+ }
+ else {
+ xxaspect = x;
+ xyaspect = y;
+ }
+
+ /* bottom and top */
+ dhrfbox(x1 - xxaspect,y1 + y,x1 + xxaspect,y1 + y,drawcolor);
+ dhrfbox(x1 - xxaspect,y1 - y,x1 + xxaspect,y1 - y,drawcolor);
+
+ /* bottom side and top side */
+ dhrfbox(x1 - xyaspect,y1 + x,x1 + xyaspect,y1 + x,drawcolor);
+ dhrfbox(x1 - xyaspect,y1 - x,x1 + xyaspect,y1 - x,drawcolor);
+
+ }
+
+ return;
+}
diff --git a/AppleX/GRAPHICS/DHDISC.R b/AppleX/GRAPHICS/DHDISC.R
new file mode 100644
index 0000000..e186e55
Binary files /dev/null and b/AppleX/GRAPHICS/DHDISC.R differ
diff --git a/AppleX/GRAPHICS/DHRCALC.C b/AppleX/GRAPHICS/DHRCALC.C
new file mode 100644
index 0000000..01158e0
--- /dev/null
+++ b/AppleX/GRAPHICS/DHRCALC.C
@@ -0,0 +1,130 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dhrcalc.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color
+ helper routine for pixel drawing functions.
+
+ inputs: x co-ordinate 0-139 and color 0-15
+
+ outputs required information for pixel drawing
+ to static structure used by pixel drawing functions.
+
+ range checking and things of that nature
+ are done outside of here.
+
+ values that are not used by drawing function logic
+ are not set. said logic depends on the particular
+ bank position in the framebuffer and whether or not
+ that position is using main and/or auxiliary memory.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+extern struct dhrpixel dhrx;
+
+extern unsigned char dhapix[16][7];
+extern unsigned char dhmpix[16][7];
+
+dhrcalc(x, drawcolor)
+int x, drawcolor;
+{
+
+ dhrx.pattern = (x%7); /* 7 pixel color pattern */
+
+ /* default - set the initial offset into the framebuffer for each byte pair in
+ both memory banks to the first byte to avoid excessive mult and div
+ instructions bulking-up this object module with repetitive code */
+
+ dhrx.xaux = dhrx.xmain = (x/7) * 2; /* assign offset for pointer addresses */
+
+
+ /* Summary of AND and OR bitwise operators
+ bit a bit b a & b a | b
+ 0 0 0 0
+ 0 1 0 1
+ 1 0 0 1
+ 1 1 1 1
+
+ Bitmasking can be a confusing business in practice only because
+ the code to do so is barely man-readable and even less man-writable...
+ but theoretically straight-forward and quite efficient:
+
+ 1. Bitwise ANDing a binary 1 will preserve the bit and
+ Bitwise ANDing a binary 0 will erase the bit.
+
+ 2. Combining 2 values by inclusively ORing them together works
+ fantastically if the areas to be combined have been mutually zeroed
+ in the complementary bits of the other value by using a bitwise AND.
+ */
+
+ /* the following switch statement provides the dhrpixel structure with all the data necessary
+ for the calling function to plot a color in a more or less data-driven abstract manner...
+ review dhrvline to see how the rest of this is done */
+
+ /* assign color bitmap for inclusive OR from 7 pixel level color bitmap patterns
+ for either auxiliary or main memory respectively from the dhapix or dhmpix arrays. */
+
+ /* provide mask value to erase target framebuffer area before including color bitmap */
+ /* increment framebuffer pointer offset to second byte in byte pair if needed */
+
+ switch(dhrx.pattern)
+ {
+ case 0:
+ dhrx.caux = dhapix[drawcolor][0]; /* 00001111 assign 4 bits */
+ dhrx.mska = 0x70; /* 01110000 erase 4 bits */
+ break;
+ case 1:
+ dhrx.caux = dhapix[drawcolor][1]; /* 01110000 assign 3 bits */
+ dhrx.mska = 0x0f; /* 00001111 erase 3 bits */
+ dhrx.cmain = dhmpix[drawcolor][1]; /* 00000001 assign 1 bit */
+ dhrx.mskm = 0x7e; /* 01111110 erase 1 bit */
+ break;
+ case 2:
+ dhrx.cmain = dhmpix[drawcolor][2]; /* 00011110 assign 4 bits */
+ dhrx.mskm = 0x61; /* 01100001 erase 4 bits */
+ break;
+ case 3:
+ dhrx.cmain = dhmpix[drawcolor][3]; /* 01100000 assign 2 bits */
+ dhrx.mskm = 0x1f; /* 00011111 erase 2 bits */
+
+ /* the byte pair splits here at meridian pixel 3 of 7 with the first
+ half of the pixel in the high nibble of the first pair in the main memory bank
+ and the second half of the pixel in the low nibble of the second pair in
+ the auxiliary memory bank */
+
+ dhrx.xaux++; /* second byte in auxiliary memory byte pair */
+ dhrx.caux = dhapix[drawcolor][3]; /* 00000011 assign 2 bits */
+ dhrx.mska = 0x7c; /* 01111100 erase 2 bits */
+ break;
+ case 4:
+ dhrx.xaux++ ; /* second byte in auxiliary memory byte pair */
+ dhrx.caux = dhapix[drawcolor][4]; /* 00111100 assign 4 bits */
+ dhrx.mska = 0x43; /* 01000011 erase 4 bits */
+ break;
+ case 5:
+ dhrx.xaux++; /* second byte in auxiliary memory byte pair */
+ dhrx.caux = dhapix[drawcolor][5]; /* 01000000 assign 1 bit */
+ dhrx.mska = 0x3f; /* 00111111 erase 1 bit */
+ dhrx.xmain++; /* second byte in main memory byte pair */
+ dhrx.cmain = dhmpix[drawcolor][5]; /* 00000111 assign 3 bits */
+ dhrx.mskm = 0x78; /* 01111000 erase 3 bits */
+ break;
+ case 6:
+ dhrx.xmain++; /* second byte in main memory byte pair */
+ dhrx.cmain = dhmpix[drawcolor][6]; /* 01111000 assign 4 bits */
+ dhrx.mskm = 0x07; /* 00000111 erase 4 bits */
+
+ }
+
+return;
+
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/DHRCALC.R b/AppleX/GRAPHICS/DHRCALC.R
new file mode 100644
index 0000000..49d01fd
Binary files /dev/null and b/AppleX/GRAPHICS/DHRCALC.R differ
diff --git a/AppleX/GRAPHICS/DHRCALC2.C b/AppleX/GRAPHICS/DHRCALC2.C
new file mode 100644
index 0000000..08071d1
--- /dev/null
+++ b/AppleX/GRAPHICS/DHRCALC2.C
@@ -0,0 +1,128 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dhrcalc2.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color
+ helper routine for pixel drawing functions.
+
+ inputs: x co-ordinate 0-139 and color 0-15
+
+ outputs required information for pixel drawing
+ to static structure used by pixel drawing functions.
+
+ range checking and things of that nature
+ are done outside of here.
+
+ values that are not used by drawing function logic
+ are not set. said logic depends on the particular
+ bank position in the framebuffer and whether or not
+ that position is using main and/or auxiliary memory.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+extern struct dhrpixel dhrx;
+extern unsigned char dhrbytes[16][4];
+
+dhrcalc2(x, drawcolor)
+int x, drawcolor;
+{
+
+ dhrx.pattern = (x%7); /* 7 pixel color pattern */
+
+ /* default - set the initial offset into the framebuffer for each byte pair in
+ both memory banks to the first byte to avoid excessive mult and div
+ instructions bulking-up this object module with repetitive code */
+
+ dhrx.xaux = dhrx.xmain = (x/7) * 2; /* assign offset for pointer addresses */
+
+
+ /* Summary of AND and OR bitwise operators
+ bit a bit b a & b a | b
+ 0 0 0 0
+ 0 1 0 1
+ 1 0 0 1
+ 1 1 1 1
+
+ Bitmasking can be a confusing business in practice only because
+ the code to do so is barely man-readable and even less man-writable...
+ but theoretically straight-forward and quite efficient:
+
+ 1. Bitwise ANDing a binary 1 will preserve the bit and
+ Bitwise ANDing a binary 0 will erase the bit.
+
+ 2. Combining 2 values by inclusively ORing them together works
+ fantastically if the areas to be combined have been mutually zeroed
+ in the complementary bits of the other value by using a bitwise AND.
+ */
+
+ /* the following switch statement provides the dhrpixel structure with all the data necessary
+ for the calling function to plot a color in a more or less data-driven abstract manner...
+ review dhrvline to see how the rest of this is done */
+
+ /* extract color bitmap for inclusive OR from 4 - 7 bit bytes x 7 - 4 bit color bitmap patterns
+ stored in the dhrbytes array by using a bitwise AND */
+ /* provide mask value to erase target framebuffer area before including color bitmap */
+ /* increment framebuffer pointer offset to second byte in byte pair if needed */
+
+
+ switch(dhrx.pattern)
+ {
+ case 0:
+ dhrx.caux = (dhrbytes[drawcolor][0] & 0x0f); /* 00001111 extract 4 bits */
+ dhrx.mska = 0x70; /* 01110000 erase 4 bits */
+ break;
+ case 1:
+ dhrx.caux = (dhrbytes[drawcolor][0] & 0x70); /* 01110000 extract 3 bits */
+ dhrx.mska = 0x0f; /* 00001111 erase 3 bits */
+ dhrx.cmain = (dhrbytes[drawcolor][1] & 0x01); /* 00000001 extract 1 bit */
+ dhrx.mskm = 0x7e; /* 01111110 erase 1 bit */
+ break;
+ case 2:
+ dhrx.cmain = (dhrbytes[drawcolor][1] & 0x1e); /* 00011110 extract 4 bits */
+ dhrx.mskm = 0x61; /* 01100001 erase 4 bits */
+ break;
+ case 3:
+ dhrx.cmain = (dhrbytes[drawcolor][1] & 0x60); /* 01100000 extract 2 bits */
+ dhrx.mskm = 0x1f; /* 00011111 erase 2 bits */
+
+ /* the byte pair splits here at meridian pixel 3 of 7 with the first
+ half of the pixel in the high nibble of the first pair in the main memory bank
+ and the second half of the pixel in the low nibble of the second pair in
+ the auxiliary memory bank */
+
+ dhrx.xaux++ ; /* second byte in auxiliary memory byte pair */
+ dhrx.caux = (dhrbytes[drawcolor][2] & 0x03); /* 00000011 extract 2 bits */
+ dhrx.mska = 0x7c; /* 01111100 erase 2 bits */
+ break;
+ case 4:
+ dhrx.xaux++ ; /* second byte in auxiliary memory byte pair */
+ dhrx.caux = (dhrbytes[drawcolor][2] & 0x3c); /* 00111100 extract 4 bits */
+ dhrx.mska = 0x43; /* 01000011 erase 4 bits */
+ break;
+ case 5:
+ dhrx.xaux++; /* second byte in auxiliary memory byte pair */
+ dhrx.caux = (dhrbytes[drawcolor][2] & 0x40); /* 01000000 extract 1 bit */
+ dhrx.mska = 0x3f; /* 00111111 erase 1 bit */
+ dhrx.xmain++; /* second byte in main memory byte pair */
+ dhrx.cmain = (dhrbytes[drawcolor][3] & 0x07); /* 00000111 extract 3 bits */
+ dhrx.mskm = 0x78; /* 01111000 erase 3 bits */
+ break;
+ case 6:
+ dhrx.xmain++; /* second byte in main memory byte pair */
+ dhrx.cmain = (dhrbytes[drawcolor][3] & 0x78); /* 01111000 extract 4 bits */
+ dhrx.mskm = 0x07; /* 00000111 erase 4 bits */
+
+ }
+
+return;
+
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/DHRCALC2.R b/AppleX/GRAPHICS/DHRCALC2.R
new file mode 100644
index 0000000..3808d76
Binary files /dev/null and b/AppleX/GRAPHICS/DHRCALC2.R differ
diff --git a/AppleX/GRAPHICS/DHRFONT.C b/AppleX/GRAPHICS/DHRFONT.C
new file mode 100644
index 0000000..5a99d42
--- /dev/null
+++ b/AppleX/GRAPHICS/DHRFONT.C
@@ -0,0 +1,102 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dhrfont.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color font routine
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+extern char __chr[1096];
+
+int msk7[]={0x1,0x2,0x4,0x8,0x10,0x20,0x40};
+int dhrfont(str,row,col,fg,bg,scale,pitch,justify)
+char *str;
+int row,col,fg,bg,scale,pitch;
+char justify;
+{
+ int target, scanline, offset, r, r2, c, d, byte, nibble, x, spaces = 0;
+ unsigned char ch;
+
+ if (scale > 2)scale = 1;
+ if (pitch != 6)pitch = 7;
+
+ target = strlen(str);
+
+ for (byte=0;byte 191)break;
+ r2 = r + 1;
+
+ /* run the string 8 times
+ if scale = 2 then print a double line
+ each time which gives us a font of 16 high */
+ spaces = 0;
+ for (byte=0;byte 139)continue;
+
+ d = str[byte]&0x7f;
+ if (d < 32)d = 32;
+ if (d == 32 || d == 'l' || d == '1'|| d == '.'||d == '!')spaces +=1;
+
+ if (d == 32 && bg < 0)continue;
+
+ offset = ((d-32) * 8) + scanline;
+ ch = __chr[offset];
+
+ if (ch == 0 && bg < 0)continue;
+
+ for (nibble=0;nibble 139)break;
+
+ if (ch & msk7[nibble]){
+ if (scale > 1 && r2 < 192)
+ dhrvline(x,r,r2,fg);
+ else
+ dhrvline(x,r,r,fg);
+
+ }
+ else {
+ if (bg < 0)continue;
+ if (scale > 1 && r2 < 192)
+ dhrvline(x,r,r2,bg);
+ else
+ dhrvline(x,r,r,bg);
+
+ }
+
+ }
+
+ }
+ }
+ return 0;
+
+}
diff --git a/AppleX/GRAPHICS/DHRFONT.R b/AppleX/GRAPHICS/DHRFONT.R
new file mode 100644
index 0000000..5769dfd
Binary files /dev/null and b/AppleX/GRAPHICS/DHRFONT.R differ
diff --git a/AppleX/GRAPHICS/DHRLINE.C b/AppleX/GRAPHICS/DHRLINE.C
new file mode 100644
index 0000000..8249b0a
--- /dev/null
+++ b/AppleX/GRAPHICS/DHRLINE.C
@@ -0,0 +1,60 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dhrline.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color
+ Bresenham Algorithm line drawing routine
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+dhrline(x1, y1, x2, y2, drawcolor)
+int x1, y1, x2, y2, drawcolor;
+{
+
+ int dx, dy, sx, sy, err, err2;
+
+ if(x1 < x2) {
+ dx = x2 - x1;
+ sx = 1;
+ }
+ else {
+ sx = -1;
+ dx = x1 - x2;
+ }
+
+ if(y1 < y2) {
+ sy = 1;
+ dy = y2 - y1;
+ }
+ else {
+ sy = -1;
+ dy = y1 - y2;
+ }
+
+ err = dx-dy;
+
+ for (;;) {
+ dhrplot(x1,y1,drawcolor);
+
+ if(x1 == x2 && y1 == y2)break;
+
+ err2 = err*2;
+
+ if(err2 > (0-dy)) {
+ err = err - dy;
+ x1 = x1 + sx;
+ }
+
+ if(err2 < dx) {
+ err = err + dx;
+ y1 = y1 + sy;
+ }
+ }
+ return;
+}
diff --git a/AppleX/GRAPHICS/DHRLINE.R b/AppleX/GRAPHICS/DHRLINE.R
new file mode 100644
index 0000000..87c2d95
Binary files /dev/null and b/AppleX/GRAPHICS/DHRLINE.R differ
diff --git a/AppleX/GRAPHICS/DHRPIXEL.R b/AppleX/GRAPHICS/DHRPIXEL.R
new file mode 100644
index 0000000..d6e1f57
Binary files /dev/null and b/AppleX/GRAPHICS/DHRPIXEL.R differ
diff --git a/AppleX/GRAPHICS/DHRPLOT.C b/AppleX/GRAPHICS/DHRPLOT.C
new file mode 100644
index 0000000..46acf68
--- /dev/null
+++ b/AppleX/GRAPHICS/DHRPLOT.C
@@ -0,0 +1,85 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dhrplot.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color plot routine
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+
+extern struct dhrpixel dhrx;
+
+extern unsigned DHRB[];
+
+int dhrplot(x,y,drawcolor)
+int x, y, drawcolor;
+{
+ unsigned char *paux, *pmain;
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ /* bi-directional wrap supported for one scanline only
+ for vector line drawing */
+ if (x < 0) x+= 140;
+ if (x > 139) x-=140;
+
+ /* other than that... */
+ /* plotting is not supported outside viewing window */
+ if (x < 0 || x > 139 || y < 0 || y > 191)return 0;
+
+ /* initialize plotting values */
+ dhrcalc(x, drawcolor);
+
+ /* erase old color then slide new color into place */
+ switch(dhrx.pattern)
+ {
+
+ case 0:
+ case 4:
+ paux = (unsigned char *) (DHRB[y] + dhrx.xaux);
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *paux = (*paux & dhrx.mska) | dhrx.caux;
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ break;
+
+ case 1:
+ case 3:
+ case 5:
+
+ paux = (unsigned char *) (DHRB[y] + dhrx.xaux);
+ pmain = (unsigned char *) (DHRB[y] + dhrx.xmain);
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *paux = (*paux & dhrx.mska) | dhrx.caux;
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ *pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
+ break;
+
+ case 2:
+ case 6:
+ pmain = (unsigned char *) (DHRB[y] + dhrx.xmain);
+ *pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
+
+ }
+
+
+return 0;
+
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/DHRPLOT.R b/AppleX/GRAPHICS/DHRPLOT.R
new file mode 100644
index 0000000..16ccc00
Binary files /dev/null and b/AppleX/GRAPHICS/DHRPLOT.R differ
diff --git a/AppleX/GRAPHICS/DHRPLOT.REF b/AppleX/GRAPHICS/DHRPLOT.REF
new file mode 100644
index 0000000..4266f87
--- /dev/null
+++ b/AppleX/GRAPHICS/DHRPLOT.REF
@@ -0,0 +1,263 @@
+/* the following array simplifies scanline origin offset
+ lookup in the hires screen area...
+ DHRB stands for Double High-Res Base-Address and is indexed
+ sequentially from scanline 0-191 which avoids the
+ ubiquituous venetian blind effect that we know and love */
+extern unsigned DHRB[];
+
+/*
+
+The following is logically reordered to match the lores
+color order...
+
+ Repeated
+ Binary
+ Color aux1 main1 aux2 main2 Pattern
+ Black 00 00 00 00 0000
+ Magenta 08 11 22 44 0001
+ Dark Blue 11 22 44 08 1000
+ Violet 19 33 66 4C 1001
+ Dark Green 22 44 08 11 0100
+ Grey1 2A 55 2A 55 0101
+ Medium Blue 33 66 4C 19 1100
+ Light Blue 3B 77 6E 5D 1101
+ Brown 44 08 11 22 0010
+ Orange 4C 19 33 66 0011
+ Grey2 55 2A 55 2A 1010
+ Pink 5D 3B 77 6E 1011
+ Green 66 4C 19 33 0110
+ Yellow 6E 5D 3B 77 0111
+ Aqua 77 6E 5D 3B 1110
+ White 7F 7F 7F 7F 1111
+
+*/
+
+/*
+
+#define LOBLACK 0
+#define LORED 1
+#define LODKBLUE 2
+#define LOPURPLE 3
+#define LODKGREEN 4
+#define LOGRAY 5
+#define LOMEDBLUE 6
+#define LOLTBLUE 7
+#define LOBROWN 8
+#define LOORANGE 9
+#define LOGREY 10
+#define LOPINK 11
+#define LOLTGREEN 12
+#define LOYELLOW 13
+#define LOAQUA 14
+#define LOWHITE 15
+
+*/
+
+/* the following array is based on the above */
+extern unsigned char dhrbytes[16][4];
+
+
+/* position of pixels in 4 byte pattern */
+/* remember that byte 0 and byte 2 are auxmem
+ and byte 1 and byte 3 are main mem
+ and the 4 bit pattern of the 7 pixels straddle
+ the two memory banks */
+
+/* 7 pixels = 4 bytes */
+
+/* left for reference...
+unsigned char dhrpattern[7][4] = {
+0,0,0,0,
+0,0,0,1,
+1,1,1,1,
+1,1,2,2,
+2,2,2,2,
+2,3,3,3,
+3,3,3,3};
+
+*/
+
+/* mask values to erase previous contents of pixels */
+/* for reference
+
+unsigned char dhrmsk[7][2] = {
+0x70, 0,
+0x0f, 0x7e,
+0x61, 0,
+0x1f, 0x7c,
+0x43, 0,
+0x3f, 0x78,
+0x07, 0};
+
+*/
+
+/* getpixel mask values - what color to use */
+/* for reference
+
+unsigned char dhrgetmsk[7][2] = {
+0x0f, 0,
+0x70, 0x01,
+0x1e, 0,
+0x60, 0x03,
+0x3c, 0,
+0x40, 0x07,
+0x78, 0};
+
+*/
+
+
+/* the following soft switches select between
+ upper and lower banks of video memory */
+extern char *dhrmain;
+extern char *dhraux;
+
+
+/* offset into memory frame for pixels */
+/* double hi-res xbase */
+/* for reference
+
+char DHB[140] = {
+0,0,0,0,0,0,0,
+2,2,2,2,2,2,2,
+4,4,4,4,4,4,4,
+6,6,6,6,6,6,6,
+8,8,8,8,8,8,8,
+10,10,10,10,10,10,10,
+12,12,12,12,12,12,12,
+14,14,14,14,14,14,14,
+16,16,16,16,16,16,16,
+18,18,18,18,18,18,18,
+20,20,20,20,20,20,20,
+22,22,22,22,22,22,22,
+24,24,24,24,24,24,24,
+26,26,26,26,26,26,26,
+28,28,28,28,28,28,28,
+30,30,30,30,30,30,30,
+32,32,32,32,32,32,32,
+34,34,34,34,34,34,34,
+36,36,36,36,36,36,36,
+38,38,38,38,38,38,38};
+
+*/
+
+
+
+/* a double hi-res pixel can occur at any one of 7 positions */
+/* in a 4 byte block which spans aux and main screen memory */
+/* the horizontal resolution is 140 pixels */
+int dhrplot(x,y,drawcolor)
+int x, y, drawcolor;
+{
+ int xoff, pattern;
+ unsigned char *ptr;
+
+
+ if (x < 0 || x > 159 || y < 0 || y > 191)return 0;
+
+ pattern = (x%7);
+
+ if (pattern > 3)xoff = ((x/7) * 2) + 1;
+ else xoff = (x/7) * 2;
+
+ ptr = (unsigned char *) (DHRB[y] + xoff);
+
+
+ /* In praise of the common bitmask...
+
+ The following algorithm uses a simple bitmask
+ to erase the target pixel "in place". The same technique
+ is used to extract the appropriate new target pixel
+ value from a color palette array which contains the
+ 7 possible pixel values (in 4 bit blocks), and this new
+ value is inclusively bitwise OR'd "in place" into
+ the position where the previous value was erased
+ (in the appropriate area of screen memory).
+
+ The tricky part here (if there is a tricky part) is
+ understanding that the high bit is skipped
+ in each byte and that pixel order direction is from
+ bit 0 to bit 6. The other consideration is that
+ some of the pixels span the interleaving of aux and
+ main memory "pages". It really isn't too hard to
+ understand if you look at the binary values in the
+ code below using your favourite scientific calculator.
+
+ Keep in mind that when you use a bitwise AND against a
+ bitmask, the binary mask will protect the values
+ that hide behind the 1's and erase the values that
+ hide behind the 0's. Also keep in mind that an inclusive
+ OR is like sliding the two values together into a
+ single bitwise value (recombinance).
+
+ So there you have it... a simple process to work
+ with a convoluted twisted puppy of a hardware display.
+
+ I should note that the reason I chose to work with
+ constants below rather than reduce this to an array
+ driven function was two-fold... first-off it was easier
+ to read and to to test (i.e. to visually organize)
+ but more importantly the use of constants seems to me
+ to be a tad more efficient... and if I am wrong then
+ I admit to being imperfect. */
+
+ *dhrmain = 0; /* set to main memory */
+
+ switch(pattern)
+ {
+ /* left this here for reference
+
+ unsigned char dhrpattern[7][4] = {
+ 0,0,0,0,
+ 0,0,0,1,
+ 1,1,1,1,
+ 1,1,2,2,
+ 2,2,2,2,
+ 2,3,3,3,
+ 3,3,3,3};
+ */
+
+ case 0: *dhraux = 0; /* select auxilliary memory */
+ *ptr &= 0x70;
+ *ptr |= (dhrbytes[drawcolor][0] &0x0f);
+ *dhrmain = 0; /* reset to main memory */
+ break;
+ case 1: *dhraux = 0; /* select auxilliary memory */
+ *ptr &= 0x0f;
+ *ptr |= (dhrbytes[drawcolor][0] & 0x70);
+ *dhrmain = 0; /* reset to main memory */
+ *ptr &= 0x7e;
+ *ptr |= (dhrbytes[drawcolor][1] & 0x01);
+ break;
+ case 2: *ptr &= 0x61;
+ *ptr |= (dhrbytes[drawcolor][1] & 0x1e);
+ break;
+ case 3: *ptr &= 0x1f;
+ *ptr |= (dhrbytes[drawcolor][1] & 0x60);
+ *dhraux = 0; /* select auxilliary memory */
+ *ptr++; /* advance offset in frame */
+ *ptr &= 0x7c;
+ *ptr |= (dhrbytes[drawcolor][2] & 0x03);
+ *dhrmain = 0; /* reset to main memory */
+ break;
+ case 4: *dhraux = 0; /* select auxilliary memory */
+ *ptr &= 0x43;
+ *ptr |= (dhrbytes[drawcolor][2] & 0x3c);
+ *dhrmain = 0; /* reset to main memory */
+ break;
+ case 5: *dhraux = 0; /* select auxilliary memory */
+ *ptr &= 0x3f;
+ *ptr |= (dhrbytes[drawcolor][2] & 0x40);
+ *dhrmain = 0; /* reset to main memory */
+ *ptr &= 0x78;
+ *ptr |= (dhrbytes[drawcolor][3] & 0x07);
+ break;
+ case 6: *ptr &= 0x07;
+ *ptr |= (dhrbytes[drawcolor][3] & 0x78);
+ break;
+ }
+
+*dhrmain = 0; /* reset to main memory */
+
+return 0;
+
+}
diff --git a/AppleX/GRAPHICS/DHVLIN.C b/AppleX/GRAPHICS/DHVLIN.C
new file mode 100644
index 0000000..f2283bb
--- /dev/null
+++ b/AppleX/GRAPHICS/DHVLIN.C
@@ -0,0 +1,130 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dhvlin.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color
+ vertical line drawing routine
+
+ This routine is also called by dhrfbox and dhrfont.
+
+ Writing vertical lines in double hi-res is as effective
+ if not arguably more effective for these two calling functions
+ than re-calculating a single pixel write repeatedly.
+
+ In the case of dhrfont, since dhrfbox is used both to
+ clear the screen and draw filled boxes, dhrvline is already
+ compiled into the program so using dhrvline to do a single
+ pixel write or a two pixel write made more sense than
+ adding the extra baggage of dhrplot to dhrfont.
+
+ In the case of dhrfbox, using a series of vertical lines
+ to "flesh-out" the edges of a filled box can be fairly
+ effective depending whether or not the filled box falls
+ within the co-ordinates supported by blitting with a
+ block of pixels.
+
+ Also keeping in mind that drfbox is used to draw
+ horizontal lines, so unless vector graphics beyond box
+ primitives are needed it just made the most sense to
+ keep the code small by avoiding the extra overhead
+ of a single pixel write.
+
+ Really, because of the nature of the double hi-res
+ screen, the only difference between dhrplot and dhrvline
+ is the yterm in dhrvline. And that is at least part of
+ the reason that I have broken the cardinal rule of making
+ a vertical line the smallest element in most of this
+ double hi-res stuff rather than a single-pixel write.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+extern struct dhrpixel dhrx;
+
+extern unsigned DHRB[];
+extern unsigned char dhrbytes[16][4];
+extern char *dhrmain;
+extern char *dhraux;
+
+
+int dhrvline(x,y1,y2,drawcolor)
+int x, y1, y2, drawcolor;
+{
+ int y;
+ unsigned char *paux, *pmain;
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ /* swap co-ordinates if out of order */
+ if (y2 < y1) {
+ y = y2;
+ y2 = y1;
+ y1 = y;
+ }
+
+ /* plotting is not supported outside viewing window */
+ if (x < 0 || x > 139 || y1 < 0 || y2 > 191)return 0;
+
+ /* initialize plotting values */
+ dhrcalc(x, drawcolor);
+
+ /* plot a vertical line in the color selected */
+ y = y1;
+ y2++;
+ while (y< y2) {
+ /* run the yterm for each pixel */
+ /* erase old color then slide new color into place */
+ switch(dhrx.pattern)
+ {
+
+ case 0:
+ case 4:
+ paux = (unsigned char *) (DHRB[y] + dhrx.xaux);
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *paux = (*paux & dhrx.mska) | dhrx.caux;
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ break;
+
+ case 1:
+ case 3:
+ case 5:
+
+ paux = (unsigned char *) (DHRB[y] + dhrx.xaux);
+ pmain = (unsigned char *) (DHRB[y] + dhrx.xmain);
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *paux = (*paux & dhrx.mska) | dhrx.caux;
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ *pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
+ break;
+
+ case 2:
+ case 6:
+ pmain = (unsigned char *) (DHRB[y] + dhrx.xmain);
+ *pmain = (*pmain & dhrx.mskm) | dhrx.cmain;
+
+ }
+ y++;
+ }
+
+
+return 0;
+
+}
diff --git a/AppleX/GRAPHICS/DHVLIN.R b/AppleX/GRAPHICS/DHVLIN.R
new file mode 100644
index 0000000..7d6e6b0
Binary files /dev/null and b/AppleX/GRAPHICS/DHVLIN.R differ
diff --git a/AppleX/GRAPHICS/DLODELO.C b/AppleX/GRAPHICS/DLODELO.C
new file mode 100644
index 0000000..bb9a8f0
--- /dev/null
+++ b/AppleX/GRAPHICS/DLODELO.C
@@ -0,0 +1,189 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dlodelo.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Dec 29, 2012
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+
+/* the following loads two non-compressed
+ graphics image formats associated with
+ double lores mode...
+
+ Single File Raster Format - DLO
+ 2 Part Bsaved Image Format - DL1 and DL2
+
+
+ for bsaved images the convention of calling
+ the second image a .DL2 file is supported in
+ this loader when loading a 2 part image...
+
+
+ the load is split in the middle after loading
+ the first half into auxilliary memory */
+
+
+extern char *dhrmain;
+extern char *dhraux;
+
+
+/* The following buffer is not very elegant but necessary I am afraid... when I tried to do a raw read
+ into screen memory some funky conflict was happening between ProDOS and screen memory and nothing would display.
+
+ So I separated my read operations from my display operations hence the buffer, unlike in the DOS 3.3 version
+ which reads directly to the screen.
+
+*/
+
+char lodebuf[1920];
+
+int dlodelo(name)
+char *name;
+{
+ int fh, y, status=-2;
+ int c, fl = 1016, height, packet, jdx, idx;
+ char tempchar[2], name1[20], name2[20], *ptr1, *ptr2;
+ unsigned temp;
+
+ ptr1 = (char *)&lodebuf[0];
+ ptr2 = (char *)&lodebuf[40];
+
+ jdx = 999;
+ for (idx = 0; name[idx] != 0; idx++) {
+ name1[idx] = name[idx];
+ name2[idx] = name[idx];
+ if (name[idx] == '.') {
+ name1[idx] = 0;
+ name2[idx] = 0;
+ jdx = idx;
+ break;
+
+ }
+ }
+ if (jdx == 999) return status;
+
+ strcat(name2,".DL1");
+
+ /* start in main memory - page1 */
+ *dhrmain = 0;
+ fh = open(name2,O_RDONLY,0x3C); /* open a binary DL1 file */
+ /* if we can't open a DL1 we must be loading a raster file
+ so open a DLO file... and if we can't open that
+ just fail... I don't want garbage in here so
+ I don't support creative naming... */
+ if (fh == -1) {
+ strcat(name1,".DLO");
+ fl = 1922;
+ /* main memory - page1 */
+ *dhrmain = 0;
+ fh = open(name1,O_RDONLY,0x3C);
+ if (fh == -1) {
+ /* main memory - page1 */
+ *dhrmain = 0;
+ return -1;
+ }
+ }
+ else {
+ /* if we opened a DL1 then get ready to open a DL2 */
+ strcat(name1,".DL2");
+ }
+
+ switch(fl) {
+ case 1922:
+ /* is it a DLO ? */
+ c = read(fh,tempchar,2);
+ if (c!=2) {
+ close(fh);
+ break;
+ }
+ packet= (int)tempchar[0];
+ height= (int)tempchar[1];
+ if (height != 24 || packet != 80) {
+ close(fh);
+ break;
+ }
+ c = read(fh,lodebuf,1920);
+ close(fh);
+ if (c!=1920)break;
+ status = 0;
+
+ idx = 0;
+
+ /* The following is not very elegant I am afraid... but when I tried to do this
+ in a loop using an address array like in the DOS 3.3 version I kept hitting some kind of limitation
+ so I used constants and an onerous code-block instead which worked... so here it is...
+
+ */
+ dhraux[0] = 0; movmem(ptr1+idx,0x0400,40); /* switch to auxilliary memory - page2 */
+ dhrmain[0] = 0; movmem(ptr2+idx,0x0400,40);/* switch back to main memory - page1 */
+ idx += 80;
+
+ dhraux[0] = 0; movmem(ptr1+idx,0x0480,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0480,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0500,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0500,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0580,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0580,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0600,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0600,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0680,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0680,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0700,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0700,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0780,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0780,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0428,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0428,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x04A8,40); dhrmain[0] = 0; movmem(ptr2+idx,0x04A8,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0528,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0528,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x05A8,40); dhrmain[0] = 0; movmem(ptr2+idx,0x05A8,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0628,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0628,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x06A8,40); dhrmain[0] = 0; movmem(ptr2+idx,0x06A8,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0728,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0728,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x07A8,40); dhrmain[0] = 0; movmem(ptr2+idx,0x07A8,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0450,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0450,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x04D0,40); dhrmain[0] = 0; movmem(ptr2+idx,0x04D0,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0550,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0550,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x05D0,40); dhrmain[0] = 0; movmem(ptr2+idx,0x05D0,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0650,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0650,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x06D0,40); dhrmain[0] = 0; movmem(ptr2+idx,0x06D0,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x0750,40); dhrmain[0] = 0; movmem(ptr2+idx,0x0750,40); idx += 80;
+ dhraux[0] = 0; movmem(ptr1+idx,0x07D0,40); dhrmain[0] = 0; movmem(ptr2+idx,0x07D0,40);
+ break;
+
+ case 1016:
+ /* is it a bsaved image */
+ c = read(fh,lodebuf,1016);
+ close(fh);
+ if (c != 1016)break;
+
+ /* switch to auxilliary memory - page2 */
+ *dhraux = 0;
+ movmem(ptr1,0x0400,1016);
+
+ /* switch back to main memory - page1 */
+ *dhrmain = 0;
+ fh = open(name1,O_RDONLY,0x3C); /* open a binary DL2 file */
+ if (fh == -1) {
+ status = -1;
+ break;
+ }
+ c = read(fh,lodebuf,1016);
+ close(fh);
+ if (c != 1016)break;
+
+ /* switch back to main memory - page1 */
+ *dhrmain = 0;
+ movmem(ptr1,0x0400,1016);
+
+ status=0;
+ break;
+ }
+
+ /* switch back to main memory - page1 */
+ *dhrmain = 0;
+
+ return status;
+}
+
diff --git a/AppleX/GRAPHICS/DLODELO.R b/AppleX/GRAPHICS/DLODELO.R
new file mode 100644
index 0000000..17a052e
Binary files /dev/null and b/AppleX/GRAPHICS/DLODELO.R differ
diff --git a/AppleX/GRAPHICS/DLOFONT.C b/AppleX/GRAPHICS/DLOFONT.C
new file mode 100644
index 0000000..11a4fd0
--- /dev/null
+++ b/AppleX/GRAPHICS/DLOFONT.C
@@ -0,0 +1,78 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dlofont.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: March 28, 2013
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern char __chr[1096];
+
+int dlomsk[]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
+int dlofont(str,row,col,fg,bg,scale)
+char *str;
+int row,col,fg,bg,scale;
+{
+ int target, scanline, offset, r, r2, c, d, byte, nibble, x, color;
+ unsigned char ch;
+
+
+ if (scale > 2)scale = 1;
+
+ target = strlen(str);
+ for(scanline=0;scanline<8;scanline++)
+ {
+
+ /* set values for vertical term */
+ /* expand x scale in the vertical direction */
+ r = (scanline * scale) + row; /* max 16 high */
+ if (r > 47)break;
+ r2 = r + 1;
+
+ /* run the string 8 times
+ if scale =2 then print a double line
+ each time which gives us a font of 16 high */
+ for (byte=0;byte 79)continue;
+
+ d = str[byte]&0x7f;
+ if (d < 32)d = 32;
+ offset = ((d-32) * 8) + scanline;
+ ch = __chr[offset];
+
+
+ for (nibble=0;nibble<7;nibble++)
+ {
+
+ x = c+nibble;
+ if (x > 79)break;
+
+ if (ch & dlomsk[6-nibble]){
+ color = fg;
+ }
+ else {
+ if (bg < 0)continue;
+ color = bg;
+ }
+ dloplot(x,r, color);
+ if (scale > 1)dloplot(x,r2,color);
+
+ }
+
+ }
+ }
+ return 0;
+
+}
diff --git a/AppleX/GRAPHICS/DLOFONT.R b/AppleX/GRAPHICS/DLOFONT.R
new file mode 100644
index 0000000..a4f8996
Binary files /dev/null and b/AppleX/GRAPHICS/DLOFONT.R differ
diff --git a/AppleX/GRAPHICS/DLOPIXEL.C b/AppleX/GRAPHICS/DLOPIXEL.C
new file mode 100644
index 0000000..a0bf2cf
--- /dev/null
+++ b/AppleX/GRAPHICS/DLOPIXEL.C
@@ -0,0 +1,33 @@
+
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dlopixel.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: March 28, 2013
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+/* double lo-res routine */
+
+setdlopixel(color,x,y)
+int color, x, y;
+{
+ /* wrapper for ml routines */
+ /* dlosetcolor(color); */
+ dloplot(x, y, color);
+
+/* set back to main memory before returning to caller */
+
+#asm
+ sta $c054
+#endasm
+
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/DLOPIXEL.R b/AppleX/GRAPHICS/DLOPIXEL.R
new file mode 100644
index 0000000..ab32b2b
Binary files /dev/null and b/AppleX/GRAPHICS/DLOPIXEL.R differ
diff --git a/AppleX/GRAPHICS/DLORES.C b/AppleX/GRAPHICS/DLORES.C
new file mode 100644
index 0000000..0c4657d
--- /dev/null
+++ b/AppleX/GRAPHICS/DLORES.C
@@ -0,0 +1,189 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dlores.c
+Description : G2 Library Routine
+ Double Lo-Res and Double Hi-Res Routines
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use these routines for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* The same soft switch that changes normal hi-res into double hi-res
+ does the trick for lo-res also. Reading or writing $C05E will
+ double the resolution, and $C05F will put it back to normal. You
+ also have to be in 80-column mode.
+
+ http://www.txbobsc.com/aal/1987/aal8708.html
+
+*/
+
+
+mode80()
+{
+#asm
+ jsr $c300 ; TURN ON 80-COLUMN MODE
+#endasm
+}
+
+dloreson()
+{
+#asm
+ jsr $c300 ; TURN ON 80-COLUMN MODE
+ sta $c050 ; GRAPHICS
+ sta $c052 ; GRAPHICS ONLY, NOT MIXED
+ sta $c054 ; START IN MAIN MEM
+ sta $c056 ; LO-RES
+ sta $c05e ; DOUBLE
+#endasm
+}
+
+dhireson()
+{
+#asm
+ jsr $c300 ; TURN ON 80-COLUMN MODE
+ sta $c050 ; GRAPHICS
+ sta $c052 ; GRAPHICS ONLY, NOT MIXED
+ sta $c054 ; START IN MAIN MEM
+ sta $c057 ; HI-RES
+ sta $c05e ; DOUBLE
+#endasm
+}
+
+
+dlomixed()
+{
+#asm
+ sta $c053 ; MIXED TEXT/GRAPHICS
+#endasm
+}
+
+
+dlonotmixed()
+{
+#asm
+ sta $c052 ; GRAPHICS ONLY, NOT MIXED
+#endasm
+}
+
+
+clear1()
+{
+#asm
+ sta $c054 ; MAIN MEM
+ jsr $f832 ; CLEAR
+#endasm
+}
+
+
+clear2()
+{
+#asm
+ sta $c055 ; AUX MEM
+ jsr $f832 ; CLEAR
+#endasm
+}
+
+dloresoff()
+{
+#asm
+ sta $c051 ; TEXT
+ sta $c05f ; SINGLE
+ sta $c054 ; PAGE ONE
+#endasm
+}
+
+
+/* some functions to output text directly to the screen
+ in mixed mode double lo-res */
+
+/* base addresses for last 4 text lines */
+/* of primary text page */
+int dlotextbase[4]={
+ 0x0650,
+ 0x06D0,
+ 0x0750,
+ 0x07D0};
+
+dloputmain(c, ptr)
+char c, *ptr;
+{
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+ ptr[0] = c;
+
+}
+
+dloputaux(c, ptr)
+char c, *ptr;
+{
+
+#asm
+ sta $c055 ; AUX MEM
+#endasm
+ ptr[0] = c;
+}
+
+dloclear_bottom()
+{
+ char *crt;
+ int row, col;
+ char c = 32 + 128;
+
+ for (row = 0; row < 4; row++) {
+ crt = (char *)(dlotextbase[row]);
+ for (col = 0; col < 40; col++) {
+ dloputaux(c,crt);
+ dloputmain(c,crt);
+ *crt++;
+ }
+ }
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+}
+
+/* row = 0,0 to 3,79 in split screen mode */
+/* I am just going directly to the text screen address */
+/* and outputting a raw ascii value */
+dloprint_bottom(str,row,col)
+char *str;
+int row, col;
+{
+ char *crt;
+ char c;
+ int x, aux = 1, idx, jdx;
+
+ x = col / 2;
+ if (col % 2) aux = 0;
+
+ crt = (char *)(dlotextbase[row]+x);
+
+ idx = 0;
+ for (;;) {
+
+ c = str[idx]; idx++;
+ if (c == 0)break;
+ c+=128;
+ if (aux == 1) {
+ aux = 0;
+ dloputaux(c,crt);
+ }
+ else {
+ aux = 1;
+ dloputmain(c,crt);
+ *crt++;
+ }
+ }
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+}
diff --git a/AppleX/GRAPHICS/DLORES.R b/AppleX/GRAPHICS/DLORES.R
new file mode 100644
index 0000000..127ef4d
Binary files /dev/null and b/AppleX/GRAPHICS/DLORES.R differ
diff --git a/AppleX/GRAPHICS/DLORES2.C b/AppleX/GRAPHICS/DLORES2.C
new file mode 100644
index 0000000..c90559e
--- /dev/null
+++ b/AppleX/GRAPHICS/DLORES2.C
@@ -0,0 +1,230 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dlores2.c
+Description : G2 Library Routine
+ Double Lo-Res Routines
+
+ These Routines are modified
+ from my routines for Ordinary Lo-Res Mode
+ which can be found in lores.c.
+
+ Note: These routines do not apply to DHGR mode.
+
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 2.0 March 28, 2013
+Licence : You may use these routines for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* bank 0 color remapping to bank 1 color */
+unsigned char dloauxcolor[16] = {
+ 0,8,1,9,2,10,3,11,4,12,5,13,6,14,7,15};
+
+#define XREG 0
+#define YREG 1
+#define COLOREG 0
+
+#asm
+
+ instxt
+
+XVAL equ REGS
+YVAL equ REGS+1
+COLOR equ REGS
+
+#endasm
+
+unsigned char *dlobyteregptr = (unsigned char *)0x80;
+unsigned char *dloeolptr = (unsigned char *)0x2c;
+
+dloplot(x, y, color)
+{
+ int w, z = x;
+
+/* Double Lo-Res works the same way 80-column text does:
+ columns 0, 2, 4, ...78 are stored in AuxRAM,
+ and columns 1, 3, 5, ...79 are stored in MainRAM. */
+
+ x = z / 2;
+ w = x * 2;
+
+ if (z==w) dlobyteregptr[COLOREG] = dloauxcolor[color];
+ else dlobyteregptr[COLOREG] = (unsigned char)color;
+
+#asm
+ LDA COLOR ; Sets the plotting color to N, 0 <= N <= 15
+ JSR $F864
+#endasm
+
+ if (z!=w)
+ {
+#asm
+ sta $c054
+#endasm
+ }
+ else {
+#asm
+ sta $c055
+#endasm
+ }
+
+ /* load parameters into user regs */
+ dlobyteregptr[XREG] = x;
+ dlobyteregptr[YREG] = y;
+ /* make ml call */
+#asm
+ LDY XVAL ; Lo-Res Plot X (Horizontal) Coordinate (0-39)
+ LDA YVAL ; Lo-Res Plot Y (Vertical) Coordinate (0-39)
+ JSR $F800
+#endasm
+}
+
+dlogetcolor(x,y)
+{
+
+ int w, z = x;
+
+/* Double Lo-Res works the same way 80-column text does:
+ columns 0, 2, 4, ...78 are stored in AuxRAM,
+ and columns 1, 3, 5, ...79 are stored in MainRAM. */
+
+ x = z / 2;
+ w = x * 2;
+
+
+ if (z!=w)
+ {
+#asm
+ sta $c054
+#endasm
+ }
+ else {
+#asm
+ sta $c055
+#endasm
+ }
+
+ /* load parameters into user regs */
+ dlobyteregptr[XREG] = x;
+ dlobyteregptr[YREG] = y;
+ /* make ml call */
+#asm
+ LDY XVAL ; Lo-Res Plot X (Horizontal) Coordinate (0-39)
+ LDA YVAL ; Lo-Res Plot Y (Vertical) Coordinate (0-39)
+ JSR $F871 ; Result (0-15) in Accumulator
+ STA COLOR
+#endasm
+ /* return accumulator value in user reg */
+ return (int)dlobyteregptr[COLOREG];
+}
+
+dlohline(y, x1, x2, color)
+{
+ int x;
+
+ /* swap horizontal co-ordinates if out of order */
+ if (x1 > x2) {
+ x = x2;
+ x2 = x1;
+ x1 = x;
+ }
+
+ x2++;
+ for (x = x1; x < x2; x++) dloplot(x, y, color);
+
+}
+
+dlovline(x, y1, y2, color)
+{
+ int y, z=x;
+
+ /* swap co-ordinates if out of order */
+ if (y1 > y2) {
+ y = y2;
+ y2 = y1;
+ y1 = y;
+ }
+
+/* Double Lo-Res works the same way 80-column text does:
+ columns 0, 2, 4, ...78 are stored in AuxRAM,
+ and columns 1, 3, 5, ...79 are stored in MainRAM. */
+
+ x = z/2;
+ y = x * 2;
+
+ if (y==z) dlobyteregptr[COLOREG] = dloauxcolor[color];
+ else dlobyteregptr[COLOREG] = (unsigned char)color;
+
+#asm
+ LDA COLOR ; Sets the plotting color to N, 0 <= N <= 15
+ JSR $F864
+#endasm
+
+ if (y != z) /* odd pixel */
+ {
+#asm
+ sta $c054
+#endasm
+ }
+ else {
+#asm
+ sta $c055
+#endasm
+ }
+
+ /* load parameters into user regs */
+ dlobyteregptr[XREG] = x;
+ dlobyteregptr[YREG] = y1;
+ /* Bottom Y Coordinate (0-47) */
+ /* Store it at V2 Lo-res line end-point */
+ dloeolptr[YREG] = y2;
+ /* make ml call */
+#asm
+ LDY XVAL ; X Coordinate (0-39)
+ LDA YVAL ; Top Y Coordinate (0-47)
+ JSR $F828
+#endasm
+}
+
+
+dlobox(x1,y1,x2,y2,color)
+{
+
+ int x, y;
+
+ /* swap horizontal co-ordinates if out of order */
+ if (x1 > x2) {
+ x = x2;
+ x2 = x1;
+ x1 = x;
+ }
+
+ /* swap vertical co-ordinates if out of order */
+ if (y1 > y2) {
+ y = y2;
+ y2 = y1;
+ y1 = y;
+ }
+
+ y = x2 + 1;
+
+ for (x = x1; x < y; x++) dloplot(x, y1,color);
+ y1++;
+ y2--;
+ dlovline(x1, y1, y2, color);
+ dlovline(x2, y1, y2, color);
+ y2++;
+ for (x = x1; x < y; x++) dloplot(x, y2, color);
+
+/* set back to main memory before returning to caller
+ from "hi-level" routine */
+#asm
+ sta $c054
+#endasm
+
+}
diff --git a/AppleX/GRAPHICS/DLORES2.R b/AppleX/GRAPHICS/DLORES2.R
new file mode 100644
index 0000000..713acec
Binary files /dev/null and b/AppleX/GRAPHICS/DLORES2.R differ
diff --git a/AppleX/GRAPHICS/DMONBYTE.C b/AppleX/GRAPHICS/DMONBYTE.C
new file mode 100644
index 0000000..a9d8d10
--- /dev/null
+++ b/AppleX/GRAPHICS/DMONBYTE.C
@@ -0,0 +1,17 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dmonbyte.c
+Description : G2 Library Routine
+ Double Hi-Res 560 x 192 monochrome bitmasks
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+unsigned char dhbmono[] = {0x7e,0x7d,0x7b,0x77,0x6f,0x5f,0x3f};
+unsigned char dhwmono[] = {0x1,0x2,0x4,0x8,0x10,0x20,0x40};
diff --git a/AppleX/GRAPHICS/DMONBYTE.R b/AppleX/GRAPHICS/DMONBYTE.R
new file mode 100644
index 0000000..f970ac0
Binary files /dev/null and b/AppleX/GRAPHICS/DMONBYTE.R differ
diff --git a/AppleX/GRAPHICS/DMONCHAR.C b/AppleX/GRAPHICS/DMONCHAR.C
new file mode 100644
index 0000000..7501b4f
--- /dev/null
+++ b/AppleX/GRAPHICS/DMONCHAR.C
@@ -0,0 +1,76 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dmonchar.c
+Description : G2 Library Routine
+ Double Hi-Res 560 x 192 monochrome
+ reasonably quick Font Routine
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+extern unsigned DHRB[];
+extern char *dhraux;
+extern char __chr[1096];
+
+dhmonochar(d,x,y,color)
+{
+
+int xoff, offset, y1, aux = 1;
+unsigned char ch, *ptr;
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ if ((x%14) > 6) aux = 0;
+ xoff = x/14;
+
+ d &= 0x7f;
+ if (d < 32)d = 32;
+
+ for (y1 = 0; y1 < 8; y1++) {
+ ptr = (unsigned char *) (DHRB[y] + xoff);
+ y++;
+ if (y > 191)break;
+ offset = ((d-32) * 8) + y1;
+ if (color > 0)ch = __chr[offset];
+ else ch = __chr[offset]^0xff;
+ if (aux!=0)*dhraux = 0; /* select auxiliary memory */
+ *ptr = ch;
+ }
+
+/* reset to main memory */
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+}
+
+dmonoplots(str,x,y,color,justify)
+char *str,justify;
+int x,y,color;
+{
+ unsigned d, idx = 0;
+
+ if(str[0]!=0)
+ {
+ if (justify == 'm' || justify == 'M') {
+ idx = 0;
+ for (;;) {
+ idx++;
+ if (str[idx] == 0)break;
+ }
+ x -= ((idx * 7) / 2);
+ }
+
+ while((d=*str++)!=0){
+ dhmonochar(d,x,y,color); x+=7;
+ }
+ }
+}
+
diff --git a/AppleX/GRAPHICS/DMONCHAR.R b/AppleX/GRAPHICS/DMONCHAR.R
new file mode 100644
index 0000000..35f32c3
Binary files /dev/null and b/AppleX/GRAPHICS/DMONCHAR.R differ
diff --git a/AppleX/GRAPHICS/DMONLINE.C b/AppleX/GRAPHICS/DMONLINE.C
new file mode 100644
index 0000000..9fe62c2
--- /dev/null
+++ b/AppleX/GRAPHICS/DMONLINE.C
@@ -0,0 +1,60 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dmonline.c
+Description : G2 Library Routine
+ Double Hi-Res 560 x 192 monochrome
+ Bresenham Algorithm line drawing routine
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+dhmonoline(x1, y1, x2, y2, drawcolor)
+int x1, y1, x2, y2, drawcolor;
+{
+
+ int dx, dy, sx, sy, err, err2;
+
+ if(x1 < x2) {
+ dx = x2 - x1;
+ sx = 1;
+ }
+ else {
+ sx = -1;
+ dx = x1 - x2;
+ }
+
+ if(y1 < y2) {
+ sy = 1;
+ dy = y2 - y1;
+ }
+ else {
+ sy = -1;
+ dy = y1 - y2;
+ }
+
+ err = dx-dy;
+
+ for (;;) {
+ dhmonoplot(x1,y1,y1,drawcolor);
+
+ if(x1 == x2 && y1 == y2)break;
+
+ err2 = err*2;
+
+ if(err2 > (0-dy)) {
+ err = err - dy;
+ x1 = x1 + sx;
+ }
+
+ if(err2 < dx) {
+ err = err + dx;
+ y1 = y1 + sy;
+ }
+ }
+ return;
+}
diff --git a/AppleX/GRAPHICS/DMONLINE.R b/AppleX/GRAPHICS/DMONLINE.R
new file mode 100644
index 0000000..fc903db
Binary files /dev/null and b/AppleX/GRAPHICS/DMONLINE.R differ
diff --git a/AppleX/GRAPHICS/DMONPLOT.C b/AppleX/GRAPHICS/DMONPLOT.C
new file mode 100644
index 0000000..64375ab
--- /dev/null
+++ b/AppleX/GRAPHICS/DMONPLOT.C
@@ -0,0 +1,77 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dmonplot.c
+Description : G2 Library Routine
+ Double Hi-Res 560 x 192 x monochrome plot routine
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern unsigned DHRB[];
+extern unsigned char dhbmono[];
+extern unsigned char dhwmono[];
+
+int dhmonoplot(x,y1,y2,drawcolor)
+int x, y1, y2, drawcolor;
+{
+ int y, xoff, pixel, aux = 1;
+ unsigned char *ptr;
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ /* swap coordinates if out of order */
+ if (y1 > y2) {
+ y = y1;
+ y1 = y2;
+ y2 = y;
+ }
+
+ /* allow bi-directional scanline wrap */
+ if (x < 0) x+= 560;
+ if (x > 559) x-=560;
+
+ if (x < 0 || x > 559 || y1 < 0 || y2 > 191)return 0;
+
+ pixel = (x%14);
+ if (pixel > 6) {
+ pixel -= 7;
+ }
+ else {
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ }
+ xoff = x/14;
+
+ y2++;
+ for (y = y1; y < y2; y++) {
+
+ ptr = (unsigned char *) (DHRB[y] + xoff);
+
+ if (drawcolor != 0) {
+ /* white */
+ *ptr = *ptr | dhwmono[pixel]; /* inclusive OR */
+ }
+ else {
+ /* black */
+ *ptr = *ptr & dhbmono[pixel]; /* bitwise AND */
+ }
+ }
+
+/* reset to main memory */
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+
+return 0;
+
+}
diff --git a/AppleX/GRAPHICS/DMONPLOT.R b/AppleX/GRAPHICS/DMONPLOT.R
new file mode 100644
index 0000000..088981b
Binary files /dev/null and b/AppleX/GRAPHICS/DMONPLOT.R differ
diff --git a/AppleX/GRAPHICS/DPLODE.C b/AppleX/GRAPHICS/DPLODE.C
new file mode 100644
index 0000000..41f2e23
--- /dev/null
+++ b/AppleX/GRAPHICS/DPLODE.C
@@ -0,0 +1,172 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dplode.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color Image Loader
+ for dhx and dhr images.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+extern unsigned DHRB[];
+
+#define BLOCK_SIZE 1280
+
+int dplode(name)
+char *name;
+{
+ unsigned int target;
+ int fh,x,x1=0,x2=0,xcnt,y1=0,offset=0,bytes=0,bank=0;
+ unsigned char *ptra,*ptrm,ch,buf[BLOCK_SIZE],mainbuf[40],auxbuf[40];
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+
+ x = read(fh,buf,5);
+ if (x!= 5) {
+ close(fh);
+ return -1;
+ }
+
+ if (buf[0] == 'D' && buf[1] == 'H' && buf[3] == 80 && buf[4] == 192 && (buf[2] == 'R' || buf[2] == 'X')) {
+ ch = buf[2];
+ }
+ else {
+ close(fh);
+ return -2;
+ }
+
+ /* raster oriented raw data */
+ if (ch == 'R') {
+ /* read 12 blocks of 16 scanlines */
+ for (x = 0; x < 12; x++) {
+ if (read(fh,buf,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+ /* display */
+ for (x1 = 0, x2=40; x1 < BLOCK_SIZE; x1+=80,x2+=80) {
+
+ /* read the keyboard buffer */
+ /* stop if keypress */
+ ptra = (unsigned char*)0xC000;
+ if (ptra[0] > 127) {
+ x = 12;
+ break;
+ }
+
+ ptra = (unsigned char *)&buf[x1];
+ ptrm = (unsigned char *)&buf[x2];
+ target = DHRB[y1];
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ movmem(ptra,target,40);
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ movmem(ptrm,target,40);
+ y1++;
+ }
+ }
+ close(fh);
+ return 0; /* done and outa' here */
+ }
+
+
+ if (read(fh,buf,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+
+ /* raster oriented run-length encoded raw data */
+ target = DHRB[0];
+
+ do{
+
+ ch = buf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,buf,BLOCK_SIZE);
+ bytes = 0;
+ }
+
+ /* check to see if its raw */
+ /* if its not, run encoded */
+ if(0xC0 == (ch & 0xc0)){
+ xcnt = 0x3f & ch;
+ ch = buf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,buf,BLOCK_SIZE);
+ bytes = 0;
+ }
+ }
+ else
+ xcnt = 1;
+
+ for(x=0;x= 80) {
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ movmem(auxbuf,target,40);
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ movmem(mainbuf,target,40);
+ x1 = x2 = bank = 0;
+ y1++;
+ if (y1 >= 192)break;
+ target = DHRB[y1];
+
+ /* read the keyboard buffer */
+ /* stop if keypress */
+ ptra = (unsigned char*)0xC000;
+ if (ptra[0] > 127) {
+ y1 = 192;
+ offset = 15360;
+ break;
+ }
+
+ }
+ }
+ else break;
+
+ offset++;
+ }
+ if (y1 >= 192)break;
+
+ } while(offset<15360);
+
+ close(fh);
+
+ return 0;
+}
diff --git a/AppleX/GRAPHICS/DPLODE.R b/AppleX/GRAPHICS/DPLODE.R
new file mode 100644
index 0000000..007b4ed
Binary files /dev/null and b/AppleX/GRAPHICS/DPLODE.R differ
diff --git a/AppleX/GRAPHICS/DRAWLINE.C b/AppleX/GRAPHICS/DRAWLINE.C
new file mode 100644
index 0000000..0702e56
--- /dev/null
+++ b/AppleX/GRAPHICS/DRAWLINE.C
@@ -0,0 +1,76 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dlopixel.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: May 20, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#define BOX '\x01'
+
+drawline(x1, y1, x2, y2, dcolor,action)
+int x1, y1, x2, y2, dcolor;
+char action;
+{
+
+ /* make sure x2 is greater than x1 */
+ int temp;
+ if(x1 > x2)
+ {
+ temp=x1;
+ x1 = x2;
+ x2 = temp;
+ temp = y1;
+ y1 = y2;
+ y2 = temp;
+ }
+
+
+ switch(dcolor)
+ {
+
+
+ case 1 : if(action==BOX)
+ {
+ bdrw(x1,y1,x2,y1);
+ blineto(x2,y2);
+ blineto(x1,y2);
+ blineto(x1,y1);
+ break;
+ }
+ bdrw(x1,y1,x2,y2);
+ break;
+
+ case 2 : if(action==BOX)
+ {
+ rdrw(x1,y1,x2,y1);
+ rlineto(x2,y2);
+ rlineto(x1,y2);
+ rlineto(x1,y1);
+ break;
+ }
+ bdrw(x1,y1,x2,y2);
+ break;
+
+ default: if(action==BOX)
+ {
+ drw(x1,y1,x2,y1);
+ lineto(x2,y2);
+ lineto(x1,y2);
+ lineto(x1,y1);
+ break;
+ }
+ drw(x1,y1,x2,y2);
+
+ }
+
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/DRAWLINE.R b/AppleX/GRAPHICS/DRAWLINE.R
new file mode 100644
index 0000000..f00d4ea
Binary files /dev/null and b/AppleX/GRAPHICS/DRAWLINE.R differ
diff --git a/AppleX/GRAPHICS/DRBYTES.C b/AppleX/GRAPHICS/DRBYTES.C
new file mode 100644
index 0000000..bf4b830
--- /dev/null
+++ b/AppleX/GRAPHICS/DRBYTES.C
@@ -0,0 +1,158 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : drbytes.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color array
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+/*
+
+The following is logically reordered to match the lores
+color order...
+
+ Repeated
+ Binary
+ Color aux1 main1 aux2 main2 Pattern
+ Black 00 00 00 00 0000
+ Magenta 08 11 22 44 0001
+ Dark Blue 11 22 44 08 1000
+ Violet 19 33 66 4C 1001
+ Dark Green 22 44 08 11 0100
+ Grey1 2A 55 2A 55 0101
+ Medium Blue 33 66 4C 19 1100
+ Light Blue 3B 77 6E 5D 1101
+ Brown 44 08 11 22 0010
+ Orange 4C 19 33 66 0011
+ Grey2 55 2A 55 2A 1010
+ Pink 5D 3B 77 6E 1011
+ Green 66 4C 19 33 0110
+ Yellow 6E 5D 3B 77 0111
+ Aqua 77 6E 5D 3B 1110
+ White 7F 7F 7F 7F 1111
+
+*/
+
+/*
+
+#define LOBLACK 0
+#define LORED 1
+#define LODKBLUE 2
+#define LOPURPLE 3
+#define LODKGREEN 4
+#define LOGRAY 5
+#define LOMEDBLUE 6
+#define LOLTBLUE 7
+#define LOBROWN 8
+#define LOORANGE 9
+#define LOGREY 10
+#define LOPINK 11
+#define LOLTGREEN 12
+#define LOYELLOW 13
+#define LOAQUA 14
+#define LOWHITE 15
+
+*/
+
+/* the following array is based on the above */
+unsigned char dhrbytes[16][4] = {
+ 0x00,0x00,0x00,0x00,
+ 0x08,0x11,0x22,0x44,
+ 0x11,0x22,0x44,0x08,
+ 0x19,0x33,0x66,0x4C,
+ 0x22,0x44,0x08,0x11,
+ 0x2A,0x55,0x2A,0x55,
+ 0x33,0x66,0x4C,0x19,
+ 0x3B,0x77,0x6E,0x5D,
+ 0x44,0x08,0x11,0x22,
+ 0x4C,0x19,0x33,0x66,
+ 0x55,0x2A,0x55,0x2A,
+ 0x5D,0x3B,0x77,0x6E,
+ 0x66,0x4C,0x19,0x33,
+ 0x6E,0x5D,0x3B,0x77,
+ 0x77,0x6E,0x5D,0x3B,
+ 0x7F,0x7F,0x7F,0x7F};
+
+/* position of pixels in 4 byte pattern */
+/* remember that byte 0 and byte 2 are auxmem
+ and byte 1 and byte 3 are main mem
+ and the 4 bit pattern of the 7 pixels straddle
+ the two memory banks */
+
+/* 7 pixels = 4 bytes */
+
+/* left for reference...
+unsigned char dhrpattern[7][4] = {
+0,0,0,0,
+0,0,0,1,
+1,1,1,1,
+1,1,2,2,
+2,2,2,2,
+2,3,3,3,
+3,3,3,3};
+
+*/
+
+/* mask values to erase previous contents of pixels */
+/* for reference
+
+unsigned char dhrmsk[7][2] = {
+0x70, 0,
+0x0f, 0x7e,
+0x61, 0,
+0x1f, 0x7c,
+0x43, 0,
+0x3f, 0x78,
+0x07, 0};
+
+*/
+
+/* getpixel mask values - what color to use */
+/* for reference
+
+unsigned char dhrgetmsk[7][2] = {
+0x0f, 0,
+0x70, 0x01,
+0x1e, 0,
+0x60, 0x03,
+0x3c, 0,
+0x40, 0x07,
+0x78, 0};
+
+*/
+
+
+/* offset into base of memory frame "raster" of byte pairs for pixels */
+/* double hi-res xbase */
+/* for reference
+
+char DHB[140] = {
+0,0,0,0,0,0,0,
+2,2,2,2,2,2,2,
+4,4,4,4,4,4,4,
+6,6,6,6,6,6,6,
+8,8,8,8,8,8,8,
+10,10,10,10,10,10,10,
+12,12,12,12,12,12,12,
+14,14,14,14,14,14,14,
+16,16,16,16,16,16,16,
+18,18,18,18,18,18,18,
+20,20,20,20,20,20,20,
+22,22,22,22,22,22,22,
+24,24,24,24,24,24,24,
+26,26,26,26,26,26,26,
+28,28,28,28,28,28,28,
+30,30,30,30,30,30,30,
+32,32,32,32,32,32,32,
+34,34,34,34,34,34,34,
+36,36,36,36,36,36,36,
+38,38,38,38,38,38,38};
+
+*/
+
diff --git a/AppleX/GRAPHICS/DRBYTES.R b/AppleX/GRAPHICS/DRBYTES.R
new file mode 100644
index 0000000..f15a117
Binary files /dev/null and b/AppleX/GRAPHICS/DRBYTES.R differ
diff --git a/AppleX/GRAPHICS/DRFBOX.C b/AppleX/GRAPHICS/DRFBOX.C
new file mode 100644
index 0000000..13c6f96
--- /dev/null
+++ b/AppleX/GRAPHICS/DRFBOX.C
@@ -0,0 +1,118 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : drfbox.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color routine
+ Draws a filled box to the color specified
+ using double hi-res colors 0-15.
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern unsigned DHRB[];
+extern unsigned char dhrbytes[16][4];
+
+int dhrfbox(x1,y1,x2,y2,drawcolor)
+int x1,y1,x2,y2,drawcolor;
+{
+ unsigned int temp;
+ int y, x, packet, xorg, xend, prefix, postfix, idx, xoff;
+ unsigned char mainbuf[40], auxbuf[40];
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ if (x1 < 0 || x2 > 139 || y1 < 0 || y2 > 191)return 0;
+
+ /* convert pixels to 4 byte blocks and
+ calculate pixels before blocks */
+
+ prefix = x1;
+ while ((prefix%7)!=0) prefix++; /* advance to left side */
+
+ xorg = ((prefix / 7) * 4);
+
+ idx = x2 + 1;
+ xend = ((idx/7) * 4);
+
+ /* assign packet length */
+ idx = (xend-xorg);
+
+ /* if box width does not include a full 4 byte block
+ draw a filled box using a series of vertical lines */
+ if(idx < 4) {
+ x2 += 1;
+ for (x = x1; x < x2; x++)dhrvline(x,y1,y2,drawcolor);
+ return 0;
+ }
+
+ packet = idx / 2;
+ xoff = (xorg / 2);
+
+ switch (drawcolor)
+ {
+
+ case 15: /* white or black set the memory... */
+ setmem(auxbuf,packet,(unsigned char)0x7f);
+ setmem(mainbuf,packet,(unsigned char)0x7f);
+ break;
+ case 0: setmem(auxbuf,packet,(unsigned char)0);
+ setmem(mainbuf,packet,(unsigned char)0);
+ break;
+
+ default:
+ /* other colors */
+ /* expand byte pairs to build scanline buffers */
+ /* interleaf 7 pixels between main and aux memory */
+ for (idx = 0; idx < packet; idx++) {
+ auxbuf[idx] = dhrbytes[drawcolor][0];
+ mainbuf[idx] = dhrbytes[drawcolor][1];
+ idx++;
+ auxbuf[idx] = dhrbytes[drawcolor][2];
+ mainbuf[idx] = dhrbytes[drawcolor][3];
+ }
+ }
+
+
+ /* first write the horizontal pixel blocks */
+ y = y1;
+ y2++;
+ while(y x1; x--) dhrvline(x,y1,y2,drawcolor);
+ }
+
+ postfix = ((xend / 4) * 7) - 1;
+ if (postfix != x2) {
+ x2++;
+ for (x = postfix;x < x2; x++) dhrvline(x,y1,y2,drawcolor);
+ }
+
+return 0;
+}
+
diff --git a/AppleX/GRAPHICS/DRFBOX.R b/AppleX/GRAPHICS/DRFBOX.R
new file mode 100644
index 0000000..029642e
Binary files /dev/null and b/AppleX/GRAPHICS/DRFBOX.R differ
diff --git a/AppleX/GRAPHICS/DRFLOOD.C b/AppleX/GRAPHICS/DRFLOOD.C
new file mode 100644
index 0000000..fcdf15b
--- /dev/null
+++ b/AppleX/GRAPHICS/DRFLOOD.C
@@ -0,0 +1,142 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : drflood.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color routine
+ Draws a filled box to the color specified
+ using double hi-res colors 0-16.
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+/* note: the original version of dhrflood which was distributed with
+ the DOS 3.3 G3 Library was buggy. this version is called in pixels
+ also but works only in 4 byte blocks. */
+
+/* consider using dhrfbox instead of this routine unless you are not doing
+ other plotting and you want to do something like clear the screen which
+ does not require pixel level accuracy */
+
+extern unsigned DHRB[];
+extern unsigned char dhrbytes[16][4];
+extern char *dhrmain;
+extern char *dhraux;
+
+int dhrflood(x1,y1,x2,y2,drawcolor)
+int x1,y1,x2,y2,drawcolor;
+{
+
+ /* draws a filled box to the color specified */
+ /* using double hi-res colors 0-16 */
+ unsigned int temp;
+ int x, packet, xorg, xend, idx, xoff;
+ unsigned char *ptr, mainbuf[40], auxbuf[40];
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ if (x1 < 0 || x2 > 139 || y1 < 0 || y2 > 191)return 0;
+
+ /* convert pixels to 4 byte blocks - for now */
+
+ x = x1;
+ while ((x%7)!=0) x ++; /* advance to left side of box */
+
+ xorg = ((x / 7) * 4);
+
+ idx = x2 + 1;
+ xend = ((idx/7) * 4);
+
+ /* assign packet length */
+ idx = (xend-xorg);
+
+ if(idx < 4) return 0;
+
+ packet = idx / 2;
+ xoff = (xorg / 2);
+
+ if (drawcolor < 1 || drawcolor > 16) drawcolor = 0;
+
+ switch (drawcolor)
+ {
+ case 16:
+ /* pseudo-color 16 */
+ /* inverse video */
+ y2++;
+ while(y1
+
+
+/* The convention of calling the second image a .AUX file is
+ supported in this loader when loading a 2 part file... the load is
+ split in the middle after loading the first half into auxiliary
+ memory */
+
+extern unsigned DHRB[];
+extern char *dhrmain;
+extern char *dhraux;
+
+int dlode(name)
+char *name;
+{
+ int fh, status=-2;
+ int c, fa = 0, fl = 8192, jdx, idx;
+ char name2[64];
+
+ jdx = 999;
+ for (idx = 0; name[idx] != 0; idx++) {
+ name2[idx] = name[idx];
+ if (name[idx] == '.') jdx = idx;
+ }
+ name2[idx] = 0;
+
+ if (jdx != 999) name2[jdx] = 0;
+ strcat(name2,".AUX");
+
+ fl = 8192;
+ fh = open(name2,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) {
+ fl = 16384;
+ fh = open(name,O_RDONLY,0x3C);
+ if (fh == -1)return -1;
+ }
+
+
+ switch(fl) {
+ case 16384:
+ case 8192:
+ /* read to auxiliary memory */
+ *dhraux = 0;
+ c = read(fh,(char *)DHRB[0],8192);
+ if (c != 8192)break;
+ if (fl == 8192) {
+ close(fh);
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1)return -1;
+
+ }
+ /* read to main memory */
+ *dhrmain = 0;
+ c = read(fh,(char *)DHRB[0],8192);
+ if (c != 8192)break;
+ status=0;
+ break;
+ }
+
+ close(fh);
+
+ return status;
+}
diff --git a/AppleX/GRAPHICS/DRLODE.R b/AppleX/GRAPHICS/DRLODE.R
new file mode 100644
index 0000000..a2ce4c9
Binary files /dev/null and b/AppleX/GRAPHICS/DRLODE.R differ
diff --git a/AppleX/GRAPHICS/DRMAIN.C b/AppleX/GRAPHICS/DRMAIN.C
new file mode 100644
index 0000000..ce0738e
--- /dev/null
+++ b/AppleX/GRAPHICS/DRMAIN.C
@@ -0,0 +1,23 @@
+
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : drmain.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color mode
+ and
+ Double Lo-Res Mode
+ Global Soft Switches for Main Mem and Aux Mem.
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+/* the following soft switches select between
+ upper and lower banks of video memory */
+
+char *dhrmain = (char *)49236;
+char *dhraux = (char *)49237;
diff --git a/AppleX/GRAPHICS/DRMAIN.R b/AppleX/GRAPHICS/DRMAIN.R
new file mode 100644
index 0000000..2c5d371
Binary files /dev/null and b/AppleX/GRAPHICS/DRMAIN.R differ
diff --git a/AppleX/GRAPHICS/DWAIT.C b/AppleX/GRAPHICS/DWAIT.C
new file mode 100644
index 0000000..5b6191b
--- /dev/null
+++ b/AppleX/GRAPHICS/DWAIT.C
@@ -0,0 +1,100 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dwait.c
+Description : G2 Library Routine
+ Wait for a period of seconds or until a key is pressed.
+ See comments below.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* The timing loop function for dlode's slideshow feature is
+ below these comments but first some words about timing loops... */
+
+/* In the BASUC DHGR SLIDE.SHOW example that came with BEAGLE GRAPHICS a
+ single loop construct with a value of 30 loops per second of
+ duration was used:
+
+B=0
+FOR J = 1 TO TIME(I) * 30
+ IF PEEK ( - 16286) > 127 THEN J = TIME(I) * 44
+ IF PEEK ( - 16287) > 127 THEN J = TIME(I) * 44:B = 1
+ IF PEEK ( - 16384) = 155 THEN POKE - 16368,0: & TEXT : END
+NEXT J
+
+When I modified the BEAGLE code to add keyboard navigation for my own
+version (which is in pure Applesoft and doesn't use the BEAGLE DHGR
+extension module), with all due respect for Mark Simonsen, I
+discovered that my extra code shown below didn't affect the timing,
+which shouldn't surprise anyone since Applesoft is dogslow.
+
+My code below is commented... I am not a big fan of one-liners or
+even applesoft in particular but dlode is fundamentally doing the
+same thing as the BASUC version without the paddles when it comes
+to its slideshow logic so give it a quick read:
+
+FOR J = 1 TO TIME(I) * 30
+ REM PADDLE BUTTONS
+ IF PEEK ( - 16286) > 127 THEN J = TIME(I) * 44
+ IF PEEK ( - 16287) > 127 THEN J = TIME(I) * 44:B = 1
+ K = PEEK ( - 16384)
+ REM ESCAPE KEY, ANY KEY, LEFT ARROW, UP ARROW
+ IF K = 155 THEN POKE - 16368,0: GOTO 700
+ IF K > 127 THEN POKE - 16368,0: J = TIME(I) * 44 : REM ANY KEY
+ IF K = 136 THEN B = 1 : REM LEFT ARROW - BACK
+ IF K = 139 THEN B = 1 : REM UP ARROW - BACK
+NEXT J
+
+By comparison dlode's timing loop is about 30 times or so faster
+than interpreted Applesoft which shouldn't surprise anyone, and
+if there is a trick here, it is simply in balancing my double loop
+while I check for keypresses and using a large enough number to
+accomodate the quicker code in Aztec C.
+
+*/
+
+/* timing loop function for slideshow */
+#define XTIME 1024L
+#define YTIME 32L
+
+/* duration is (hopefully) in seconds on a stock Apple //e without accelerator */
+/* use long integers for timing loop to avoid overflow */
+/* folks with faster machines can enter larger timeout values from the
+ command line and folks with slower disc drives can enter lower
+ timeout values if they need to... if a timing loop was
+ good enough for the BEAGLES then who am I to complain. */
+wait(duration,xmult,yterm)
+int duration;
+long xmult,yterm;
+{
+ long x, y;
+ int key = 0;
+
+ x=(xmult*duration)/yterm;
+
+ while (x > 0L) {
+ y=yterm;
+ while (y > 0L) {
+ y--;
+ key = kbhit();
+ if (key!=0) y = 0L;
+ }
+ x--;
+ if (key!=0) x = 0L;
+ }
+
+ /* clear stragglers from the keyboard if any */
+ if (key != 0) {
+ clearkey();
+ while (kbhit())clearkey();
+ }
+
+ return key;
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/DWAIT.R b/AppleX/GRAPHICS/DWAIT.R
new file mode 100644
index 0000000..61a1e57
Binary files /dev/null and b/AppleX/GRAPHICS/DWAIT.R differ
diff --git a/AppleX/GRAPHICS/DXBLOCK.C b/AppleX/GRAPHICS/DXBLOCK.C
new file mode 100644
index 0000000..7cbb028
--- /dev/null
+++ b/AppleX/GRAPHICS/DXBLOCK.C
@@ -0,0 +1,75 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dxblock.c
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color routine.
+ Screen Width Color Block Line.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern unsigned DHRB[];
+extern unsigned char dhrbytes[16][4];
+
+/* produces screen width lines with only 1 color
+ useful when called from my fullscreen XCrunched Image Decoder routines */
+/* also handy for clearing the DHGR screen */
+dxdblock(y, y2, color)
+unsigned int y,y2,color;
+{
+ unsigned int target, a;
+ int x;
+ unsigned char mainbuf[40], auxbuf[40];
+
+ if (color == 0) { /* black */
+ setmem(auxbuf,40,0);
+ setmem(mainbuf,40,0);
+ }
+ else {
+
+ a = color & 0xf; /* handles xcrunched colors and color indices 0-15 */
+
+ if (a == 15) { /* white */
+ setmem(auxbuf,40,0x7f);
+ setmem(mainbuf,40,0x7f);
+
+ }
+ else {
+ /* other colors */
+ /* expand byte pairs to build scanline buffers */
+ /* interleaf 7 pixels between main and aux memory */
+ for (x = 0; x < 40; x++) {
+ auxbuf[x] = dhrbytes[a][0];
+ mainbuf[x] = dhrbytes[a][1];
+ x++;
+ auxbuf[x] = dhrbytes[a][2];
+ mainbuf[x] = dhrbytes[a][3];
+ }
+ }
+ }
+
+ /* now write the pixels */
+ y2++;
+ while(y> 4);
+
+ if (ci == 0) {
+ /* skip black pixels - buffers are initially black */
+ if (p == 6) {
+ p= -1;
+ i+=2;
+ j+=2;
+ }
+ }
+ else {
+ switch(p) {
+ case 0: abuf[i] = dhapix[ci][0]; /* 00001111 4 bits */
+ break;
+ case 1: abuf[i] = (abuf[i] | dhapix[ci][1]);/* 01110000 3 bits */
+ mbuf[i] = dhmpix[ci][1]; /* 00000001 1 bit */
+ break;
+ case 2: mbuf[i] = (mbuf[i] | dhmpix[ci][2]);/* 00011110 4 bits */
+ break;
+ case 3: mbuf[i] = (mbuf[i] | dhmpix[ci][3]);/* 01100000 2 bits */
+ abuf[j] = dhapix[ci][3]; /* 00000011 2 bits */
+ break;
+ case 4: abuf[j] = (abuf[j] | dhapix[ci][4]);/* 00111100 4 bits */
+ break;
+ case 5: abuf[j] = (abuf[j] | dhapix[ci][5]);/* 01000000 1 bit */
+ mbuf[j] = dhmpix[ci][5]; /* 00000111 3 bits */;
+ break;
+ case 6: mbuf[j] = (mbuf[j] | dhmpix[ci][6]);/* 01111000 4 bits */
+ p = -1;
+ i+=2;
+ j+=2;
+ }
+ }
+ }
+ }
+
+
+ /* display the scanline */
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ movmem(abuf,target,40);
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ movmem(mbuf,target,40);
+
+}
+
+
diff --git a/AppleX/GRAPHICS/DXLINE.R b/AppleX/GRAPHICS/DXLINE.R
new file mode 100644
index 0000000..856659f
Binary files /dev/null and b/AppleX/GRAPHICS/DXLINE.R differ
diff --git a/AppleX/GRAPHICS/DXLODE.C b/AppleX/GRAPHICS/DXLODE.C
new file mode 100644
index 0000000..9a913e6
--- /dev/null
+++ b/AppleX/GRAPHICS/DXLODE.C
@@ -0,0 +1,499 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dxlode.c (inline version - does not use dxline.c)
+Description : G2 Library Routine
+ Double Hi-Res 140 x 192 x 16 color Image Loader.
+ Load an xcrunched image to the screen
+ in either format.
+
+ Note: See dxlode2.c for the modular version of
+ this code. This inline version works slightly
+ faster than the modular version but is a little
+ larger.
+
+ The code in putrax.c that I wrote afew years back
+ might offer an easier read if you just want to look
+ at some simpler code that uses ZSoft PCX RLE but be
+ forewarned that putrax operates on raw data and does
+ not decode bitmapped indices like this code does.
+
+ Nevertheless it is a layer or two of indirection
+ simpler... and a guy needs a place to start unless
+ he's done some of these before and also knows his
+ Apple II graphics and some other stuff that I hope
+ will rub-off when he gets what I am doing here.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+extern unsigned DHRB[];
+extern unsigned char dhrbytes[16][4];
+extern unsigned char dhapix[16][7];
+extern unsigned char dhmpix[16][7];
+
+
+/* note: BLOCK_SIZE (see below) has been set to match the read loop for
+ non-RLE images... before you change this read the code... and change
+ the other define (BLOCKS) accordingly.
+
+ The non-RLE code reads 12 blocks of 16 scanline indices.
+ doubling the size of this buffer made very little difference
+ in the loading of these images during my testing. I never bothered
+ to test a smaller buffer size much because I decided that it was
+ acceptable for my purposes to give up 1K or so of memory for
+ a read buffer.
+
+ If you do make BLOCK_SIZE larger or smaller stay within even multiples...
+
+ a smaller BLOCK_SIZE of 560 will use 560 bytes less memory but require
+ twice as many reads. It will cause this code to read 24 blocks of
+ 8 scanlines.
+
+ a larger BLOCK_SIZE of 2240 will use 1120 bytes more memory and will
+ require half the the reads. It will cause this code to read 6 blocks
+ of 32 scanlines.
+
+
+ */
+
+
+/* the following 3 defines are constant and must not be changed
+ unless you are modifying this code to handle variable size images (image fragments)
+ in my format... or modifying this code for other screen modes or for
+ something compltely different of course... */
+
+#define IMAGE_LINES 192
+#define IMAGE_LINE 70
+/* 192 * 70 = 13440 */
+#define IMAGE_SIZE 13440
+
+/* the following 2 defines must be equal multiples of IMAGE_LINE
+ and must be equally divisible by image size.
+ see notes above and code below */
+#define BLOCKS 12
+/* BLOCK_SIZE = (IMAGE_SIZE / BLOCKS) */
+#define BLOCK_SIZE 1120
+/* BLOCK_LINES = (BLOCK_SIZE / IMAGE_LINE) */
+
+unsigned char dxreadbuf[BLOCK_SIZE];
+
+/* load a raw xcrunched dhgr image */
+int dxrclode(name)
+char *name;
+{
+ unsigned int target;
+ register int x1=0, z, i, j, ci, p;
+ int fh,x,y=0,cnt,r;
+ unsigned char *ptr,c,ch,mbuf[40],abuf[40];
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+
+ x = read(fh,dxreadbuf,5); /* read header */
+ if (x!= 5) {
+ close(fh);
+ return -1;
+ }
+
+ /* check header */
+ if (dxreadbuf[0] != 'X' || dxreadbuf[1] != 'R' || dxreadbuf[2] != 'C' ||
+ dxreadbuf[3] != 140 || dxreadbuf[4] != 192) {
+ close(fh);
+ return -2;
+ }
+
+ /* read 12 blocks of 16 scanline indices */
+ /* doubling the size of this buffer made very little difference
+ in the loading of these images during my testing */
+ for (cnt = 0; cnt < BLOCKS; cnt++) {
+ if (read(fh,dxreadbuf,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+ /* decode and display */
+ for (x = 0; x < BLOCK_SIZE; x+=IMAGE_LINE) {
+
+ /* read the keyboard buffer */
+ /* stop if keypress */
+ ptr = (unsigned char*)0xC000;
+ if (ptr[0] > 127) {
+ cnt = BLOCKS;
+ break;
+ }
+
+ ptr = (unsigned char *)&dxreadbuf[x];
+
+ /* check for lines with only 1 color */
+ r = 1; /* repeat = true */
+ c = ptr[0]; /* store first byte per line */
+ for (x1 = 1; x1 < IMAGE_LINE; x1++) {
+ if (c != ptr[x1]) {
+ /* multiple colors */
+ r = 0; break; /* repeat = false */
+ }
+ }
+
+ /* multiple colors - repeat = false */
+ if (r==0) {
+
+ /* decode and display scanline */
+ /* set buffers to black */
+ setmem(abuf,40,0);
+ setmem(mbuf,40,0);
+
+ i=0, j=1, ci, p=-1;
+
+ /* decode the scanline indices */
+ for (x1 = 0; x1 < IMAGE_LINE; x1++) {
+ /* unpack the 2 colors */
+ /* map the low nibble first */
+ c = ptr[x1];
+ ci = (int )(c & 0xf);
+ for(z=0;z<2;z++) {
+ p++;
+ if (z==1)ci = (int )(c >> 4);
+
+ if (ci == 0) {
+ /* skip black pixels - buffers are initially black */
+ if (p == 6) {
+ p= -1;
+ i+=2;
+ j+=2;
+ }
+ }
+ else {
+ switch(p) {
+ case 0: abuf[i] = dhapix[ci][0]; /* 00001111 4 bits */
+ break;
+ case 1: abuf[i] = (abuf[i] | dhapix[ci][1]);/* 01110000 3 bits */
+ mbuf[i] = dhmpix[ci][1]; /* 00000001 1 bit */
+ break;
+ case 2: mbuf[i] = (mbuf[i] | dhmpix[ci][2]);/* 00011110 4 bits */
+ break;
+ case 3: mbuf[i] = (mbuf[i] | dhmpix[ci][3]);/* 01100000 2 bits */
+ abuf[j] = dhapix[ci][3]; /* 00000011 2 bits */
+ break;
+ case 4: abuf[j] = (abuf[j] | dhapix[ci][4]);/* 00111100 4 bits */
+ break;
+ case 5: abuf[j] = (abuf[j] | dhapix[ci][5]);/* 01000000 1 bit */
+ mbuf[j] = dhmpix[ci][5]; /* 00000111 3 bits */;
+ break;
+ case 6: mbuf[j] = (mbuf[j] | dhmpix[ci][6]);/* 01111000 4 bits */
+ p = -1;
+ i+=2;
+ j+=2;
+ }
+ }
+ }
+ }
+ target = DHRB[y];
+ /* display the scanline */
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ movmem(abuf,target,40);
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ movmem(mbuf,target,40);
+ }
+ else {
+
+ /* only 1 color - repeat = true */
+
+ if (c == 0) { /* black */
+ setmem(abuf,40,0);
+ setmem(mbuf,40,0);
+ }
+ else {
+
+ ci = (int )(c & 0xf); /* color indices 1-14 */
+
+ if (ci == 15) { /* white */
+ setmem(abuf,40,0x7f);
+ setmem(mbuf,40,0x7f);
+
+ }
+ else {
+ /* other colors */
+ /* expand byte pairs to build scanline buffers */
+ /* interleaf 7 pixels between main and aux memory */
+ for (i = 0; i < 40; i++) {
+ abuf[i] = dhrbytes[ci][0];
+ mbuf[i] = dhrbytes[ci][1];
+ i++;
+ abuf[i] = dhrbytes[ci][2];
+ mbuf[i] = dhrbytes[ci][3];
+ }
+ }
+ }
+
+ /* now write the pixels */
+ target = DHRB[y];
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ movmem(abuf,target,40);
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ movmem(mbuf,target,40);
+ }
+ /* set to next line */
+ y++;
+ }
+ }
+ close(fh);
+ return 0;
+
+}
+
+/* load a pcx run-length encoded xcrunched dhgr image */
+int dxcclode(name)
+char *name;
+{
+ unsigned int target;
+ register int x1=0, z, i, j, ci, p;
+ int fh,x,xcnt,y1=0,offset=0,bytes=0,r;
+ unsigned char *ptr, ch, c, xbuf[IMAGE_LINE], mbuf[40], abuf[40];
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+
+ x = read(fh,dxreadbuf,5); /* read header */
+ if (x!= 5) {
+ close(fh);
+ return -1;
+ }
+
+ /* check header */
+ if (dxreadbuf[0] != 'X' || dxreadbuf[1] != 'C' || dxreadbuf[2] != 'C' ||
+ dxreadbuf[3] != 140 || dxreadbuf[4] != 192) {
+ close(fh);
+ return -2;
+ }
+
+ /* we don't know how many reads we need to make but to be somewhat careful
+ we check our first read of image data outside the pcx decoder and if successful
+ we don't check for read errors again */
+ if (read(fh,dxreadbuf,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+
+ do{
+
+ ch = dxreadbuf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,dxreadbuf,BLOCK_SIZE);
+ bytes = 0;
+ }
+
+ /* check to see if its raw */
+ /* if its not, run encoded */
+ if(0xC0 == (ch & 0xc0)){
+ xcnt = 0x3f & ch;
+ ch = dxreadbuf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,dxreadbuf,BLOCK_SIZE);
+ bytes = 0;
+ }
+ }
+ else
+ xcnt = 1;
+
+ for(x=0;x= IMAGE_LINE) {
+
+ /* read the keyboard buffer */
+ /* stop if keypress */
+ ptr = (unsigned char*)0xC000;
+ if (ptr[0] > 127) {
+ y1 = IMAGE_LINES;
+ offset = IMAGE_SIZE;
+ break;
+ }
+
+ /* this version of dxlode has the display code inline (below).
+ it is slightly faster than the modular version
+ but it is also slightly larger since the display code
+ is duplicated for run-lenth encoded images and
+ non-run-length encoded images.
+
+ this version is also one heck of a lot harder to
+ read than the modular version and I should add, it was
+ harder to write since I needed to write several
+ inline versions to create the modular version, and
+ then used the modular version to create the inline
+ version.
+
+ I also messed with encoding image data directly before
+ encoding pixel-level indices after being completely
+ disgusted with the poor compression that raw data yielded
+ despite much quicker load times.
+
+ Raw data has its place however... see the comments
+ in my xpack utility for a place to start for
+ my raw data compression version which is complimented
+ by the loader code in the G2 library routine dplode.c
+ and the dplode command line loader for the Aztec C Shell
+ in the Applex\projects\dhr\shell directory.
+
+
+ */
+
+ /* multiple colors - repeat = false */
+ if (r == 0) {
+
+ /* decode and display scanline */
+ /* set buffers to black */
+ setmem(abuf,40,0);
+ setmem(mbuf,40,0);
+
+ i=0, j=1, ci, p=-1;
+
+ /* decode the scanline indices */
+ for (x1 = 0; x1 < IMAGE_LINE; x1++) {
+ /* unpack the 2 colors */
+ /* map the low nibble first */
+ c = xbuf[x1];
+ ci = (int )(c & 0xf);
+ for(z=0;z<2;z++) {
+ p++;
+ if (z==1)ci = (int )(c >> 4);
+
+ if (ci == 0) {
+ /* skip black pixels - buffers are initially black */
+ if (p == 6) {
+ p= -1;
+ i+=2;
+ j+=2;
+ }
+ }
+ else {
+ switch(p) {
+ case 0: abuf[i] = dhapix[ci][0]; /* 00001111 4 bits */
+ break;
+ case 1: abuf[i] = (abuf[i] | dhapix[ci][1]);/* 01110000 3 bits */
+ mbuf[i] = dhmpix[ci][1]; /* 00000001 1 bit */
+ break;
+ case 2: mbuf[i] = (mbuf[i] | dhmpix[ci][2]);/* 00011110 4 bits */
+ break;
+ case 3: mbuf[i] = (mbuf[i] | dhmpix[ci][3]);/* 01100000 2 bits */
+ abuf[j] = dhapix[ci][3]; /* 00000011 2 bits */
+ break;
+ case 4: abuf[j] = (abuf[j] | dhapix[ci][4]);/* 00111100 4 bits */
+ break;
+ case 5: abuf[j] = (abuf[j] | dhapix[ci][5]);/* 01000000 1 bit */
+ mbuf[j] = dhmpix[ci][5]; /* 00000111 3 bits */;
+ break;
+ case 6: mbuf[j] = (mbuf[j] | dhmpix[ci][6]);/* 01111000 4 bits */
+ p = -1;
+ i+=2;
+ j+=2;
+ }
+ }
+ }
+ }
+ target = DHRB[y1];
+ /* display the scanline */
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ movmem(abuf,target,40);
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ movmem(mbuf,target,40);
+ }
+ else {
+ /* only 1 color - repeat = true */
+
+ if (c == 0) { /* black */
+ setmem(abuf,40,0);
+ setmem(mbuf,40,0);
+ }
+ else {
+
+ ci = (int )(c & 0xf); /* color indices 1-14 */
+
+ if (ci == 15) { /* white */
+ setmem(abuf,40,0x7f);
+ setmem(mbuf,40,0x7f);
+
+ }
+ else {
+ /* other colors */
+ /* expand byte pairs to build scanline buffers */
+ /* interleaf 7 pixels between main and aux memory */
+ for (i = 0; i < 40; i++) {
+ abuf[i] = dhrbytes[ci][0];
+ mbuf[i] = dhrbytes[ci][1];
+ i++;
+ abuf[i] = dhrbytes[ci][2];
+ mbuf[i] = dhrbytes[ci][3];
+ }
+ }
+ }
+
+ /* now write the pixels */
+ target = DHRB[y1];
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ movmem(abuf,target,40);
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ movmem(mbuf,target,40);
+ }
+
+ /* set to next line */
+ x1 = 0;
+ y1++;
+ if (y1 >= IMAGE_LINES)break;
+ }
+ }
+ else break;
+
+ offset++;
+ }
+ if (y1 >= IMAGE_LINES)break;
+
+ } while(offset
+
+extern unsigned DHRB[];
+extern char *dhrmain;
+extern char *dhraux;
+
+#define BLOCK_SIZE 1024
+
+
+/* LUT's (look-up tables) for discrete DHGR colors */
+
+/* auxiliary memory */
+unsigned char dhapix[16][7] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x08,0x00,0x00,0x02,0x20,0x00,0x00,
+0x01,0x10,0x00,0x00,0x04,0x40,0x00,
+0x09,0x10,0x00,0x02,0x24,0x40,0x00,
+0x02,0x20,0x00,0x00,0x08,0x00,0x00,
+0x0A,0x20,0x00,0x02,0x28,0x00,0x00,
+0x03,0x30,0x00,0x00,0x0C,0x40,0x00,
+0x0B,0x30,0x00,0x02,0x2C,0x40,0x00,
+0x04,0x40,0x00,0x01,0x10,0x00,0x00,
+0x0C,0x40,0x00,0x03,0x30,0x00,0x00,
+0x05,0x50,0x00,0x01,0x14,0x40,0x00,
+0x0D,0x50,0x00,0x03,0x34,0x40,0x00,
+0x06,0x60,0x00,0x01,0x18,0x00,0x00,
+0x0E,0x60,0x00,0x03,0x38,0x00,0x00,
+0x07,0x70,0x00,0x01,0x1C,0x40,0x00,
+0x0F,0x70,0x00,0x03,0x3C,0x40,0x00};
+
+/* main memory */
+unsigned char dhmpix[16][7] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x01,0x10,0x00,0x00,0x04,0x40,
+0x00,0x00,0x02,0x20,0x00,0x00,0x08,
+0x00,0x01,0x12,0x20,0x00,0x04,0x48,
+0x00,0x00,0x04,0x40,0x00,0x01,0x10,
+0x00,0x01,0x14,0x40,0x00,0x05,0x50,
+0x00,0x00,0x06,0x60,0x00,0x01,0x18,
+0x00,0x01,0x16,0x60,0x00,0x05,0x58,
+0x00,0x00,0x08,0x00,0x00,0x02,0x20,
+0x00,0x01,0x18,0x00,0x00,0x06,0x60,
+0x00,0x00,0x0A,0x20,0x00,0x02,0x28,
+0x00,0x01,0x1A,0x20,0x00,0x06,0x68,
+0x00,0x00,0x0C,0x40,0x00,0x03,0x30,
+0x00,0x01,0x1C,0x40,0x00,0x07,0x70,
+0x00,0x00,0x0E,0x60,0x00,0x03,0x38,
+0x00,0x01,0x1E,0x60,0x00,0x07,0x78};
+
+
+/* read and xunch an xcrunched image to the screen */
+
+/* These are raster oriented 4 bit color indexes in the range 0-15
+ which map to the double low-res color order. Each byte contains
+ 2 pixels which results in a packet length of 70 bytes rather than
+ the 80 bytes required for the Apple II display. Indexes for even pixels
+ are stored in the low nibble and indexes for odd pixels are stored
+ in the high nibble.
+
+ Also by dealing with only the visible portion of Apple II
+ screen memory, additional space saving over a BSaved image is possible.
+
+ To further save disk space, each raster's color indexes are compressed
+ using ZSoft PCX RLE (run-length encoding).
+
+ When we unpack these we remap the indexes to colors using a LUT (look-up table).
+*/
+int dxlode(name)
+char *name;
+{
+ int fh,pattern=0,x,x1=0,xcnt,y1=0,z,offset=0,width,height,target,bytes=0;
+ unsigned char ch,color,buf[BLOCK_SIZE],*ptr;
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+ x = read(fh,buf,5);
+
+ if (x!= 5) {
+ close(fh);
+ return -1;
+ }
+
+ if (buf[0] == 'X' && buf[1] == 'C' && buf[2] == 'C') {
+ width = buf[3];
+ height = buf[4];
+ }
+ else {
+ close(fh);
+ return -2;
+
+ }
+
+ if (read(fh,buf,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+
+ width = width/2;
+ target = width * height;
+ ptr = (unsigned char *)DHRB[y1];
+
+ do{
+
+ ch = buf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,buf,BLOCK_SIZE); bytes = 0;
+ }
+
+ /* check to see if its raw */
+ /* if its not, run encoded */
+ if(0xC0 == (ch & 0xc0)){
+ xcnt = 0x3f & ch;
+ ch = buf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,buf,BLOCK_SIZE); bytes = 0;
+ }
+ }
+ else
+ xcnt = 1;
+
+ for(x=0;x>= 4;
+ for (z = 0; z < 2; z++ ) {
+ switch(pattern) {
+ case 0:
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *ptr = dhapix[color][0]; /* 00001111 4 bits */
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ pattern++;
+ break;
+ case 1:
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *ptr |= dhapix[color][1]; /* 01110000 3 bits */
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ *ptr = dhmpix[color][1]; /* 00000001 1 bit */
+ pattern++;
+ break;
+ case 2:
+ *ptr |= dhmpix[color][2]; /* 00011110 4 bits */
+ pattern++;
+ break;
+ case 3:
+ *ptr |= dhmpix[color][3]; /* 01100000 2 bits */
+ *ptr++;
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *ptr = dhapix[color][3]; /* 00000011 2 bits */
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ pattern++;
+ break;
+ case 4:
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *ptr |= dhapix[color][4]; /* 00111100 4 bits */
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ pattern++;
+ break;
+ case 5:
+ #asm
+ sta $c055 ; AUX MEM
+ #endasm
+ *ptr |= dhapix[color][5]; /* 01000000 1 bit */
+ #asm
+ sta $c054 ; MAIN MEM
+ #endasm
+ *ptr = dhmpix[color][5]; /* 00000111 3 bits */
+ pattern++;
+ break;
+ case 6:
+ *ptr |= dhmpix[color][6]; /* 01111000 4 bits */
+ *ptr++;
+ pattern = 0;
+
+ }
+
+ color = ch; /* double assignment to avoid conditional */
+ }
+ /* move down one raster every 70 bytes */
+ x1++;
+ if (x1 >= width) {
+ x1 = pattern = 0;
+ y1++;
+ if (y1 >= height)break;
+ ptr = (unsigned char *)DHRB[y1];
+ }
+ }
+ else break;
+
+ offset++;
+ }
+ if (y1 >= height)break;
+
+ } while(offset
+
+extern unsigned DHRB[];
+extern char *dhrmain;
+extern char *dhraux;
+
+#define BLOCK_SIZE 256
+
+
+dxraster(xorg, y, mainbuf, auxbuf, packet)
+int xorg, y, packet;
+char *mainbuf, *auxbuf;
+{
+ int offset = xorg;
+
+ while ((offset%7)!=0) offset++; /* advance to left side */
+ offset = ((offset / 7) * 4);
+ offset = (offset / 2);
+ offset=DHRB[y]+offset;
+
+ *dhraux = 0; /* select auxiliary memory */
+ movmem(auxbuf,offset,packet);
+ *dhrmain = 0; /* reset to main memory */
+ movmem(mainbuf,offset,packet);
+
+ return;
+}
+
+
+/* read and xunch an xcrunched image to the screen */
+int dxlode(name,xorg,yorg)
+char *name;
+int xorg,yorg;
+{
+ int fh, c, status=0, pattern;
+ int x, x1, xcnt, xmain, xaux, y1, z;
+ int offset=0,width,height,target, packet,bytes, cnt;
+ unsigned char ch, color, mainbuf[40], auxbuf[40], buf[BLOCK_SIZE];;
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+ c = read(fh,buf,5);
+
+ if (c!= 5) {
+ close(fh);
+ return -1;
+ }
+
+ if (buf[0] == 'X' && buf[1] == 'C' && buf[2] == '2') {
+ width = buf[3];
+ height = buf[4];
+ }
+ else {
+ close(fh);
+ return -2;
+
+ }
+
+ if (read(fh,buf,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+
+
+ width = width/2;
+ packet = (width * 4)/7;
+ target = (width * height);
+
+ bytes = cnt = x1 = y1 = status = 0;
+
+ do{
+
+ ch = buf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,buf,BLOCK_SIZE); bytes = 0;
+ }
+
+ /* check to see if its raw */
+ /* if its not, run encoded */
+ if(0xC0 == (ch & 0xc0)){
+ xcnt = 0x3f & ch;
+ ch = buf[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,buf,BLOCK_SIZE); bytes = 0;
+ }
+ }
+ else
+ xcnt = 1;
+
+ for(x=0;x> 4;
+
+ xaux = xmain = (x1/7);
+ pattern = cnt%7;
+ cnt++;
+ switch(pattern) {
+ case 0:
+ auxbuf[xaux] = color; /* 00001111 4 bits */
+ break;
+ case 1:
+ auxbuf[xaux] |= ((color << 4) & 0x70); /* 01110000 3 bits */
+ mainbuf[xmain] = ((color >> 3)& 0x01); /* 00000001 1 bit */
+ break;
+ case 2:
+ mainbuf[xmain] |= (color <<1); /* 00011110 4 bits */
+ break;
+ case 3:
+ mainbuf[xmain] |= ((color << 5) & 0x60); /* 01100000 2 bits */
+ xaux++ ; /* second byte in auxiliary memory byte pair */
+ auxbuf[xaux] = ((color >> 2) & 0x03); /* 00000011 2 bits */
+ break;
+ case 4:
+ xaux++ ; /* second byte in auxiliary memory byte pair */
+ auxbuf[xaux] = ((color << 2) & 0x3c); /* 00111100 4 bits */
+ break;
+ case 5:
+ xaux++; /* second byte in auxiliary memory byte pair */
+ auxbuf[xaux] |= ((color << 6) & 0x40); /* 01000000 1 bit */
+ xmain++; /* second byte in main memory byte pair */
+ mainbuf[xmain] = ((color >> 1) & 0x07); /* 00000111 3 bits */
+ break;
+ case 6:
+ xmain++; /* second byte in main memory byte pair */
+ mainbuf[xmain] |= ((color << 3) & 0x78); /* 01111000 4 bits */
+
+ }
+ }
+ x1++;
+ if (x1 >= width) {
+ /* move scanline to screen */
+ dxraster(xorg, y1 + yorg, mainbuf, auxbuf, packet);
+ cnt = x1 = 0;
+ y1++;
+ if (y1 >= height)break;
+ }
+ }
+ else break;
+
+ offset++;
+ }
+ if (y1 >= height)break;
+
+ } while(offset
+
+#define BLOCK_SIZE 1120
+unsigned char dxreadbuf2[BLOCK_SIZE];
+
+/* load a raw xcrunched dhgr image */
+int dxrclode2(name)
+char *name;
+{
+ int fh,x,x1,y=0,i,r;
+ unsigned char *ptr,c;
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+
+ x = read(fh,dxreadbuf2,5); /* read header */
+ if (x!= 5) {
+ close(fh);
+ return -1;
+ }
+
+ /* check header */
+ if (dxreadbuf2[0] != 'X' || dxreadbuf2[1] != 'R' || dxreadbuf2[2] != 'C' ||
+ dxreadbuf2[3] != 140 || dxreadbuf2[4] != 192) {
+ close(fh);
+ return -2;
+ }
+
+ /* read 12 blocks of 16 scanline indices */
+ for (i = 0; i < 12; i++) {
+ if (read(fh,dxreadbuf2,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+ /* decode and display */
+ for (x = 0; x < BLOCK_SIZE; x+=70) {
+
+ /* read the keyboard buffer */
+ /* stop if keypress */
+ ptr = (unsigned char*)0xC000;
+ if (ptr[0] > 127) {
+ i = 12;
+ break;
+ }
+
+ ptr = (unsigned char *)&dxreadbuf2[x];
+
+ /* check for lines with only 1 color */
+ r = 1;
+ c = ptr[0];
+ for (x1 = 1; x1 < 70; x1++) {
+ if (c != ptr[x1]) {
+ dxdline(y,ptr); /* multiple colors */
+ r = 0;
+ break;
+ }
+ }
+ if (r!=0) dxdblock(y,y,(unsigned int)c); /* only 1 color */
+ y++;
+ }
+ }
+ close(fh);
+ return 0;
+
+}
+
+
+/* load a pcx run-length encoded xcrunched dhgr image */
+int dxcclode2(name)
+char *name;
+{
+ int fh,x,xcnt,x1=0,y1=0,offset=0,bytes=0,r=1;
+ unsigned char *ptr, ch, cmp, xbuf[70];
+
+#asm
+ sta $c054 ; MAIN MEM
+#endasm
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+
+ x = read(fh,dxreadbuf2,5); /* read header */
+ if (x!= 5) {
+ close(fh);
+ return -1;
+ }
+
+ /* check header */
+ if (dxreadbuf2[0] != 'X' || dxreadbuf2[1] != 'C' || dxreadbuf2[2] != 'C' ||
+ dxreadbuf2[3] != 140 || dxreadbuf2[4] != 192) {
+ close(fh);
+ return -2;
+ }
+
+ /* we don't know how many reads we need to make but to be somewhat careful
+ we check our first read of image data outside the pcx decoder and if successful
+ we don't check for read errors again */
+ if (read(fh,dxreadbuf2,BLOCK_SIZE) < BLOCK_SIZE) {
+ close(fh);
+ return -3;
+ }
+
+ do{
+
+ ch = dxreadbuf2[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,dxreadbuf2,BLOCK_SIZE);
+ bytes = 0;
+ }
+
+ /* check to see if its raw */
+ /* if its not, run encoded */
+ if(0xC0 == (ch & 0xc0)){
+ xcnt = 0x3f & ch;
+ ch = dxreadbuf2[bytes]; bytes++;
+ if (bytes == BLOCK_SIZE) {
+ read(fh,dxreadbuf2,BLOCK_SIZE);
+ bytes = 0;
+ }
+ }
+ else
+ xcnt = 1;
+
+ for(x=0;x= 70) {
+
+ /* read the keyboard buffer */
+ /* stop if keypress */
+ ptr = (unsigned char*)0xC000;
+ if (ptr[0] > 127) {
+ y1 = 192;
+ offset = 13440;
+ break;
+ }
+
+ /* decode and display scanline */
+ if (r!=0) {
+ dxdblock(y1,y1,(unsigned int)cmp); /* only 1 color */
+ }
+ else {
+ dxdline(y1,xbuf); /* multiple colors */
+ }
+ x1 = 0;
+ y1++;
+ if (y1 >= 192)break;
+ }
+ }
+ else break;
+
+ offset++;
+ }
+ if (y1 >= 192)break;
+
+ } while(offset<13440);
+
+ close(fh);
+
+ return 0;
+}
diff --git a/AppleX/GRAPHICS/DXLODE2.R b/AppleX/GRAPHICS/DXLODE2.R
new file mode 100644
index 0000000..116bccd
Binary files /dev/null and b/AppleX/GRAPHICS/DXLODE2.R differ
diff --git a/AppleX/GRAPHICS/DXLUT.C b/AppleX/GRAPHICS/DXLUT.C
new file mode 100644
index 0000000..71be812
--- /dev/null
+++ b/AppleX/GRAPHICS/DXLUT.C
@@ -0,0 +1,61 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : dxlut.c
+Description : G2 Library Routine
+ LUT's (look-up tables) for discrete DHGR pixel color values
+ which correspond to the 7 pixels in the 4 byte block.
+ Using these to write DHGR pixels eliminates the need to
+ extract these values from the dhrbytes array at runtime
+ so results in slightly quicker code.
+
+ Quite abstract really... and in Lo-Res color order
+ for consistency with the other related G2 library routines.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* auxiliary memory */
+unsigned char dhapix[16][7] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x08,0x00,0x00,0x02,0x20,0x00,0x00,
+0x01,0x10,0x00,0x00,0x04,0x40,0x00,
+0x09,0x10,0x00,0x02,0x24,0x40,0x00,
+0x02,0x20,0x00,0x00,0x08,0x00,0x00,
+0x0A,0x20,0x00,0x02,0x28,0x00,0x00,
+0x03,0x30,0x00,0x00,0x0C,0x40,0x00,
+0x0B,0x30,0x00,0x02,0x2C,0x40,0x00,
+0x04,0x40,0x00,0x01,0x10,0x00,0x00,
+0x0C,0x40,0x00,0x03,0x30,0x00,0x00,
+0x05,0x50,0x00,0x01,0x14,0x40,0x00,
+0x0D,0x50,0x00,0x03,0x34,0x40,0x00,
+0x06,0x60,0x00,0x01,0x18,0x00,0x00,
+0x0E,0x60,0x00,0x03,0x38,0x00,0x00,
+0x07,0x70,0x00,0x01,0x1C,0x40,0x00,
+0x0F,0x70,0x00,0x03,0x3C,0x40,0x00};
+
+/* main memory */
+unsigned char dhmpix[16][7] = {
+0x00,0x00,0x00,0x00,0x00,0x00,0x00,
+0x00,0x01,0x10,0x00,0x00,0x04,0x40,
+0x00,0x00,0x02,0x20,0x00,0x00,0x08,
+0x00,0x01,0x12,0x20,0x00,0x04,0x48,
+0x00,0x00,0x04,0x40,0x00,0x01,0x10,
+0x00,0x01,0x14,0x40,0x00,0x05,0x50,
+0x00,0x00,0x06,0x60,0x00,0x01,0x18,
+0x00,0x01,0x16,0x60,0x00,0x05,0x58,
+0x00,0x00,0x08,0x00,0x00,0x02,0x20,
+0x00,0x01,0x18,0x00,0x00,0x06,0x60,
+0x00,0x00,0x0A,0x20,0x00,0x02,0x28,
+0x00,0x01,0x1A,0x20,0x00,0x06,0x68,
+0x00,0x00,0x0C,0x40,0x00,0x03,0x30,
+0x00,0x01,0x1C,0x40,0x00,0x07,0x70,
+0x00,0x00,0x0E,0x60,0x00,0x03,0x38,
+0x00,0x01,0x1E,0x60,0x00,0x07,0x78};
+
diff --git a/AppleX/GRAPHICS/DXLUT.R b/AppleX/GRAPHICS/DXLUT.R
new file mode 100644
index 0000000..6f9b0f4
Binary files /dev/null and b/AppleX/GRAPHICS/DXLUT.R differ
diff --git a/AppleX/GRAPHICS/EMSGET.C b/AppleX/GRAPHICS/EMSGET.C
new file mode 100644
index 0000000..35170c6
--- /dev/null
+++ b/AppleX/GRAPHICS/EMSGET.C
@@ -0,0 +1,31 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : emsget.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: June 20, 2008
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* copies a chunk of library data from auxmem
+ to a buffer */
+
+emsget(emsarraybase,buffer,len)
+unsigned emsarraybase;
+char *buffer;
+int len;
+{
+
+ /* the ems buffer starts above the 2nd page of text screen */
+ /* in auxiliary memory */
+
+ unsigned hitemp=emsarraybase+0x0C00;
+
+ auxtomain(hitemp,hitemp+len-1,&buffer[0]);
+}
diff --git a/AppleX/GRAPHICS/EMSGET.R b/AppleX/GRAPHICS/EMSGET.R
new file mode 100644
index 0000000..0822b19
Binary files /dev/null and b/AppleX/GRAPHICS/EMSGET.R differ
diff --git a/AppleX/GRAPHICS/EMSLODE.C b/AppleX/GRAPHICS/EMSLODE.C
new file mode 100644
index 0000000..aab4e63
--- /dev/null
+++ b/AppleX/GRAPHICS/EMSLODE.C
@@ -0,0 +1,151 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : emslode.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: June 5, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+
+/* the address of 2048 in main memory is used */
+/* for the ems signature which reserves 40 bytes */
+/* this is the first line of the text screen page 2 */
+/* the ems buffer start is set to 0x0C00 in aux memory */
+
+/* this is the area directly above the secondary page of video ram */
+/* the auxilliary memory map for the apple 2C indicates that areas */
+/* below this have memory "holes" which are reserved or assigned even */
+/* though zero page and the hardware stack finish at 0x200 */
+
+/* in Main Memory... */
+/* a 4000 byte buffer is used above where we store the font */
+/* at 0x0C00+1096+24 =4192 as a temporary IO buffer */
+/* to transfer the data to the upper ram banks */
+/* this avoids text screen page 2 and is below the prodos load address */
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+/* loads a library file */
+emslode(name,libsize)
+char *name;
+unsigned libsize;
+{
+ int fh;
+ int emscheck();
+ unsigned int i;
+ unsigned packet, straggler;
+ unsigned himem,lomem;
+
+ /* don't load the library if it's too big... */
+ /* don't load the library if it's in high memory already */
+ /* step 1... get the signature... this is the library name */
+ /* if the library is already in memory this will likely be there */
+ /* when we exit we erase this to make sure. */
+
+ /* step 2... compare and return -2 if it's already there */
+ /* otherwise continue */
+
+ if(libsize>46080)return -3;
+
+ if(emscheck(name)!=0)return -2;
+
+ if((fh = open(name,O_RDONLY,0xC3))==-1)
+ {
+ emsoff();
+ return -1;
+ }
+
+ packet= libsize/4000; /* primary number of reads */
+ straggler= libsize%4000; /* remainder of reads */
+
+ himem = 0x0C00;
+ lomem = 0x0C00+1096+24;
+
+ /* do the bulk of the work and then the remainder */
+
+
+ i=0;
+ while(i0)
+ {
+ read(fh,(char *)lomem,straggler);
+ maintoaux(lomem,lomem+straggler-1,himem);
+ }
+ close(fh);
+
+ strcpy((char *)2048,name);
+ /* Step 3... now do the signature... and return */
+ return 0;
+
+}
+
+
+
+/* sign off the upper memory at 2048 */
+/* the apple has no standard for this */
+/* unlike the IBM LIM convention */
+
+emscheck(name)
+char *name;
+{
+ char *sigbuf=(char *)2048;
+ int target;
+
+ unsigned int i;
+
+ /* don't load the library if it's in high memory already */
+ /* step 1... get the signature... this is the library name */
+ /* if the library is already in memory this will likely be there */
+ /* when we exit we erase this to make sure. */
+
+ target=strlen(name);
+
+ /* step 2... compare and return -2 if it's already there */
+ /* otherwise return 0 */
+
+ i=0;
+ while(i
+#include
+#include
+#include
+#include
+#include
+
+
+emsrag(name,emsarraybase)
+char *name;
+unsigned emsarraybase;
+{
+ int fh;
+ unsigned packet, straggler, lomem, himem, ragsize, i;
+ char height, width;
+
+ if((fh = open(name,O_RDONLY,0xC3))==-1)return -1;
+
+ read(fh,&width,1);
+ read(fh,&height,1);
+
+ ragsize = width;
+ ragsize *= height;
+
+ packet= ragsize/4000; /* primary number of reads */
+ straggler= ragsize%4000; /* remainder of reads */
+
+ lomem = 0x0C00+1096+24;
+ himem=emsarraybase+0x0C00;
+
+ /* do the bulk of the work and then the remainder */
+ i=0;
+ while(i0)
+ {
+ read(fh,(char *)lomem,straggler);
+ maintoaux(lomem,lomem+straggler-1,himem);
+ }
+ close(fh);
+
+ return 0;
+
+}
+
+
diff --git a/AppleX/GRAPHICS/EMSRAG.R b/AppleX/GRAPHICS/EMSRAG.R
new file mode 100644
index 0000000..16a4490
Binary files /dev/null and b/AppleX/GRAPHICS/EMSRAG.R differ
diff --git a/AppleX/GRAPHICS/EMSRIG.C b/AppleX/GRAPHICS/EMSRIG.C
new file mode 100644
index 0000000..c66a72f
--- /dev/null
+++ b/AppleX/GRAPHICS/EMSRIG.C
@@ -0,0 +1,86 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : emsrig.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: June 26, 2008
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* loads a rag from an open rib to himem */
+/* assumes that the rib contains rags and only rags
+ and that they are all the same size */
+/* emsputimage can then be used to display the image */
+
+
+/* the ems buffer start is set to 0x0C00 in aux memory */
+
+/* this is the area directly above the secondary page of video ram */
+/* the auxilliary memory map for the apple 2C indicates that areas */
+/* below this have memory "holes" which are reserved or assigned even */
+/* though zero page and the hardware stack finish at 0x200 */
+
+/* in Main Memory... */
+/* a 4000 byte buffer is used above where we store the font */
+/* at 0x0C00+1096+24 =4192 as a temporary IO buffer */
+/* to transfer the data to the upper ram banks */
+/* this avoids text screen page 2 and is below the prodos load address */
+
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+
+emsrig(fh,pos,width,height,emsarraybase)
+int fh, pos, width,height;
+unsigned emsarraybase;
+{
+ long lpos;
+ unsigned packet, straggler, lomem, himem, ragsize, i;
+
+ ragsize = width * height;
+
+ lpos = (long)ragsize;
+ lpos = lpos * (long)pos;
+
+ /* seek to the image */
+ /* lseek(fh, lpos, 0);*/
+
+ packet= ragsize/4000; /* primary number of reads */
+ straggler= ragsize%4000; /* remainder of reads */
+
+ lomem = 0x0C00+1096+24;
+ himem=emsarraybase+0x0C00;
+
+ /* do the bulk of the work and then the remainder */
+ i=0;
+ while(i0)
+ {
+ read(fh,(char *)lomem,straggler);
+ maintoaux(lomem,lomem+straggler-1,himem);
+ }
+
+
+ return 0;
+
+}
+
+
diff --git a/AppleX/GRAPHICS/EMSRIG.R b/AppleX/GRAPHICS/EMSRIG.R
new file mode 100644
index 0000000..bbe0ae0
Binary files /dev/null and b/AppleX/GRAPHICS/EMSRIG.R differ
diff --git a/AppleX/GRAPHICS/FBOX.C b/AppleX/GRAPHICS/FBOX.C
new file mode 100644
index 0000000..58caf04
--- /dev/null
+++ b/AppleX/GRAPHICS/FBOX.C
@@ -0,0 +1,83 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : fbox.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: July 7, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern unsigned HB[];
+
+fbox(x1,y1,x2,y2,drawcolor)
+int x1,y1,x2,y2,drawcolor;
+{
+ /* draws a filled box to the color specified */
+ int packet = (x2-x1)+1;
+ int temp,ctr;
+ char *ptr;
+ char c[2];
+
+ /* if on an odd byte boundary reverse color arg */
+ /* to match color mapping in the framebuffer */
+ if(x1%2!=0)
+ {
+ switch(drawcolor)
+ {
+ case 1 : drawcolor = 2; break;
+ case 2 : drawcolor = 1; break;
+ default: break;
+ }
+ }
+
+
+ /* set the color */
+ switch(drawcolor)
+ {
+ case 4 : break; /* inverse video box */
+ case 3 : c[0]='\xff'; c[1]='\xff'; /* white ... everything */
+ break;
+ case 2 : c[0]='\xaa'; c[1]='\xd5'; /* orange */
+ break;
+ case 1 : c[0]='\xd5'; c[1]='\xaa'; /* blue */
+ break;
+ default: c[0]='\x80';c[1]='\x80'; /* black ... nothing */
+ }
+
+ y2++;
+
+ /* now write the pixels */
+ while(y139)x-=40;
+ else whitey='\x00';
+ /* a reverse video flag... if x is 40 higher than it should be */
+
+ for(j=0,y2=y;j<=7;++j,++y2){
+
+ /* find address of char to be plotted */
+
+ if (y2>=0 && y2<=63){
+ ybase=0x4000;y1=y2;}
+ else if (y2>=64 && y2<=127){
+ ybase=0x4028;y1=(y2-64);}
+ else if (y2>=128 && y2<=191){
+ ybase=0x4050;y1=(y2-128);}
+
+ z=y1/8;
+
+ a=z*0x80+ybase;
+ yfin=(y1-(z*8))*0x400 +a;
+
+ if(!whitey)gs1[yfin+x]=filechar[(num-32)*8+j]|0x80;
+ else gs1[yfin+x]=(filechar[(num-32)*8+j]^whitey);
+ }
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/FILECHAR.R b/AppleX/GRAPHICS/FILECHAR.R
new file mode 100644
index 0000000..aa87aba
Binary files /dev/null and b/AppleX/GRAPHICS/FILECHAR.R differ
diff --git a/AppleX/GRAPHICS/FILEPLOT.C b/AppleX/GRAPHICS/FILEPLOT.C
new file mode 100644
index 0000000..3a808df
--- /dev/null
+++ b/AppleX/GRAPHICS/FILEPLOT.C
@@ -0,0 +1,34 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : fileplot.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: April 13, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+plots2(str,x,y,color)
+char *str;
+int x,y,color;
+{
+ char c;
+ if(color==4)x+=40; /* set reverse video flag */
+
+ if(str[0]!=0)
+ {
+ if(color!=0)
+ while((c=*str++)!=0)plotchar2(c,x++,y);
+ else
+ while((c=*str++)!=0)plotchar2(' ',x++,y);
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/FILEPLOT.R b/AppleX/GRAPHICS/FILEPLOT.R
new file mode 100644
index 0000000..d255fdf
Binary files /dev/null and b/AppleX/GRAPHICS/FILEPLOT.R differ
diff --git a/AppleX/GRAPHICS/FONTLODE.C b/AppleX/GRAPHICS/FONTLODE.C
new file mode 100644
index 0000000..ea3a91b
--- /dev/null
+++ b/AppleX/GRAPHICS/FONTLODE.C
@@ -0,0 +1,32 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : fonlode.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: June 4, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+fontlode()
+{
+ int fh;
+ fh = open("FATFONT.FNT",O_RDONLY,0xc3);
+ read(fh,(char *)0x0c00,1096);
+ close(fh);
+}
+
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/FONTLODE.R b/AppleX/GRAPHICS/FONTLODE.R
new file mode 100644
index 0000000..5eea04d
Binary files /dev/null and b/AppleX/GRAPHICS/FONTLODE.R differ
diff --git a/AppleX/GRAPHICS/FSCREEN.C b/AppleX/GRAPHICS/FSCREEN.C
new file mode 100644
index 0000000..82ad275
--- /dev/null
+++ b/AppleX/GRAPHICS/FSCREEN.C
@@ -0,0 +1,7 @@
+fscreen()
+{
+ char *tswitch=(char*)0xc052;
+
+ tswitch[0]=0x00; /* full screen */
+}
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/FSCREEN.R b/AppleX/GRAPHICS/FSCREEN.R
new file mode 100644
index 0000000..d8fd270
Binary files /dev/null and b/AppleX/GRAPHICS/FSCREEN.R differ
diff --git a/AppleX/GRAPHICS/GETCH.C b/AppleX/GRAPHICS/GETCH.C
new file mode 100644
index 0000000..0e3ec38
--- /dev/null
+++ b/AppleX/GRAPHICS/GETCH.C
@@ -0,0 +1,35 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : getch.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: March 9, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+getch()
+{
+ char *KEYPRESS = (char*)0xC000; /* return the last key press */
+ char *KEYCLEAR = (char*)0xC010; /* clear the last key press */
+ char c;
+ /* clear stragglers from the keyboard buffer */
+ while((c=KEYPRESS[0]) > 127)KEYCLEAR[0]=0;
+
+ /* read the keyboard buffer */
+ /* and return the character */
+ do{
+ c = KEYPRESS[0];
+ }while(c < 128);
+
+ c-=128;
+ KEYCLEAR[0]=0;
+ return (int )c;
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/GETCH.R b/AppleX/GRAPHICS/GETCH.R
new file mode 100644
index 0000000..02ccf7e
Binary files /dev/null and b/AppleX/GRAPHICS/GETCH.R differ
diff --git a/AppleX/GRAPHICS/GRAFMODE.C b/AppleX/GRAPHICS/GRAFMODE.C
new file mode 100644
index 0000000..2228652
--- /dev/null
+++ b/AppleX/GRAPHICS/GRAFMODE.C
@@ -0,0 +1,40 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : fbox2.c
+Description : G2 Library Routine
+ For Hi-Res Mode
+
+Written by : Bill Buckels
+Revision Date: January 9, 2010
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+#define PAGEONE poke(49236,0)
+#define PAGETWO poke(49237,0)
+#define TEXTMODE 0
+#define GRAFMODE 2 /* graphics only */
+
+setcrtmode(CRTMODE)
+unsigned int CRTMODE;
+{
+ switch(CRTMODE)
+ {
+ case TEXTMODE:
+ poke(49233,0);
+ PAGEONE;
+ break;
+ default :
+ poke(49239,0); /* hi res */
+ PAGETWO ; /* avoid prodos load address */
+ poke(49232,0); /* set graphics */
+ poke(49234,0); /* full graphics */
+
+ }
+
+}
diff --git a/AppleX/GRAPHICS/GRAFMODE.R b/AppleX/GRAPHICS/GRAFMODE.R
new file mode 100644
index 0000000..9daa8fa
Binary files /dev/null and b/AppleX/GRAPHICS/GRAFMODE.R differ
diff --git a/AppleX/GRAPHICS/GRAFMODX.C b/AppleX/GRAPHICS/GRAFMODX.C
new file mode 100644
index 0000000..75b80d5
--- /dev/null
+++ b/AppleX/GRAPHICS/GRAFMODX.C
@@ -0,0 +1,59 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : fbox2.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: December 24, 2012
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+#include
+
+
+/* Does not work with double res modes or for mixing 80
+ column text with standard hi-res and lo-res graphics
+ modes...
+
+ I have developed alternate single purposes routines which
+ in the end keep the code size smaller and are more
+ efficient than a kitchen-sink routine like this one.
+
+ Use those instead following the code samples that I have
+ provided.
+
+ */
+
+setcrtmodex(CRTMODE)
+unsigned int CRTMODE;
+{
+ switch(CRTMODE)
+ {
+ case TEXTMODE:
+ poke(49233,0);
+ PAGEONE;
+ break;
+
+
+ case LORES:
+ poke(49238,0); /* lo res */
+ PAGEONE;
+ poke(49232,0); /* set graphics */
+ poke(49234,0); /* full graphics */
+ loclear();
+ break;
+
+ case GRAFMODE:
+ default :
+ poke(49239,0); /* hi res */
+ PAGETWO; /* avoid prodos load address */
+ poke(49232,0); /* set graphics */
+ poke(49234,0); /* full graphics */
+
+ }
+
+}
diff --git a/AppleX/GRAPHICS/GRAFMODX.R b/AppleX/GRAPHICS/GRAFMODX.R
new file mode 100644
index 0000000..22de188
Binary files /dev/null and b/AppleX/GRAPHICS/GRAFMODX.R differ
diff --git a/AppleX/GRAPHICS/HBSH.R b/AppleX/GRAPHICS/HBSH.R
new file mode 100644
index 0000000..41aee4d
Binary files /dev/null and b/AppleX/GRAPHICS/HBSH.R differ
diff --git a/AppleX/GRAPHICS/HGR.C b/AppleX/GRAPHICS/HGR.C
new file mode 100644
index 0000000..88d52bf
--- /dev/null
+++ b/AppleX/GRAPHICS/HGR.C
@@ -0,0 +1,13 @@
+hgr()
+{
+ char *gswitch=(char*)0xc050;
+ char *hswitch=(char*)0xc055;
+ char *tswitch=(char*)0xc052;
+ char *mswitch=(char*)0xc057;
+
+ gswitch[0]=0x00; /* graphics */
+ hswitch[0]=0x00; /* secondary page */
+ tswitch[0]=0x00; /* full screen */
+ mswitch[0]=0x00; /* hi_res */
+}
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/HGR.R b/AppleX/GRAPHICS/HGR.R
new file mode 100644
index 0000000..54b4420
Binary files /dev/null and b/AppleX/GRAPHICS/HGR.R differ
diff --git a/AppleX/GRAPHICS/HIBASE.C b/AppleX/GRAPHICS/HIBASE.C
new file mode 100644
index 0000000..17cd5ee
--- /dev/null
+++ b/AppleX/GRAPHICS/HIBASE.C
@@ -0,0 +1,53 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : hibase2.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: March 3, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+/* use hibase2.c instead... this routine was modified from
+ the original aztec C library but it is too processor intensive
+ for real purposes... a table works best despite the larger
+ data segment... see hibase2.c */
+
+
+/* provides base address for page2 hires scanlines */
+/* does not bother to check whether we are in range */
+/* gets the address as quickly as possible */
+/* stays away from processor intensive mul and div */
+
+gethibase(currentline,currentbase)
+int currentline;
+int *currentbase;
+{
+ int ybase=0x4000,z,a;
+
+ if(currentline >63)
+ {
+ if (currentline < 128)
+ {
+ ybase+=0x28;
+ currentline-=64;
+ }
+ else
+ {
+ ybase+=0x50;
+ currentline-=128;
+ }
+ }
+
+ z=(currentline>>3);
+ a = (z<<7)|ybase;
+ *currentbase = (currentline - (z<<3))<<10 | a;
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/HIBASE.R b/AppleX/GRAPHICS/HIBASE.R
new file mode 100644
index 0000000..55b4638
Binary files /dev/null and b/AppleX/GRAPHICS/HIBASE.R differ
diff --git a/AppleX/GRAPHICS/HIBASE2.C b/AppleX/GRAPHICS/HIBASE2.C
new file mode 100644
index 0000000..a8da962
--- /dev/null
+++ b/AppleX/GRAPHICS/HIBASE2.C
@@ -0,0 +1,43 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : hibase2.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: June 5, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+/* provides base address for page2 hires scanlines */
+unsigned HB[]={
+0x4000, 0x4400, 0x4800, 0x4C00, 0x5000, 0x5400, 0x5800, 0x5C00,
+0x4080, 0x4480, 0x4880, 0x4C80, 0x5080, 0x5480, 0x5880, 0x5C80,
+0x4100, 0x4500, 0x4900, 0x4D00, 0x5100, 0x5500, 0x5900, 0x5D00,
+0x4180, 0x4580, 0x4980, 0x4D80, 0x5180, 0x5580, 0x5980, 0x5D80,
+0x4200, 0x4600, 0x4A00, 0x4E00, 0x5200, 0x5600, 0x5A00, 0x5E00,
+0x4280, 0x4680, 0x4A80, 0x4E80, 0x5280, 0x5680, 0x5A80, 0x5E80,
+0x4300, 0x4700, 0x4B00, 0x4F00, 0x5300, 0x5700, 0x5B00, 0x5F00,
+0x4380, 0x4780, 0x4B80, 0x4F80, 0x5380, 0x5780, 0x5B80, 0x5F80,
+0x4028, 0x4428, 0x4828, 0x4C28, 0x5028, 0x5428, 0x5828, 0x5C28,
+0x40A8, 0x44A8, 0x48A8, 0x4CA8, 0x50A8, 0x54A8, 0x58A8, 0x5CA8,
+0x4128, 0x4528, 0x4928, 0x4D28, 0x5128, 0x5528, 0x5928, 0x5D28,
+0x41A8, 0x45A8, 0x49A8, 0x4DA8, 0x51A8, 0x55A8, 0x59A8, 0x5DA8,
+0x4228, 0x4628, 0x4A28, 0x4E28, 0x5228, 0x5628, 0x5A28, 0x5E28,
+0x42A8, 0x46A8, 0x4AA8, 0x4EA8, 0x52A8, 0x56A8, 0x5AA8, 0x5EA8,
+0x4328, 0x4728, 0x4B28, 0x4F28, 0x5328, 0x5728, 0x5B28, 0x5F28,
+0x43A8, 0x47A8, 0x4BA8, 0x4FA8, 0x53A8, 0x57A8, 0x5BA8, 0x5FA8,
+0x4050, 0x4450, 0x4850, 0x4C50, 0x5050, 0x5450, 0x5850, 0x5C50,
+0x40D0, 0x44D0, 0x48D0, 0x4CD0, 0x50D0, 0x54D0, 0x58D0, 0x5CD0,
+0x4150, 0x4550, 0x4950, 0x4D50, 0x5150, 0x5550, 0x5950, 0x5D50,
+0x41D0, 0x45D0, 0x49D0, 0x4DD0, 0x51D0, 0x55D0, 0x59D0, 0x5DD0,
+0x4250, 0x4650, 0x4A50, 0x4E50, 0x5250, 0x5650, 0x5A50, 0x5E50,
+0x42D0, 0x46D0, 0x4AD0, 0x4ED0, 0x52D0, 0x56D0, 0x5AD0, 0x5ED0,
+0x4350, 0x4750, 0x4B50, 0x4F50, 0x5350, 0x5750, 0x5B50, 0x5F50,
+0x43D0, 0x47D0, 0x4BD0, 0x4FD0, 0x53D0, 0x57D0, 0x5BD0, 0x5FD0};
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/HIBASE2.R b/AppleX/GRAPHICS/HIBASE2.R
new file mode 100644
index 0000000..2227883
Binary files /dev/null and b/AppleX/GRAPHICS/HIBASE2.R differ
diff --git a/AppleX/GRAPHICS/HIBASE3.C b/AppleX/GRAPHICS/HIBASE3.C
new file mode 100644
index 0000000..71fdbdf
--- /dev/null
+++ b/AppleX/GRAPHICS/HIBASE3.C
@@ -0,0 +1,42 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : hibase3.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Dec 24, 2012
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+/* provides base address for page1 hires scanlines */
+
+unsigned DHRB[]={
+0x2000, 0x2400, 0x2800, 0x2C00, 0x3000, 0x3400, 0x3800, 0x3C00,
+0x2080, 0x2480, 0x2880, 0x2C80, 0x3080, 0x3480, 0x3880, 0x3C80,
+0x2100, 0x2500, 0x2900, 0x2D00, 0x3100, 0x3500, 0x3900, 0x3D00,
+0x2180, 0x2580, 0x2980, 0x2D80, 0x3180, 0x3580, 0x3980, 0x3D80,
+0x2200, 0x2600, 0x2A00, 0x2E00, 0x3200, 0x3600, 0x3A00, 0x3E00,
+0x2280, 0x2680, 0x2A80, 0x2E80, 0x3280, 0x3680, 0x3A80, 0x3E80,
+0x2300, 0x2700, 0x2B00, 0x2F00, 0x3300, 0x3700, 0x3B00, 0x3F00,
+0x2380, 0x2780, 0x2B80, 0x2F80, 0x3380, 0x3780, 0x3B80, 0x3F80,
+0x2028, 0x2428, 0x2828, 0x2C28, 0x3028, 0x3428, 0x3828, 0x3C28,
+0x20A8, 0x24A8, 0x28A8, 0x2CA8, 0x30A8, 0x34A8, 0x38A8, 0x3CA8,
+0x2128, 0x2528, 0x2928, 0x2D28, 0x3128, 0x3528, 0x3928, 0x3D28,
+0x21A8, 0x25A8, 0x29A8, 0x2DA8, 0x31A8, 0x35A8, 0x39A8, 0x3DA8,
+0x2228, 0x2628, 0x2A28, 0x2E28, 0x3228, 0x3628, 0x3A28, 0x3E28,
+0x22A8, 0x26A8, 0x2AA8, 0x2EA8, 0x32A8, 0x36A8, 0x3AA8, 0x3EA8,
+0x2328, 0x2728, 0x2B28, 0x2F28, 0x3328, 0x3728, 0x3B28, 0x3F28,
+0x23A8, 0x27A8, 0x2BA8, 0x2FA8, 0x33A8, 0x37A8, 0x3BA8, 0x3FA8,
+0x2050, 0x2450, 0x2850, 0x2C50, 0x3050, 0x3450, 0x3850, 0x3C50,
+0x20D0, 0x24D0, 0x28D0, 0x2CD0, 0x30D0, 0x34D0, 0x38D0, 0x3CD0,
+0x2150, 0x2550, 0x2950, 0x2D50, 0x3150, 0x3550, 0x3950, 0x3D50,
+0x21D0, 0x25D0, 0x29D0, 0x2DD0, 0x31D0, 0x35D0, 0x39D0, 0x3DD0,
+0x2250, 0x2650, 0x2A50, 0x2E50, 0x3250, 0x3650, 0x3A50, 0x3E50,
+0x22D0, 0x26D0, 0x2AD0, 0x2ED0, 0x32D0, 0x36D0, 0x3AD0, 0x3ED0,
+0x2350, 0x2750, 0x2B50, 0x2F50, 0x3350, 0x3750, 0x3B50, 0x3F50,
+0x23D0, 0x27D0, 0x2BD0, 0x2FD0, 0x33D0, 0x37D0, 0x3BD0, 0x3FD0};
diff --git a/AppleX/GRAPHICS/HIBASE3.R b/AppleX/GRAPHICS/HIBASE3.R
new file mode 100644
index 0000000..cb1e5e9
Binary files /dev/null and b/AppleX/GRAPHICS/HIBASE3.R differ
diff --git a/AppleX/GRAPHICS/HIBOX.C b/AppleX/GRAPHICS/HIBOX.C
new file mode 100644
index 0000000..1586db7
--- /dev/null
+++ b/AppleX/GRAPHICS/HIBOX.C
@@ -0,0 +1,94 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : hibox.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Jan 9, 2010
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern unsigned HB[];
+
+/* this version of fbox provides filled boxes in both hires palettes
+ and conforms to the standard Apple II hires color numbers.
+ it is not backwardly compatible due to my support for one
+ palette only in the past. c'est la vie */
+
+hibox(x1,y1,x2,y2,drawcolor)
+int x1,y1,x2,y2,drawcolor;
+{
+ /* draws a filled box to the color specified */
+ int packet = (x2-x1)+1;
+ int temp,ctr;
+ char *ptr;
+ char c[2];
+
+ /* if on an odd byte boundary reverse color arg */
+ /* to match color mapping in the framebuffer */
+ if(x1%2!=0)
+ {
+ switch(drawcolor)
+ {
+ case 1 : drawcolor = 2; break;
+ case 2 : drawcolor = 1; break;
+ default: break;
+ }
+ }
+
+
+ /* set the color */
+ switch(drawcolor)
+ {
+ case 8 : break; /* inverse video box */
+ case 7 : c[0]='\x7f'; c[1]='\x7f'; /* white ... everything */
+ break;
+ case 6 : c[0]='\x2a'; c[1]='\x55'; /* green */
+ break;
+ case 5 : c[0]='\x55'; c[1]='\x2a'; /* purple */
+ break;
+ case 4: c[0]='\x00';c[1]='\x00'; /* black ... nothing */
+ break;
+ case 3 : c[0]='\xff'; c[1]='\xff'; /* white ... everything */
+ break;
+ case 2 : c[0]='\xaa'; c[1]='\xd5'; /* orange */
+ break;
+ case 1 : c[0]='\xd5'; c[1]='\xaa'; /* blue */
+ break;
+ default: c[0]='\x80';c[1]='\x80'; /* black ... nothing */
+ }
+
+ y2++;
+
+ /* now write the pixels */
+ while(y1 127)KEYCLEAR[0]=0;
+}
diff --git a/AppleX/GRAPHICS/KEYCLR.R b/AppleX/GRAPHICS/KEYCLR.R
new file mode 100644
index 0000000..fba5632
Binary files /dev/null and b/AppleX/GRAPHICS/KEYCLR.R differ
diff --git a/AppleX/GRAPHICS/LIBLODE.C b/AppleX/GRAPHICS/LIBLODE.C
new file mode 100644
index 0000000..caf3910
--- /dev/null
+++ b/AppleX/GRAPHICS/LIBLODE.C
@@ -0,0 +1,40 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : liblode.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: June 23, 2008
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+#include
+#include
+#include
+#include
+#include
+
+/* loads a library file */
+int liblode(name,libsize)
+char *name;
+int libsize;
+{
+ int fh;
+ if(libsize>4000)libsize=4000;
+ fh = open(name,O_RDONLY,0xc3);
+
+ if (fh == -1) return 0;
+ read(fh,(char *)4192,libsize);
+ close(fh);
+
+ return 1;
+
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/LIBLODE.R b/AppleX/GRAPHICS/LIBLODE.R
new file mode 100644
index 0000000..ef0f8d4
Binary files /dev/null and b/AppleX/GRAPHICS/LIBLODE.R differ
diff --git a/AppleX/GRAPHICS/LINE.C b/AppleX/GRAPHICS/LINE.C
new file mode 100644
index 0000000..ba603ac
--- /dev/null
+++ b/AppleX/GRAPHICS/LINE.C
@@ -0,0 +1,120 @@
+int plot(), bplot(), gplot(), rplot(), vplot();
+
+drw(x1,y1,x2,y2)
+int x1,y1,x2,y2;
+{
+ comline(x1,y1,x2,y2,plot);
+}
+
+bdrw(x1,y1,x2,y2)
+int x1,y1,x2,y2;
+{
+ comline(x1,y1,x2,y2,bplot);
+}
+
+gdrw(x1,y1,x2,y2)
+int x1,y1,x2,y2;
+{
+ comline(x1,y1,x2,y2,gplot);
+}
+
+rdrw(x1,y1,x2,y2)
+int x1,y1,x2,y2;
+{
+ comline(x1,y1,x2,y2,rplot);
+}
+
+vdrw(x1,y1,x2,y2)
+int x1,y1,x2,y2;
+{
+ comline(x1,y1,x2,y2,vplot);
+}
+
+
+int __oldx=0, __oldy=0;
+
+lineto(x,y)
+int x,y;
+{
+ drw(__oldx,__oldy,x,y);
+}
+
+blineto(x,y)
+int x,y;
+{
+ bdrw(__oldx,__oldy,x,y);
+}
+
+glineto(x,y)
+int x,y;
+{
+ gdrw(__oldx,__oldy,x,y);
+}
+
+vlineto(x,y)
+int x,y;
+{
+ vdrw(__oldx,__oldy,x,y);
+}
+
+rlineto(x,y)
+int x,y;
+{
+ rdrw(__oldx,__oldy,x,y);
+}
+
+
+static int
+comline(x1,y1,x2,y2,func)
+int (*func)();
+{
+ register int dx,dy,ix,iy;
+ int e,ei,ed,i;
+
+ __oldx=x2; __oldy=y2;
+ dx=x2-x1;
+ dy=y2-y1;
+ ix=1;
+ if(dx<0)
+ { ix=-1;
+ dx=-dx;
+ }
+ iy=1;
+ if(dy<0)
+ { iy=-1;
+ dy=-dy;
+ }
+ if(dy>dx)
+ goto ylin;
+
+ ei=2*dy;
+ ed=ei-2*dx;
+ e=-dx+ei;
+ for(i=1;i<=dx;++i){
+ (*func)(x1,y1);
+ x1=x1+ix;
+ if(e<0)
+ e=e+ei;
+ else{
+ y1=y1+iy;e=e+ed;
+ }
+ }
+ goto fin;
+
+ylin:
+
+ ei=2*dx;
+ ed=ei-2*dy;
+ e=-dy+ei;
+ for(i=1;i<=dy;++i)
+ { (*func)(x1,y1);
+ y1=y1+iy;
+ if(e<0)
+ e=e+ei;
+ else{ x1=x1+ix;e=e+ed;}
+ }
+fin:
+;
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/LINE.R b/AppleX/GRAPHICS/LINE.R
new file mode 100644
index 0000000..8f27f44
Binary files /dev/null and b/AppleX/GRAPHICS/LINE.R differ
diff --git a/AppleX/GRAPHICS/LOFONT.C b/AppleX/GRAPHICS/LOFONT.C
new file mode 100644
index 0000000..38321ba
--- /dev/null
+++ b/AppleX/GRAPHICS/LOFONT.C
@@ -0,0 +1,78 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : lofont.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Dec 4, 2009
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern char __chr[1096];
+
+int lomsk[]={0x80,0x40,0x20,0x10,0x8,0x4,0x2,0x1};
+int lofont(str,row,col,fg,bg,scale)
+char *str;
+int row,col,fg,bg,scale;
+{
+ int target, scanline, offset, r, r2, c, d, byte, nibble, x;
+ unsigned char ch;
+
+
+ if (scale > 2)scale = 1;
+
+ target = strlen(str);
+ for(scanline=0;scanline<8;scanline++)
+ {
+
+ /* set values for vertical term */
+ /* expand x scale in the vertical direction */
+ r = (scanline * scale) + row; /* max 16 high */
+ if (r > 47)break;
+ r2 = r + 1;
+
+ /* run the string 8 times
+ if scale =2 then print a double line
+ each time which gives us a font of 16 high */
+ for (byte=0;byte 39)continue;
+
+ d = str[byte]&0x7f;
+ if (d < 32)d = 32;
+ offset = ((d-32) * 8) + scanline;
+ ch = __chr[offset];
+
+
+ for (nibble=0;nibble<7;nibble++)
+ {
+
+ x = c+nibble;
+ if (x > 39)break;
+
+ if (ch & lomsk[6-nibble]){
+ setcolor(fg);
+ }
+ else {
+ if (bg < 0)continue;
+ setcolor(bg);
+ }
+ loplot(x,r);
+ if (scale > 1)loplot(x,r2);
+
+ }
+
+ }
+ }
+ return 0;
+
+}
diff --git a/AppleX/GRAPHICS/LOFONT.R b/AppleX/GRAPHICS/LOFONT.R
new file mode 100644
index 0000000..2bd10c0
Binary files /dev/null and b/AppleX/GRAPHICS/LOFONT.R differ
diff --git a/AppleX/GRAPHICS/LOLODE.C b/AppleX/GRAPHICS/LOLODE.C
new file mode 100644
index 0000000..8e5e818
--- /dev/null
+++ b/AppleX/GRAPHICS/LOLODE.C
@@ -0,0 +1,65 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : lolode.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: March, 2013
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+
+/* the following loads two non-compressed
+ graphics image formats associated with
+ lores mode...*/
+
+extern int textbase[24];
+unsigned char slobuf[1016];
+
+int slolode(name)
+char *name;
+{
+ int fh, status=-2;
+ unsigned y, packet, width, height, bufoff, screenoff;
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+ packet = read(fh,slobuf,1016);
+ close(fh);
+
+ switch(packet) {
+ case 1016: status = 0;
+ bufoff = (unsigned) &slobuf[0];
+ screenoff = (unsigned)textbase[0];
+ movmem(bufoff,screenoff,packet);
+ break;
+ case 802:
+ case 962:
+ width = (unsigned)slobuf[0];
+ if (width!=40)break;
+ height= (unsigned)slobuf[1];
+ if (packet == 802 && height != 20) break;
+ if (packet == 962 && height != 24) break;
+
+ status = 0;
+ bufoff = (unsigned) &slobuf[2];
+ for (y = 0; y < height; y++) {
+ screenoff = (unsigned)textbase[y];
+ movmem(bufoff,screenoff,width);
+ bufoff+=width;
+ }
+
+
+ }
+
+ return status;
+}
+
+
+
diff --git a/AppleX/GRAPHICS/LOLODE.R b/AppleX/GRAPHICS/LOLODE.R
new file mode 100644
index 0000000..36b6b21
Binary files /dev/null and b/AppleX/GRAPHICS/LOLODE.R differ
diff --git a/AppleX/GRAPHICS/LOPIXEL.C b/AppleX/GRAPHICS/LOPIXEL.C
new file mode 100644
index 0000000..eaab2a6
--- /dev/null
+++ b/AppleX/GRAPHICS/LOPIXEL.C
@@ -0,0 +1,48 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : lopixel.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Dec 4, 2009
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern int textbase[24];
+setlopixel(color,x,y,page)
+int color, x, y, page;
+{
+ unsigned char *crt, c1, c2;
+ int y1;
+
+
+ y1 = y / 2;
+ if (page !=0) x = x + 1024;
+
+
+
+ c2 = (unsigned char ) (color & 15);
+
+
+ if (y%2 == 0) {
+ /* even rows in low nibble */
+ /* mask value to preserve high nibble */
+ c1 = 240;
+ }
+ else {
+ /* odd rows in high nibble */
+ /* mask value to preserve low nibble */
+ c1 = 15;
+ c2 = c2 * 16;
+ }
+
+ crt = (unsigned char *)(textbase[y1]+x);
+ crt[0] &= c1;
+ crt[0] |= c2;
+
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/LOPIXEL.R b/AppleX/GRAPHICS/LOPIXEL.R
new file mode 100644
index 0000000..918f76d
Binary files /dev/null and b/AppleX/GRAPHICS/LOPIXEL.R differ
diff --git a/AppleX/GRAPHICS/LORES.C b/AppleX/GRAPHICS/LORES.C
new file mode 100644
index 0000000..81726aa
--- /dev/null
+++ b/AppleX/GRAPHICS/LORES.C
@@ -0,0 +1,119 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : lores.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Dec 4, 2009
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#define XREG 0
+#define YREG 1
+#define COLOREG 0
+
+#asm
+
+ instxt
+
+XVAL equ REGS
+YVAL equ REGS+1
+COLOR equ REGS
+
+#endasm
+
+unsigned char *byteregptr = (unsigned char *)0x80;
+unsigned char *eolptr = (unsigned char *)0x2c;
+
+setcolor(value)
+{
+ /* load parameters into user reg */
+ byteregptr[COLOREG] = value;
+ /* make ml call */
+#asm
+ LDA COLOR ; Sets the plotting color to N, 0 <= N <= 15
+ JSR $F864
+#endasm
+}
+
+
+loplot(x, y)
+{
+ /* load parameters into user regs */
+ byteregptr[XREG] = x;
+ byteregptr[YREG] = y;
+ /* make ml call */
+#asm
+ LDY XVAL ; Lo-Res Plot X (Horizontal) Coordinate (0-39)
+ LDA YVAL ; Lo-Res Plot Y (Vertical) Coordinate (0-39)
+ JSR $F800
+#endasm
+}
+
+
+getlocolor(x,y)
+{
+ /* load parameters into user regs */
+ byteregptr[XREG] = x;
+ byteregptr[YREG] = y;
+ /* make ml call */
+#asm
+ LDY XVAL ; Lo-Res Plot X (Horizontal) Coordinate (0-39)
+ LDA YVAL ; Lo-Res Plot Y (Vertical) Coordinate (0-39)
+ JSR $F871 ; Result (0-15) in Accumulator
+ STA COLOR
+#endasm
+ /* return accumulator value in user reg */
+ return (int)byteregptr[COLOREG];
+}
+
+
+lohlin(y, x1, x2)
+{
+ /* load parameters into user regs */
+ byteregptr[XREG] = x1;
+ byteregptr[YREG] = y;
+ /* Rightmost X Coordinate (0-39) */
+ /* Store it at H2 Lo-res line end-point */
+ eolptr[XREG] = x2;
+ /* make ml call */
+#asm
+ LDY XVAL ; Leftmost X Coordinate (0-39)
+ LDA YVAL ; Y Coordinate (0-47)
+ JSR $F819
+#endasm
+}
+
+lovlin(x, y1, y2)
+{
+ /* load parameters into user regs */
+ byteregptr[XREG] = x;
+ byteregptr[YREG] = y1;
+ /* Bottom Y Coordinate (0-47) */
+ /* Store it at V2 Lo-res line end-point */
+ eolptr[YREG] = y2;
+ /* make ml call */
+#asm
+ LDY XVAL ; X Coordinate (0-39)
+ LDA YVAL ; Top Y Coordinate (0-47)
+ JSR $F828
+#endasm
+}
+
+
+lobox(x1,y1,x2,y2,color)
+{
+ setcolor(color);
+ lohlin(y1, x1, x2);
+ y1++;
+ y2--;
+ lovlin(x1, y1, y2);
+ lovlin(x2, y1, y2);
+ y2++;
+ lohlin(y2, x1, x2);
+}
diff --git a/AppleX/GRAPHICS/LORES.R b/AppleX/GRAPHICS/LORES.R
new file mode 100644
index 0000000..3d6ed4a
Binary files /dev/null and b/AppleX/GRAPHICS/LORES.R differ
diff --git a/AppleX/GRAPHICS/MAKEFILE b/AppleX/GRAPHICS/MAKEFILE
new file mode 100644
index 0000000..a6d35b8
--- /dev/null
+++ b/AppleX/GRAPHICS/MAKEFILE
@@ -0,0 +1,408 @@
+# /* ------------------------------------------------------------------------
+# System : Manx Aztec C65 Version 3.2b
+# MS-DOS cross-development environment
+# Platform : Apple IIe 128K PRODOS 8
+# Program : G2 Library MAKEFILE
+# Description : This is the MAKEFILE for my highly modified
+# and expanded "catch-all" version
+# of the Aztec C Graphics Library (G.LIB).
+#
+# The original was shipped from Manx when I first bought
+# the compiler, circa 1990, with another programmer, Les Gros,
+# for a contract for the Apple II and C64 that we took together.
+# The contract involved the heavy use of graphics.
+#
+# By comparison to IBM-PC Compiler Libraries which I had
+# become accustomed, G.LIB offered only a starting point so I
+# set-out to fill-in the blanks in G2.lib for ProDOS
+# (and in SYSIO.LIB).
+#
+# Then, when I resurrected all this a few years ago I ported
+# many of my old routines to DOS 3.3 as well, then expanded
+# the DOS 3.3 routines in G3.lib, back-ported the new routines
+# to ProDOS and then started adding to the ProDOS routines
+# again fall 2012 and winter of 2012/2013.
+#
+# 23 years later I have kept expanding the thing and
+# consequently it is now simply where I put my stuff
+# which is unlikely to ever change.
+#
+# Modified by : Bill Buckels
+# Revision Date: January 2013
+#
+# Licence : You may use this code for whatever you wish as long
+# as you agree that Bill Buckels has no warranty or
+# liability obligations whatsoever from said use.
+# ------------------------------------------------------------------------ */
+#
+
+
+# Comment from 2008 - still true, but vastly expanded-on.
+#
+# among other things...
+# this make file creates a "new" prodos graphics library which
+# replaces g.lib which came with the Aztec C ProDOS compiler
+# with an hgr screen base at 0x4000 instead of 0x2000
+# stores an "expanded" font of size 1096 at 0x0c00
+# uses data "library" storage transfer buffer at 0x0c00+1096
+# uses ems (auxmem) at 0x0c00 with a signature at 2048 in main memory
+# loads to ems (auxmem) with a size 4000 buffer at 4196
+# ems (auxmem) is accessed with complementary putimage and getimage functions
+
+g2.lib: plots.r emslode.r emsput.r emsput2.r fbox2.r hibase2.r \
+ monochar.r monoline.r monoplot.r \
+ call33.r bottom.r putrax.r bars.r emsget.r emsrag.r \
+ emsrig.r dlores2.r dlopixel.r dlofont.r drfbox.r \
+ bopen.r drawline.r bsave.r bload.r picsave.r dmonline.r \
+ subchar.r liblode.r fontlode.r fileplot.r filechar.r \
+ hgr.r text.r plotchar.r circle.r line.r plot.r clear.r clear1.r \
+ page.r fscreen.r mscreen.r setasp.r play.r dmonbyte.r \
+ grafmode.r fbox.r piclode.r putimage.r hibase.r poke.r \
+ getch.r kbhit.r sound.r keyclr.r hibox.r pchar.r \
+ lofont.r lores.r lopixel.r textbase.r dhrcalc.r dmonchar.r \
+ dhrfont.r dlodelo.r drbytes.r drflood.r drmain.r lolode.r \
+ dhrplot.r drlode.r hibase3.r grafmodx.r dlores.r \
+ dhvlin.r dhcirc.r dhrline.r dhdisc.r dmonplot.r dxlode.r \
+ dxlut.r dxblock.r dxline.r dxlode2.r dhrcalc2.r dwait.r \
+ dhrpixel.r dplode.r crt80.r putchar.r ff.r strulr.r raxlode.r \
+ ffg.r d2circ.r d2fbox.r d2flood.r d2font.r d2init.r d2line.r \
+ d2lode.r d2plot.r d2vline.r d2pld.r d2save.r MAKEFILE hbsh.r
+ lb g2 plots.r
+ lb g2 -a+ emslode.r emsput.r emsput2.r fbox2.r hibase2.r
+ lb g2 -a+ monochar.r monoline.r monoplot.r
+ lb g2 -a+ bopen.r drawline.r bsave.r bload.r picsave.r
+ lb g2 -a+ subchar.r dlores2.r dlopixel.r dlofont.r dxlut.r
+ lb g2 -a+ liblode.r fontlode.r fileplot.r filechar.r hbsh.r
+ lb g2 -a+ hgr.r text.r plotchar.r circle.r line.r plot.r clear.r
+ lb g2 -a+ page.r fscreen.r mscreen.r setasp.r dmonline.r clear1.r
+ lb g2 -a+ play.r dhrcalc.r dhvlin.r drfbox.r dmonplot.r
+ lb g2 -a+ grafmode.r fbox.r piclode.r putimage.r hibase.r poke.r
+ lb g2 -a+ getch.r kbhit.r sound.r dhdisc.r dmonbyte.r dxlode.r
+ lb g2 -a+ call33.r bottom.r putrax.r bars.r emsget.r emsrag.r
+ lb g2 -a+ emsrig.r keyclr.r dhcirc.r dhrline.r dmonchar.r
+ lb g2 -a+ hibox.r pchar.r lofont.r lores.r lopixel.r textbase.r
+ lb g2 -a+ dhrfont.r dlodelo.r drbytes.r drflood.r drmain.r
+ lb g2 -a+ dhrplot.r drlode.r hibase3.r grafmodx.r dlores.r
+ lb g2 -a+ dxblock.r dxline.r dxlode2.r dhrcalc2.r dwait.r
+ lb g2 -a+ dhrpixel.r dplode.r crt80.r putchar.r ff.r strulr.r
+ lb g2 -a+ raxlode.r ffg.r d2lode.r d2plot.r d2vline.r d2pld.r
+ lb g2 -a+ d2circ.r d2fbox.r d2flood.r d2font.r d2init.r d2line.r
+ lb g2 -a+ d2save.r lolode.r
+
+lolode.r: lolode.c
+ c65 lolode.c
+
+monochar.r: monochar.c
+ c65 monochar.c
+
+monoline.r: monoline.c
+ c65 monoline.c
+
+monoplot.r: monoplot.c
+ c65 monoplot.c
+
+hbsh.r: hbsh.c
+ c65 hbsh.c
+
+d2save.r: d2save.c
+ c65 d2save.c
+
+d2pld.r: d2pld.c
+ c65 d2pld.c
+
+d2circ.r: d2circ.c
+ c65 d2circ.c
+
+d2fbox.r: d2fbox.c
+ c65 d2fbox.c
+
+d2flood.r: d2flood.c
+ c65 d2flood.c
+
+d2font.r: d2font.c
+ c65 d2font.c
+
+d2init.r: d2init.c
+ c65 d2init.c
+
+d2line.r: d2line.c
+ c65 d2line.c
+
+d2lode.r: d2lode.c
+ c65 d2lode.c
+
+d2plot.r: d2plot.c
+ c65 d2plot.c
+
+d2vline.r: d2vline.c
+ c65 d2vline.c
+
+ffg.r: ffg.c
+ c65 ffg.c
+
+raxlode.r: raxlode.c
+ c65 raxlode.c
+
+strulr.r: strulr.c
+ c65 strulr.c
+
+ff.r: ff.c
+ c65 ff.c
+
+putchar.r: putchar.c
+ c65 putchar.c
+
+crt80.r: crt80.c
+ c65 crt80.c
+
+dplode.r: dplode.c
+ c65 dplode.c
+
+dhrpixel.r: dhrpixel.c
+ c65 dhrpixel.c
+
+dwait.r: dwait.c
+ c65 dwait.c
+
+dxblock.r: dxblock.c
+ c65 dxblock.c
+
+dxline.r: dxline.c
+ c65 dxline.c
+
+dxlut.r: dxlut.c
+ c65 dxlut.c
+
+dxlode2.r: dxlode2.c
+ c65 dxlode2.c
+
+dxlode.r: dxlode.c
+ c65 dxlode.c
+
+dmonchar.r: dmonchar.c
+ c65 dmonchar.c
+
+dmonbyte.r: dmonbyte.c
+ c65 dmonbyte.c
+
+dmonplot.r: dmonplot.c
+ c65 dmonplot.c
+
+dmonline.r: dmonline.c
+ c65 dmonline.c
+
+dhcirc.r: dhcirc.c
+ c65 dhcirc.c
+
+dhdisc.r: dhdisc.c
+ c65 dhdisc.c
+
+dhrline.r: dhrline.c
+ c65 dhrline.c
+
+drfbox.r: drfbox.c
+ c65 drfbox.c
+
+dhrcalc.r: dhrcalc.c
+ c65 dhrcalc.c
+
+dhrcalc2.r: dhrcalc2.c
+ c65 dhrcalc2.c
+
+dhvlin.r: dhvlin.c
+ c65 dhvlin.c
+
+dlores2.r: dlores2.c
+ c65 dlores2.c
+
+dlofont.r: dlofont.c
+ c65 dlofont.c
+
+dlopixel.r: dlopixel.c
+ c65 dlopixel.c
+
+dlores.r: dlores.c
+ c65 dlores.c
+
+grafmodx.r: grafmodx.c
+ c65 grafmodx.c
+
+hibase3.r: hibase3.c
+ c65 hibase3.c
+
+drlode.r: drlode.c
+ c65 drlode.c
+
+dhrplot.r: dhrplot.c
+ c65 dhrplot.c
+
+dhrfont.r: dhrfont.c
+ c65 dhrfont.c
+
+dlodelo.r: dlodelo.c
+ c65 dlodelo.c
+
+drbytes.r: drbytes.c
+ c65 drbytes.c
+
+drflood.r: drflood.c
+ c65 drflood.c
+
+drmain.r: drmain.c
+ c65 drmain.c
+
+keyclr.r: keyclr.c
+ c65 keyclr.c
+
+hibox.r: hibox.c
+ c65 hibox.c
+
+pchar.r: pchar.c
+ c65 pchar.c
+
+lofont.r: lofont.c
+ c65 lofont.c
+
+lores.r: lores.c
+ c65 lores.c
+
+lopixel.r: lopixel.c
+ c65 lopixel.c
+
+textbase.r: textbase.c
+ c65 textbase.c
+
+plots.r: plots.c
+ c65 plots.c
+
+emslode.r: emslode.c
+ c65 emslode.c
+
+emsput.r: emsput.c
+ c65 emsput.c
+
+emsput2.r: emsput2.c
+ c65 emsput2.c
+
+fbox2.r: fbox2.c
+ c65 fbox2.c
+
+hibase2.r: hibase2.c
+ c65 hibase2.c
+
+bopen.r: bopen.c
+ c65 bopen.c
+
+drawline.r: drawline.c
+ c65 drawline.c
+
+bsave.r: bsave.c
+ c65 bsave.c
+
+bload.r: bload.c
+ c65 bload.c
+
+picsave.r: picsave.c
+ c65 picsave.c
+
+subchar.r: subchar.c
+ c65 subchar.c
+
+liblode.r: liblode.c
+ c65 liblode.c
+
+fontlode.r: fontlode.c
+ c65 fontlode.c
+
+fileplot.r: fileplot.c
+ c65 fileplot.c
+
+filechar.r: filechar.c
+ c65 filechar.c
+
+hgr.r: hgr.c
+ c65 hgr.c
+
+text.r: text.c
+ c65 text.c
+
+plotchar.r: plotchar.c
+ c65 plotchar.c
+
+circle.r: circle.c
+ c65 circle.c
+
+line.r: line.c
+ c65 line.c
+
+plot.r: plot.c
+ c65 plot.c
+
+clear.r: clear.asm
+ as65 clear.asm
+
+clear1.r: clear1.asm
+ as65 clear1.asm
+
+page.r: page.c
+ c65 page.c
+
+fscreen.r: fscreen.c
+ c65 fscreen.c
+
+mscreen.r: mscreen.c
+ c65 mscreen.c
+
+setasp.r: setasp.c
+ c65 setasp.c
+
+play.r: play.c
+ c65 play.c
+
+grafmode.r: grafmode.c
+ c65 grafmode.c
+
+fbox.r: fbox.c
+ c65 fbox.c
+
+piclode.r: piclode.c
+ c65 piclode.c
+
+putimage.r: putimage.c
+ c65 putimage.c
+
+hibase.r: hibase.c
+ c65 hibase.c
+
+poke.r: poke.c
+ c65 poke.c
+
+getch.r: getch.c
+ c65 getch.c
+
+kbhit.r: kbhit.c
+ c65 kbhit.c
+
+sound.r: sound.c
+ c65 sound.c
+
+call33.r: call33.c
+ c65 call33.c
+
+bottom.r: bottom.c
+ c65 bottom.c
+
+putrax.r: putrax.c
+ c65 putrax.c
+
+bars.r: bars.c
+ c65 bars.c
+
+emsget.r: emsget.c
+ c65 emsget.c
+
+emsrag.r: emsrag.c
+ c65 emsrag.c
+
+emsrig.r: emsrig.c
+ c65 emsrig.c
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/MONOCHAR.C b/AppleX/GRAPHICS/MONOCHAR.C
new file mode 100644
index 0000000..fee1990
--- /dev/null
+++ b/AppleX/GRAPHICS/MONOCHAR.C
@@ -0,0 +1,64 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : monochar.c
+Description : G2 Library Routine
+ Hi-Res 280 x 192 monochrome
+ reasonably quick Font Routine
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+extern unsigned HB[];
+extern char __chr[1096];
+
+monochar(d,x,y,color)
+{
+
+int xoff, offset, y1, aux = 1;
+unsigned char ch, *ptr;
+
+ xoff = x/7;
+
+ d &= 0x7f;
+ if (d < 32)d = 32;
+
+ for (y1 = 0; y1 < 8; y1++) {
+ ptr = (unsigned char *) (HB[y] + xoff);
+ y++;
+ if (y > 191)break;
+ offset = ((d-32) * 8) + y1;
+ if (color > 0)ch = __chr[offset];
+ else ch = __chr[offset]^0xff;
+ *ptr = ch;
+ }
+}
+
+monoplots(str,x,y,color,justify)
+char *str,justify;
+int x,y,color;
+{
+ unsigned d, idx = 0;
+
+ if(str[0]!=0)
+ {
+ /* centred text - Mid-Justify */
+ if (justify == 'm' || justify == 'M') {
+ idx = 0;
+ for (;;) {
+ idx++;
+ if (str[idx] == 0)break;
+ }
+ x -= ((idx * 7) / 2);
+ }
+
+ while((d=*str++)!=0){
+ monochar(d,x,y,color); x+=7;
+ }
+ }
+}
+
diff --git a/AppleX/GRAPHICS/MONOCHAR.R b/AppleX/GRAPHICS/MONOCHAR.R
new file mode 100644
index 0000000..285d576
Binary files /dev/null and b/AppleX/GRAPHICS/MONOCHAR.R differ
diff --git a/AppleX/GRAPHICS/MONOLINE.C b/AppleX/GRAPHICS/MONOLINE.C
new file mode 100644
index 0000000..86a2ba7
--- /dev/null
+++ b/AppleX/GRAPHICS/MONOLINE.C
@@ -0,0 +1,60 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : monoline.c
+Description : G2 Library Routine
+ Hi-Res 280 x 192 monochrome
+ Bresenham Algorithm line drawing routine
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+monoline(x1, y1, x2, y2, drawcolor)
+int x1, y1, x2, y2, drawcolor;
+{
+
+ int dx, dy, sx, sy, err, err2;
+
+ if(x1 < x2) {
+ dx = x2 - x1;
+ sx = 1;
+ }
+ else {
+ sx = -1;
+ dx = x1 - x2;
+ }
+
+ if(y1 < y2) {
+ sy = 1;
+ dy = y2 - y1;
+ }
+ else {
+ sy = -1;
+ dy = y1 - y2;
+ }
+
+ err = dx-dy;
+
+ for (;;) {
+ monoplot(x1,y1,y1,drawcolor);
+
+ if(x1 == x2 && y1 == y2)break;
+
+ err2 = err*2;
+
+ if(err2 > (0-dy)) {
+ err = err - dy;
+ x1 = x1 + sx;
+ }
+
+ if(err2 < dx) {
+ err = err + dx;
+ y1 = y1 + sy;
+ }
+ }
+ return;
+}
diff --git a/AppleX/GRAPHICS/MONOLINE.R b/AppleX/GRAPHICS/MONOLINE.R
new file mode 100644
index 0000000..14f113d
Binary files /dev/null and b/AppleX/GRAPHICS/MONOLINE.R differ
diff --git a/AppleX/GRAPHICS/MONOPLOT.C b/AppleX/GRAPHICS/MONOPLOT.C
new file mode 100644
index 0000000..0d7772e
--- /dev/null
+++ b/AppleX/GRAPHICS/MONOPLOT.C
@@ -0,0 +1,59 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : monoplot.c
+Description : G2 Library Routine
+ Hi-Res 280 x 192 x monochrome plot routine
+Written by : Bill Buckels
+Date Written : February 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern unsigned HB[];
+extern unsigned char dhbmono[];
+extern unsigned char dhwmono[];
+
+int monoplot(x,y1,y2,drawcolor)
+int x, y1, y2, drawcolor;
+{
+ int y, xoff, pixel;
+ unsigned char *ptr;
+
+ /* swap coordinates if out of order */
+ if (y1 > y2) {
+ y = y1;
+ y1 = y2;
+ y2 = y;
+ }
+
+ /* allow bi-directional scanline wrap */
+ if (x < 0) x+= 280;
+ if (x > 279) x-=280;
+
+ if (x < 0 || x > 279 || y1 < 0 || y2 > 191)return 0;
+
+ pixel = (x%7);
+ xoff = x/7;
+
+ y2++;
+ for (y = y1; y < y2; y++) {
+
+ ptr = (unsigned char *) (HB[y] + xoff);
+
+ if (drawcolor != 0) {
+ /* white */
+ *ptr = *ptr | dhwmono[pixel]; /* inclusive OR */
+ }
+ else {
+ /* black */
+ *ptr = *ptr & dhbmono[pixel]; /* bitwise AND */
+ }
+ }
+
+return 0;
+
+}
diff --git a/AppleX/GRAPHICS/MONOPLOT.R b/AppleX/GRAPHICS/MONOPLOT.R
new file mode 100644
index 0000000..42520be
Binary files /dev/null and b/AppleX/GRAPHICS/MONOPLOT.R differ
diff --git a/AppleX/GRAPHICS/MSCREEN.C b/AppleX/GRAPHICS/MSCREEN.C
new file mode 100644
index 0000000..9868d54
--- /dev/null
+++ b/AppleX/GRAPHICS/MSCREEN.C
@@ -0,0 +1,7 @@
+mscreen()
+{
+ char *tswitch=(char*)0xc053;
+
+ tswitch[0]=0x00; /* mixed screen */
+}
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/MSCREEN.R b/AppleX/GRAPHICS/MSCREEN.R
new file mode 100644
index 0000000..26c2256
Binary files /dev/null and b/AppleX/GRAPHICS/MSCREEN.R differ
diff --git a/AppleX/GRAPHICS/PAGE.C b/AppleX/GRAPHICS/PAGE.C
new file mode 100644
index 0000000..c6d38a8
--- /dev/null
+++ b/AppleX/GRAPHICS/PAGE.C
@@ -0,0 +1,11 @@
+page1()
+{
+ *(char *)0xc054=0x00; /* primary page */
+}
+
+page2()
+{
+ *(char *)0xc055=0x00; /* secondary page */
+}
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/PAGE.R b/AppleX/GRAPHICS/PAGE.R
new file mode 100644
index 0000000..57ffe79
Binary files /dev/null and b/AppleX/GRAPHICS/PAGE.R differ
diff --git a/AppleX/GRAPHICS/PCHAR.C b/AppleX/GRAPHICS/PCHAR.C
new file mode 100644
index 0000000..bae9f75
--- /dev/null
+++ b/AppleX/GRAPHICS/PCHAR.C
@@ -0,0 +1,154 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : pchar.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: Dec 4, 2009
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+char __chr[1096] = {
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x0C, 0x0C, 0x0C, 0x0C, 0x0C, 0x00, 0x0C, 0x00,
+0x64, 0x66, 0x26, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x66, 0x7E, 0x66, 0x7E, 0x66, 0x00, 0x00,
+0x18, 0x7E, 0x06, 0x7E, 0x60, 0x7E, 0x18, 0x00,
+0x4E, 0x66, 0x30, 0x18, 0x0C, 0x66, 0x66, 0x00,
+0x3C, 0x66, 0x66, 0x1C, 0x7E, 0x66, 0x7C, 0x00,
+0x18, 0x18, 0x0C, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x18, 0x0C, 0x06, 0x06, 0x06, 0x0C, 0x18, 0x00,
+0x06, 0x0C, 0x18, 0x18, 0x18, 0x0C, 0x06, 0x00,
+0x66, 0x7E, 0x18, 0x7E, 0x18, 0x7E, 0x66, 0x00,
+0x00, 0x18, 0x18, 0x7E, 0x18, 0x18, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x06,
+0x00, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x0C, 0x0C, 0x00,
+0x40, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x06, 0x00,
+0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x18, 0x1C, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,
+0x3C, 0x66, 0x66, 0x30, 0x18, 0x0C, 0x7E, 0x00,
+0x7E, 0x20, 0x18, 0x30, 0x60, 0x66, 0x3E, 0x00,
+0x60, 0x66, 0x66, 0x66, 0x7E, 0x60, 0x60, 0x00,
+0x7E, 0x06, 0x06, 0x3E, 0x60, 0x66, 0x3E, 0x00,
+0x30, 0x18, 0x0C, 0x1E, 0x66, 0x66, 0x3C, 0x00,
+0x7E, 0x30, 0x18, 0x0C, 0x06, 0x06, 0x06, 0x00,
+0x3C, 0x66, 0x66, 0x18, 0x66, 0x66, 0x3C, 0x00,
+0x3C, 0x66, 0x66, 0x3C, 0x18, 0x0C, 0x06, 0x00,
+0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x00,
+0x00, 0x0C, 0x0C, 0x00, 0x00, 0x0C, 0x0C, 0x06,
+0x30, 0x18, 0x0C, 0x06, 0x0C, 0x18, 0x30, 0x00,
+0x00, 0x00, 0x3E, 0x00, 0x00, 0x3E, 0x00, 0x00,
+0x06, 0x0C, 0x18, 0x30, 0x18, 0x0C, 0x06, 0x00,
+0x3C, 0x66, 0x60, 0x30, 0x18, 0x00, 0x18, 0x00,
+0x3C, 0x66, 0x66, 0x66, 0x66, 0x06, 0x3E, 0x00,
+0x18, 0x3C, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x00,
+0x3E, 0x66, 0x66, 0x3E, 0x66, 0x66, 0x7E, 0x00,
+0x3C, 0x66, 0x06, 0x06, 0x06, 0x66, 0x3C, 0x00,
+0x1E, 0x26, 0x66, 0x66, 0x66, 0x26, 0x1E, 0x00,
+0x7E, 0x06, 0x06, 0x1E, 0x06, 0x06, 0x7E, 0x00,
+0x7E, 0x06, 0x06, 0x1E, 0x06, 0x06, 0x06, 0x00,
+0x3C, 0x66, 0x06, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x66, 0x66, 0x66, 0x7E, 0x66, 0x66, 0x66, 0x00,
+0x3C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,
+0x78, 0x30, 0x30, 0x30, 0x30, 0x3E, 0x1C, 0x00,
+0x66, 0x66, 0x1E, 0x1E, 0x66, 0x66, 0x66, 0x00,
+0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x7E, 0x00,
+0x66, 0x76, 0x7E, 0x66, 0x66, 0x66, 0x66, 0x00,
+0x66, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x66, 0x00,
+0x3C, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06, 0x06, 0x00,
+0x3C, 0x66, 0x66, 0x66, 0x66, 0x3E, 0x7C, 0x00,
+0x3E, 0x66, 0x66, 0x3E, 0x1E, 0x66, 0x66, 0x00,
+0x3C, 0x66, 0x06, 0x3C, 0x60, 0x66, 0x3C, 0x00,
+0x7E, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00,
+0x66, 0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x66, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00,
+0x66, 0x66, 0x66, 0x66, 0x6E, 0x7E, 0x66, 0x00,
+0x66, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x66, 0x00,
+0x66, 0x66, 0x3C, 0x18, 0x18, 0x18, 0x18, 0x00,
+0x7E, 0x60, 0x30, 0x18, 0x0C, 0x06, 0x7E, 0x00,
+0x3E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x3E, 0x00,
+0x02, 0x06, 0x0C, 0x18, 0x30, 0x60, 0x40, 0x00,
+0x3E, 0x30, 0x30, 0x30, 0x30, 0x30, 0x3E, 0x00,
+0x18, 0x18, 0x3C, 0x66, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7F,
+0x0C, 0x0C, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x00, 0x1E, 0x30, 0x3E, 0x32, 0x7E, 0x00,
+0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x3C, 0x00,
+0x00, 0x00, 0x3C, 0x66, 0x06, 0x66, 0x3C, 0x00,
+0x60, 0x60, 0x60, 0x7C, 0x66, 0x66, 0x3C, 0x00,
+0x00, 0x00, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00,
+0x3C, 0x66, 0x06, 0x1E, 0x06, 0x06, 0x06, 0x00,
+0x00, 0x00, 0x3C, 0x66, 0x66, 0x7C, 0x60, 0x3E,
+0x06, 0x06, 0x06, 0x3E, 0x66, 0x66, 0x66, 0x00,
+0x18, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00,
+0x60, 0x00, 0x60, 0x60, 0x60, 0x66, 0x36, 0x1C,
+0x06, 0x06, 0x66, 0x3E, 0x1E, 0x3E, 0x66, 0x00,
+0x1C, 0x18, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,
+0x00, 0x00, 0x66, 0x7E, 0x6E, 0x66, 0x66, 0x00,
+0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x00,
+0x00, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x00, 0x00, 0x3E, 0x66, 0x66, 0x3E, 0x06, 0x06,
+0x00, 0x00, 0x3C, 0x66, 0x66, 0x7C, 0x60, 0x70,
+0x00, 0x00, 0x3C, 0x66, 0x06, 0x06, 0x06, 0x00,
+0x00, 0x00, 0x7C, 0x06, 0x3C, 0x60, 0x3E, 0x00,
+0x18, 0x18, 0x7E, 0x18, 0x18, 0x18, 0x18, 0x00,
+0x00, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x00, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x18, 0x00,
+0x00, 0x00, 0x66, 0x66, 0x6E, 0x7E, 0x66, 0x00,
+0x00, 0x00, 0x66, 0x3C, 0x18, 0x3C, 0x66, 0x00,
+0x00, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x0C, 0x06,
+0x00, 0x00, 0x7E, 0x30, 0x18, 0x0C, 0x7E, 0x00,
+0x30, 0x18, 0x18, 0x0C, 0x18, 0x18, 0x30, 0x00,
+0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00,
+0x06, 0x0C, 0x0C, 0x18, 0x0C, 0x0C, 0x06, 0x00,
+0x66, 0x3E, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+0x00, 0x18, 0x18, 0x3C, 0x42, 0x7E, 0x00, 0x00,
+0x00, 0x3C, 0x66, 0x06, 0x66, 0x3C, 0x30, 0x18,
+0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x30, 0x0C, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00,
+0x18, 0x66, 0x1E, 0x30, 0x3E, 0x32, 0x7E, 0x00,
+0x66, 0x00, 0x1E, 0x30, 0x3E, 0x32, 0x7E, 0x00,
+0x06, 0x18, 0x1E, 0x30, 0x3E, 0x32, 0x7E, 0x00,
+0x18, 0x06, 0x1E, 0x30, 0x3E, 0x32, 0x7E, 0x00,
+0x00, 0x00, 0x7C, 0x06, 0x06, 0x3C, 0x60, 0x38,
+0x18, 0x66, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00,
+0x66, 0x00, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00,
+0x0C, 0x30, 0x3C, 0x66, 0x7E, 0x06, 0x3C, 0x00,
+0x66, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00,
+0x3C, 0x66, 0x18, 0x18, 0x18, 0x18, 0x3C, 0x00,
+0x0E, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00,
+0x66, 0x18, 0x3C, 0x66, 0x7E, 0x66, 0x66, 0x00,
+0x18, 0x18, 0x00, 0x3C, 0x66, 0x7E, 0x66, 0x00,
+0x70, 0x00, 0x7E, 0x06, 0x1E, 0x06, 0x7E, 0x00,
+0x00, 0x00, 0x36, 0x58, 0x7E, 0x1A, 0x7E, 0x00,
+0x7E, 0x1A, 0x1A, 0x7E, 0x1A, 0x1A, 0x7A, 0x00,
+0x18, 0x66, 0x00, 0x3C, 0x66, 0x66, 0x3C, 0x00,
+0x66, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x0E, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x18, 0x66, 0x00, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x0E, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x66, 0x00, 0x66, 0x66, 0x3C, 0x18, 0x0C, 0x06,
+0x66, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x66, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x00, 0x18, 0x7E, 0x06, 0x06, 0x7E, 0x18, 0x00,
+0x1C, 0x36, 0x06, 0x0E, 0x66, 0x6E, 0x36, 0x00,
+0x66, 0x66, 0x3C, 0x7E, 0x18, 0x3C, 0x18, 0x00,
+0x3E, 0x66, 0x3E, 0x06, 0x76, 0x26, 0x66, 0x00,
+0x30, 0x78, 0x18, 0x7E, 0x18, 0x18, 0x1E, 0x0C,
+0x70, 0x00, 0x1E, 0x30, 0x3E, 0x32, 0x7E, 0x00,
+0x38, 0x00, 0x1C, 0x18, 0x18, 0x18, 0x3C, 0x00,
+0x70, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x70, 0x00, 0x66, 0x66, 0x66, 0x66, 0x3C, 0x00,
+0x3E, 0x00, 0x3C, 0x66, 0x66, 0x66, 0x66, 0x00,
+0x7E, 0x00, 0x66, 0x6E, 0x7E, 0x76, 0x66, 0x00,
+0x1C, 0x36, 0x7C, 0x00, 0x7E, 0x00, 0x00, 0x00,
+0x3C, 0x66, 0x3C, 0x00, 0x7E, 0x00, 0x00, 0x00,
+0x18, 0x00, 0x18, 0x0C, 0x06, 0x66, 0x3C, 0x00};
diff --git a/AppleX/GRAPHICS/PCHAR.R b/AppleX/GRAPHICS/PCHAR.R
new file mode 100644
index 0000000..12b862b
Binary files /dev/null and b/AppleX/GRAPHICS/PCHAR.R differ
diff --git a/AppleX/GRAPHICS/PICLODE.C b/AppleX/GRAPHICS/PICLODE.C
new file mode 100644
index 0000000..7546e06
--- /dev/null
+++ b/AppleX/GRAPHICS/PICLODE.C
@@ -0,0 +1,133 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : piclode.c
+Description : G2 Library Routine
+ For Hi-Res Mode
+
+Written by : Bill Buckels
+Creation Date: June 5, 1991
+Revised : January 2013
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+
+extern unsigned HB[];
+
+/* globals to override the load point for the image loader */
+char XPIC=0;
+char YPIC=0;
+
+int piclode(name)
+char *name;
+{
+ int fh,y,y1=0,x1,bos,height,packet,c=-2;
+ char tempchar[2];
+
+ fh = open(name,O_RDONLY,0xc3); /* open a binary file */
+
+ if (fh == -1)return -1;
+
+ if (read(fh,tempchar,2)==2) {
+
+ packet= (int)tempchar[0];
+ height= (int)tempchar[1];
+
+ /* special case for fullscreen images first
+ always load from top left */
+ if (packet == 40) XPIC = 0;
+ if (height == 192) YPIC = 0;
+ if (packet == 40 && height == 160) YPIC = 0; /* fullscreen mixed text */
+
+ /* center the picture in the screen */
+ if(XPIC>39)
+ x1 = 20-(packet/2); /* break on even byte boundaries */
+ else
+ x1 = (int)XPIC;
+
+ if((x1%2)!=0)x1--;
+
+ if(YPIC>191)
+ y1=96-(height/2);
+ else
+ y1=(int)YPIC;
+
+ bos=y1+height;
+ if (bos > 192)bos = 192;
+
+ /* Unbuffered read of each scanline = 192 reads for a full screen.
+ this may not be terribly efficient for full screen images
+ from a disk access perspective but may work quicker for small image
+ fragments than RAX format encoded images.
+
+ Consider encoding larger images in the RAX format if disk space
+ is the greatest consideration.
+
+ Consider leaving full screen images in a bsaved format if the
+ loading is too slow and if a venetian-blind effect is acceptable.
+
+ Also consider using the following routine and the rag format for
+ everything if code size creates a memory problem and you just want
+ one routine to save available memory. It may be your best
+ all-around option.
+
+ Keep in mind that you can use an overlay design for your program
+ and put each loader in a separate overlay. There are 3 downsides to
+ doing so: 1. overlays can be lost when programs are copied
+ by inexperienced users which will render your
+ app useless.
+ 2. overlays need to be read from disk and the extra read
+ required by their use may slow down your loader.
+ 3. the disk space that you save by reformatting a small
+ number of images into multiple formats may be
+ chewed-up by expanding your code size with multiple
+ loaders and complicating your life further (whether
+ you use overlays or just use multiple loaders).
+
+ If you decide to use multiple loaders and you can avoid using
+ overlays do so. Your program will run quicker and the bits and
+ pieces (overlays) will not become hopelessly lost by some idiot
+ which may even be you if you forget things like I do especially
+ years later.
+
+ A large non-trivial program like a paint program will likely
+ need a number of overlays and support for multiple image
+ formats. A trivial program like a slideshow or viewer will
+ likely not need any overlays but will likely need mutiple
+ format support.
+
+ A final note. If you are using many images and image fragments
+ take a look at the code in emsput which uses auxiliary memory
+ to store RAG images that you preload when your program starts
+ (or prior to viewing) and can be moved quickly directly to the screen.
+ emsput can also be used to for sprite-like animation. RAX images
+ can be expanded to RAG images and then stored in auxiliary memory
+ and other neat stuff can be done like putting a bunch of
+ concatanated RAG or RAX images into the auxiliary bank. Have a look at
+ my ribcook program in the tools directory for some idea on
+ how that can be done, and the code in emslode.c and the PLOGO.C code
+ in Applex\SAMPLES\TIME for more information on how all this fits
+ together.
+
+ */
+ for(y=y1;y
+#include
+#include
+#include
+#include
+#include
+#include
+
+extern unsigned HB[];
+picsave(savex)
+char *savex;
+{
+ int fh;
+ int y;
+ char tempchar[2];
+
+ if((fh=bopen(savex, O_WRONLY|O_TRUNC|O_CREAT,0xc3)) != -1)
+ {
+ tempchar[0]=40;
+ tempchar[1]=192;
+ write(fh,tempchar,2);
+
+ for(y=0;y<192;y++)
+ write(fh,(char *)(HB[y]),40); /* write each raster */
+ close(fh);
+ }
+
+}
+
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/PICSAVE.R b/AppleX/GRAPHICS/PICSAVE.R
new file mode 100644
index 0000000..df74ea2
Binary files /dev/null and b/AppleX/GRAPHICS/PICSAVE.R differ
diff --git a/AppleX/GRAPHICS/PLAY.C b/AppleX/GRAPHICS/PLAY.C
new file mode 100644
index 0000000..a3bfeca
--- /dev/null
+++ b/AppleX/GRAPHICS/PLAY.C
@@ -0,0 +1,33 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : play.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: July 6, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+play(song)
+char *song;
+{
+ char octave, note, duration;
+ int ctr=0;
+
+ while( (octave=song[ctr++])!=255)
+ {
+
+ note=song[ctr++];
+ duration=song[ctr++];
+ sound(octave,note,duration);
+ }
+
+}
+
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/PLAY.R b/AppleX/GRAPHICS/PLAY.R
new file mode 100644
index 0000000..6d4ea22
Binary files /dev/null and b/AppleX/GRAPHICS/PLAY.R differ
diff --git a/AppleX/GRAPHICS/PLOT.C b/AppleX/GRAPHICS/PLOT.C
new file mode 100644
index 0000000..dde7db1
--- /dev/null
+++ b/AppleX/GRAPHICS/PLOT.C
@@ -0,0 +1,105 @@
+#define PAGE2 ((char *)0x4000)
+static int ysum, xoff, bitoff, point, point1;
+
+static int
+whpnt()
+{
+ if (bitoff!=6){
+ point=3<39)x-=40;
+ else whitey='\x00';
+ /* a reverse video flag... if x is 40 higher than it should be */
+
+ for(j=0,y2=y;j<=7;++j,++y2){
+
+ /* find address of char to be plotted */
+
+ if (y2>=0 && y2<=63){
+ ybase=0x4000;y1=y2;}
+ else if (y2>=64 && y2<=127){
+ ybase=0x4028;y1=(y2-64);}
+ else if (y2>=128 && y2<=191){
+ ybase=0x4050;y1=(y2-128);}
+
+ z=y1/8;
+
+ a=z*0x80+ybase;
+ yfin=(y1-(z*8))*0x400 +a;
+
+ if(!whitey)gs1[yfin+x]=__chr[(num-32)*8+j];
+ else gs1[yfin+x]=(__chr[(num-32)*8+j]^whitey);
+ }
+}
+
+
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/PLOTCHAR.R b/AppleX/GRAPHICS/PLOTCHAR.R
new file mode 100644
index 0000000..0405d67
Binary files /dev/null and b/AppleX/GRAPHICS/PLOTCHAR.R differ
diff --git a/AppleX/GRAPHICS/PLOTS.C b/AppleX/GRAPHICS/PLOTS.C
new file mode 100644
index 0000000..ec3020d
--- /dev/null
+++ b/AppleX/GRAPHICS/PLOTS.C
@@ -0,0 +1,33 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : plots.c
+Description : G2 Library Routine
+
+Revised by : Bill Buckels
+Revision Date: April 5, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+plots(str,x,y,color)
+char *str;
+int x,y,color;
+{
+ char c;
+ if(color==4)x+=40; /* set reverse video flag */
+
+ if(str[0]!=0)
+ {
+ if(color!=0)
+ while((c=*str++)!=0)plotchar(c,x++,y);
+ else
+ while((c=*str++)!=0)plotchar(' ',x++,y);
+ }
+}
+
+
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/PLOTS.R b/AppleX/GRAPHICS/PLOTS.R
new file mode 100644
index 0000000..7c54f4f
Binary files /dev/null and b/AppleX/GRAPHICS/PLOTS.R differ
diff --git a/AppleX/GRAPHICS/POKE.C b/AppleX/GRAPHICS/POKE.C
new file mode 100644
index 0000000..94c09c8
--- /dev/null
+++ b/AppleX/GRAPHICS/POKE.C
@@ -0,0 +1,24 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : poke.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: March 9, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+poke(address,value)
+int address;
+unsigned char value;
+{
+ unsigned char *poker=(unsigned char *)address;
+ *poker=value;
+
+}
+
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/POKE.R b/AppleX/GRAPHICS/POKE.R
new file mode 100644
index 0000000..9784e0d
Binary files /dev/null and b/AppleX/GRAPHICS/POKE.R differ
diff --git a/AppleX/GRAPHICS/PUTCHAR.R b/AppleX/GRAPHICS/PUTCHAR.R
new file mode 100644
index 0000000..f71d74c
Binary files /dev/null and b/AppleX/GRAPHICS/PUTCHAR.R differ
diff --git a/AppleX/GRAPHICS/PUTIMAGE.C b/AppleX/GRAPHICS/PUTIMAGE.C
new file mode 100644
index 0000000..a518aad
--- /dev/null
+++ b/AppleX/GRAPHICS/PUTIMAGE.C
@@ -0,0 +1,89 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : putimage.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Revision Date: July 7, 1991
+
+Licence : You may use this code for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#define PUT 0 /* action verbs for putimage */
+#define GET 1 /* expand as required */
+#define P_STIX 2
+#define P_BLACK 3
+#define P_WHITE 4
+#define P_AND 5
+
+extern unsigned HB[];
+
+/* handles screen manipulation of image fragments */
+/* both gets and puts */
+putimage(arrayname,width,height,xorg,yorg,action)
+char *arrayname;
+int width,height,xorg,yorg,action;
+{
+ int ctr=0;
+ char *ptr,*ptr2;
+ int temp;
+ int bos=yorg+height;
+ char tempbyte='\x80';
+
+
+ if(action==P_WHITE)tempbyte='\xff';
+
+ ptr = (char *)&arrayname[0];
+
+ while(yorg= width) {
+ x1 = xorg;
+ yorg++;
+ if (yorg >= height)break;
+ crt = (char *)(HB[yorg]+xorg);
+ }
+ }
+ else break;
+
+ offset++;
+ }
+
+ if (yorg >= height)break;
+
+ } while(offset
+
+/* read and decode RAG images with pcx run-length ecoding */
+/* directly onto screen */
+/* these are chunk oriented and do not break on scanlines */
+/* but the header provides the width and height so no problem */
+/* slightly more efficient to encode these in chunks since
+ repeats spanning scanlines encode more efficiently.*/
+
+/* a table containing the starting addresses of
+ the 192 scanlines in HIRES PAGE 2 */
+extern int HB[];
+
+int raxlode(name,xorg,yorg,packet,readbuf)
+char *name;
+int xorg,yorg,packet;
+unsigned char *readbuf;
+{
+ unsigned char *crt, *ptr, *raxend, ch;
+ int fh, x, x1, xcnt;
+ int offset=0,width,height,target;
+
+ fh = open(name,O_RDONLY,0x3C); /* open a binary file */
+ if (fh == -1) return -1;
+
+ x = read(fh,readbuf,packet); /* read file preferably in mutiples
+ of 512 byte blocks */
+
+ /* we don't know how many reads we need to make but to be
+ somewhat careful we check our first read of image data outside
+ the pcx decoder to make sure we read something */
+
+ if (x < 3) { /* image data must follow width and height */
+ close(fh);
+ return -2;
+ }
+
+ ptr = (unsigned char *)&readbuf[0];
+ raxend = (unsigned char *)&readbuf[packet];
+
+ width = *ptr++;
+ height = *ptr++;
+
+ /* the loader centres partial images on the screen
+ if loadpoints are invalid */
+
+ /* special case for compressed fullscreen images first
+ always load from top left */
+ if (width == 40) xorg = 0;
+ if (height == 192) yorg = 0;
+ if (width == 40 && height == 160) yorg = 0; /* fullscreen mixed text */
+
+ if (xorg < 0 || (xorg+width) > 39) {
+ xorg = 20-(width/2); /* break on even byte boundaries */
+ if((xorg%2)!=0)xorg--;
+ }
+ if (yorg < 0 || yorg > 191) {
+ yorg=96-(height/2);
+ }
+
+ target = (width * height);
+ width = width + xorg;
+ height = height + yorg;
+ crt = (unsigned char *)(HB[yorg]+xorg);
+ x1 = xorg;
+
+ do{
+
+ ch=*ptr++;
+
+ if (ptr >= raxend) {
+ read(fh,readbuf,packet);
+ ptr = (unsigned char *)&readbuf[0];
+ }
+
+ /* check to see if its raw */
+ /* if its not, run encoded */
+ if(0xC0 == (ch & 0xc0)){
+ xcnt = 0x3f & ch;
+ ch = *ptr++;
+ if (ptr >= raxend) {
+ read(fh,readbuf,packet);
+ ptr = (unsigned char *)&readbuf[0];
+ }
+ }
+ else
+ xcnt = 1;
+
+ for(x=0;x= width) {
+ x1 = xorg;
+ yorg++;
+ if (yorg >= height)break;
+ crt = (unsigned char *)(HB[yorg]+xorg);
+ }
+ }
+ else break;
+
+ offset++;
+ }
+
+ if (yorg >= height)break;
+
+ } while(offset
+
+struct dhrpixel dhrx = {0,0,0,'\x00','\x00','\x00','\x00'};
diff --git a/AppleX/GRAPHICS/ff.c b/AppleX/GRAPHICS/ff.c
new file mode 100644
index 0000000..1a0572f
--- /dev/null
+++ b/AppleX/GRAPHICS/ff.c
@@ -0,0 +1,216 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : ff.c
+Description : G2 Library Routines for Reading file lists etc.
+ from ProDOS Directories.
+
+ Call in the following order:
+
+ findopen()
+ findnext()
+ findclose()
+
+ Read the code and comments and see the demo piclist.c
+ for more info.
+
+ See prodir.h and demo program ld.c for more comments
+ and even more info.
+
+ Note: recursion is not supported and these
+ routines are designed for only a single instance.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+#include
+
+/* internal - for information call 411 */
+int findcount(cnt)
+int cnt;
+{
+ static int fcount = 0;
+
+ if (cnt != 411) fcount = cnt;
+
+ return fcount;
+}
+
+/* internal - for information call 411 */
+int findhandle(fh)
+int fh;
+{
+ static int fhandle = -1;
+
+ if (fh != 411) fhandle = fh;
+
+ return fhandle;
+}
+
+
+/* closes a ProDOS directory after calling findnext */
+int findclose()
+{
+ int fh = findhandle(411);
+ if (fh != -1) {
+ close(fh);
+ findhandle(-1);
+ }
+ findcount(0);
+}
+
+
+/* opens a ProDOS directory prior to calling findnext
+
+ arg - path - if null uses current directory
+
+ closes prior open directory if any.
+
+ if successful
+
+ - sets findhandle for findfirst
+ - sets findcount for findfirst
+ - returns a valid file handle
+
+ otherwise closes directory if open and returns error
+
+ */
+
+int findopen(path)
+char *path;
+{
+ char pathname[64], buf[43];
+ struct fileinfo pathinfo;
+ int fh = -1;
+
+ findclose();
+
+ if (NULL == path) {
+ if (getprefix (pathname) == -1)return -1;
+ }
+ else strcpy(pathname,path);
+
+ if (getfinfo (pathname, &pathinfo) == -1) return -2;
+ if (pathinfo.file_type != 15) return -3;
+
+ if ((fh = open (pathname, 0, 0)) < 0)return -4;
+
+ if (read (fh, buf, 43) < 43) {
+ close (fh);
+ return -5;
+ }
+
+ findhandle(fh);
+ findcount(1);
+
+return fh;
+
+}
+
+
+/* args - input - filetype - a valid ProDOS filetype - if 0 any filetype will be returned.
+ input - ext - extension without the dot - if null any extension will be returned.
+
+ input, output - filename - char[16] - must not be null
+ - filefind structure - must not be null
+
+ returns 0 if successful
+ returns -1 if done (directory is closed when done)
+ returns -2 if directory has not been opened prior to calling
+*/
+
+int findnext(filetype, ext, filename, ff)
+int filetype;
+char *ext, *filename;
+struct filefind *ff;
+{
+
+
+ char buf[16];
+ int fh, count, i, j, filelength;
+
+ fh = findhandle(411);
+ if (fh < 0) return -2;
+
+ count = findcount(411);
+ filename[0] = 0;
+
+ if (NULL != ext) {
+ for (i = 0; ext[i] != 0; i++) ext[i] = toupper(ext[i]);
+ }
+
+
+ for (;;) {
+
+ if (read (fh,ff,39) < 39) break;
+ if (ff->type == 0) break;
+
+ count++;
+ findcount(count);
+
+ if (count == 13)
+ {
+ read (fh,buf,5);
+ count = 0;
+ findcount(count);;
+ }
+
+
+ filelength = (ff->length & 0xf);
+
+ if (filelength != 0)
+ {
+
+ if (filetype == 0 || (filetype == (int)ff->type)) {
+
+ if (NULL == ext) {
+ strncpy(filename, ff->name, filelength);
+ filename[filelength] = 0;
+ return 0;
+ }
+ j = -1;
+ for (i = 0; i < filelength; i++) {
+ if (j > -1) {
+ buf[j] = toupper(ff->name[i]);
+ j++;
+ buf[j] = 0;
+ }
+ if (ff->name[i] == '.') j = 0;
+ }
+ if (j != -1) {
+ for (i = 0; ext[i] != 0; i++) {
+ if (ext[i] == '?') continue;
+ if (ext[i] != buf[i]) {
+ j = -1;
+ break;
+ };
+ }
+
+ }
+ if (j!= -1) {
+ strncpy(filename, ff->name, filelength);
+ filename[filelength] = 0;
+ return 0;
+
+ }
+ }
+ }
+ }
+
+ close (fh);
+ findhandle(-1);
+ findcount(0);
+ ff->name[0] = 0;
+ ff->length = 0;
+ ff->type = 0;
+
+
+ return -1;
+}
diff --git a/AppleX/GRAPHICS/ffg.c b/AppleX/GRAPHICS/ffg.c
new file mode 100644
index 0000000..04dce0b
--- /dev/null
+++ b/AppleX/GRAPHICS/ffg.c
@@ -0,0 +1,217 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : ffg.c
+Description : G2 Library Routines for Reading file lists etc.
+ from ProDOS Directories.
+
+ Call in the following order:
+
+ gfindopen()
+ gfindnext()
+ ggfindclose()
+
+ Read the code and comments and see the demo piclist.c
+ for more info.
+
+ See prodir.h and demo program ld.c for more comments
+ and even more info.
+
+ Note: recursion is not supported and these
+ routines are designed for only a single instance.
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+#include
+#include
+
+/* internal - for information call 411 */
+int gfindcount(cnt)
+int cnt;
+{
+ static int fcount = 0;
+
+ if (cnt != 411) fcount = cnt;
+
+ return fcount;
+}
+
+/* internal - for information call 411 */
+int gfindhandle(fh)
+int fh;
+{
+ static int fhandle = -1;
+
+ if (fh != 411) fhandle = fh;
+
+ return fhandle;
+}
+
+
+/* closes a ProDOS directory after calling findnext */
+int gfindclose()
+{
+ int fh = gfindhandle(411);
+ if (fh != -1) {
+ close(fh);
+ gfindhandle(-1);
+ }
+ gfindcount(0);
+}
+
+
+/* opens a ProDOS directory prior to calling findnext
+
+ arg - path - if null uses current directory
+
+ closes prior open directory if any.
+
+ if successful
+
+ - sets gfindhandle for findfirst
+ - sets gfindcount for findfirst
+ - returns a valid file handle
+
+ otherwise closes directory if open and returns error
+
+ */
+
+int gfindopen(path,pathinfo)
+char *path;
+struct fileinfo *pathinfo;
+{
+ char pathname[64], buf[43];
+
+ int fh = -1;
+
+ gfindclose();
+
+ if (NULL == path) {
+ if (getprefix (pathname) == -1)return -1;
+ }
+ else strcpy(pathname,path);
+
+ if (getfinfo (pathname, pathinfo) == -1) return -2;
+ if (pathinfo->file_type != 15) return -3;
+
+ if ((fh = open (pathname, 0, 0)) < 0)return -4;
+
+ if (read (fh, buf, 43) < 43) {
+ close (fh);
+ return -5;
+ }
+
+ gfindhandle(fh);
+ gfindcount(1);
+
+return fh;
+
+}
+
+
+/* args - input - filetype - a valid ProDOS filetype - if 0 any filetype will be returned.
+ input - ext - extension without the dot - if null any extension will be returned.
+
+ input, output - filename - char[16] - must not be null
+ - filefind structure - must not be null
+
+ returns 0 if successful
+ returns -1 if done (directory is closed when done)
+ returns -2 if directory has not been opened prior to calling
+*/
+
+int gfindnext(filetype, ext, filename, ff)
+int filetype;
+char *ext, *filename;
+struct filefind *ff;
+{
+
+
+ char buf[16];
+ int fh, count, i, j, filelength;
+
+ fh = gfindhandle(411);
+ if (fh < 0) return -2;
+
+ count = gfindcount(411);
+ filename[0] = 0;
+
+ if (NULL != ext) {
+ for (i = 0; ext[i] != 0; i++) ext[i] = toupper(ext[i]);
+ }
+
+
+ for (;;) {
+
+ if (read (fh,ff,39) < 39) break;
+ if (ff->type == 0) break;
+
+ count++;
+ gfindcount(count);
+
+ if (count == 13)
+ {
+ read (fh,buf,5);
+ count = 0;
+ gfindcount(count);;
+ }
+
+
+ filelength = (ff->length & 0xf);
+
+ if (filelength != 0)
+ {
+
+ if (filetype == 0 || (filetype == (int)ff->type)) {
+
+ if (NULL == ext) {
+ strncpy(filename, ff->name, filelength);
+ filename[filelength] = 0;
+ return 0;
+ }
+ j = -1;
+ for (i = 0; i < filelength; i++) {
+ if (j > -1) {
+ buf[j] = toupper(ff->name[i]);
+ j++;
+ buf[j] = 0;
+ }
+ if (ff->name[i] == '.') j = 0;
+ }
+ if (j != -1) {
+ for (i = 0; ext[i] != 0; i++) {
+ if (ext[i] == '?') continue;
+ if (ext[i] != buf[i]) {
+ j = -1;
+ break;
+ };
+ }
+
+ }
+ if (j!= -1) {
+ strncpy(filename, ff->name, filelength);
+ filename[filelength] = 0;
+ return 0;
+
+ }
+ }
+ }
+ }
+
+ close (fh);
+ gfindhandle(-1);
+ gfindcount(0);
+ ff->name[0] = 0;
+ ff->length = 0;
+ ff->type = 0;
+
+
+ return -1;
+}
diff --git a/AppleX/GRAPHICS/hbsh.c b/AppleX/GRAPHICS/hbsh.c
new file mode 100644
index 0000000..a3a1384
--- /dev/null
+++ b/AppleX/GRAPHICS/hbsh.c
@@ -0,0 +1,13 @@
+/* adjust HGR scanline array from page 2 to page 1
+ to use existing loaders for ProDOS SYS programs in
+ programs that use graphics page 1 (i.e. shell programs) */
+extern unsigned HB[];
+
+hbsh()
+{
+ unsigned y;
+
+ if (HB[0] == 0x4000) {
+ for (y= 0; y < 192;y++) HB[y] = (HB[y] - 0x2000);
+ }
+}
diff --git a/AppleX/GRAPHICS/putchar.c b/AppleX/GRAPHICS/putchar.c
new file mode 100644
index 0000000..bf8931c
--- /dev/null
+++ b/AppleX/GRAPHICS/putchar.c
@@ -0,0 +1,91 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : putchar.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use these routines for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+#asm
+
+ instxt
+
+#endasm
+
+
+/* print character using cout */
+cputchar(ch)
+{
+
+ unsigned char *regsptr = (unsigned char *)0x80;
+
+ /* load char into user reg */
+ regsptr[0] = ch;
+
+ /* make ml call */
+#asm
+ LDA REGS
+ JSR $FDED ;SEND IT THROUGH THE COUT ROUTINE
+#endasm
+
+}
+
+mousetexton()
+{
+
+ /* MouseText Characters
+ Apple II Technical Notes Developer Technical Support
+
+ http://mirrors.apple2.org.za/apple.cabi.net/FAQs.and.INFO/A2.TECH.NOTES.ETC/A2.CLASSIC.TNTS/mouse006.html
+
+ */
+
+ #asm
+
+ LDA #$1B ;MOUSETEXT ON
+ JSR $FDED
+
+ #endasm
+
+}
+
+mousetextoff()
+{
+ #asm
+
+ LDA #$18 ;MOUSETEXT OFF
+ JSR $FDED
+
+ #endasm
+}
+
+reversetext()
+{
+
+ #asm
+
+ LDA #$0F ;REVERSE
+ JSR $FDED
+
+ #endasm
+
+}
+
+normaltext()
+{
+ #asm
+
+ LDA #$0E ;NORMAL
+ JSR $FDED
+
+ #endasm
+
+}
\ No newline at end of file
diff --git a/AppleX/GRAPHICS/strulr.c b/AppleX/GRAPHICS/strulr.c
new file mode 100644
index 0000000..ae515e8
--- /dev/null
+++ b/AppleX/GRAPHICS/strulr.c
@@ -0,0 +1,40 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : strulr.c
+Description : G2 Library Routine
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use these routines for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+strlwr(str)
+char *str;
+{
+ int i;
+ char AZ;
+
+ for (i = 0; str[i] != 0; i++) {
+ AZ = str[i];
+ if (AZ > 64 && AZ < 91) str[i] = (AZ + 32);
+ }
+
+}
+
+strupr(str)
+char *str;
+{
+ int i;
+ char az;
+
+ for (i = 0; str[i] != 0; i++) {
+ az = str[i];
+ if (az > 96 && az < 123) str[i] = (az - 32);
+ }
+}
\ No newline at end of file
diff --git a/AppleX/INCLUDE/ASSERT.H b/AppleX/INCLUDE/ASSERT.H
new file mode 100644
index 0000000..5339685
--- /dev/null
+++ b/AppleX/INCLUDE/ASSERT.H
@@ -0,0 +1,8 @@
+#ifndef NDEBUG
+#ifndef stderr
+#include
+#endif
+#define assert(x) if (!(x)) {fprintf(stderr,"Assertion failed: x, file %s, line %d\n",__FILE__,__LINE__); exit(1);}
+#else
+#define assert(x)
+#endif
diff --git a/AppleX/INCLUDE/CONSOLE.H b/AppleX/INCLUDE/CONSOLE.H
new file mode 100644
index 0000000..768c034
--- /dev/null
+++ b/AppleX/INCLUDE/CONSOLE.H
@@ -0,0 +1,15 @@
+/* keypress values for the apple */
+
+#define RTARROW 21
+#define LTARROW 8
+#define UPARROW 11
+#define DNARROW 10
+#define ESCAPE 27
+#define DELETE 127
+#define ENTERKEY 13
+#define SPACEBAR 32
+
+
+
+
+
\ No newline at end of file
diff --git a/AppleX/INCLUDE/CTYPE.H b/AppleX/INCLUDE/CTYPE.H
new file mode 100644
index 0000000..f2a48a7
--- /dev/null
+++ b/AppleX/INCLUDE/CTYPE.H
@@ -0,0 +1,20 @@
+/* Copyright (C) 1984 by Manx Software Systems */
+
+extern char ctp_[];
+
+#define isalpha(x) (ctp_[(x)+1]&0x03)
+#define isupper(x) (ctp_[(x)+1]&0x01)
+#define islower(x) (ctp_[(x)+1]&0x02)
+#define isdigit(x) (ctp_[(x)+1]&0x04)
+#define isxdigit(x) (ctp_[(x)+1]&0x08)
+#define isalnum(x) (ctp_[(x)+1]&0x07)
+#define isspace(x) (ctp_[(x)+1]&0x10)
+#define ispunct(x) (ctp_[(x)+1]&0x40)
+#define iscntrl(x) (ctp_[(x)+1]&0x20)
+#define isprint(x) (ctp_[(x)+1]&0xc7)
+#define isgraph(x) (ctp_[(x)+1]&0x47)
+#define isascii(x) (((x)&~0x7f)==0)
+
+#define toascii(x) ((x)&127)
+#define _tolower(x) ((x)|0x20)
+#define _toupper(x) ((x)&0x5f)
diff --git a/AppleX/INCLUDE/DEVICE.H b/AppleX/INCLUDE/DEVICE.H
new file mode 100644
index 0000000..49eb06f
--- /dev/null
+++ b/AppleX/INCLUDE/DEVICE.H
@@ -0,0 +1,66 @@
+
+struct _slot_dev {
+ short outvec; /* CSW vector ($36-37) */
+ short invec; /* KSW vector ($38-39) */
+ short init; /* offset of init str into init_buf */
+ char slot; /* slot number */
+ char hi_slot; /* $s0 */
+ char type; /* -1=BASIC, 0=Pascal1.0, 1=Pascal1.1 */
+ char flags; /* flag byte for simple mappings */
+ char tabp; /* head position for tab mapping */
+ char tabw; /* tab width */
+ char iflags; /* initialization flags */
+ char xtra; /* unused */
+};
+
+/*
+ * Bit definition for "flags" field.
+ */
+
+#define SLOT_LFCR 0x01 /* map lf to cr/lf */
+#define SLOT_TABS 0x02 /* map tabs to spaces */
+#define SLOT_UPPR 0x04 /* map lower case to upper */
+#define SLOT_CRLF 0x08 /* follow cr with lf */
+#define SLOT_HIGH 0x80 /* turn on high bit of chars */
+
+/*
+ * Bit definition for "iflags" field.
+ */
+
+#define INIT_VEC 0x01 /* init the vector and type */
+#define INIT_CAL 0x02 /* call the init function */
+#define INIT_STR 0x04 /* send the init string */
+#define INIT_ONCE 0x08 /* only do it once */
+#define BACK_VEC 0x10
+#define BACK_CAL 0x20
+#define BACK_STR 0x40
+
+struct _name_dev {
+ char dev_nam[5];
+ char dev_num;
+};
+
+/* bits for con_flags */
+
+#define CON_IMAP 0x01
+#define CON_UPPR 0x02
+#define CON_HIGH 0x80
+
+struct _dev_info {
+ char fnd_str[14]; /* signature string for config */
+
+ unsigned short con_flags; /* console flags */
+ struct sgttyb tty; /* console tty structure */
+
+ struct _name_dev dev_con, /* the named slots */
+ dev_pr,
+ dev_ser;
+
+ struct _slot_dev slots[8]; /* the slots themselves */
+ int init_max; /* no. bytes of init space */
+ int init_len; /* no bytes used of init space */
+ char init_buf[]; /* the init space */
+};
+
+extern struct _dev_info *_dev_info;
+
diff --git a/AppleX/INCLUDE/ERRNO.H b/AppleX/INCLUDE/ERRNO.H
new file mode 100644
index 0000000..e162c60
--- /dev/null
+++ b/AppleX/INCLUDE/ERRNO.H
@@ -0,0 +1,31 @@
+extern int errno;
+
+/* ProDOS return codes */
+#define EINVAL 1
+#define ENOTDIR 3
+#define EMFILE 0x42
+#define EBADF 0x43
+#define ENOENT 0x46
+#define EEXIST 0x47
+#define EACCES 0x4e
+#define ENOTVOL 0x52
+#define ENOSPC 0x55
+#define EARENA 7
+#define ENOMEM 8
+#define EFAULT 9
+#define EINVENV 10
+#define EBADFMT 11
+#define EINVACC 12
+#define EINVDAT 13
+#define ENODEV 15
+#define ERMCD 16
+#define EXDEV 17
+#define ENOMORE 18
+
+/* additional codes used by Aztec C */
+#define ENOTTY 20
+#define EBADPRM 0x101
+#define ENOFUNC 0x102
+/* used by the math library */
+#define ERANGE 21
+#define EDOM 22
diff --git a/AppleX/INCLUDE/FCNTL.H b/AppleX/INCLUDE/FCNTL.H
new file mode 100644
index 0000000..8053b89
--- /dev/null
+++ b/AppleX/INCLUDE/FCNTL.H
@@ -0,0 +1,7 @@
+#define O_RDONLY 0
+#define O_WRONLY 1
+#define O_RDWR 2
+#define O_CREAT 0x0100
+#define O_TRUNC 0x0200
+#define O_EXCL 0x0400
+#define O_APPEND 0x0800
diff --git a/AppleX/INCLUDE/G3.H b/AppleX/INCLUDE/G3.H
new file mode 100644
index 0000000..c8b7ab4
--- /dev/null
+++ b/AppleX/INCLUDE/G3.H
@@ -0,0 +1,88 @@
+#ifndef _G3H_
+#define _G3H_
+
+#define PAGEONE poke(49236,0)
+#define PAGETWO poke(49237,0)
+
+/*
+ 80STORE off $C000 49152,0
+ on $C001 49153,0
+
+*/
+
+#define EIGHTYON poke(49153,0)
+#define EIGHTYOFF poke(49152,0)
+
+#define TEXTMODE 0
+#define LORES 1
+#define GRAFMODE 2 /* graphics only */
+#define DHRMODE 3 /* double hi-res graphics */
+#define DLORES 4 /* double lo-res graphics */
+#define TEXT80 5 /* 80 column textmode */
+#define MIXEDMODE 6
+#define FULLMODE 7
+
+
+/*
+
+color definitions for lores mode
+
+black COLOR=0
+red COLOR=1
+dk blue COLOR=2
+purple COLOR=3
+dk green COLOR=4
+gray COLOR=5
+med blue COLOR=6
+lt blue COLOR=7
+brown COLOR=8
+orange COLOR=9
+grey COLOR=10
+pink COLOR=11
+lt green COLOR=12
+yellow COLOR=13
+aqua COLOR=14
+white COLOR=15
+
+*/
+
+
+#define LOBLACK 0
+#define LORED 1
+#define LODKBLUE 2
+#define LOPURPLE 3
+#define LODKGREEN 4
+#define LOGRAY 5
+#define LOMEDBLUE 6
+#define LOLTBLUE 7
+#define LOBROWN 8
+#define LOORANGE 9
+#define LOGREY 10
+#define LOPINK 11
+#define LOLTGREEN 12
+#define LOYELLOW 13
+#define LOAQUA 14
+#define LOWHITE 15
+
+
+/*
+
+ black HCOLOR=0
+ green HCOLOR=1
+ purple HCOLOR=2
+ white HCOLOR=3
+ black2 HCOLOR=4
+ orange HCOLOR=5
+ blue HCOLOR=6
+ white2 HCOLOR=7
+
+*/
+
+
+/* timing loop function for slideshow - see G2 library function dwait.c */
+#define XTIME 1024L
+#define YTIME 32L
+
+
+
+#endif
\ No newline at end of file
diff --git a/AppleX/INCLUDE/MATH.H b/AppleX/INCLUDE/MATH.H
new file mode 100644
index 0000000..c0f5c18
--- /dev/null
+++ b/AppleX/INCLUDE/MATH.H
@@ -0,0 +1,12 @@
+double sin(), cos(), tan(), cotan();
+double asin(), acos(), atan(), atan2();
+double ldexp(), frexp(), modf();
+double floor(), ceil(), fabs();
+double log(), log10(), exp(), sqrt(), pow();
+double sinh(), cosh(), tanh();
+
+#define fabs(d) ((d) < 0.0 ? -(d) : (d))
+#define HUGE_VAL 5.2e+151
+#define LOGHUGE 349.3
+#define TINY_VAL 7.5e-155
+#define LOGTINY -354.8
diff --git a/AppleX/INCLUDE/OBJECT.H b/AppleX/INCLUDE/OBJECT.H
new file mode 100644
index 0000000..3863c3e
--- /dev/null
+++ b/AppleX/INCLUDE/OBJECT.H
@@ -0,0 +1,127 @@
+#define SPEC2 0x00
+#define THEEND 0x00
+#define ABSDATA 0x10
+#define EXPR 0x20
+#define SMLINT 0x30
+#define SMLNEG 0x40
+#define MEDINT 0x50
+#define LCLSYM 0x60
+#define GBLSYM 0x70
+#define SPACE 0x80
+#define USECOMN 0x90
+#define CODEREF 0xa0
+#define DATAREF 0xb0
+#define BSSREF 0xc0
+#define SEGREL 0xd0 /* segment relative reference */
+#define SPECIAL 0xf0
+#define DATASEG 0xf0 /* para # of data segment (8086 only) */
+#define BEXPR 0xf1 /* byte expression */
+#define BREL 0xf2 /* 8-bit PC relative */
+#define LRGINT 0xf3
+#define USECODE 0xf4
+#define USEDATA 0xf5
+#define STARTAD 0xf6
+#define LRGCODE 0xf7
+#define LRGDATA 0xf8
+#define INTJSR 0xf9 /* interpreter call instruction */
+#define WREL 0xfa /* 16-bit PC relative */
+#define LRGBSS 0xfb
+#define HUGINT 0xfc /* 32-bit constant */
+#define LEXPR 0xfd /* 32-bit address expression */
+#define CODESEG 0xfe /* para # of code segment (8086 only) */
+#define NLINE 0xff
+
+#define ADD 1
+#define SUB 2
+#define MUL 3
+#define DIV 4
+#define MOD 5
+#define AND 6
+#define OR 7
+#define XOR 8
+#define RSH 9
+#define LSH 10
+#define NOT 11 /* must be the first unary op, and only unarys may follow */
+#define NEG 12
+#define OHIGH 13
+#define OLOW 14
+#define OSEG 15
+
+#define M_MAGIC 0x5466
+#define M_LMAGIC 0x020c
+#define M_OVROOT ((int)0xcf56)
+#define M_LIBRARY ((int)0xec62)
+
+struct module {
+ short m_magic; /* magic number for object files */
+ char m_name[8]; /* module name */
+ unsigned short m_code; /* size of code in this module */
+ unsigned short m_data; /* size of data in this module */
+ unsigned short m_static;/* size of static storage (bss) in this module */
+ unsigned short m_global;/* offset of start of global symbols */
+ short m_nglobal; /* # of global symbols */
+ unsigned short m_local; /* offset of start of local symbols */
+ short m_nlocal; /* # of local symbols */
+ unsigned short m_end; /* end of local symbols */
+ unsigned short m_next; /* offset of next module in this file */
+ unsigned short m_nfix; /* number of segment fixes required */
+};
+
+#define LBSIZE (2048-2*sizeof(short))
+
+struct newlib {
+ short nl_magic; /* magic number for library files */
+ unsigned short nl_next; /* location of next dictionary block */
+ char nl_dict[LBSIZE]; /* dictionary buffer */
+ /* the format of the dictionary is:
+ two bytes - (position of module defining symbol) / 128
+ nul terminated string - name of symbol
+ */
+};
+
+#define S_ABS 1
+#define S_CODE 2
+#define S_DATA 3
+#define S_COMN 4 /* common segment (obsolete) */
+#define S_CMNREF 5
+#define S_ROOTSYM 6 /* used by linker to tag root symbols */
+#define S_EXPR 6
+#define S_UND 7
+#define S_WEAK 8
+#define S_BSS 9
+#define S_GROUP 10
+#define S_PSEG 11 /* public segment */
+#define S_SSEG 12 /* stack segment */
+#define S_MSEG 13 /* memory segment */
+#define S_CSEG 14 /* common segment (new form) */
+#define S_CLASS 15 /* segment class name */
+
+#define ST_TYPE 0x0f /* type part of symbol type */
+
+#define ST_ALIGN 0x70 /* alignment type (for segments) */
+#define ST_BYTE 0x00 /* alignment boundarys (byte) */
+#define ST_WORD 0x10 /* even */
+#define ST_PARA 0x20 /* 16-byte */
+#define ST_PAGE 0x30 /* 256-byte */
+#define ST_INPAGE 0x40 /* within 256 byte page */
+
+/* symbol flags */
+#define SF_DATAREF 0x02 /* used for externs in dataseg */
+#define SF_HAVCLAS 0x04 /* symbol is followed by class index */
+#define SF_GLOBL 0x08 /* symbol is public/extern */
+#define SF_HAVSEG 0x10 /* symbol is followed by segment/group # */
+#define SF_OVSYM 0x20 /* overlay symbol */
+#define S_FIXED 0x40
+#define S_UNNAMED 0x80
+
+struct symtab {
+ char s_type,s_flags;
+ unsigned short s_value;
+};
+
+/* symbol table entry is followed by a segment or group # if the SF_HAVSEG
+ flag is set.
+
+ Global symbols are followed by a nul terminated string which is the
+ name of the symbol.
+*/
diff --git a/AppleX/INCLUDE/PRODIR.H b/AppleX/INCLUDE/PRODIR.H
new file mode 100644
index 0000000..30c7fb8
--- /dev/null
+++ b/AppleX/INCLUDE/PRODIR.H
@@ -0,0 +1,221 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : prodir.h
+Description : G2 Library Demo Program
+ ProDOS Directory Structures
+
+Written by : Bill Buckels
+Date Written : January 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+
+/* the Aztec C runtime library function getfinfo() fetches information from ProDOS
+about a file, including volume directories and subdirectories, by issuing the
+GET_FILE_INFO ProDOS MLI call, and returns the information about the file
+in the following structure... */
+
+
+struct fileinfo {
+ unsigned char access;
+ unsigned char file_type;
+ unsigned aux_type;
+ unsigned char storage_type;
+ unsigned blocks_used;
+ unsigned mod_date;
+ unsigned mod_time;
+ unsigned create_date;
+ unsigned create_time;
+ };
+
+
+/* based on volume directory header */
+struct keyblockheader{
+ unsigned char length; /* low nibble = file name length */
+ char name[15];
+ unsigned char reserved[8];
+ unsigned create_date;
+ unsigned create_time;
+ unsigned char version;
+ unsigned char minversion;
+ unsigned char access;
+ unsigned char entrylength;
+ unsigned char entries;
+ unsigned count;
+ unsigned pointer;
+ unsigned blocks;
+ };
+
+/* based on directory file entries */
+struct filefind{
+ unsigned char length; /* low nibble = file name length */
+ char name[15];
+ unsigned char type;
+ unsigned key;
+ unsigned blocks;
+ unsigned size;
+ unsigned char size3; /* highest byte of 3 byte filesize integer */
+ unsigned create_date;
+ unsigned create_time;
+ unsigned char version;
+ unsigned char minversion;
+ unsigned char access;
+ unsigned address; /* load adress (subtype) low-byte */
+ unsigned mod_date;
+ unsigned mod_time;
+ unsigned hdr;
+ };
+
+
+
+
+
+/*
+
+Figure B-3. The Volume Directory Header
+
+
+ Field Byte of
+ Length Block
+ +----------------------------+
+ 1 byte | storage_type | name_length | $04
+ |----------------------------|
+ | | $05
+ / /
+ 15 bytes / file_name /
+ | | $13
+ |----------------------------|
+ | | $14
+ / /
+ 8 bytes / reserved /
+ | | $1B
+ |----------------------------|
+ | | $1C
+ | creation | $1D
+ 4 bytes | date & time | $1D
+ | | $1F
+ |----------------------------|
+ 1 byte | version | $20
+ |----------------------------|
+ 1 byte | min_version | $21
+ |----------------------------|
+ 1 byte | access | $22
+ |----------------------------|
+ 1 byte | entry_length | $23
+ |----------------------------|
+ 1 byte | entries_per_block | $24
+ |----------------------------|
+ | | $25
+ 2 bytes | file_count | $26
+ |----------------------------|
+ | | $27
+ 2 bytes | bit_map_pointer | $28
+ |----------------------------|
+ | | $29
+ 2 bytes | total_blocks | $2A
+ +----------------------------+
+
+Figure B-4. The Subdirectory Header
+
+
+ Field Byte of
+ Length Block
+ +----------------------------+
+ 1 byte | storage_type | name_length | $04
+ |----------------------------|
+ | | $05
+ / /
+ 15 bytes / file_name /
+ | | $13
+ |----------------------------|
+ | | $14
+ / /
+ 8 bytes / reserved /
+ | | $1B
+ |----------------------------|
+ | | $1C
+ | creation | $1D
+ 4 bytes | date & time | $1D
+ | | $1F
+ |----------------------------|
+ 1 byte | version | $20
+ |----------------------------|
+ 1 byte | min_version | $21
+ |----------------------------|
+ 1 byte | access | $22
+ |----------------------------|
+ 1 byte | entry_length | $23
+ |----------------------------|
+ 1 byte | entries_per_block | $24
+ |----------------------------|
+ | | $25
+ 2 bytes | file_count | $26
+ |----------------------------|
+ | | $27
+ 2 bytes | parent_pointer | $28
+ |----------------------------|
+ 1 byte | parent_entry_number | $29
+ |----------------------------|
+ 1 byte | parent_entry_length | $2A
+ +----------------------------+
+
+*/
+
+
+/* ProDOS 8 Technical Reference Manual
+ http://www.easy68k.com/paulrsm/6502/PDOS8TRM.HTM
+
+Figure B-5. The File Entry
+
+ Field Entry
+ Length Offset
+ +----------------------------+
+ 1 byte | storage_type | name_length | $00
+ |----------------------------|
+ | | $01
+ / /
+ 15 bytes / file_name /
+ | | $0F
+ |----------------------------|
+ 1 byte | file_type | $10
+ |----------------------------|
+ | | $11
+ 2 bytes | key_pointer | $12
+ |----------------------------|
+ | | $13
+ 2 bytes | blocks_used | $14
+ |----------------------------|
+ | | $15
+ 3 bytes | EOF |
+ | | $17
+ |----------------------------|
+ | | $18
+ | creation |
+ 4 bytes | date & time |
+ | | $1B
+ |----------------------------|
+ 1 byte | version | $1C
+ |----------------------------|
+ 1 byte | min_version | $1D
+ |----------------------------|
+ 1 byte | access | $1E
+ |----------------------------|
+ | | $1F
+ 2 bytes | aux_type | $20
+ |----------------------------|
+ | | $21
+ | |
+ 4 bytes | last mod |
+ | | $24
+ |----------------------------|
+ | | $25
+ 2 bytes | header_pointer | $26
+ +----------------------------+
+
+*/
+
diff --git a/AppleX/INCLUDE/PRODOS.H b/AppleX/INCLUDE/PRODOS.H
new file mode 100644
index 0000000..9a1819c
--- /dev/null
+++ b/AppleX/INCLUDE/PRODOS.H
@@ -0,0 +1,24 @@
+#define MAXFILES 8
+struct _fil_buf {
+ char unit, /* DOS return or device nr | 0x80 */
+ flags; /* r/w flags */
+ char *iob; /* alloc'd area for io buffer */
+ };
+
+extern struct _fil_buf *_fil_tab;
+
+#define RDWRT 2
+
+/* file information structure */
+struct finfo {
+ unsigned char access;
+ unsigned char file_type;
+ unsigned short aux_type;
+ unsigned char storage_type;
+ unsigned short blocks_used;
+ unsigned short mod_date;
+ unsigned short mod_time;
+ unsigned short create_date;
+ unsigned short create_time;
+};
+
diff --git a/AppleX/INCLUDE/SETJMP.H b/AppleX/INCLUDE/SETJMP.H
new file mode 100644
index 0000000..cfc8adf
--- /dev/null
+++ b/AppleX/INCLUDE/SETJMP.H
@@ -0,0 +1 @@
+typedef char jmp_buf[26];
diff --git a/AppleX/INCLUDE/SGTTY.H b/AppleX/INCLUDE/SGTTY.H
new file mode 100644
index 0000000..36baebe
--- /dev/null
+++ b/AppleX/INCLUDE/SGTTY.H
@@ -0,0 +1,22 @@
+/* Copyright (C) 1984,85 by Manx Software Systems, Inc. */
+
+#define TIOCGETP 0 /* read contents of tty control structure */
+#define TIOCSETP 1 /* set contents of tty control structure */
+#define TIOCSETN 2 /* ditto only don't wait for output to flush */
+
+struct sgttyb {
+ short sg_flags; /* control flags */
+ char sg_erase;
+ char sg_kill;
+};
+
+/* settings for flags */
+#define TABSIZ 0x000f /* size of tab if XTABS is set */
+#define XTABS 0x0010 /* convert tabs to spaces on output */
+#define CRMOD 0x0020 /* CR -> LF on input, LF -> CR/LF on output */
+#define ECHO 0x0040 /* echo input to output */
+#define ECHOE 0x0080 /* follow erase character by space, BS */
+#define CBREAK 0x0100 /* don't wait for the whole line */
+#define NODELAY 0x0200 /* return even if no characters */
+#define RAW 0x0400 /* no input or output mapping at all */
+
diff --git a/AppleX/INCLUDE/STDIO.H b/AppleX/INCLUDE/STDIO.H
new file mode 100644
index 0000000..99c1ca6
--- /dev/null
+++ b/AppleX/INCLUDE/STDIO.H
@@ -0,0 +1,46 @@
+/* Copyright (C) 1982, 1984 by Manx Software Systems */
+#define fgetc getc
+#define fputc putc
+#define NULL (void *)0
+#define EOF -1
+
+
+#define BUFSIZ 1024
+#define MAXSTREAM 20
+
+#define _BUSY 0x01
+#define _ALLBUF 0x02
+#define _DIRTY 0x04
+#define _EOF 0x08
+#define _IOERR 0x10
+#define _TEMP 0x20 /* temporary file (delete on close) */
+
+typedef struct {
+ char *_bp; /* current position in buffer */
+ char *_bend; /* last character in buffer + 1 */
+ char *_buff; /* address of buffer */
+ char _flags; /* open mode, etc. */
+ char _unit; /* token returned by open */
+ char _bytbuf; /* single byte buffer for unbuffer streams */
+ int _buflen; /* length of buffer */
+ char *_tmpname; /* name of file for temporaries */
+} FILE;
+
+extern FILE Cbuffs[];
+FILE *fopen();
+long ftell();
+
+#define stdin (&Cbuffs[0])
+#define stdout (&Cbuffs[1])
+#define stderr (&Cbuffs[2])
+#define getchar() agetc(stdin)
+#define putchar(c) aputc(c, stdout)
+#define feof(fp) (((fp)->_flags&_EOF)!=0)
+#define ferror(fp) (((fp)->_flags&_IOERR)!=0)
+#define clearerr(fp) ((fp)->_flags &= ~(_IOERR|_EOF))
+#define fileno(fp) ((fp)->_unit)
+#define fflush(fp) flsh_(fp,-1)
+
+#define P_tmpdir ""
+#define L_tmpnam 40
+
\ No newline at end of file
diff --git a/AppleX/INCLUDE/SYSFUNC.H b/AppleX/INCLUDE/SYSFUNC.H
new file mode 100644
index 0000000..5d8f921
--- /dev/null
+++ b/AppleX/INCLUDE/SYSFUNC.H
@@ -0,0 +1,30 @@
+/* Copyright (c) 1984 by Manx Software Systems */
+
+extern char _sys_parm[18]; /* parameter area for ProDOS MLI calls */
+
+#define SYS_CREAT 0xC0
+#define SYS_DSTRY 0xC1
+#define SYS_RENAM 0xC2
+#define SYS_SINFO 0xC3
+#define SYS_GINFO 0xC4
+#define SYS_ONLIN 0xC5
+#define SYS_STPFX 0xC6
+#define SYS_GTPFX 0xC7
+#define SYS_OPEN 0xC8
+#define SYS_NEWLN 0xC9
+#define SYS_READ 0xCA
+#define SYS_WRITE 0xCB
+#define SYS_CLOSE 0xCC
+#define SYS_FLUSH 0xCD
+#define SYS_STMRK 0xCE
+#define SYS_GTMRK 0xCF
+#define SYS_STEOF 0xD0
+#define SYS_GTEOF 0xD1
+#define SYS_STBUF 0xD2
+#define SYS_GTBUF 0xD3
+#define SYS_ALINT 0x40
+#define SYS_DALIN 0x41
+#define SYS_RDBLK 0x80
+#define SYS_WRBLK 0x81
+#define SYS_TIME 0x82
+
diff --git a/AppleX/INCLUDE/TIME.H b/AppleX/INCLUDE/TIME.H
new file mode 100644
index 0000000..d461e71
--- /dev/null
+++ b/AppleX/INCLUDE/TIME.H
@@ -0,0 +1,21 @@
+/* Copyright (C) 1984, 1985 by Manx Software Systems */
+
+typedef long time_t;
+
+struct tm {
+ short tm_sec;
+ short tm_min;
+ short tm_hour;
+ short tm_mday;
+ short tm_mon;
+ short tm_year;
+ short tm_wday;
+ short tm_yday;
+ short tm_isdst;
+ short tm_hsec;
+};
+
+struct tm *gmtime(), *localtime();
+char *asctime(), *ctime();
+time_t time();
+
diff --git a/AppleX/INCLUDE/ZPAGE.H b/AppleX/INCLUDE/ZPAGE.H
new file mode 100644
index 0000000..a44ad26
--- /dev/null
+++ b/AppleX/INCLUDE/ZPAGE.H
@@ -0,0 +1,29 @@
+*:ts=8
+*
+* Copyright (C) 1985 by Manx Software Systems, Inc.
+*
+
+* These are set up for the Apple // Dos 3.3
+
+STK EQU $00 ;8 byte stack area
+VAL EQU STK
+SP EQU STK+2
+AFRAME EQU STK+4
+FRAME EQU STK+4
+LFRAME EQU STK+6
+PC EQU STK+6
+
+TREGS equ $08 ;24 byte tmp register area
+R0 EQU TREGS+0
+R1 EQU TREGS+4
+R2 EQU TREGS+8
+R3 EQU TREGS+12
+R4 EQU TREGS+16
+
+ACC EQU TREGS+20
+SEC EQU TREGS+22
+
+REGS EQU $80 ;16 byte user register area
+
+TMP EQU $40 ;4 byte zero page temporary area
+
diff --git a/AppleX/INCLUDE/dhrpixel.h b/AppleX/INCLUDE/dhrpixel.h
new file mode 100644
index 0000000..1c2aaa8
--- /dev/null
+++ b/AppleX/INCLUDE/dhrpixel.h
@@ -0,0 +1,21 @@
+/* structure used by Double Hi-Res 140 x 192 x 16 color plot routines */
+/* by Bill Buckels 2013 */
+
+/* note: if this structure is expanded, the G2 global library structure in
+ dhrpixel.c must be expanded to match and a new library must be
+ built and put into the lib directory. Also review the other
+ library routines that use this structure to ensure they do not break. */
+
+struct dhrpixel
+{
+ int pattern; /* 7 positions 0 - 6 of 4 bit color straddling 4 7-bit bytes */
+ int xaux; /* offset for auxmem pointer address */
+ int xmain; /* offset for mainmem pointer address */
+
+ unsigned char caux; /* auxmem color bitmap */
+ unsigned char cmain; /* mainmem color bitmap */
+ unsigned char mska; /* auxmem mask to erase old color */
+ unsigned char mskm; /* mainmem mask to erase old color */
+
+};
+
diff --git a/AppleX/LIB/C.LIB b/AppleX/LIB/C.LIB
new file mode 100644
index 0000000..2306a73
Binary files /dev/null and b/AppleX/LIB/C.LIB differ
diff --git a/AppleX/LIB/CI.LIB b/AppleX/LIB/CI.LIB
new file mode 100644
index 0000000..de702ec
Binary files /dev/null and b/AppleX/LIB/CI.LIB differ
diff --git a/AppleX/LIB/G2.LIB b/AppleX/LIB/G2.LIB
new file mode 100644
index 0000000..83c6915
Binary files /dev/null and b/AppleX/LIB/G2.LIB differ
diff --git a/AppleX/LIB/G2lib.txt b/AppleX/LIB/G2lib.txt
new file mode 100644
index 0000000..e039954
--- /dev/null
+++ b/AppleX/LIB/G2lib.txt
@@ -0,0 +1,19 @@
+lb 3.40a 5-29-86
+**DIR** plots emslode emsput emsput2 fbox2
+hibase2 monochar monoline monoplot bopen drawline
+bsave bload picsave subchar dlores2 dlopixel
+dlofont dxlut liblode fontlode fileplot filechar
+hbsh hgr text plotchar circle line
+plot clear page fscreen mscreen setasp
+dmonline clear1 play dhrcalc dhvlin drfbox
+dmonplot grafmode fbox piclode putimage hibase
+poke getch kbhit sound dhdisc dmonbyte
+dxlode call33 bottom putrax bars emsget
+emsrag emsrig keyclr dhcirc dhrline dmonchar
+hibox pchar lofont lores lopixel textbase
+dhrfont dlodelo drbytes drflood drmain dhrplot
+drlode hibase3 grafmodx dlores dxblock dxline
+dxlode2 dhrcalc2 dwait dhrpixel dplode crt80
+putchar ff strulr raxlode ffg **DIR**
+d2lode d2plot d2vline d2pld d2circ d2fbox
+d2flood d2font d2init d2line d2save lolode
diff --git a/AppleX/LIB/IO.LIB b/AppleX/LIB/IO.LIB
new file mode 100644
index 0000000..f938421
Binary files /dev/null and b/AppleX/LIB/IO.LIB differ
diff --git a/AppleX/LIB/M.LIB b/AppleX/LIB/M.LIB
new file mode 100644
index 0000000..689a777
Binary files /dev/null and b/AppleX/LIB/M.LIB differ
diff --git a/AppleX/LIB/MI.LIB b/AppleX/LIB/MI.LIB
new file mode 100644
index 0000000..aca4ceb
Binary files /dev/null and b/AppleX/LIB/MI.LIB differ
diff --git a/AppleX/LIB/ReadMe.txt b/AppleX/LIB/ReadMe.txt
new file mode 100644
index 0000000..186d571
--- /dev/null
+++ b/AppleX/LIB/ReadMe.txt
@@ -0,0 +1,14 @@
+ReadMe file for the Applex\LIB Directory
+
+The text files in this directory list the libraries that correspond
+to the text file name. These files are simply output from the Aztec C
+lb utility redirected to disk. To list the contents of a library make
+sure lb is on path and type lb -t libraryname.lib. This will give you
+the latest list... especially for G2.lib which seems to always be
+growing.
+
+Note that IO.LIB and SYSIO.LIB are both the same. I made the shorter-
+named copy of IO.LIB to save space on the linker line.
+
+Bill Buckels, 2013
+
diff --git a/AppleX/LIB/S.LIB b/AppleX/LIB/S.LIB
new file mode 100644
index 0000000..8c99ac0
Binary files /dev/null and b/AppleX/LIB/S.LIB differ
diff --git a/AppleX/LIB/SI.LIB b/AppleX/LIB/SI.LIB
new file mode 100644
index 0000000..6116571
Binary files /dev/null and b/AppleX/LIB/SI.LIB differ
diff --git a/AppleX/LIB/SYSIO.LIB b/AppleX/LIB/SYSIO.LIB
new file mode 100644
index 0000000..f938421
Binary files /dev/null and b/AppleX/LIB/SYSIO.LIB differ
diff --git a/AppleX/LIB/SYSIOlib.txt b/AppleX/LIB/SYSIOlib.txt
new file mode 100644
index 0000000..ac9bb05
--- /dev/null
+++ b/AppleX/LIB/SYSIOlib.txt
@@ -0,0 +1,3 @@
+lb 3.40a 5-29-86
+**DIR** sexec ldnjmp exitu savex aux2main
+main2aux
diff --git a/AppleX/LIB/V.LIB b/AppleX/LIB/V.LIB
new file mode 100644
index 0000000..b81cea8
Binary files /dev/null and b/AppleX/LIB/V.LIB differ
diff --git a/AppleX/LIB/clib.txt b/AppleX/LIB/clib.txt
new file mode 100644
index 0000000..b7f907d
--- /dev/null
+++ b/AppleX/LIB/clib.txt
@@ -0,0 +1,21 @@
+lb 3.40a 5-29-86
+**DIR** tmpfile perror fdopen fopen fseek
+scanf gets getchar fscanf fgets agetc
+fread getw getc puterr printf puts
+putchar fprintf fputs aputc fwrite putw
+putc getbuff setbuf tmpnam mktemp ungetc
+getenv calloc malloc access data execp
+exec isatty open casecvt lseek read
+write rename geteof seteof seteofu getfinfo
+getfinfu setfinfo setfinfu getiob setiob mkdir
+rsvstk brk sbrk crt0 shmain exit
+close unlink fixnam fixnamu setprfx getprfx
+strshft device exitu devtab gdev ioctl
+ctime asctime gettime localtim time system
+atoi atol qsort sscanf scan sprintf
+format ctype swapmem setmem rindex strrchr
+strncat fstswt tmpsav strequ index strchr
+movmem move strncpy strncmp strcat strcmp
+strcpy istack lmath strlen swit math
+shift lshift stack sup interp fldstar
+flt longs setjmp
diff --git a/AppleX/LIB/mlib.txt b/AppleX/LIB/mlib.txt
new file mode 100644
index 0000000..f5e16f3
--- /dev/null
+++ b/AppleX/LIB/mlib.txt
@@ -0,0 +1,6 @@
+lb 3.40a 5-29-86
+**DIR** asin atan floor pow log
+random sin sinh sqrt tan tanh
+exp fprintf printf sprintf fformat fscanf
+scanf sscanf fscan fabs flt65 math
+ftoa atof flt2 flt1
diff --git a/AppleX/LIB/slib.txt b/AppleX/LIB/slib.txt
new file mode 100644
index 0000000..86a00a3
--- /dev/null
+++ b/AppleX/LIB/slib.txt
@@ -0,0 +1,4 @@
+lb 3.40a 5-29-86
+**DIR** beep bs cdelete cinsert clear
+cr cursup cursrt curs eol home
+ldelete lf linsert tab
diff --git a/AppleX/LIB/vlib.txt b/AppleX/LIB/vlib.txt
new file mode 100644
index 0000000..7952997
--- /dev/null
+++ b/AppleX/LIB/vlib.txt
@@ -0,0 +1,2 @@
+lb 3.40a 5-29-86
+**DIR** disp file insert prodos subs
diff --git a/AppleX/R/OVBGN.R b/AppleX/R/OVBGN.R
new file mode 100644
index 0000000..a3a4228
Binary files /dev/null and b/AppleX/R/OVBGN.R differ
diff --git a/AppleX/R/OVLD.R b/AppleX/R/OVLD.R
new file mode 100644
index 0000000..06e2d38
Binary files /dev/null and b/AppleX/R/OVLD.R differ
diff --git a/AppleX/R/SAMAIN.R b/AppleX/R/SAMAIN.R
new file mode 100644
index 0000000..0d340f5
Binary files /dev/null and b/AppleX/R/SAMAIN.R differ
diff --git a/AppleX/R/TMPDEV.R b/AppleX/R/TMPDEV.R
new file mode 100644
index 0000000..f9faa5b
Binary files /dev/null and b/AppleX/R/TMPDEV.R differ
diff --git a/AppleX/ReadFirst.txt b/AppleX/ReadFirst.txt
new file mode 100644
index 0000000..849aca5
--- /dev/null
+++ b/AppleX/ReadFirst.txt
@@ -0,0 +1,204 @@
+ReadMe for AppleX 2013 Update
+Updated April 2013
+
+Release Notes and Other Stuff That Should Be In A ReadMe
+--------------------------------------------------------
+
+Additional Directory Structure - AppleX\PROGRAMS
+------------------------------------------------
+
+For the AppleX 2013 update, I have separated the directory structure for
+non- trivial Graphics and other non-trivial Demo Programs and placed them
+under AppleX\PROGRAMS. None of these were ever included in AppleX before
+now, and all have been written since late Fall of 2012 with the exception
+of a couple of the utilities and some demos from the Apple33 DOS 3.3
+Aztec C65 cross-compiler distribution. Those have been completely
+rewritten and are much improved.
+
+Graphics Mode Support Extended
+------------------------------
+
+AppleX now Supports
+
+LGR - Lo-Res
+DLGR - Double Lo-Res
+HGR - Hi-Res Color and Monochrome
+DHGR - Double Hi-Res Color and Monochrome
+
+4 of the subdirectories in the AppleX\PROGRAMS directory are related to
+the 4 main graphics modes of the Apple II (see above), and each contains
+source code, programs, utilities, documentation, and disk images related
+to working with the AppleX Aztec C65 distribution and Graphics on the
+Apple II. All 4 graphics mode are supported at a pretty similar level. Until the
+2013 Apple X update, support for Apple II graphics was limited, with
+a huge focus on HGR color, because that's what I knew best.
+
+HGR support is still stronger than the rest in specialized areas because
+AppleX provides all the tools I wrote and used many years back in
+conjunction with full-blown projects to do such things as loading
+graphics libraries into Axiliary memory and other related stuff. But each
+of the 4 graphics modes provide image loaders, line drawing routines, and
+font routines and so forth.
+
+And most importantly (to me), AppleX comes with documented methodology
+and toools to aquire bit-mapped graphics from a variety of sources
+including Windows, Apple II Native Format, and Hybrid Sources like
+AppleWin Screen Captures of running programs that make obtaining graphics
+for use in your own programs easy if not too easy.
+
+Robust Documentation Much Expanded
+----------------------------------
+
+Please read the source code and documentation, and run the demos and
+programs you find in each AppleX\PROGRAMS\subdirectory as well as any
+documentation you find laying about for more information.
+
+The immensely expanded source code in the AppleX\GRAPHICS directory is
+also a good reference for more information. This is the source code for
+the G2 (Graphics) library, which also includes the source code from the
+original Aztec C65 G.lib.
+
+Comprehensive documentation for Aztec C itself and its original toolchain
+has been available in pdf format user's manuals from the Aztec C website
+at www.aztecmuseum.ca for a number of years now. But with this release of
+AppleX and with many pdf "tutorials" and users manuals being very much
+expanded-on especially for Apple II graphics programming, new life has
+been breathed into this old compiler, taking its capabilities far beyond
+the Apple II Community's "Retro-Compiler" perception... until AppleX, all
+that was available was a previous ProDOS native-mode shell version that
+does not even support creating floating point SYS programs, so if this
+perception is not clearly incorrect, it is somewhat understandabley
+incorrect.
+
+Aztec C is not as efficient in some areas as other cross-compilers for
+the Apple II, but when it comes to documentation and usability demos it
+holds its own, even today, 25 or so years later, and more than
+compensates for whatever inefficiencies it mat have by providing a stable
+and feature-rich environment which includes the documentation by Manx
+Software (available from the website at www.aztecmuseum.ca) supplemented
+with what AppleX provides.
+
+The source code for the compiler itself was apparently lost long ago
+according to Aztec C's founder, so we can't make changes that would be
+considered modern to its style, which is transitory K&R and not ANSI or
+ISO, but all the library source is available, and it is the library
+source that I have been modifying and expanding on to provide the AppleX
+improvements to Aztec C, in the same manner and spirit I first expanded
+it over 20 years ago.
+
+Tools and More Tools
+--------------------
+
+The AppleX\TOOLS directory also contains many utilities. Some are also
+related to Graphics, but some were written long ago. The utilities in the
+subdirectories under the AppleX\PROGRAMS directory have all been
+recently written, and are more specifically targetted at today's working
+environment. For that reason, they have been placed there instead of in
+the TOOLS directory.
+
+ProDOS Directory Services
+-------------------------
+
+The AppleX\PROGRAMS directory also contains a subdirectory called
+LISTDIR which demonstrates and implements G2 library routines related to
+reading ProDOS disks and finding files on them and so forth.
+
+Command Line and Unix-Like Programs for ProDOS
+----------------------------------------------
+
+Another expansion of the AppleX distribution is the production of
+programs that run under the Aztec C Shell for ProDOS 8. Shell Versions of
+SYS programs, which are PCODE mixed with native 6502 code. allow command
+line arguments and wildcard expansion and so forth, while being able to
+run at the same speed of execution as their SYS program counterparts in
+time critical operations like graphics and floating point calculations.
+
+Previous Updates and Brief History
+----------------------------------
+
+Since making AppleX available I have kept adding to it, but did not
+update the AppleX readme file.
+
+Website
+-------
+
+I also built a website called www.aztecmuseum.ca for AppleX and many other Aztec C compilers for other platforms, and time
+permitting I have done my best to keep the website up to date.
+
+Full Blown Aztec C Projects with Source Code
+--------------------------------------------
+
+After building the website, I made selected Full-Blown non-trivial
+"Projects" in Aztec C65 part of the distribution. They are in the
+PROJECTS direcory. Two of these projects (METOO and TIME) use overlays
+and auxiliary memory extensively and should prove informative. I also
+have 3 additional overlay projects that I will someday make available if
+time permits.
+
+Mixing the Old with the New
+---------------------------
+
+As I have done in the 2013 update with the PROGRAMS subdirectory,
+I kept these projects in the PROJECTS directory, separate from
+the SAMPLES directory that comprised the first AppleX distribution.
+
+I also provided DOSBox support for Aztec C65 and included this with
+AppleX, not that it took me much work. With Windows 7 displacing WIndows
+XP, it turns-out this was a good idea. Along the way I also tested in
+Ubuntu in another DOS emulator, without problem. However I did not update
+the ReadMe with any of this, while I just kept adding to AppleX. In fact
+I did not update the ReadMe at all.
+
+When I first started resurrecting Aztec C compilers I learned quickly
+about emulators, and quickly switched to the AppleWin emulator which I
+would be a fool not to recommend. The Apple II Oasis emulator is getting
+old, and crashes my new computer gloriously, and is pretty sparse
+especially compared to the AppleWin (1.22) we enjoy today.
+
+Ciderpress is an excellent disk manager. The Disk Manager in Apple II
+Oasis has some quirks... it handles DOS 3.3 disks well except that it
+will use lower-case naming which fouls DOS 3.3, but in either DOS 3.3 or
+ProDOS 8 it beats Ciderpress in one respect... you can fill a disk with
+multiple files then apply file-type sub-type/load attributes using a
+batch select on the fly. Other than for some of my own specialized nits,
+Cider Press is what I use continually these days as a disk manager for
+Apple II disk images or to port programs to my real Apple IIe on a CF
+(compact flash) card. Ciderpress supports this card (which inserts into a
+device called a MicroDrive).
+
+I have discovered through all this that there are many other options, my point being that the original Aztec C
+ReadMe like much of my old stuff that is still included in AppleX is
+quite dated and limited.
+
+I am also mindful that there doesn't seem to be anything I can't do with
+this old compiler except co-exist nicely with AppleSOft BASIC for ProDOS.
+Aztec C and AppleX is not targeted at AppleSoft BASIC programming anyway.
+
+Apple33 Aztec C65 for DOS 3.3
+-----------------------------
+
+Along the way, I also created a smaller distribution of Aztec C65
+for building Apple II DOS 3.3 programs.
+
+Then for a couple of years or so, until Fall of 2012, I didn't do much
+with AppleX or Apple33.
+
+Permission to Distribute Aztec C65
+----------------------------------
+
+Someone pointed-out to me at some point that I have never indicated in
+this distribution that I have permission to distribute Aztec C65. This
+simply because I never updated the read me.
+
+Copyright Clarification - Copyright and Conditions of Use
+---------------------------------------------------------
+
+Harry Suckow (the Copyright holder for Aztec C) has given permission to
+redistribute Manx Software Systems discontinued Aztec C compilers for
+now-obsolete platforms.Your use must be Fair as it applies to Manx's
+Copyright on these compilers. They are not for sale.
+
+Bill Buckels
+bbuckels@mts.net
+
+End of ReadMe
\ No newline at end of file
diff --git a/AppleX/ReadMe.txt b/AppleX/ReadMe.txt
new file mode 100644
index 0000000..837604b
--- /dev/null
+++ b/AppleX/ReadMe.txt
@@ -0,0 +1,80 @@
+ReadMe for C:\AppleX
+
+This is a "customized version" of the Manx Aztec C65 Version 3.2b MS-DOS
+cross-development environment for an Apple IIe with 128K of memory running
+PRODOS 8.
+
+It is targetted specifically at writing PRODOS SYS programs, and programs that
+run under the Aztec C ProDOS Unix-like Shell.
+
+It does not provide support for Apple II's running DOS 3.3. Other than that,
+none of the run-time library functions have been removed that were in the
+original distribution.
+
+Programs are written and compiled on the IBM-PC and then moved to an Apple IIe
+or to an emulator disk image to be run.
+
+A modified Graphics link library is provided which has been extended to
+support the use of bit-mapped graphics images, sound routines, and the use of
+auxiliary memory.
+
+The build environment has been configured to run under Windows XP and a
+pre-configured shortcut has been provided for this purpose as well as a make
+utility program and some additional programs to be used in conjunction with
+make.
+
+Several sample programs are provided, each with its own MAKEFILE and each can
+be reviewed for information on how to write your own PRODOS SYS programs.
+
+Getting Started
+
+Unzip the ZIP file 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:\AppleX folder in MyComputer and click-on the shortcut. A cmd
+window will open, and you will be in the C:\AppleX directory which is the
+parent directory for this environment. The required environment variables to
+build Aztec C PRODOS 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 can test the environment by building the programs in the SAMPLES
+subdirectory.
+
+Each has its own MAKEFILE which will build a PRODOS program simply by
+typing "make" and pressing [ENTER] while in each's project directory under
+SAMPLES.
+
+What You Will Need
+
+You can write your own programs in notepad or your favorite programmer's
+editor. This environment doesn't provide an editor.
+
+You should get a copy of the Aztec C Manual which is available online at
+
+http://www.clipshop.ca/Aztec/cat1.htm and http://www.clipshop.ca/Aztec/cat2.htm
+
+This will provide you with the original text of the printed manual for the C65
+compiler and considerably more information than the SAMPLES that are included
+in this environment.
+
+You will also need an Apple II emulator like Apple II Oasis that provides a
+Disk Manager unless you have a real Apple IIe and can download one at
+
+http://www.clipshop.ca/DiskImages/
+
+You can also download a PRODOS DiskImage at the above URL and delete all but
+PRODOS and use it as a master for your own programs.
+
+If you wish to create full-screen bitmapped graphics for the Apple II you may
+wish to download the ClipShop program from the following link:
+
+http://www.clipshop.ca
+
+Other than that, all you need is the ability to write and compile programs in
+the C programming language.
+
+Review the various ReadMe files in this environment for additional notes.
+
+End of Document
diff --git a/AppleX/SYSIO/AUX2MAIN.C b/AppleX/SYSIO/AUX2MAIN.C
new file mode 100644
index 0000000..f62c630
--- /dev/null
+++ b/AppleX/SYSIO/AUX2MAIN.C
@@ -0,0 +1,32 @@
+/* move a block of data from auxiliary to main memory */
+/* do an absolute ml call */
+
+#define A1L 0x3c
+#define A1H 0x3d
+#define A2L 0x3e
+#define A2H 0x3f
+#define A4L 0x42
+#define A4H 0x43
+
+auxtomain(src1,src2,dest)
+unsigned int src1,src2,dest;
+{
+
+ /* load the registers and do the call */
+ unsigned char *ptr=(unsigned char *)A1L;
+
+ *ptr++=(unsigned char)(src1&0xff);
+ *ptr++=(unsigned char)(src1>>8);
+ *ptr++=(unsigned char)(src2&0xff);
+ *ptr =(unsigned char)(src2>>8);
+
+ ptr=(unsigned char *)A4L;
+ *ptr++=(unsigned char)(dest&0xff);
+ *ptr =(unsigned char)(dest>>8);
+#asm
+ clc
+ jsr $c311
+#endasm
+
+}
+
\ No newline at end of file
diff --git a/AppleX/SYSIO/AUX2MAIN.R b/AppleX/SYSIO/AUX2MAIN.R
new file mode 100644
index 0000000..1d06be2
Binary files /dev/null and b/AppleX/SYSIO/AUX2MAIN.R differ
diff --git a/AppleX/SYSIO/EXITU.C b/AppleX/SYSIO/EXITU.C
new file mode 100644
index 0000000..a09d94a
--- /dev/null
+++ b/AppleX/SYSIO/EXITU.C
@@ -0,0 +1,35 @@
+/* Copyright (C) 1985 by Manx Software Systems, Inc. */
+/* Copyright (C) 1988 by Michael W. Spille */
+
+#include
+#include
+
+extern struct shvar {
+ char vects[6];
+ int retflg;
+} *_Sp;
+
+_exit(n)
+{
+ char *temp;
+ temp = 0x3f4;
+
+ _sys_parm[0] = 1;
+ _sys_parm[1] = 0; /* close all files */
+ _system(SYS_CLOSE);
+ if (_Sp) /* if called from SHELL */
+ _Sp->retflg = n;
+
+ *temp++;
+
+ _sys_parm[0] = 4;
+ _sys_parm[1] = 0;
+ _sys_parm[2] = 0;
+ _sys_parm[3] = 0;
+ _sys_parm[4] = 0;
+ _sys_parm[5] = 0;
+ _sys_parm[6] = 0;
+ _system (0x65);
+
+}
+
diff --git a/AppleX/SYSIO/EXITU.R b/AppleX/SYSIO/EXITU.R
new file mode 100644
index 0000000..1460291
Binary files /dev/null and b/AppleX/SYSIO/EXITU.R differ
diff --git a/AppleX/SYSIO/LDNJMP.ASM b/AppleX/SYSIO/LDNJMP.ASM
new file mode 100644
index 0000000..c4d05a0
--- /dev/null
+++ b/AppleX/SYSIO/LDNJMP.ASM
@@ -0,0 +1,73 @@
+
+ public ldnjmp_
+ public elnj_
+ public open_parms_
+ public read_parms_
+ cseg
+ldnjmp_
+ lda #0
+ ldx #$17 ;number of bytes to clear in system bitmap
+looper sta $bf58,x ;clear out this byte in the bitmap
+ dex
+ bne looper ;go until all done
+
+ lda $f3
+ sta $bf58 ;Protect stack & sytstem bitmap
+ lda #1
+ sta $bf6f
+
+ lda #$80 ;Low byte of 0x280 (addr of file to be sexec'd)
+ sta open_parms_+1
+ lda #$02 ;High byte of 0x280
+ sta open_parms_+2
+ jsr $bf00 ;Do open MLI call
+ fcb $c8
+ fdb open_parms_
+ bne end
+
+ lda #$4 ;Parameter count for read call is 4
+ sta read_parms_
+ lda fd ;Get file descriptor from open & put it in read
+ sta fd2
+ jsr $bf00 ;Read in the file
+ fcb $ca
+ fdb read_parms_
+ bne end
+
+ lda #1 ;Parameter count for close call is 1
+ sta read_parms_
+ jsr $bf00 ;Close the file
+ fcb $cc
+ fdb read_parms_
+
+ dec $3f4 ;Invalidate power-up byte
+ jmp $2000 ;Jump to now-resident program
+
+end sta 08 ;oops! and error occured! Put error in ret. reg
+ lda #0
+ sta 09 ;err code is a char so zero-out high byte
+ rts
+
+; MLI parameter tables follow...
+
+open_parms_
+ fcb 3
+ fcb 0
+ fcb 0
+ fcb 0
+ fcb $17
+fd fcb 0
+
+read_parms_
+ fcb 4
+fd2 fcb $27
+ fcb $00
+ fcb $20
+blocks2 fcb $00
+ fcb $90
+ fcb 0
+ fcb 0
+stuffy
+ fcb 1
+ fcb 0
+elnj_ ;Marks end of ldnjmp routine
diff --git a/AppleX/SYSIO/LDNJMP.R b/AppleX/SYSIO/LDNJMP.R
new file mode 100644
index 0000000..75532ca
Binary files /dev/null and b/AppleX/SYSIO/LDNJMP.R differ
diff --git a/AppleX/SYSIO/MAIN2AUX.C b/AppleX/SYSIO/MAIN2AUX.C
new file mode 100644
index 0000000..a5ed2a8
--- /dev/null
+++ b/AppleX/SYSIO/MAIN2AUX.C
@@ -0,0 +1,33 @@
+/* move a block of data from main to auxiliary memory */
+/* do an absolute ml call */
+
+#define A1L 0x3c
+#define A1H 0x3d
+#define A2L 0x3e
+#define A2H 0x3f
+#define A4L 0x42
+#define A4H 0x43
+
+maintoaux(src1,src2,dest)
+unsigned int src1,src2,dest;
+{
+
+ /* load the registers and do the call */
+ unsigned char *ptr=(unsigned char *)A1L;
+
+ *ptr++=(unsigned char)(src1&0xff);
+ *ptr++=(unsigned char)(src1>>8);
+ *ptr++=(unsigned char)(src2&0xff);
+ *ptr =(unsigned char)(src2>>8);
+
+ ptr=(unsigned char *)A4L;
+ *ptr++=(unsigned char)(dest&0xff);
+ *ptr =(unsigned char)(dest>>8);
+#asm
+ sec
+ jsr $c311
+#endasm
+
+}
+
+
\ No newline at end of file
diff --git a/AppleX/SYSIO/MAIN2AUX.R b/AppleX/SYSIO/MAIN2AUX.R
new file mode 100644
index 0000000..c6dadb5
Binary files /dev/null and b/AppleX/SYSIO/MAIN2AUX.R differ
diff --git a/AppleX/SYSIO/SAVEX.C b/AppleX/SYSIO/SAVEX.C
new file mode 100644
index 0000000..f87fd4d
--- /dev/null
+++ b/AppleX/SYSIO/SAVEX.C
@@ -0,0 +1,41 @@
+#include
+#include
+#include
+#include
+#include
+#include
+#include
+
+#define SAVE 0
+#define RESTORE 1
+#define FILEHEADER 2
+
+memfile(savex,address,length,action)
+char *savex;
+int address,length,action;
+{
+ int fh;
+
+
+ if(action==SAVE)
+ {
+ if((fh = open(savex,O_CREAT|O_TRUNC|O_WRONLY,0x04)) != -1)
+ {
+ write(fh,(char *)address,length);
+ close(fh);
+ }
+ }
+
+ if(action==RESTORE)
+ {
+ if((fh = open(savex,O_RDONLY,0x04))!=-1)
+ {
+ if(length==0)read(fh,(char *)&length,FILEHEADER);
+ read(fh,(char *)address,length);
+ close(fh);
+ }
+ }
+
+}
+
+
\ No newline at end of file
diff --git a/AppleX/SYSIO/SAVEX.R b/AppleX/SYSIO/SAVEX.R
new file mode 100644
index 0000000..d67eb6d
Binary files /dev/null and b/AppleX/SYSIO/SAVEX.R differ
diff --git a/AppleX/SYSIO/SEXEC.C b/AppleX/SYSIO/SEXEC.C
new file mode 100644
index 0000000..0f7d2b4
--- /dev/null
+++ b/AppleX/SYSIO/SEXEC.C
@@ -0,0 +1,49 @@
+/* :ts=4 */
+/* SEXEC - Exec for system programs */
+/* Copyright (c) 1988 by Michael W. Spille */
+
+#include
+#include
+
+char *ctop();
+extern void ldnjmp ();
+extern void elnj ();
+
+sexec (pname)
+char *pname;
+{
+ char *system_path, *rest_code;
+ int (*sys_prog)();
+ char *lptr, *eptr;
+ int ret_code;
+
+ rest_code = (char *)0x1000;
+ system_path = 0x280;
+ lptr = (char *)&ldnjmp;
+ eptr = (char *)&elnj;
+
+/* Convert pname from ASCIIZ to pascal length-string convention and copy it to
+ 0x280, where prodos expects it to be. */
+
+ strcpy (system_path,pname);
+ ctop(system_path);
+
+ _sys_parm[0] = 1; /* Parm count is 1 */
+ _sys_parm[1] = 0;
+ _system(SYS_CLOSE); /* Close all files */
+
+/* Move ldnjmp down to 0x1000 */
+
+ for (;lptr != eptr;)
+ *rest_code++ = *lptr++;
+
+/* Jump to the loader */
+
+ sys_prog = 0x1000;
+ ret_code = (*sys_prog)(); /* There should be no return from this call */
+ /* If there is a return, ldnjmp couldn't load the
+ system program @ 0x2000, and will return the
+ prodos error message (in decimal) */
+ return (ret_code);
+}
+
diff --git a/AppleX/SYSIO/SEXEC.R b/AppleX/SYSIO/SEXEC.R
new file mode 100644
index 0000000..d2d6283
Binary files /dev/null and b/AppleX/SYSIO/SEXEC.R differ
diff --git a/AppleX/SYSIO/SYSIO.BAT b/AppleX/SYSIO/SYSIO.BAT
new file mode 100644
index 0000000..e8ebd73
--- /dev/null
+++ b/AppleX/SYSIO/SYSIO.BAT
@@ -0,0 +1,3 @@
+@echo off
+lb SYSIO sexec.r ldnjmp.r exitu.r savex.r aux2main.r main2aux.r
+
\ No newline at end of file
diff --git a/AppleX/SYSIO/ZPAGE.H b/AppleX/SYSIO/ZPAGE.H
new file mode 100644
index 0000000..a44ad26
--- /dev/null
+++ b/AppleX/SYSIO/ZPAGE.H
@@ -0,0 +1,29 @@
+*:ts=8
+*
+* Copyright (C) 1985 by Manx Software Systems, Inc.
+*
+
+* These are set up for the Apple // Dos 3.3
+
+STK EQU $00 ;8 byte stack area
+VAL EQU STK
+SP EQU STK+2
+AFRAME EQU STK+4
+FRAME EQU STK+4
+LFRAME EQU STK+6
+PC EQU STK+6
+
+TREGS equ $08 ;24 byte tmp register area
+R0 EQU TREGS+0
+R1 EQU TREGS+4
+R2 EQU TREGS+8
+R3 EQU TREGS+12
+R4 EQU TREGS+16
+
+ACC EQU TREGS+20
+SEC EQU TREGS+22
+
+REGS EQU $80 ;16 byte user register area
+
+TMP EQU $40 ;4 byte zero page temporary area
+
diff --git a/AppleX/XBox.bat b/AppleX/XBox.bat
new file mode 100644
index 0000000..30564e3
--- /dev/null
+++ b/AppleX/XBox.bat
@@ -0,0 +1,5 @@
+@echo off
+set CLIB65=C:\LIB\
+set INCL65=C:\INCLUDE
+set CR65=C:\R\
+set PATH=C:\BIN;C:\TOOLS;%PATH%;
diff --git a/AppleX/XBox.txt b/AppleX/XBox.txt
new file mode 100644
index 0000000..a10eeed
--- /dev/null
+++ b/AppleX/XBox.txt
@@ -0,0 +1,36 @@
+DOSBox
+
+================
+5. Special Keys:
+================
+
+ALT-ENTER Switch to full screen and back.
+ALT-PAUSE Pause emulation.
+CTRL-F1 Start the keymapper.
+CTRL-F4 Change between mounted disk-images. Update directory cache for all drives!
+CTRL-ALT-F5 Start/Stop creating a movie of the screen. (avi video capturing)
+CTRL-F5 Save a screenshot. (png)
+CTRL-F6 Start/Stop recording sound output to a wave file.
+CTRL-ALT-F7 Start/Stop recording of OPL commands.
+CTRL-ALT-F8 Start/Stop the recording of raw MIDI commands.
+CTRL-F7 Decrease frameskip.
+CTRL-F8 Increase frameskip.
+CTRL-F9 Kill dosbox.
+CTRL-F10 Capture/Release the mouse.
+CTRL-F11 Slow down emulation (Decrease DOSBox Cycles).
+CTRL-F12 Speed up emulation (Increase DOSBox Cycles).
+ALT-F12 Unlock speed (turbo button).
+
+These are the default keybindings. They can be changed in the keymapper.
+
+Saved/recorded files can be found in current_directory/capture
+(can be changed in the configfile).
+The directory has to exist prior to starting DOSBox, otherwise nothing
+gets saved/recorded !
+
+
+NOTE: Once you increase your DOSBox cycles beyond your computer's maximum
+capacity, it will produce the same effect as slowing down the emulation.
+This maximum will vary from computer to computer.
+
+
diff --git a/AppleX/apmap.gif b/AppleX/apmap.gif
new file mode 100644
index 0000000..e89716e
Binary files /dev/null and b/AppleX/apmap.gif differ
diff --git a/MAKEFILE b/MAKEFILE
new file mode 100644
index 0000000..62e4641
--- /dev/null
+++ b/MAKEFILE
@@ -0,0 +1,115 @@
+# ---------------------------------------------------------------------
+# makefile by bill buckels 2007
+# ---------------------------------------------------------------------
+
+rcrk.sys: rcrk.r mainm.r ov1.r ov2.r ov2f.r ov3.r outf.r ginit.r saveg.r p8file.r dcmotor.r outdc.r indc.r
+
+ LN65 -t -r +s +h 4000,6004 rcrk.R +C 2800 +D 400 ovld.r samain.r -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del rcrk.R
+
+ MAKEPRO rcrk
+ del rcrk
+ @echo rcrk.SYS now created!
+
+ LN65 -t mainm.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del mainm.R
+ @echo mainm.OVR now created!
+
+ LN65 -t OV1.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del OV1.R
+ @echo OV1.OVR now created!
+
+ LN65 -t OV2.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del OV2.R
+ @echo OV2.OVR now created!
+
+ LN65 -t OV2f.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del OV2f.R
+ @echo OV2f.OVR now created!
+
+ LN65 -t OV3.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del OV3.R
+ @echo OV3.OVR now created!
+
+ LN65 -t outf.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del outf.R
+ @echo outf.OVR now created!
+
+ LN65 -t ginit.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del ginit.R
+ @echo ginit.OVR now created!
+
+ LN65 -t saveg.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del saveg.R
+ @echo saveg.OVR now created!
+
+ LN65 -t p8file.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del p8file.R
+ @echo p8file.OVR now created!
+
+ LN65 -t dcmotor.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del dcmotor.R
+ @echo dcmotor.OVR now created!
+
+ LN65 -t outdc.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del outdc.R
+ @echo outdc.OVR now created!
+
+ LN65 -t indc.R ovbgn.r rcrk.RSM -lSYSIO -lg2 -lm -ls -lc -lSYSIO -lg2 -lm -ls -lc
+ del indc.R
+ @echo indc.OVR now created!
+
+ del rcrk.RSM
+ del rcrk.SYM
+ del mainm.SYM
+ del OV1.SYM
+ del OV2.SYM
+ del OV2f.SYM
+ del OV3.SYM
+ del outf.SYM
+ del ginit.SYM
+ del saveg.sym
+ del p8file.sym
+ del dcmotor.sym
+ del outdc.sym
+ del indc.sym
+
+rcrk.r: rcrk.c
+ c65 rcrk.c
+
+mainm.r: mainm.c
+ c65 mainm.c
+
+ov1.r: ov1.c
+ c65 ov1.c
+
+ov2.r: ov2.c
+ c65 ov2.c
+
+ov2f.r: ov2f.c
+ c65 ov2f.c
+
+ov3.r: ov3.c
+ c65 ov3.c
+
+outf.r: outf.c
+ c65 outf.c
+
+ginit.r: ginit.c
+ c65 ginit.c
+
+saveg.r: saveg.c
+ c65 saveg.c
+
+p8file.r: p8file.c
+ c65 p8file.c
+
+
+dcmotor.r: dcmotor.c
+ c65 dcmotor.c
+
+outdc.r: outdc.c
+ c65 outdc.c
+
+indc.r: indc.c
+ c65 indc.c
\ No newline at end of file
diff --git a/d2monplt.h b/d2monplt.h
new file mode 100644
index 0000000..06d1151
--- /dev/null
+++ b/d2monplt.h
@@ -0,0 +1,81 @@
+/* ------------------------------------------------------------------------
+System : Manx Aztec C65 Version 3.2b
+ MS-DOS cross-development environment
+Platform : Apple IIe 128K PRODOS 8
+Program : d2monplt.h
+Description : G2 Library Routine
+ Double Hi-Res 560 x 192 x monochrome plot routine
+Written by : Bill Buckels
+Date Written : July 31, 2013
+Revision : 1.0 First Release
+Licence : You may use this routine for whatever you wish as long
+ as you agree that Bill Buckels has no warranty or
+ liability obligations whatsoever from said use.
+------------------------------------------------------------------------ */
+
+extern unsigned HB[]; /* page 2 scanline origins */
+extern unsigned char dhbmono[];
+extern unsigned char dhwmono[];
+
+int d2monoplot(x,y1,y2,drawcolor)
+int x, y1, y2, drawcolor;
+{
+ int y, xoff, pixel, aux = 0;
+ unsigned char *ptr, auxbuf[1];
+ unsigned dest;
+
+ /* swap coordinates if out of order */
+ if (y1 > y2) {
+ y = y1;
+ y1 = y2;
+ y2 = y;
+ }
+
+ /* allow bi-directional scanline wrap */
+ if (x < 0) x+= 560;
+ if (x > 559) x-=560;
+
+ if (x < 0 || x > 559 || y1 < 0 || y2 > 191)return 0;
+
+ pixel = (x%14);
+ if (pixel > 6) {
+ /* main memory */
+ pixel -= 7;
+ }
+ else {
+ /* auxiliary memory */
+ aux = 1;
+ ptr = (unsigned char *)&auxbuf[0];
+ }
+ xoff = x/14;
+
+ y2++;
+ for (y = y1; y < y2; y++) {
+
+ if (aux == 1) {
+ /* auxiliary memory */
+ dest = HB[y] + xoff;
+ auxtomain(dest,dest,&auxbuf[0]);
+ }
+ else {
+ /* main memory */
+ ptr = (unsigned char *) (HB[y] + xoff);
+ }
+
+ if (drawcolor != 0) {
+ /* white */
+ *ptr = *ptr | dhwmono[pixel]; /* inclusive OR */
+ }
+ else {
+ /* black */
+ *ptr = *ptr & dhbmono[pixel]; /* bitwise AND */
+ }
+ if (aux == 1) {
+ /* auxiliary memory */
+ maintoaux(&auxbuf[0],&auxbuf[0],dest);
+ }
+ }
+
+return 0;
+
+}