Despite a very hectic semester, I managed to put together a 256B intro
for Outline 2026. You'd think I'd have more material with the lack
of Lovebyte this year, but it's just been that kind of semester.
Hectic By -=DEsIRE=-: code by deater
Video
Capture on an actual Apple IIe Platinum.
b
Notes on the Intro
I'm getting a lot of people commenting on the minisite here, which made
me feel bad because I had just thrown it together at the last minute.
I've since improved the writeup below to be a bit more complete.
Requirements
This intro requires an Apple IIe specifically
because it uses the VBLANK register to sync
the beam position.
On older models of Apple II you can use a horrendous
hack to get the beam location (the technique is often called
'vapor lock' and
involves reading a floating bus, but it's difficult to do this in
a 256B budget).
Why not support newer Apple II models?
On newer Apple IIgs / Apple IIc you can also get the VBLANK timing
but annoyingly it's not compatible with the Apple IIe method.
The extra code needed to handle all models is not a lot, but
tricky on a 256B budget.
(One more thing: lo-res PAGE2 is broken on some models of IIgs and
it takes extra bytes to enable the workaround code).
For some reason even with code that *should* give consistent beam placement
it isn't lining up on the MAME emulator.
(Update: apparently it is known that older versions of MAME VBL is off
by 25 cycles and this should be fixed in the 0.288 release)
Applewin and real hardware
are giving more or less the same results so I'm hoping it's good for
other people. I didn't have time to track down what was going on.
It's still not quite as centered as I'd like but I ran out of time
to mess with it.
Mode Switching / Setup
I was planning a slightly different intro but as always with these things
it sort of progressed when working on it. I do have some interesting
outtakes which might turn into later intros, though some of the cool
ones often have a lot of flashing patterns which isn't always optimal.
The intro uses the monitor-ROM routine HLIN to draw the rainbow
pattern to lo-res GR PAGE1, then uses the monitor MOVE routines to
copy to GR PAGE2. This is the first time I've used the MOVE routine
so might use it more in the future (on 6502 it's trivial to copy
256 bytes, but lo-res graphics are 1k which is harder). MOVE only really
saves maybe 4 bytes over open-coding it, but 4-bytes it 4 bytes.
The gear patterns use Apple II ROM "shapetable" (vector-drawing) routines.
They are reusing some code from a gears demo I had made a few years ago.
It draws the two versions of the animation to PAGE1 and PAGE2 of memory;
Apple II lets you do hardware page flipping which is nice and gives
you a nice animation effect essentially for free.
The page flipping does complicate things; it's why I had to copy the
rainbow pattern to LORES PAGE2, and the text scrolling also has to happen
on both pages. (You might, say, can't you just switch pages when
doing mode switches? And you can, but it takes 3 more bytes and 4 more
cycles to do that and we're trying to conserve here).
Once everything is drawn we sync up and start cycle counting for the rest.
You can flip modes by just reading or writing to a soft-switch so it's
mostly counting cycles. There's 65 cycles per line (25 HSYNC and
hen 40 where things are drawn). We do some tricks to alter the
location of the switch in this part to give the jagged appearance.
The Apple II people probably find the mode switching here the
most impressive; the mid-screen
switch from hi to lo-res is sort of an unusual thing to do.
With lo-res you get 15 colors at 40x48
but hi-res is 6 colors at 280x192 so usually you don't get that many colors
on the screen while also displaying detailed line art.
(Apple IIe and later support various new ``double'' resolution modes that
would let you attempt graphics like this without mode-switches
but doing things that way have their own set of complications).
The cycle counting changes
9 lines from the bottom of the screen, leaving room for the scrolling
text which is in text mode.
The text scrolling code is not a big deal, but some weird stuff
is going on to make it cycle-invariant, and we are drawing one-past
the end of the screen to make the code simpler, which is OK because
there are "holes" in the memory map. And to be extra safe we use
the PAGE2 hole as in theory on Apple II the PAGE1 holes might
be used by firmware.
In the rest of VBLANK we do the page flipping and count FRAMEs
(we actually only scroll/page flip at a much slower frame rate because
things go to fast at the full 60Hz).
Cycle counting on 6502 can be interesting, especially when trying to
save space because you can't just sprinkle NOPs around.
I had found a great new resource for size-coded delays of various
sizes,
the
Bisqwit 6502 cycle counting resource.
I had hoped to get some sound going too, but probably for the best
that I didn't.
You can get the sourcecode
here in the demos/outline2026 directory of
my dos33fsprogs github repository: git clone https://github.com/deater/dos33fsprogs/
Vote for this at PouetBack to my Demos