Oldskooler Ramblings

the unlikely child born of the home computer wars

Archive for September, 2011

No keyboard, no monitor, no problem

Posted by Trixter on September 29, 2011

I have a friend named Andrew Jenner.  If you’re intimately familiar with PC retrocomputing, you may remember him as the person who thought it would be a good idea to remaster an old game called Digger so that it could be recompiled for modern machines/languages/operating systems.  Meaning:  He took the original game binary, used DEBUG.COM to dump sections of it out as partially-assembled assembler source, and examined and tweaked it over several months until it could compile back into the original.  Then he translated that into C.  Then he made the C portable.  Then he made the C portable across operating systems.  Then he switched out the graphics for higher-resolution ones.  The end result is that you can now play this ancient game perfectly on any operating system, even in a Java VM.  His actions inspired similar projects by other people, like The Jumpman Project and The Beyond Castle Wolfenstein Project.  So that’s what Andrew does for fun.  At least, that’s one of the things he does for fun, when he’s not building new electronic music toys for his children, or writing a cycle-exact 8088 emulator, or just generally visiting every single hackerspace in a 200-mile radius to kick down the door and show them who’s boss.

He wrote me recently to let me know he had purchased an XT to do some democoding on it, a shared passion of ours.  It came with a monochrome card, but he lacked a suitable monitor; it also lacked a keyboard, and a working disk drive.  Did that stop him from using it?  Hell no, this is Andrew Fucking Jenner!  Step aside, son:

I ordered a CGA card but decided to see if I could jerry-rig something up in the meantime. I programmed my Arduino to pretend to be an XT keyboard and also the “manufacturing test device” that IBM used in their factories to load code onto the machine during early stage POST (it works by returning 65H instead of AAH in response to a keyboard reset). I then used this to reprogram the CRTC of the MDA to CGA frequencies (113 characters of 9 pixels at 16MHz pixel clock for 18 rows (14 displayed) of 14-scanline characters plus an extra 10 scanlines for a total of 262 scanlines). The sources for this are on github.

I had to re-read that a few times to make sure I wasn’t having a seizure.  Let’s confirm what happened:

  1. With no input device or working disk drive, he still managed to load code by reprogramming a microcontroller to emulate a long-forgotten IBM diagnostic protocol, formerly used only in factories by test devices to QA units before they went out the door.
  2. The code he loaded was to force a monochrome card to output NTSC signals, so that could be connected to a TV.  Not dramatic enough for you?  How about this:  He forced a monochrome card to behave like a color card.
  3. He made the schematic and source code available, because that’s the kind of guy he is.

You don’t mess with Jenner.  You do read his blog, however.

Posted in Programming, Vintage Computing | 3 Comments »

MPEG-2 Encoding, The OCD Way

Posted by Trixter on September 17, 2011

Remember that AssemblyTV advert that said we would ship MindCandy 3 in September?  We won’t, because we found several bugs in the first release candidate that we’re fixing.  In one instance, a Samsung BD-P1000 (a very early player) wouldn’t even get to the main menu!  So we’re going back and doing more compatibility fixes and testing, and adding a few missing features along the way (like pop-up menus for the NVScene talks).  We should be shipping in October.

However, with the Blu-ray build taking several hours at a time to test changes, I have some time to concentrate on the DVD (and write blog posts).  Let’s talk about MPEG-2 encoders.

Ever wonder what the very best MPEG-2 encoder is?  Each have different strengths, parameters, quantization matrices, sensitivity to noise, and so on.  There’s no way to see which one is best for your source footage until you try one.  So you may be tickled to know that we tested pretty much every single Windows encoder that someone claimed to produce decent results (with the exception of ProCoder, which kept crashing on my rig, which is a shame since I recall it produced great output).  A few months ago, I prepared the then-current 480i version of the main timeline, a thoroughly interlaced 3h29m27s 30i video.  I made an avisynth wrapper for it that presented itself as a YV12 colorspace format (what MPEG-2 uses) and fed it to several encoders, each set to the same average bitrate (4.7 mbit/s) and set to DVD-compliant settings.  I then ran the encoded results through the MSU Video Quality Measurement Tool and concentrated on five metrics:

  • SSIM (the metric x264 uses)
  • 3SSIM (a modified version of SSIM)
  • VQM (a metric that exploits the DCT to simulate human visual perception)
  • PSNR (older, depreciated)
  • The color results of PSNR (U and V components) since the previous four only looked at luminance (Y)

Finally, I took the average metric score for all 376642 frames, stuck everything in a spreadsheet, and color-coded each from green (most similar to the original input file) to red (farthest):

Encoder Notable Configuration Parameters Average SSIM (Y) Average 3SSIM (Y) Average VQM (Y) Average PNSR (Y) Average PSNR (UV) Average PNSR (U) Average PNSR (V)
CCE SP3 CBR 4.7mbit/s (intentionally bad) 0.9562 0.95988 1.14252 34.36616 39.05231063 38.9542 38.53384
Adobe Media Encoder CS5 Quality 5, max render depth 0.96163 0.96772 1.00816 36.35463 39.09635214 39.8727 39.42966
CCE SP3 default settings 0.96511 0.96949 1.01146 36.45595 39.00388083 39.41969 38.96111
HcEnc 0.26 9-bit DC, defaults 0.96355 0.97021 0.98358 36.63967 38.966577 39.57915 39.15758
CCE SP3 10-bit DC, CG1 matrix, no filters, Q16 0.96428 0.97053 1.03151 36.72093 38.86613 39.32893 38.8701
CCE SP3 9-bit DC, CG1 matrix, no filters, Q16 0.96446 0.97075 1.02869 36.75945 38.788335 39.33256 38.87439
TMPGEnc 5 9-bit DC, defaults 0.96324 0.97108 0.9676 36.93709 38.630765 39.53456 39.12228
QuEnc 0.72 9-bit DC, all quality settings on (slow) 0.96679 0.97581 0.9007 38.36719 37.93311 38.11264 37.75358

