Introduction: Wedding 'save the Date' Disk With Hidden Message

My now wife came up with a wonderfully nerdy idea to send out 3.5 inch floppy disks as 'save the date' reminders for our wedding. Feeling that my status as 'nerdiest' in the relationship was threatened I thought...

"Wouldn't it be great if we could put a secret message on the disks. Some kind of program that displays a secret message when you boot up your computer with the disk in the drive".

This instructable is a description of how I wrote a helper script in python and a healthy does of 8086 assembly to regain my 'nerdiest' status.

Step 1: Plan

To make the secret message I originally explored a few ideas:

 1. Copy a text and or image file to the disk
 2. Find a copy of some floppy disk linux distro and setup an init script to display a message on boot
 3. Write to the boot sector of the disk and hope someone is silly enough to put the disk in before turning on their computer

Number 1 would have been relatively easy, but not nearly as fun. 2 seemed doable however I had some difficulty finding a working distro and 3 sounded like oh so much fun.

So, the basic plan was to find some way to make a custom 'boot disk' that when the computer is powered on with the disk in the drive a secret message will appear on the screen. For those of you too impatient to read the instructable, you can find the code to make your own secret message floppy disks here:

http://github.com/braingram/floppysecret

Step 2: Dusting Off Old Webpages

After some google searching I found a series of awesome tutorials on linuxgazette.net on 'Writing Your Own Toy OS':
Part 1: http://linuxgazette.net/issue77/krishnakumar.html
Part 2: http://linuxgazette.net/issue79/krishnakumar.html
Part 3: http://linuxgazette.net/issue82/raghu.html

In short, these tutorials detail how to write some assembly code for 8086 type processors (i.e. 386s, 486s, Pentiums, etc...) to do epic things like display a single letter A on screen and more! These actually covered everything I needed to know to display a simple secret message on screen.

Rather than try to duplicate the tutorials I will just highly recommend that you go through at least parts 1 and 2. If you don't have a floppy drive or disks on hand don't worry. I did all of the development and debugging using qemu, a processor emulator, and only burned the resulting image to actual disks when I had worked out most of the bugs.

Step 3: Setting Up Software

If you're lucky enough to be on a *nix system it's likely that Qemu is available through whatever package manager you use. On ubuntu, you can install it by typing:

sudo apt-get install qemu

or by searching for qemu in the software center (*shiver*). It looks like it may soon be renamed to qemu-kvm

On Macs, last time I checked qemu was available through homebrew (possibly also macports, fink, etc.).

On Windows... not sure. If anyone has a good link, please include it in the comments.

Finally, the source is available at: http://wiki.qemu.org/Download

Other software that you will need includes:
 1. as86 and ld86 (on ubuntu, available in the bin86 package: sudo apt-get install bin86)
 2. gcc
 3. python
 4. make

Here is all of it on one line for you ubuntuers:

sudo apt-get install qemu bin86 gcc python make

Step 4: Working Through Tutorial Part 1

Now that your computer has the necessary software, it's time to work through part 1 of the "Writing Your Own Toy OS" tutorial. Now if you're not using a physical floppy drive you'll have to use a slightly modified write.c that writes the image to a file, not to a floppy.

I will include the text of write.c at the bottom of this step and also attach the file.

Finally, test the image (boot) that you made in the tutorial in qemu. When I first made these images, ubuntu sensibly named the qemu binary 'qemu'. Now, it appears that at least in 12.04 qemu is now 'kvm'. So, if you're not using a recent ubuntu the command you will want to run may be slightly different.

On Ubuntu 12.04:

kvm -fda boot.img

On other platforms where qemu is referred to as... qemu (*sigh*)

qemu -fda boot.img

At this point, a  window should pop up where the first character (eventually) becomes a white A on a black background.

------------------------ write.c -------------------------
#include /* unistd.h needs this */
#include     /* contains read/write */
#include

int main()
{
        char boot_buf[512];
        int floppy_desc, file_desc;

       
        file_desc = open("./boot", O_RDONLY);
        read(file_desc, boot_buf, 510);
        close(file_desc);
       
        boot_buf[510] = 0x55;
        boot_buf[511] = 0xaa;

        floppy_desc = open("./boot.img", O_RDWR | O_CREAT);
        lseek(floppy_desc, 0, SEEK_CUR);
        write(floppy_desc, boot_buf, 512);
        close(floppy_desc);
}

