Friday, April 14, 2017

Our April 1st website

Every year, it seems most of the Internet goes bonkers for April 1st, also known as "April Fools Day." Generally, I don't like to get involved in website "pranks." I recognize that I'm just not clever or funny enough to pull it off.

But this year, I decided to give it a shot anyway.

Rather than invent something fake with an intention of making a cheap joke, I decided to update the FreeDOS website. So for all day on April 1, the FreeDOS website was a "throwback" to the 1980s. If you missed it, this is what it looked like:


I swapped out the web stylesheet with one that used DOS colors, and loaded a VGA font copied from int10h.org.

Our "April 1st" website was very popular, and gave us a boost in website traffic and downloads of the FreeDOS 1.2 distribution. (Of course, some Internet wise guy decided to bot-attack us on the same day, maybe as his own "prank." Ironically, an attempted DOS attack on a website about DOS. But after you account for that in our website hits, we really did get more visitors that day.)

There's not much to this, so I figured I'd share the details and stylesheet in case you want to do this on your own website.

The FreeDOS website is built around HTML Version 5, using a pretty standard template. We structure every page like this:
header
logo | search
nav
main
nav
main text (section)
footer
nav
footer text (section)
There's some extra markup in there to make things look pretty, but that's the basic design of the website. For details, you can view the source of any page on our website.