Some interesting things can be noted from these results (keep in mind that my source is a noise-free, digitally clean, computer-generated video):

  • Adobe Media Encoder, which uses MainConcept’s engine, clearly uses PSNR as its comparison metric when optimizing 2-pass encodes (unfortunately, PSNR is not a good metric to optimize to, which is why it doesn’t do well in the metrics that actually matter like SSIM and 3SSIM, and why it looks worse visually)
  • CinemaCraft readily sacrifices color accuracy during a CBR encode, presumably to fit the target bitrate better and try to preserve as much luminance as it can.
  • CinemaCraft’s default settings produce, for it, the best SSIM metric.  All attempts to make it better by me (10-bit DC precision vs. 9-bit, different matrices, different filter settings, etc.) actually made it worse.

The subjective viewing quality of each of these results was mostly in-line with the technical results with one exception:  The QuEnc output was noticably worse than its SSIM score above would suggest.  It’s hard to explain without showing individual frames as comparison, but there was just something in QuEnc’s output that made it feel worse to the viewer than the others.  The PSNR metrics confirm that somewhat.  I think I must have made a mistake somewhere along the way with my testing of the QuEnc encoder, so I mentally ignored it when making my comparisons.

So which one did we end up using?  To understand that, you should understand my motivation.  I have a history of using psychology in most of my projects to gain a slight edge with my target audience wherever I can:  I chose nerd-familiar material for 8088 Corruption, I played virt’s rickroll composition during my presentation of MONOTONE, the contribution point reward system in MobyGames was my idea, etc.  So while TMPGEnc produced the best overall results in subjective user observations across the entire video, we went with CinemaCraft SP.  Why?  CinemaCraft SP allows you to skew the bitrate for any number of user-defined sections.  I used this feature to ensure perfect visual quality for the very first and last demo in the timeline.  Start strong and finish strong.

Posted in Digital Video, MindCandy | 4 Comments »

The PC Mockingboard

Posted by Trixter on September 9, 2011

I am a lucky owner of the IBM PC version of Bank Street Music Writer, which I purchased in 1986 using $85 of saved allowance through a friend’s older brother who worked at Babbage’s and could get it at a discount (normal cost was $150).  The Ad Lib Computer Music System wasn’t available yet, and for $245 I couldn’t have afforded it anyway.  $150 was a lot for a consumer-oriented music composition program, and with good reason:  It came with a sound board.  For the owner of a PC jealous of nearly every other home computer that came with decent sound hardware built in, this was the holy grail in a software box to me.

The software and packaging called it the Bank Street Music Writer card, and it was capable of six synthesized voices with different instrument types, some of which could be percussive.  If that sounds a lot like the Ad Lib, don’t be fooled — the output was square waves, the volume envelopes were controlled by the software, and the percussive sounds were made by mixing white noise with a waveform.  It sounded a lot like two PCjrs glued together.   Apple users are familiar with this sound:  It’s the Mockingboard.  The PC board doesn’t say anything like that on its PCB, and the components aren’t arranged the same way as they are on a real Mockingboard, but it sure sounded awfully similar.  So much so, in fact, that I pulled my card out of storage a few years ago to see if I could decipher it for adding support for it in MONOTONE.  I discovered it was built around a GI AY-3-8913, which itself is a smaller pincount version of the AY-3-8910, which was, in fact, the main chip on a Mockingboard.  But that was the only connection, and it was mostly conjecture on my part.

Until tonight.  I was browsing through The Internet Archives’ collection of Family Computing Magazines (thank you, Mr. Scott) when this caught my eye:

Well look at that — it is a PC version of the Mockingboard!  So at some point there was going to be a PC Mockingboard, but the only fabrication of it was as the “Bank Street Music Writer Card” bundled with Bank Street Music Writer.  You don’t see this written in any Mockingboard/Apple history, which is a shame because I’d be curious to know what the plans were and how far they got off the ground.  All we have proof of, thanks to Family Computing, is that they were planning to market it as a Mockingboard at some point.

This is easily the rarest sound card I have in my collection, and is probably the most rare and valuable PC sound card second only to the Innovation SSI 2001 music card, of which only two are known to still exist.  (Only one BSMW card is known to exist — mine — but remember the first lesson of the collector:  Rarity != value.)  And the Innovation has its own trump card:  It’s a PC version of the SID.

Scans of this card, reference samples of its output, and my interview with Glen Clancy about Bank Street Music Writer and it’s music file format will probably be inaugural entries in my Sound Card Museum project, which I will start building before the year is over.  If you can’t wait and want to hear what it sounds like right now, you can check out both a sample file that came with BSMW, or a piece of music I transcribed myself (a section of “Consider Yourself” from Oliver).

(PROTIP: Bank Street Music Writer also supports the PCjr and Tandy 1000 sound chip in a limited capacity, so you can snag BSMW from your favorite abandonware watering hole to play with it in DOSBOX.  It requires ANSI.SYS, so hopefully that won’t be a problem in DOSBOX.  If you’re especially lucky, it will come bundled with the songdisk I released with it so you can play with 20+ extra tunes.)

Posted in Software Piracy, Vintage Computing | 6 Comments »