Step 5: What You Can Do So Far

So now you can make a boot disk that displays simple characters on screen. The meat of the code is as follows

mov [0],#0x41; set the first character to ascii code 0x41 "A"
mov [1],#0x1f; set the 'attribute' of the first character

The attribute bits set the color of the character and background. 0x1f or %00011111 sets the background to blue (first 4 bits, 0001) and foreground to white (1111). One word of warning here, when i tested this out on a real machine I discovered that at least the computer I used also had a blink bit (woot!). From the following link, it should be bit 7 or (%10000000 = blink).

You can find more info here:
http://geezer.osdevbrasil.net/osd/cons/index.htm

Feel free to do what I did here, and play around with making all sorts of colored text (make all you design friends cry with yellow text on a white background) and display funny things like 'Feed me' etc...

This seemed very promising however I ran into a limitation where the boot sector on a floppy disk is only 512 bytes. This is fine for short messages, however if you want to do something fancier or more complicated you'll have to move on to part 2.

Step 6: Part 2

I'll let part 2 of "Writing Your Own Toy OS" explain all the nitty gritty of getting the computer to run code that is not on the boot sector. Again, you'll have to make a few changes to write.c if you're not using a physical floppy drive (see attachment).

If all you want to do is display a short message than just change the lines:

     mov     cx,#26
and
     .ascii "Handling BIOS interrupts"

Change the 26 to the length of your string + 2 and the text in quotes to your message.

For example, a message like "Hello Human" would be 11 characters long so:

    mov      cx,#13
and
    .ascii "Hello Human"

Step 7: Secret Message

The message I ended up displaying was 80x25 characters (standard display size). Rather than writing the assembly directly, I wrote a python script that:

 1. reads in a text file
 2. reads the ascii code of each character
 3. generates the 8086 assembly code for sect2.s to display the characters

The script is terribly ugly, but hopefully with what you've learned from these tutorials, you can change it to your liking. Setting the attr variable at the beginning of the file will change the text attributes (if you don't like the white on pink). Also, if you edit secret.txt you might want to make sure each line has 80 characters so that you fully define what is on screen.

Step 8: Reception

Overall the disks went over quite well. At first, we told no one that they contained anything, hoping that someone would foolishly try to boot it as I probably would :). After a few weeks of suspense (and a few broken disks in the mail) we let people know that the disk was bootable. After that, several people dusted off their old computers, booted up the disks and were quite pleased to find the secret message.

I then proposed a challenge to a few of the more technically inclined invitees and I will pose the same challenge to you. There is a secret within the secret. There is some way to trigger the display of a second secret message (which you can easily find in the code). If you figure out the trigger, please post it in the comments along with a brief description of how you figured it out.

I've attached a zip file containing all the files related to parts 1 and 2 of the 'Writing Your Own Toy OS' tutorial and the final disk image with the 2 secret messages. Happy hunting!

Comments

author
SegF4ult made it!(author)2012-07-09

I figured out one of the secrets. It's a variation on the Konami code. In sequence you enter the following:

Up Up Down Down Left Right Left Right B A Return

I figured it out by reading and altering gen_asm.py. I took out most of the key compares in the keyloop, then ran a new version of the image and pressed buttons. (I know I could've looked up key constants and whatnot) When I hit UP, I figured that there were some repeats in the sequence that seemed familiar.

Gives you the nice little message "Grow Up! :-)"

author
braingram made it!(author)2012-07-09

Ding ding ding! We have a winner! Nice work :)

author
SegF4ult made it!(author)2012-07-09

I was just playing around a bit, I wanted to thank you for this instructable. This is actually the first assembler code I've looked at in ages. (I'm not even famliar with x86 assembler to begin with).

You've sparked my interest to keep looking into these things and experiment away .

author
braingram made it!(author)2012-07-09

This is wonderful to hear!

It gave me a certain sense of glee to move registers around and see results. I'm just glad that I could pass along a little bit of the enjoyment.

Maybe I'll see if I can get a version of tetris working... :)

author
SegF4ult made it!(author)2012-07-10

I'd love to see something alike tetris, it'd be awesome if you could log the development process and maybe post it as an instructable?

