[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Introduction to to Graphics in C on the Apple II
- Subject: Introduction to to Graphics in C on the Apple II
- From: Bill Buckels <bbuckels@escape.ca>
- Date: Wed, 6 Jan 2010 18:14:49 -0800 (PST)
- Complaints-to: groups-abuse@google.com
- Injection-info: m16g2000yqc.googlegroups.com; posting-host=204.112.129.224; posting-account=lfN1DgkAAAAuU7dh9hSE-dqv44ZCj35R
- Newsgroups: comp.sys.apple2, comp.sys.apple2.programmer
- Organization: http://groups.google.com
- User-agent: G2/1.0
- Xref: g2news1.google.com comp.sys.apple2:13379 comp.sys.apple2.programmer:2309
For your perusal and viewing pleasure I am pleased to announce the
following addition to the AppleOldies website:
http://www.appleoldies.ca/azgraphics33/index.htm
Please visit the above link.
Single and Double
Lo-Res and Hi-Res Graphics in the
C Programming Language
Introduction to 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).
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:
Download Apple33 Aztec C DOS 3.3 Distribution
http://www.aztecmuseum.ca/Apple33.zip
Note: Everything on this page is included in the above distribution
including Apple II diskimages of all programs, the source code and
library routines for all programs, and of course the cross-compiler
and the build environment pre-configured to produce these as well as
your own Apple II DOS 3.3 Aztec C programs from the comfort of your
Windows or MS-DOS compatible computer or favourite MS-DOS emulator.
The idea here is to learn by example without wading through mounds of
"fakeware" technical documents.
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.
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.
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 also providing
disk images of working Lo-Res demos in both compilers for those of you
who may be interested (even in porting code from Aztec C to cc65).
Happy New Year and Have Fun!
Bill Buckels
bbuckels@mts.net
January 2010