Single and Double
Lo-Res and Hi-Res Graphics in the
C Programming Language
<< Back to Apple Oldies Home

<< Back to Aztec C Museum

Introduction to Graphics in C on the Apple II

The purpose of this page is to share some of my routines and working programs for those of you who are interested in Apple II Graphics in C. When I first started developing in C on the Apple II back in the 1980's, I expanded the ProDOS graphics library that came with my compiler (the Aztec C Apple II C65 Cross-Development Environment for MS-DOS):

Apple II Development - My Early Days

Recently I expanded the Apple II DOS 3.3 graphics library for this same compiler creating a simpler DOS 3.3 equivalent of my ProDOS graphics library (which I call the "G3" library for DOS 3.3). The first releases of the "G3" library provided support for Apple II Hi-Res Mode Graphics only.

Having devoted most of my Apple II C language graphics programming during that time back in the 1980's exclusively to Hi-Res mode, I decided recently (December 2009) to explore some of the other graphics modes available... Lo-Res, Double Lo-Res and Double Hi-Res modes. I stopped short of the additional "secret" modes.

As a result I have put-together an Apple II DOS 3.3 Aztec C compiler distribution for MS-DOS and Windows based both on my recent and past work with Apple II Graphics which includes an updated "G3" link library and a reasonably large number of demo programs. These demo programs are detailed on this page and hopefully will prove informative to the novice and expert alike (although nothing presented here is particularly new or mind-boggling). But this is not just some lame attempt at a DOS 3.3 target environment either... DOS 3.3 Text and Binary File Operations like reading "slide-show" scripts and loading and saving Apple II Images are also supported by this compiler and the "G3" library making all of this reasonably effective to actually do something.

These programs listed here with working disk images, source code and the compiler are up for download at the Aztec C website:

Apple33 DOS 3.3 Distribution rebundled for Windows XP

In all of this I also dabble with vector graphics, but much of my work focuses around converting bitmapped graphics between different platforms and the Apple II (and working with these under DOS 3.3).To this end I have written and provide several utility programs which are also part of this distribution and which are also discussed here.

Several of the Utility programs for converting from PC Bitmapped Graphics to Apple II Bitmapped Graphics are written in 16 bit Microsoft C for MS-DOS. I have been using that compiler for over 20 years to write simple graphics conversion utilities with excellent results. To use these Utility programs run in an MS-DOS emulator like DOSBox if you can't run them raw.

If you are lucky enough to be a Windows User your best bet to handle the various archives here is
Andy McFadden's CiderPress and if you are lucky enough to be a Windows User, the DOS 3.3 compiler distribution is provided with shortcuts to make DOS 3.3 development a very simple matter (as it is with the other Aztec C compilers that I provide through the Aztec C Museum website). If you are not a Windows User you have my deepest sympathy, and note that if absolutely necessary this compiler runs under Unix in an MS-DOS Emulator, and although I much prefer Windows, I have occasionally held my nose and run this under Ubuntu without problems:

Installation and Other Notes

Finally, the demos provided here work nicely under Windows in the AppleWin Emulator (as well as the emulator that comes with Apple II Oasis) at their highest speeds. I have also run these on my real Apple //e with the 8 MHZ Zip Chip where they also work nicely.

I should also note that I tested the Double Lo-Res and Double Hi-Res graphics on both a composite monitor and an rgb monitor on my real Apple //e. The composite monitor gave me the best results between the two, although the AppleWin and Apple II Oasis emulators gave me the best results of all (albeit the fact that the emulators are not real:). And I made a strange discovery on my real Apple //e... after running Double Lo-Res or Double Hi-Res programs... if I didn't turn-off the Double Res mode, and then I attempted to display Hi-Res graphics afterwards in some other program, and even if I had rebooted, the rgb monitor will display "garbage" but the composite monitor will display Hi-Res graphics in some strange and undocumented reduced color palette which looks ok but doesn't work quite right. The moral here is to clean-up when done:)

So without much further ado, please review and enjoy the code listings on this website and feel free to download and work with this DOS 3.3 cross-compiler and its many demos and utilities. One final note... it would be a simple matter to port these routines from DOS 3.3 to ProDOS 8... not much of a port really... but that exercise is left for the reader or for another day:) as is porting to other compilers which may create faster programs but don't do everything that Aztec C does.

<< Back to Top

Lo-Res Graphics

Lo-Res Graphics Mode for the Apple II is such a coarse resolution that it is unsuitable for much more than a medium for very primitive graphics demos or similar programs. Regardless, demos can be fun.

Of particular interest in the Aztec C code below is the machine language mli which I support in Aztec C through the use of Inline Assembly. The Aztec C assembly interface is extremely robust.

Lo-Res Graphics for the Apple II in Aztec C
Lo-Res Graphics for the Apple II in cc65

Aztec C and cc65 Lo-Res and Hi-Res Demos for ProDOS and DOS 3.3

A word or two of explanation... cc65 has become a popular compiler on the Apple II and although at time of this writing no DOS 3.3 file operations are supported directly in cc65, one can always add this sort of thing. cc65 seems to produce faster code than Aztec C and although my preference is biased towards Aztec C I am providing (above) disk images of working Lo-Res and Hi-Res demos in both compilers for those of you who may be interested (even in porting code from Aztec C to cc65).

<< Back to Top

Hi-Res Graphics

One very important consideration when writing graphics programs for the Apple II (and Commodore 64) and indeed any computer which shares program memory with screen memory is to avoid clobbering the screen with the program. The Aztec C c65 cross-compiler provides a linker which creates a hole over the screen so the program jumps around the display area and therefore graphics and program play nicely together.

PC Based Programs for Apple II Bitmapped Graphics Conversion
Apple II Bitmapped Graphics Core Routines
Apple II Bitmapped Graphics Example Programs
Apple II Vector Graphics Example Programs

<< Back to Top

Double Lo-Res Graphics

Lo-Res Graphics Mode for the Apple II is such a coarse resolution that it is unsuitable for much more than a medium for very primitive graphics demos or similar programs. However, by doubling-up the horizontal resolution to 80 pixels x 48 rasters and using the 16 discrete Lo-Res colors it is possible (albeit barely) to display a more recognizable graphic...

PC Based Program for Apple II Bitmapped Graphics Conversion
Apple II Bitmapped Graphics Core Routine
Apple II Bitmapped Graphics Example Program
<< Back to Top

Double Hi-Res Graphics

The double high-resolution display mode that is available for the Apple IIe displays 140 columns of color, for which all 16 of the low-resolution colors are available. Because the double high-resolution graphics mode provides twice the horizontal dot density as standard hi-res graphics does, double hi-res requires twice as much memory as does standard hi-res.

The double hi-res display interleaves bytes from the two different memory pages (auxiliary and motherboard). Seven bits from a byte in the auxiliary memory bank are displayed first, followed by seven bits from the corresponding byte on the motherboard. The bits are shifted out the same way as in standard hi-res (least-significant bit first).

Double High-Resolution Graphics - Apple II Technical Notes

PC Based Programs for Apple II Bitmapped Graphics Conversion

Apple II Bitmapped Graphics Example Program
Apple II Vector Graphics Example Programs
<< Back to Top

© Copyright Bill Buckels 2010
All Rights Reserved.