author
SegF4ult made it!(author)2012-07-09

Also, on a small note. You hardcoded the text attributes in some lines, so if you're changing the attr value, not all of the screen would be (in my case) blue and white, for example. All it takes is look where text is written and substitute 0xdf or 0x00df for 0x"""+attr+"""

that pretty much fixed up the attribute things.

author
braingram made it!(author)2012-07-09

Good catch. I'll make the code changes and hopefully spare a few viewers from pink screens.

author
mtdna made it!(author)2012-07-08

What's a 3.5 inch floppy?

author
ricardouvina made it!(author)2012-07-08

Are you serious?

author
dalmond1 made it!(author)2012-07-08

Can you even buy these any more ??

author
CreativeGeek made it!(author)2013-08-14

eBay.

author
braingram made it!(author)2012-07-08

It was fun trying to find enough of these and of the right colors. We ended up buying some off of ebay and the rest from meritline.com. I do wonder if there are still floppy disk factories out there or if we're just wasting through the remaining stock from the 'age of the floppy'.

author
Istarian made it!(author)2012-07-19

I think they've mostly ceased production, although there may be some limited production still going on. I think SONY officially quit making/having made both the drives and the disks.

author
john3347 made it!(author)2012-07-15

I don't know if any 3.5 floppies are still being manufactured or not (don't know about 5.25 floppies either. I have a few 5.25 discs and a 5.25 drive on a Windows 2000 computer that is still in daily service) but 3.5s are still available at select retail outlets.

author
osgeld made it!(author)2012-07-08

sure can, though its getting a bit more difficult ... whats surprising is you can still buy brand new 5.25 inch disks in both HD and DD

author
mtdna made it!(author)2012-07-08

I assume it's some new kind of high-density storage medium. I'm excited to hear about it because I'm having trouble carrying my music collection back and forth from work. How many 3.5 inch floppy disks would I need to store my 80Gb mp3 library?

author
CreativeGeek made it!(author)2013-08-14

Nope. 3.5" floppies are decades old and were the standard portable data storage medium when I was a kid, however they have long since been rendered obsolete by optical media and flash drives.

author
osgeld made it!(author)2012-07-08

about 55,556 if you can manage to not waste any space on the disk's

author
mtdna made it!(author)2012-07-08

Thanks for the help osgeld. Now let's see. 55,556 disks x ~25 grams per disk = ~1400kg = ~3,000lb. Anyone know where I can buy a heavy-duty trailer??

But seriously braingram, your project really is cute. It will be one of the few save-the-dates people don't throw away.

author
Istarian made it!(author)2012-07-16

Somebody should build a trailer sized jukebox that operates on floppy disks just for the curiousity factor. :P

author
taylorcc made it!(author)2012-07-18

With redundant floppies for when the die.

author
Istarian made it!(author)2012-07-16

If you had some kind of weird floppy autoloader, and some kind of floppy stack (bit like slide trays) you might be able to get by with a fridge sized mp3 player given the ~57000 or so floppy disks you'd need. :)

author
DeusXMachina made it!(author)2012-07-16

Epic trolling is epic. :D

author
john3347 made it!(author)2012-07-15

I have single pictures that will not even fit on a 3.5 disc. What is a double density disc - 1.44 MB? (MB - not GB)

author
wa7jos made it!(author)2012-07-15

I have stacks of 3.5" floppys.
I recently needed to get something off an old laptop that only had a floppy.
Guess what?
Of the 6 other computers in the house, NONE of them had a floppy drive.
Floppy drives have not been standard equipment for many years.
Cute idea, but who's going to have a slot to stick it in?

author
willrandship made it!(author)2012-07-15

you know, if you hate the software center THAT much, just use
apt-cache search *
where * is your search term. it should give a readout of various packages that you can install with apt-get.

author
CreativeGeek made it!(author)2013-08-14

There's also using Synaptic.

author
RocketPenguin made it!(author)2012-07-15

Love it because it uses linux, but who has a floppy drive anymore???

author
CreativeGeek made it!(author)2013-08-14

I'm pretty sure you can use a CD.

author
actimm made it!(author)2012-07-16

I do, I have a USB powered floppy drive and a USB powered MAX drive because sometimes I end up getting old software from various places.

author
srilyk made it!(author)2012-07-17