It was fairly straightforward to create a web stylesheet to redefine the website colors to look like a DOS terminal. Here is the stylesheet we used: (you'll need to download your own copy of the VGA fonts for this to work)
@font-face {
  font-family: 'VGAsquarePx';
  src: url(int10h.org/vga_squarepx.eot);
  src: url(int10h.org/vga_squarepx.eot?#iefix) format('embedded-opentype'),
       url(int10h.org/vga_squarepx.woff2) format('woff2'),
       url(int10h.org/vga_squarepx.woff) format('woff'),
       url(int10h.org/vga_squarepx.ttf) format('truetype');
  font-weight: normal;
  font-style: normal;
}
/* define a black "stipple" background with DOS font */
body {
  background:
    radial-gradient(black 15%, transparent 16%) 0 0,
    radial-gradient(black 15%, transparent 16%) 8px 8px,
    radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 0 1px,
    radial-gradient(rgba(255,255,255,.1) 15%, transparent 20%) 8px 9px;
  background-color:#282828;
  background-size:16px 16px;
  color: #aaa;
  font-family: 'VGAsquarePx', serif;
  font-size: 20pt;
  margin: 0;
}
/* links are cyan, hover is bright yellow */
a {
  color: #0aa;
  text-decoration: none;
}
a:hover {
  color: #ff5;
}
/* headings and bold text are bright white */
h1,h2,h3,h4,
b, strong {
  color: #fff;
  font-size: 1em;
  font-style: normal;
  font-weight: normal;
  margin: 0;
}
/* italic text is green */
em, i {
  color: #0a0;
  font-style: normal;
}
/* define content areas */
header, main, footer {
  margin: 0 auto;
  padding: 1em 0;
  max-width: 800px;
}
/* use black on cyan text for header */
header {
  background-color: #0aa;
  color: #000;
}
  /* insert the "April 1st" text */
  header > h1::before {
    content: "Today is April 1, 2017!";
  }
  header > h1 img {
    display: block;
    width: 300px;
  }
  header > form {
  }
    header > form fieldset {
      border: none;
    }
  /* use black on gray for navigation */
  nav {
    background-color: #aaa;
    color: #000;
  }
    nav a {
      color: #000;
    }
    nav img {
      display: none;
    }
    nav span {
    }
    nav > ul {
      list-style-type: none;
      margin: 0;
      padding: 0;
      text-align: center;
    }
      nav > ul li {
        display: inline;
        margin: 0 .5em;
      }
/* use white on blue for main text */
main {
  background-color: #00a;
  color: #aaa;
}
  main > nav {
  }
    main > nav li::before {
      content: ">";
    }
  main > section {
  }
  main div.third img {
    display: block;
  }
/* use black on brown text for footer */
footer {
  background-color: #a50;
  color: #000;
}
  footer > nav {
  }
  footer > section {
  }
The April 1st website was only meant for the one day, but I have to admit that I really liked it. And from your responses on social media and via email, I think a lot of other people enjoyed it too! Maybe the "throwback" design will make a reappearance sometime in the future. This seems like something to bring out for special occasions.

Monday, February 20, 2017

Why DOS has sixteen colors

Over at my blog about the usability of open source software, I recently wrote about the readability of DOS applications. This was a followup to an earlier article about how websites are becoming unreadable. I also provided a simple Bash script to compute the contrast ratios of text.

In writing about the readability of DOS applications, I wanted to expand on the color palette for DOS text, but it didn't seem to fit the article. I thought I'd write about it here.

Do you wonder why DOS only supports sixteen colors for text? With DOS, you had a color palette of sixteen colors, enumerated 0 (black) to 15 (white). Backgrounds were limited to the first eight colors:
BackgroundForeground
  1. Black
  2. Blue
  3. Green
  4. Cyan
  5. Red
  6. Magenta
  7. Brown
  8. White ("Light Gray")
  1. Black
  2. Blue
  3. Green
  4. Cyan
  5. Red
  6. Magenta
  7. Brown
  8. White ("Light Gray")
  9. Bright Black ("Gray")
  10. Bright Blue
  11. Bright Green
  12. Bright Cyan
  13. Bright Red
  14. Bright Magenta
  15. Yellow
  16. Bright White
The origins go back to CGA, the Color/Graphics Adapter from the earlier PC-compatible computers. This was a step up from the plain monochrome displays; as the name implies, monochrome could only display black or white. CGA could display a limited range of colors.

CGA supports mixing red (R), green (G) and blue (B) colors. In its simplest form, RGB is either "on" or "off." In this case, you can mix the RGB colors in 2×2×2=8 ways. Let me represent that in a simple table showing the binary and decimal representations of RGB:
000(0)Black
001(1)Blue
010(2)Green
011(3)Cyan
100(4)Red
101(5)Magenta
110(6)Yellow
111(7)White
To double the number of colors, CGA added an extra bit called the "intensifier" bit. With the intensifier bit set, the red, green and blue colors would be set to their maximum values. Without the intensifier bit, each RGB value would be set to a "midrange" intensity. Let's represent that intensifier bit as an extra 1 or 0 in the binary color representation, as iRGB:
0000(0)Black
0001(1)Blue
0010(2)Green
0011(3)Cyan
0100(4)Red
0101(5)Magenta
0110(6)Yellow
0111(7)White
1000(8)Bright Black
1001(9)Bright Blue
1010(10)Bright Green
1011(11)Bright Cyan
1100(12)Bright Red
1101(13)Bright Magenta
1110(14)Bright Yellow
1111(15)Bright White
But there's a problem: 0000 Black and 1000 Black are the same color. There's no red, green or blue color to intensify, so black is black whether or not the "intensifier" bit is set. To get around this limitation, CGA actually implemented a modified iRGB definition, using two intermediate values, at about one-third and two-thirds intensity. Most "normal" mode (0–7) colors used values at the two-thirds intensity, with the exception of yellow which was assigned a one-third green value that turned the color brown. Translating from "normal" mode to "bright" mode, convert zero values to the one-third intensity, and two-thirds values to full intensity.

Here's another iteration of the color table, using 0x0 to 0xF for the color range, with 0x5 and 0xA as the one-third and two-thirds intensities, respectively:
0000(#000)Black
0001(#00A)Blue
0010(#0A0)Green
0011(#0AA)Cyan
0100(#A00)Red
0101(#A0A)Magenta
0110(#A50)Brown
0111(#AAA)White
1000(#555)Bright Black
1001(#55F)Bright Blue
1010(#5F5)Bright Green
1011(#5FF)Bright Cyan
1100(#F55)Bright Red
1101(#F5F)Bright Magenta
1110(#FF5)Bright Yellow
1111(#FFF)Bright White
And that's how DOS got sixteen text colors! That's also why you'll often see "brown" labeled "yellow" in some references, because it started out as plain "yellow" before the intensifier bit. Similarly, you may also see "gray" represented as "Bright Black," because "gray" is really "black" with the intensifier bit set.

You may wonder why only eight background colors? Note that DOS also supported a "Blink" attribute. With this attribute set, your text could blink on and off. The "Blink" bit was encoded at the end of the foreground and background bit-pattern:
Bbbbffff
That's a full byte! Counting from right to left: four bits to represent the text foreground color (0000 Black to 1111 Bright White), three bits to code the background color (000 Black to 111 White) and one bit for the "Blink" attribute.

Sunday, February 12, 2017

Posting FreeDOS news

FreeDOS is community-driven, and we want to hear about how people are using FreeDOS, and what new things they are developing for it. When cool new things come to us, we like to post news items on the FreeDOS website about it. Sometimes, we may put it on our FreeDOS Twitter instead.

We don't have hard rules or guidelines for what we post as news on the website versus what we prefer to put on Twitter, but generally what I do is this:

  1. If it's an update to an existing open source DOS program we already include in FreeDOS, or an update to a program everyone knows about, then post it as news
  2. If it's a new open source DOS program that's just getting off the ground, tweet it instead
  3. If it's a new open source DOS program that's gone through several updates and is clearly going to be around for a while, post it as news
  4. If it's a new open source DOS program by a current FreeDOS contributor, could be either news or tweet, depending.

And anything that's posted as news also gets tweeted.

So if you are doing something cool in FreeDOS, and especially if you are updating or contributing to a DOS program, please let us know!

The best way to share your news is to join the FreeDOS community via the freedos-devel or freedos-user email lists, and make announcements there so everyone can see it. We often pick up news items from those forums to post on the website or on Twitter.

Tuesday, January 31, 2017

Workaround for Help bug

Updated so you don't need to hard-code your preferred language.

There's a bug in the HELP.EXE program on FreeDOS 1.2. If you try to run Help with the language set to anything other than English, it hangs. I don't know why, but I haven't looked at the code. (I'm not the maintainer. But if you'd like to fix this bug, email me.)

Here's a simple workaround to get Help working on your system, regardless of what language you use:

1. Rename the HELP.EXE program
C:
CD \FDOS\BIN
REN HELP.EXE HHELP.EXE
2. Create a new HELP.BAT program
EDIT HELP.BAT
3. Add these lines to HELP.BAT
@ECHO OFF
SET OLDLANG=%LANG%
SET LANG=EN
C:\FDOS\BIN\HHELP.EXE
SET LANG=%OLDLANG%
4. Save and exit

This workaround is a "wrapper" that always sets the language to English before running the Help command. Here, I've renamed the HELP.EXE program to HHELP.EXE, so it will show up next to HELP.BAT when you view the directory.

Note that in DOS, batch files (*.BAT) are just shortcuts to what you would type at the command line. So in HELP.BAT, you need to save your language so you can set it back to whatever you usually use, or it will remain English.

Friday, January 27, 2017

100,000 downloads

We released FreeDOS 1.2 on December 25, and since then we have seen keen interest in the latest version of FreeDOS. As of January 26, we had 100,000 downloads of FreeDOS 1.2. That's just a month and a day to reach this major milestone.

While FreeDOS 1.2 is the latest version, we do see some folks still downloading the older 1.0 and 1.1 releases. If you consider downloads for all versions of FreeDOS we actually reached "100,000 since December 25" on January 25, a month after the release of FreeDOS 1.2. That's pretty cool too!


If you're curious, our peak day for FreeDOS 1.2 was December 27, at just over 12,000 downloads. And That's pretty impressive! We figure releasing the new version on Christmas Day meant some FreeDOS users weren't able to download it right away, because they were visiting family for the holidays.

We're holding steady now at about 1,800 to 1,900 downloads of FreeDOS 1.2 per day.

It's interesting to compare the difference between FreeDOS 1.2 and 1.1. In the previous version, released January 2, 2012, we didn't see nearly the same initial interest in FreeDOS. Our peak day for FreeDOS 1.1 was a few months later, in April 2012, as though people suddenly found out about FreeDOS. We reached 100,000 downloads of FreeDOS 1.1 on May 24, 2012.


So I think we've done something right with the new version of FreeDOS. I'm very excited by FreeDOS 1.2! I think the latest FreeDOS is a great little operating system that meets a lot of needs.