Devious Malcontent

 Blog Blog RSS

Decoding\Reimplementing the Microsoft Windows 1.x startup logo animation

Sunday 28th April 2024

Windows 1.4 Start up Logo

Background

My weekend hacking project was spurred on during the ongoing research portion of a much larger project in which I discovered that the assembler source code for the Microsoft Windows 1.x startup logo animation is available in the Microsoft Windows 2.03 DDK on disk 2 under the logo folder.

Of which the Microsoft Windows 2.03 DDK kit can be obtained via the Windows SDK & DDK Page WinWorldPC archive.

The startup splash screen logo itself is encoded in hexadecimal using defined bytes, and the file itself goes into extraneous details to explain how the logo is animated on the screen.

So, the thought crossed my mind that I could potentially write a PowerShell script to decode the hexadecimal values and convert them to a bitmap file, or then perhaps re-implement the animation in JavaScript just for the sake of it, but I'm also trying to stay on topic with my current video project.

But it just so happens that Microsoft released the MS DOS 4.0 source code on Friday morning, and I spent a good portion of my time reviewing some of the code, specifically this file:https://github.com/microsoft/MS-DOS/blob/main/v4.0/src/DEV/DISPLAY/EGA/860-8X16.ASM

It's the section for handling font rendering, specifically for EGA displays where each character is drawn at a size of 8 by 16 pixels, but this whole exercise into legacy versions of the Windows Operating System came about after playing with the sample files in Michael Abrash's Zen of Graphics Programming, specifically exercise 2 of chapter 4, because it introduced me to the font pointer, where I got an idea of how to render high resolution text, and I've spent today trying to understand how DOS facilitates this.

Just like the big screen logo, it looks like the font characters are represented in hexadecimal, but I need to decode them to confirm this.

So now I have a reason to write a script.

Analysing the assembler code...

LOGO Assembly Code

So, what can be gleaned from a peek under the hood?

First off, we can tell that the image is interlaced, that is, every second line is drawn independently of the first and the two lines are merged together, this allows the logo to be animated like in the example .gif image at the start of this article.

We see that the code supports multiple graphics modes, we can tell that the height of the logo is 36 lines, and the overall width of the logo is 67, pixels perhaps.

If we analyse the first line of defined bytes in the code, we cans see that for each line the hexadecimal characters, are in and array of 10 by 6 blocks with the last line only 7 values long.

Preformatting the file

Copy and paste lines 0 to 34 for the first document. (starting at 1426 to 1551 in Logo.asm)

Find and replace the db and blank spaces parts.

Use ctrl alt to select the line comments and all lines vertically downwards, and inject a comma (,).

Find and replace the lines with a comma and blank spaces, replace with a semicolon (;)

Remove the line breaks,

Re-inject the line breaks by replacing the semicolon (;) with \r\n

For the first document, I saved this as windows logo even.txt

For the second document, repeat about, but this time copying lines 1 to 35. (starting at 1552 to 1677 in Logo.asm), I saved this as windows logo odd.txt

Merging the files with a script

This leaves us with two text files, one for even lines and one for odd lines, to merge them I used this PowerShell script:

$arrayList1 = (Get-Content 'windows logo odd.txt') -split '\n'
$arrayList2 = (Get-Content 'windows logo even.txt') -split '\n'

for ($i = 0; $i -lt $arrayList1.Length; $i++) {
	Add-Content -Path joinedFile.txt -Value $arrayList1<$i>, $arrayList2<$i>
}

The output of this was a new text called joinedFile.txt

Logo outlined in Notepad++

Finally in Notepad++ highlighting one set of the values vaguely gives us a crude render of the old logo.

My old copy of the Microsoft C compiler.

Fun fact: I've actually got this logo on an old copy of the Microsoft C compiler.

Determining the Colours

So, while this image looks like a monochrome image, it looks like it is using more than 2 colours,

To show how many colours are being used?

To figure this out I simply changed the comma (,) to \r\n in notepad++, then I went to Edit > Line Operations > Remove Duplicate Lines, and we get about 13 unique lines.

This presents us with a little bit of a dilemma because we don't actually know what should be blue and what should be white, I'm wondering if the extra bits of data are for higher resolution displays or an artifact of bi-linear filtering (used in image compression).

I want to see the logo

While I am not sure that I want to spend the time animating it, I did want to have ago rendering it out to an image file.

There is a bit of guesswork involved since we don't actually know what colours these hexadecimal values are meant to represent.

But I came up with this script:

$lines = Get-Content -path .\joinedFile.txt

::LoadWithPartialName("System.Drawing")

for ($counter=0; $counter -lt $lines.Length; $counter++) {
   $array = $lines<$counter>.Split(",")
   if ($counter -lt 1) { $bmp = New-Object System.Drawing.Bitmap($array.Length, $lines.Length) }

   for ($counter2=0; $counter2 -lt $array.Length; $counter2++)
   {

     switch ($array<$counter2>) {
        { $_ -eq "000H"  }  { $bmp.SetPixel($counter2, $counter, "Blue") }
        { $_ -eq "0FFH"  }  { $bmp.SetPixel($counter2, $counter, "White") }
        { $_ -eq "0F0H"  }  { $bmp.SetPixel($counter2, $counter, "White") }
        { $_ -eq "03FH"  }  { $bmp.SetPixel($counter2, $counter, "White") }
        { $_ -eq "0C0H"  }  { $bmp.SetPixel($counter2, $counter, "Blue") }
        { $_ -eq "0C3H"  }  { $bmp.SetPixel($counter2, $counter, "Blue") }
        { $_ -eq "003H"  }  { $bmp.SetPixel($counter2, $counter, "Blue") }
        { $_ -eq "00FH"  }  { $bmp.SetPixel($counter2, $counter, "Blue") }
        { $_ -eq "0FCH"  }  { $bmp.SetPixel($counter2, $counter, "White") }
        { $_ -eq "0F3H"  }  { $bmp.SetPixel($counter2, $counter, "White") }
        { $_ -eq "030H"  }  { $bmp.SetPixel($counter2, $counter, "Blue") }
        { $_ -eq "00CH"  }  { $bmp.SetPixel($counter2, $counter, "Blue") }
        { $_ -eq "033H"  }  { $bmp.SetPixel($counter2, $counter, "Blue") }
     }
   }
 }

$bmp.Save("$PSScriptRoot\mslogotest.bmp")

Script Output

Finally, here is the result of that script, I think with a bit of tweaking of the colour values we may be able to get it more accurate to how it was originally presented, but this is good enough for now.

So why is this here?

I suspect this code being in the driver development kit is here for OEM manufacturers to replace the Microsoft logo with their own or perhaps incorporated into the design.

I do very much appreciate this stuff being archived as it allows me to LARP as a dos\windows 3.11 developer for a weekend.

What a rabbit hole to go down...

In contrast, another interesting tidbit that I learned recently was the modern Windows loading screen uses a font for the progress indicator (the spinny dot things), when the OS boots. (I even saw a YouTube video about it here.)

I am the kind of person who can look at a block of hexadecimal code and be like: "Oh, I know where that's from."

I don't want to give too much away about my current assembly project, but I do what I mentioned that it does make heavy use of fonts.


Home | Blog Index | RSS