And if you're like me, I have several old floppies whose data I really need to migrate to HD

author
RocketPenguin made it!(author)2012-07-16

True, and maybe the generation of people getting these floppies probably still do have floppy drives, but my generation, doesn't even know what a floppy is!!

author
actimm made it!(author)2012-07-16

The really funny thing is that a 3.5" floppy disk isn't actually floppy. That name came about from the really old 8" floppy disks and their smaller, relatively newer cousins the 5.25" floppy disks.

In the late 90's I had a computer builder annoyed at me because I insisted on having my Pentium computer fitted with a 5.25" floppy drive so I could do some of my college AutoCAD and SmartCAM homework at home rather than hanging around the computer lab at my the local community college. That was considered obsolete technology even back then because a 1.44Mb 3.5" drive could hold almost 6 times my SSDD 5.25 floppy.

author
WuLongTi made it!(author)2012-07-16

The "floppy" refers to the actual disc media not the casing for the disc. so the 8, 5.25 and 3.5 discs are all "floppy" since the disc media was a flimsy bit of plastic. As opposed to the "hard" disc found inside your computer that is actually a hard piece of metal.

At least, that was always my understanding of it :)

author
actimm made it!(author)2012-07-16

You are technically correct, the floppy refers to the disk inside of the protective case. That being said, the 8" and 5.25" floppies also had cases that were a lot more flexible than the hard plastic case that was around the 3.5" floppy disk.

author
RocketPenguin made it!(author)2012-07-16

I have a hole bunch of 3.5'' floppies, planning on a project, but have never seen a 8'' floppy or even a 5.25'' want to though.

author
Istarian made it!(author)2012-07-16

Heh, me too. I've got a LaCie and Dell USB floppy drive. Got a couple of the internal ones too. I've even got some 5.25" ones.

author
oppie made it!(author)2012-07-15

My thought too.
Love your screen name.

author
RocketPenguin made it!(author)2012-07-15

Thanks. Sadly, i misspelled it for reasons i do not know, but ya....

author
srilyk made it!(author)2012-07-17

This instructable is simply *awesome*.

Combining Python, Assembly, and C to make a totally awesome wedding invite is full of win.

Now I wish I had done this when I got married :P

author
braingram made it!(author)2012-07-17

Thanks!

author
bath514 made it!(author)2012-07-15

I would have said something about 3.5 floppys only being used for table coasters now but others have made my point.

author
Istarian made it!(author)2012-07-16

There are better table coasters than floppies, they are much more exciting for retro computing. The 1.4mb ones are much better. I find it amusing that I have 140k ss disks along with my Apple IIe, a computer that was old by the time I was born.

author
john+henry made it!(author)2012-07-15

good idea but i don't thing it would work.
computers are set to boot from the hard drive before a floppy drive so it wouldn't even look at the floppy unless you change the boot setting on each of the recipients computers.

author
actimm made it!(author)2012-07-16

Actually, until fairly recently, most computers were set to boot to floppy disk first. Back in the 386/486 eras, the boot sequence used to be A: E: C: which was 3.5" floppy drive, CD ROM, then Hard Drive. That allowed you to use a boot disk and your install CD to restore your computer if someone did something stupid and you got the "Blue Screen of Death". Even on the newest computers, you can go into the BIOS and change the boot order if you choose. With my server I have it set to boot from the CD Rom first, so I don't have to go through as many steps in case of a crash.

author
The+Lightning+Stalker made it!(author)2012-07-15

A few years ago, I made a CD version of this using fasm. It's buried somewhere on the fasm forums. I can dig it up of anyone is interested.

author
Starpurge made it!(author)2012-07-15

People still have computers with floppy drives?

author
riff+raff made it!(author)2012-07-15

Now try it with your old 8-in. floppy disks.

What?

;-)


author
namlegz made it!(author)2012-07-15

Step 0: Only send this to people with computers more than a decade old.

author
onemoroni1 made it!(author)2012-07-08

This is funny and creative. I see boxes of these brightly colored things in thrift stores new in the original packaging and wondered what could be done with them? Your reuse is cool, but who has a floppy drive anymore? Peace

About This Instructable

25,755views

81favorites

License:

More by braingram:Wedding 'save the date' disk with hidden messagertl-sdr on UbuntuGoogle Bike
Add instructable to: