
8088 Domination Post-Mortem, Part 1 - userbinator
http://trixter.oldskool.org/2014/06/19/8088-domination-post-mortem-part-1/
======
jacquesm
That's absolutely insane at that clockrate. The way I would get 'animations'
(for want of a better term) done is by rendering them frame-by-frame,
compressing that and then playing it back at high speed. And even that was
next to impossible. Decompressing video @60fps, and doing real-time dithering
to increase the effective number of colours and still have time enough for
45KHz audio is totally nuts. This qualifies as art, not just software.

~~~
sgt
"This qualifies as art, not just software."

For me there was never any doubt.

A bit unrelated, but I've got an old 5150 at my parent's place, so when I'm
visiting next Xmas I'll try to load this demo onto it. The only problem is
that of transferring files to it. It only has a 5.25" floppy drive, and I
don't have a means to copy files onto those floppies.

Any suggestions?

~~~
Two9A
I have, in the past, been forced to type an Xmodem transfer program into
debug.com's hex mode, to get to the point where I can transfer files over a
null-modem connection from another box. I can dig up the file in question, if
that'd help you out at all.

I ended up typing it in 1k at a time, and independently typing in a CRC32
utility to check that I'd done it properly.

(That was to install Windows 98 on a computer with no drives, if I recall. So,
not so very long ago.)

~~~
jacquesm
That's how I used to transfer files to my coding buddies.

On the phone, hex dump in S-record format, then read out loud while the other
side would type in the line. Checksum matches? Next line...

Our respective parents were not too happy about this unplanned usage of their
phone lines but it saved a ton of cycling.

~~~
sgt
That's how you do it! What's the today's equivalent that kids do?

------
Arjuna
Wow... for that hardware, a 4.77MHz 8088 PC with CGA graphics and Sound
Blaster audio, those stats are overwhelming:

1\. Variable frame-rates up to 60 FPS.

2\. Audio rates to 45kHz.

3\. 16 colors through composite artifacting.

4\. Simultaneous color and B&W output.

On a related note, you will probably be interested in Michael Abrash's _Zen of
Assembly Language_. From the "README.md":

"This is the source for an ebook version of Michael Abrash's Zen of Assembly
Language: Volume I, Knowledge, originally published in 1990. Reproduced with
blessing of Michael Abrash, converted and maintained by James Gregory.
Original conversion produced by Ron Welch."

[https://github.com/jagregory/abrash-zen-of-
asm](https://github.com/jagregory/abrash-zen-of-asm)

~~~
ajross
It's worth pointing out (on a quick scan I don't see this called out in the
article itself) that the preprocessing involved in generating these
executables is almost certainly not meaningfully possible on a 5150 PC.

So while this might run on 1978-era hardware, it wouldn't have been possible
for 1978-era hackers to create.

~~~
Audrey_II
Incredible work! If only we had this kind of ingenuity today to get a simple
graphics card working with Linux! Imagine the possibilities. One day, I might
even have an option in Ubuntu to change the refresh rate to 60hz without
entering 'xrandr -r 60' into the console EVERY DAMN TIME I REBOOT. Now, I know
I'm going on a limb with this next one, but imagine if someone had the
intelligence to code a universal installer that works every time and installed
every piece of needed software all at once with zero user interaction??! I'm
getting a bit craaazy here, but imagine effortless uninstalls! Mind blown.

Edit: "One more thing" as I get voted down by those in denial. Imagine this
brilliance getting Linux to talk to a relatively unheard of device called an
iPhone 5s! It sure would be nice getting pictures and video off this damn
phone so I can free up space!

~~~
rbanffy
> getting Linux to talk to a relatively unheard of device called an iPhone 5s!
> It sure would be nice getting pictures and video off this damn phone so I
> can free up space!

I do it all the time. All it takes is to plug the phone in.

~~~
rbanffy
Answering the dead question, it's an iPhone 5s running the latest iOS. The
only catch is that I have to plug it unlocked and tell it to trust my computer
(running Ubuntu 14.04) when the prompt pops up. It imports pictures into
Shotwell just fine. I also tested it with an iPhone 4 (not 4S) and it worked
just the same.

------
jcr
The work is very impressive, but the part I loved most was how even after
deciding the problem was "impossible" to solve, he kept at it:

> _" Then I thought about the problem for 7 years."_

~~~
frownie
In the demoscene, doing the impossible was just regular behaviour :-) Just
look at what they get out of a mere C64...

~~~
adestefan
The VIC-II and SID chips in the C64 are amazing. They blew away anything that
could be found inside an IBM PC.

~~~
Intermernet
I'm a softy, but I still think the SID is amazing. The sounds that developers
squeezed out of that chip are a testament to true hackery. I have a feeling
the tricks developed to stress the SID to it's maximum have been adopted by a
lot of serious audio developers in recent years to get higher track count /
lower latency / higher bit rate etc. It's like the SID was the home-chemistry
set equivalent for many a professional DAW / plugin designer.

------
nevster
Wow - Trixter from Hornet - haven't heard that name in a long time. Always fun
to dip back into the demoscene every now and then. Think I might just break
out my Mindcandy dvd tonight.

------
Flow
At first I wanted to link to C64 productions such as this one
[https://www.youtube.com/watch?feature=player_detailpage&v=gG...](https://www.youtube.com/watch?feature=player_detailpage&v=gGCLPPyRUxA#t=416)
but then I realized that the IBM PC was vastly worse designed than the C64. On
the CPU, although running at whopping 4.77 MHz, trivial operations takes loads
of cycles. The graphics memory sits on an ISA slot, 8-bit path and few MHz
data-rate.

So, well done doing this on a machine that weak!

------
throwwit
For perspective, it was still difficult doing video in the year 1999... I
still remember the lengths some people had to go, to get MPEG working on the
Nintendo 64:
[http://web.archive.org/web/20080331015735/http://www.gamasut...](http://web.archive.org/web/20080331015735/http://www.gamasutra.com/features/20001004/meynink_01.htm)

~~~
throwwit
(Edit - Single Page View:
[http://web.archive.org/web/20080326212226/http://www.gamasut...](http://web.archive.org/web/20080326212226/http://www.gamasutra.com/features/20001004/meynink_pfv.htm)
)

------
leoc
The author mentions getting involved with Video for Windows in the early '90s.
For a laugh, here's some official VfW sample video from 1992 for comparison:
[https://www.youtube.com/watch?v=b4ieKNtZ8yY](https://www.youtube.com/watch?v=b4ieKNtZ8yY)

------
przemoc
8088 Domination is one of the examples of truest hacking and deserves to be
sticky on HN. I mean it!

------
dennisnedry
This is truly impressive, I'm amazed by how fast it renders. So I guess Mr.
Gates was right, you only need 64k...

~~~
jacquesm
> So I guess Mr. Gates was right, you only need 64k...

That was 640K.

~~~
zak_mc_kracken
And it wasn't Bill Gates who said that.

------
MattBearman
The PC I ever used was an Amstrad 8086 CGA, seeing the 4 colour palette 1
again made me super nostalgic. Somehow back then playing games with only
black, white, magenta and cyan didn't bother me.

~~~
johansch
The Amstrad PC1512/PC1640 actually had this quirky 640x200x16 color mode. I
only ever came across one piece of software except the bundled GEM that
supported it though...

------
frownie
Wiz / Imphobia here.. Damn, that is dedication. I didn't know there was a
160x200 X 4 bits resolution on the CGA card. How was that activated ?

~~~
DanBC
Wikipedia has a bit under "special effects on composite monitors"
[http://en.m.wikipedia.org/wiki/Color_Graphics_Adapter](http://en.m.wikipedia.org/wiki/Color_Graphics_Adapter)

------
ANTSANTS
You might also be interested in these efforts to get video playing on the Sega
Genesis
([https://www.youtube.com/watch?v=2vPe452cegU](https://www.youtube.com/watch?v=2vPe452cegU))
and the TI-84 graphing calculator
([https://www.youtube.com/watch?v=6pAeWf3NPNU](https://www.youtube.com/watch?v=6pAeWf3NPNU))

------
detroitcoder
If someone in 1981 had seen this running on the same hardware they would have
assumed it was alien software created by a higher lever species.

------
guard-of-terra
I never knew CGA could do 16 colors. In my memory 16 colors is EGA.

~~~
transitorykris
That caught my attention as well. I wish I knew this trick 3 decades ago..
[http://en.wikipedia.org/wiki/Color_Graphics_Adapter#160.C3.9...](http://en.wikipedia.org/wiki/Color_Graphics_Adapter#160.C3.97100_16_color_mode)

~~~
frownie
Interstingly they talk about the "change palette in the middle of the screen"
tricks that we used in Imphobia. The precision timing was certainly tricky,
especially when playing a MOD-file while drawing ! Ahhh memories...

~~~
jacquesm
Try changing _modes_ in the middle of the scan :)

~~~
wiz21
Argh ! was that possible ? I actually stop playing with that with my last
overscan "320 x +/\- 240" attempt during which, for some reason, the screen
beamer concentrated itself on exactly on scan line of the screen, rendering it
super bright and emitting a super scary sound. My screen always had a darker
line in the middle of it since that experiment :-( You could _actually_ damage
things by playing with hardware...

~~~
jacquesm
> Argh ! was that possible ?

Sure, if you were prepared to give up a few scanlines for the register
changes. The monitor will happily continue to scan as long as the basics
(vertical resolution, frame rate) don't change and you make the the coils are
still being swept.

That's why you ended up with that darker scanline, for a brief time the
vertical deflection was turned off and that caused that one scanline to be hit
by the electron beam in rapid succession at an intensity that it normally
would not receive.

It's like looking into the sun.

Scanning is the hard part, so you don't need to worry too much if you keep the
timing steady but you can change things like colours, palette contents,
horizontal resolution without too much trouble.

If you're going to mess with the vertical resolution then you'll have to have
write access to the register that counts the scanlines (and you'll need to set
it to what it would have been had the whole screen be that resolution).

And of course at the end of the frame you have to switch it all back.

------
mmastrac
I imagine that part 2 is effectively going to involve "compiling" the
sequences to assembly and executing them. You just don't have a lot of cycles
to do much math on the 8088, so you may as well just write compile this as a
big assembly program and start running it.

Looking forward to part 2 very much.

~~~
gwern
Part 2 is already up, no?
[http://trixter.oldskool.org/2014/06/20/8088-domination-
post-...](http://trixter.oldskool.org/2014/06/20/8088-domination-post-mortem-
conclusion/)

------
jhallenworld
This reminds me of Yoomp!

[http://yoomp.atari.pl/media.htm](http://yoomp.atari.pl/media.htm)

1.79 MHz 6502..

------
przemoc
Second (and the last) part of trixter's write-up on how 8088 Domination was
achieved is already up there.

8088 Domination Post-Mortem, Conclusion
[https://news.ycombinator.com/item?id=7924928](https://news.ycombinator.com/item?id=7924928)

------
vijayaggarwal
As a person who started with 24-bit colors, I only have a lot of respect for
Jim.

------
fixerfrasse
The Spaceballs references almost makes me cry of nostalgia. Thanks!

------
drivers99
I can't wait to try this out. I still have my 4.77 MHz 8088 IBM PC with CGA
video.

I don't have a monitor for it anymore, but that is fine since this was
designed for the composite out anyway which I can put on a TV.

And I need to find an 8-bit SoundBlaster to put back in it.

Nice to see trixter doing stuff. I remember him from demoscene stuff in the
90s. Back then, PC demos were for 386/486/Pentium and VGA graphics. Nobody
bothered with PC or XT (or CGA or EGA graphics) even back then.

------
fixerfrasse
The references to Spaceballs left a nostalgic tear in my eye.

------
nitrogen
It's fascinating that the developer basically reinvented RLE, but did it
significantly better.

------
ctdonath
When you can adapt the problem to the solution, the solution becomes much
easier. Real-world problems are rarely so adaptable, first issue being "code
from bare metal up" is rarely an option.

------
Natsu
This makes me want to run this on my 8088. Does it fit on a 10 MB HD? Also, I
wonder if any of the old floppies I have still work... I haven't turned the
thing on in over a decade.

------
jaxb
I wonder how well PC emulators will render this :-)

~~~
Narishma
I don't know of any accurate IBM PC emulator. Most of the typical ones like
DosBox will play it either too fast or too slow.

~~~
joakleaf
Dosbox plays it fine, but only B&W.

~~~
Narishma
With mode=cga it plays in color, though some of the colors are inaccurate
compared to a real PC.

------
csense
Wow, this is the first time I've seen Bad Apple on HN. That alone is enough to
earn my upvote!

------
rasz_pl
This looks like reimplementation on animated GIF.

~~~
gaius
That is not at all like how GIF animation works.

[http://en.m.wikipedia.org/wiki/Graphics_Interchange_Format#A...](http://en.m.wikipedia.org/wiki/Graphics_Interchange_Format#Animated_GIF)

~~~
rasz_pl
Umm yes it is?

"Some economy of data is possible where a frame need only rewrite a portion of
the pixels of the display, because the Image Descriptor can define a smaller
rectangle to be rescanned instead of the whole image"

Every frame of animated gif can choose to modify small portion of previously
drawn image. This is why you cant display animated gif starting in the middle,
you will only render moving parts until you loop whole thing.

This is precisely what Author implemented, he is encoding changes between
frames, this way cpu has to only modify parts of display memory that are
changing.

How is that not the way animated gif works?

~~~
pjc50
This is delta coding; it's _part_ of animated GIF, which then applies LZW
compression to the deltas. This guy has used RLE compression (like TIFF, I
believe) instead.

------
beyondcompute
Amazing!

