Second Actuality for Apple II
Particulars
Second Actuality, the well-known MS-DOS demo, however on an Apple II…
Completed first place within the Retro Demo class at
Demosplash 2023
Movies
Video seize from an precise Apple IIe:
System Necessities
- An Apple IIe / IIc / IIgs with Mockingboard sound card and 128k whole RAM
- Notice: the IIe and above requirement is as a result of I exploit the additional RAM as a
ramdisk, it isn’t utilizing every other IIe options.
Downloads
Disk Pictures
- You have to each disk photos.
That is model 1.2 (12 November 2023) - You may get the unique social gathering launch right here:
a2_reality.zip - If you do not have actual {hardware} it ought to work in emulators.
Applewin (you’ll want to allow mockingboard sound help)
and MAME each examined. - Strive it on the in-browser emulator at archive.org:
disk1,
disk2
Supply
You possibly can vote for this on pouet (you may see the crew there aren’t
large followers):
Apple ][ Reality
Mini-faq
- Q. I believed you stated you were not going to do that?
A. I say a variety of issues.
- Q. Did you expertise Second Actuality again within the 90s?
A. Sure, it managed to even discover its strategy to my middle-of-nowhere
a part of the US. I noticed it just a few instances, usually individuals
downloading from a BBS and displaying it off on their
top-of-the-line 486 techniques with sound playing cards.
(I particularly keep in mind a buddy’s high-end 486 system,
he even had a double-speed CD-ROM drive he purchased solely
so they may play Wing Commander)I do not assume I used to be that impressed, I imply it was kind of
cool but in addition bizarre. Do not forget that a variety of the attract
of the demo was “Wow, look, a PC can do Amiga results”
however I had by no means seen an Amiga so that did not actually
seize me. - Q. Did you utilize graphics sources from the unique demo?
A. No. Numerous the graphics are literally hard-coded into the
binaries and never separate recordsdata. The few standalone
recordsdata are Deluxe-paint LBM recordsdata that are arduous to work
with today. Ultimately I simply used display screen grabs
from a youtube video of the demo. - Q. Did you utilize any code from the unique demo?
A. No. The unique demo is doing a variety of actually obscure
x86 / VGA methods
which actually do not map nicely to a 6502. - Q. Are you the primary particular person to demake this demo?
A. No, famously there was a model made for the
Commodore 64 again in 1997.
There’s additionally an
Atari ST model.
And a
Gameboy Color model. - Q. It seems like this demo solely has just a few precise results
and the remaining are trickery or fakes?A. I assume that is a technique of it. The Apple II
is so restricted that even the
trickery and fakes is usually a important
quantity of labor. The “faux” 3d-rendered animation earlier than
the credit is certainly “simply” a film, but it surely’s a minute
lengthy full-color film rendered at 4fps in solely 24k of RAM. - Q. Aren’t Second Actuality re-makes overdone?
A. I am going to admit that I really feel that approach too. On the identical time,
I’ve a variety of working Apple II machines I can run
this on, whereas my outdated 486 from the 90s hasn’t booted
for years (additionally my 486 again within the day ran completely
Linux, it by no means ran DOS whereas I owned it) - Q. This platform is just too terrible, you should not have bothered
A. Bear in mind the Apple II graphics have been designed in 1977.
You need to be evaluating this to what would run on
Commodore PET or TRS-80. This introduces some
new results which have by no means been executed earlier than on Apple II
so far as I do know (like full-screen Hello-res plasma).
That is why I submitted this to an American demoparty,
because it’s extra possible they will have appreciation for the
limitations of the platform. I would prefer to assume the
outcomes for some scenes examine favorably with
the Commodore 64 model of Second Actuality
(although I notice the state-of-the-art in C64
results has improved a bit since 1997).Additionally observe, Apple II graphics launched 1977, C64 graphics 1982,
VGA launched 1987. - Q. Is not it dishonest to make use of a Mockingboard sound card?
Weren’t they considerably uncommon?A. If you wish to hearken to demos with solely beeper music
(and keep in mind, it is bitbanged, there isn’t any helper
{hardware} or timers to drive the speaker) then you definitely’re
going to be upset within the sound high quality doable
on this platform.
For lots of Apple II software program any music you bought was
appreciated as a result of it was there in any respect, not as a result of
it was of fantastic high quality.The Mockingboard was fashionable sufficient that just a few video games
supported it again within the day. I really feel high-quality utilizing is as a result of
whereas my household did not have one, the child throughout the road
from us did and I noticed it in motion at his home.I may in comparable vogue ask why it is truthful for
DOS demos (particularly ones concentrating on early {hardware}) to
have a soundblaster. My household’s 386 did not include
a sound card, and solely after years of bugging my household,
saving up, and shopping for an affordable knockoff clone at
a pc/hamfest did we lastly get one. Once I went to
faculty and bought my very own used 486 I soldered collectively a parallel
port resistor-ladder DAC card to make use of for sound till I
may scrounge up sufficient cash for an actual sound card. - Q. Do you propose to launch a ultimate model with fixes over the
social gathering model?A. I used to be fascinated with it, however I managed to cram a variety of coding
into the previous couple of days earlier than the deadline and carried out
most of what I needed to. Some issues that would
use enchancment: higher sound sync (particularly the intro),
higher credit music, page-flipping in the course of the scrolling,
a correct tunnel impact, extra frames within the dice rotozoom,
correct falling chessboard animation, precise 3d polygon,
full the total 3d animation sequence, correct bounce
impact for the polar bear girl image. It may also
be good to do extra correct interference impact, although
I all the time discovered that half to be tedious within the unique.
I assume additionally do a correct wrapped rotozoom fairly than
filling the perimeters with a stable coloration. And possibly repair
the scrolling (or lack there of) points in the course of the thumbnail
elements of the credit. Oh yeah possibly a correct lens impact.
I even have graphics for a hi-res model of the transmission
theme, however doing diagonal sprites in hi-res can be an enormous
ache.
So in the long run I assume there are a variety of
enhancements I may do. - Q. Are you able to scale back the reminiscence utilization to 64k?
A. Sure, I would truly prefer to run this on my Apple II+ with
language card. It needs to be doable however would possibly contain
having to pause the music at instances to do the disk reads. - Q. Are you able to make a model that does not require a Mockingboard?
A. This is able to be trickier. I exploit the music interrupts for timing.
Locations that simply busy wait we will exchange with a CPU loop.
Nonetheless a variety of the timing is designed to sync up with
sure areas within the music, we wait till the music
code hits a sure sample location. In principle we may
faux one thing up and have all loops increment the FRAME
rely and do issues based mostly on that, however I would basically
must intrusively add this code in every single place and it might
be an enormous ache. - Q. I believe the entire thing seems ugly and lazy
A. Perhaps. Like a variety of my retro tasks, this began as a joke
that bought out of hand. Then I ended up spending 2 months
engaged on it, which is loads contemplating I do not even
like Second Actuality that a lot. Then lastly,
in typical demoscene vogue, the deadline was every week away
so I labored late hours slapping collectively no matter results
I may handle and simply barely bought one thing affordable
collectively minutes earlier than the deadline.The factor is even when I spent one other few months perfecting
the “transmission” scene, or doing a correct tunnel impact,
I nonetheless do not assume there’d be any much less complaining so
why would I trouble.
Platform Notes
Apple II limitations
I am positive I’ve lengthy detailed explanations of the Apple II limitations
elsewhere on this website, however a fast refresher. Apple II has a 1MHz
6502 processor. A “base” mannequin will be assumed to have 48k of RAM and
16k of ROM (with a reasonably fashionable bank-switched 16k RAM enlargement accessible,
though you possibly can solely have 12k of that lively directly).
Graphics RAM takes up a big chunk of this room, lo-res graphics has two
1k pages however hi-res takes up the entire vary from $2000-$5FFF (16k) if
you utilize each pages. Numerous my results use web page flipping so that you typically
want one other off-screen buffer (one other 8k) solely leaving round 16k for
precise code.
No {hardware} graphics acceleration of any kind besides web page flipping.
Graphics are difficult however roughly you’ve got hi-res which is 140×192
in 6 colours (with some coloration conflict) and 40×48 in blocky lo-res with
16 colours. The reminiscence map for the graphics modes is bizarre and interleaved.
The hi-res mode is 3.5 pixels per byte, the excessive bit picks a palette, and
it is NTSC artifact coloration so a lot of different points. One thing so simple as
attempting to put in writing orange ($AA) to the entire 8k hi-res body buffer in
order will truly provide you with 40 blue/orange alternating columns that seem
in a venetian blind impact, it takes a variety of work to simply get a pixel
of a coloration you need on the display screen.
Inventory Apple II has only a bitbang speaker. To do any kind of fascinating
music usually requires a lot of the CPU. That is why most demos
run on an optionally available sound card, on this case a Mockingboard which
has just a few AY-3-8910 sound chips. This has the additional advantage of offering
an everyday timing interrupt too, one thing the Apple II does not have by
default.
Particular Mannequin Help
This presently requires an Apple IIe with 128k.
I am not truly utilizing any superior IIe options (65c02, double-graphics
modes, lowercase, 80-column, and so forth). I am principally utilizing the additional RAM
like a ramdisk so I haven’t got to pause the music to learn from disk.
I am hoping to possibly shrink issues down so it can run on a 64k system
(which might enable operating on a II+ with language card)
Disk II observe
The Apple Disk II drive is an incredible piece of Woz engineering,
but it surely’s managed with cycle-accurate bitbanging of the {hardware}.
It is basically a tough real-time job. Having interrupts
enabled would make disk accesses fail. There are two teams who’ve
managed to get disk masses taking place whereas enjoying music:
Fast Loader
by French Contact with
and
Low Tech by Imphobia. I ought to most likely look into how they bought
issues to work although I believe it is complicated.
The disk code I exploit is by Qkumba. It is tremendous quick. I am utilizing that with
uncooked disk sector reads, there isn’t any filesystem on the disk (no AppleDOS
or ProDOS).
Code Notes
General Framework
That is the primary demo I’ve written that was large enough to not all
slot in reminiscence directly. I’ve written Apple II video games that wanted some kind
of overlay-style framework however often these are extra forgiving of pausing
sooner or later for disk masses.
The disk photos are booters, there isn’t any OS current. It makes use of qkumba’s
qboot boot sector which gives quick disk routines to load consecutive
sectors into reminiscence in a short time. Roughly 4k is loaded into the
space of $1000-$1FFF which gives the disk loading code, the primary
framework code, lookup tables (principally for hi-res row addresses as they
are non-consecutive/interlaced), and a few widespread routines.
The music, music participant, and the AUX reminiscence copy routines are loaded
into the “language card” financial institution switched space at $D000. The in-built
ROM firmware is swapped out and never used in any respect in the course of the demo.
A customized AUX (excessive 64k) copy routine is used because the ROM one is sluggish, and
we put it within the language card as a result of we use the “preserve the identical stack
web page and zero-page whereas AUX mem is lively ” mode which for some motive
additionally leaves the language card reminiscence alone when financial institution switching.
Usually the consequences are loaded to $6000 which is above the 2 hi-res pages.
If we want an off-screen copy of graphics whereas web page flipping we’ll use
$6000-$7FFF for that and cargo our code at $8000.
For lo-res results you possibly can load decrease, all the way down to $2000, which gives
much more room, and is why the 3d flyover code will be a lot bigger
than the opposite results.
For this code at the very least I attempted to keep away from studying from disk as a lot as doable,
so the excessive reminiscence was used as a kind of RAMDISK, in the beginning of the demo
a variety of the consequences have been pre-loaded there, after which copied in whereas wanted.
The advantage of that is the music can preserve enjoying whereas that is taking place.
As talked about elsewhere on this web page you possibly can’t actually play music whereas
the disk is being learn. I’d attempt to cram issues to suit on a 64k
Apple II+ however in that case there may be few second pauses when masses
occur (the Disk II is far quicker than the c64 floppy drive, however even
with qkumba’s code it takes a noticeable period of time to load in a
few tracks price of knowledge).
PT3 Music Participant
The music is within the Vortex-tracker PT3 format (often used for
ZX-Spectrum music, the Mockingboard I exploit has the identical AY-3-8910
sound chips).
I’ve a library I made that performs PT3 recordsdata
on 6502 processors. Within the course of of constructing this demo I discovered a bug
(solely exhibits up if in case you have greater than 42 patterns within the sound file).
My repair for that bug was flawed and made the credit music crash, which
I used to be debugging late at evening proper earlier than the deadline.
Discovering a PT3 copy of the primary theme by z00m is what impressed me to
do that entire mission. Particular due to mA2E for making a PT3 model
of the into music on the final minute.
Compression
I make a variety of use of ZX02 compression to make issues match. It is a surprise
all of it matches on simply two 140k floppies (and the second floppy has a variety of
spare room).
Results abstract
Pretend Bios |
Why not make an Apple II faux to be a PC. Nothing that thrilling right here although adapting an 8-pixel extensive font to the 7-pixel extensive Apple II was a ache. It truly is doing a little system detection right here so the output |
Intro |
The pan throughout the panorama is a 2-pixel horizontal scroll which is de facto arduous to do on Apple II. There is no {hardware} scrolling. Every byte of hi-res reminiscence is 3.5 pixels, so when scrolling you need to cross byte boundaries. The bits are in LSB (least-significant bit) order but in addition the highest bit does not scroll (it is a palette bit) and should you’re not cautious the colours will swap. It is jerky as a result of I am not utilizing page-flipping right here (that will be even extra complicated). I am utilizing lookup tables. Oddly the approach I am utilizing relies on a writeup I discovered on my system not too long ago that I had saved off of usenet in 1996 for some motive. No {hardware} sprites on the Apple II both. I am truly simply |
Chessboard |
There have been a variety of higher methods I may have executed this, however I am simply utilizing sprites to cheat a bit. I did not have time to hack up an actual 3d-render, and even some kind of triangle-drawing library. I made the chessboard orange as an alternative of purple as because of the coloration palettes issues work together higher (you possibly can’t have purple/inexperienced in the identical 3.5 pixel chunk of display screen as blue/orange). You continue to see some fringing on the edges, that is as a result of the right approach to do that can be to have a masks to masks off the clear elements of the sprite however that will make it slower and in addition use much more RAM that what I am doing which is doing transparency at 3.5 pixel boundaries. Additionally whilst you can solely have your X-position be on multiples of 3.5 pixels, it does deal with robotically shifting the sprite knowledge to verify the colours nonetheless look proper for each odd/even columns. |
Tunnel |
I wasted every week attempting to get tunnel impact and gave up (after some very fascinating outcomes ( 1 2 3 4 )) from buggy code. Drawing circles is a ache on 6502. So for this I simply took 2 screenshots and web page flip. I believe this captures finest the quick tempo of the unique. Numerous tunnel code entails multiply, divide, and trig capabilities Notice that the Second Actuality impact is a |
Circles / Interference |
The circle code and a number of the interference code are based mostly on code from Hellmood’s well-known Reminiscences demo. I ought to have tried to make precise round interference patterns however simply cheated and used some present code that gave vaguely comparable patterns. As I stated earlier than, drawing circles shortly when you do not have multiply or trig capabilities is a ache. Lookup tables and self-modifying code solely get you to date. I did handle to get sound sync on the falling bars, that |
Monster Graphic |
The graphics are principally automated conversions. I’ve been utilizing Kris Kennaway’s iipix converter. Nonetheless it generally wants some tweaking and works higher on photographs than on drawings. Ultimately I typically simply scale back photos to a low variety of colours after which fill manually with dither patterns. The scroll here’s a fast hack, it wanted to be quick. It is truly |
New Solution to Scroll |
Simply two photos with web page flipping, did not have time to do that correctly. Not solely would I’ve to by some means map a font |
Lens/ Rotozoom |
Finished in lo-res for velocity. The lens half I meant to do some kind of warping when drawing the clear sprite. I used to be going to make use of colours to specify an offset to get when wanting up the warped pixels from the background. As a placeholder I used to be simply anding the colours in, and it truly seemed OK as an impact and I by no means had time to implement issues correctly. You would possibly miss it, however the music is paused in order that Rotozoom relies on earlier rotozoom code I had. As an alternative of |
Plasma |
I would been attempting for years to get a hi-res plasma happening the Apple II. Ultimately that is based mostly on French Contact’s Plasmagoria plasma code, however transformed for hi-res. It solely attracts ever different line for velocity. So far as I do know nobody has ever executed full-screen hi-res plasma on Apple II earlier than. |
Plasmacube |
I believe that is my favourite impact. Once more the French Contact code, however with my very own masking utilized. The masks have R/G/B elements to use totally different coloration lookups to the underlying plasma. The cubes are pre-rendered. Solely 8 steps, however they compress rather well. I most likely have room for 16 steps however ran out of time. |
Bouncing Dots |
I meant to do one thing fancier. Ultimately it seemed surprisingly nicely. It is not doing any of the flamboyant patterns within the unique although, however that is one case I’d have the ability to approximate it with sufficient lookup tables. It is a case I’ve since seemed on the precise code (and |
Transmission |
I had a very nice hi-res model of the background, however could not work out a great way to do the sword in hi-res with out an enormous quantity of labor (diagonal sprites, coloration conflict). So in the long run I went with lo-res which I believe labored out OK. I even bought the “transmission” line stated there should you pay attention carefully. There is a glitch in the beginning on account of a disk entry and I did not have time to repair it, I ought to have cleared the display screen to black earlier than it occurred, in truth I believed I had so unsure why it did not. |
Ocean Voxels |
Totally dishonest on this one. It is simply screengrabs hand-colored by me and being decompressed by way of ZX02 full velocity. This takes up 24k which is far bigger than a lot of the different results. |
Polar Girl |
I needed to make it bounce, even had numerous plans for attempting to do it (it isn’t straightforward, once more due to the bizarre approach pixels work on hi-res, you possibly can’t simply scale them out barely with out bizarre coloration results). Ultimately I simply needed to accept a fast vertical scroll. |
3D-scene |
As you would possibly guess this isn’t rendered in 3d. It is a bunch of rectangles being drawn actually shortly. I began out optimizing the rectangle lists by hand, Hand optimizing took without end, so I wrote a program |
Credit |
Utilizing 4am’s font and libs right here. The scroll in of the thumbnail will not be good, did not have time to scroll it in from off display screen correctly. The ultimate credit are once more a bit of jerky as I am not utilizing web page flipping. |
Growth Notes
12 November 2023 — Launch v1.2
Up to date to incorporate the total 3d scene within the credit (earlier than stopped
2/3 of the way in which via as I ran out of time). It simply barely matches,
I must see if possibly utilizing ZX02 compression as an alternative would cut back
the filesize.
8 November 2023 — Launch v1.1
Launched an replace, ought to now work on IIc and IIgs techniques.
Examined on MAME. On IIgs you may must ensure you have a Mockingboard
enabled, then press ctrl-cmd-esc and choose that you’ve got your personal
card in Slot 4.
4 November 2023
Up late discovering a bug within the music participant which was launched by my
repair for giant recordsdata just a few days in the past. Throughout the competitors their
machine crashed on account of music points, hope my code is not nonetheless
buggy 🙁
3 November 2023
After a variety of late nights managed to get one thing collectively simply earlier than
the Demosplash deadline.
29 October 2023
I unwisely have spent the final month or so attempting to place collectively
an actual model of this for Demosplash, so I assume watch this house.
15 August 2023 — Launch v0.1
I actually needs to be engaged on different stuff. I stumbled throughout the
AY-3-8910 PT3 music for this by z00m, after which in fact wanted some visuals.
The graphics have been transformed utilizing
Kris Kennaway’s ii-pix program although it was a problem getting all of the
python dependencies going.
I had pre-existing rotozoom code. Ideally I would repair it to wrap on the edges
however seems that’d be a ache.
Back to the VMW Software Productions Page