The Goat Emoji Is 100% Valid Machine Code, And It Doesn’t Stop There

Did you know emojis can be executables? Well, they are if you treat them like Intel 8088 or 8086 machine code, anyway. [GloriousCow] shared this clever revelation, demonstrating that executable programs could be created entirely from emojis. To really appreciate why, it’s necessary to take a small step back.

It all started when [GloriousCow] happened to notice, entirely by chance, that ๐Ÿ (the goat emoji) was F0 9F 90 90. Anyone familiar with x86 assembly language probably recognizes 90h as nop,ย  or null operation, or “spend a cycle doing nothing”. What about F0 and 9F? Together they are lock lahf (assert the bus lock signal then copy some status flags into register AH) which, on an 8088 and 8086, essentially does nothing.

This means the goat emoji (F0 9F 90 90) is 100% technically valid machine code. It doesn’t do anything, but here’s where it gets even more interesting.

A short string of emojis is machine code that writes HELLO (lower right) by writing directly to video memory.

There are loads of emojis, and manyย of them start with F0 9F followed by two more bytes, and many of those other two-byte combinations are surely also valid machine code. Could one create a meaningful executable program consisting entirely of emojis? The answer is yes, and [GloriousCow] crafted a simple Hello World program to demonstrate.

The simple program looks like this: ๐Ÿธโ˜บ๏ธ๐Ÿฐ๐ŸŽโ™๐Ÿ—ƒ๏ธ๐Ÿงฏ๐Ÿงฏ๐Ÿงฏ๐Ÿฎ๐Ÿ’—๐Ÿฆฎ๐Ÿชโ™๐Ÿฐ๐Ÿน๐Ÿ—ƒ๏ธ๐Ÿงฏ๐Ÿงฏ๐Ÿงฏ๐Ÿงฏ๐Ÿ’—๐Ÿช—๐Ÿงฏ๐Ÿ˜—๐Ÿงฎ๐Ÿซช๐Ÿ˜—๐Ÿงฎ๐Ÿ˜—๐Ÿฎ๐Ÿ˜ช๐Ÿ˜”โญ. Save that string of emojis to a file, give it a .com extension, and run it in DOSBox with CPU type set to 8086. It’ll printย HELLO at the bottom-right of the screen by writing directly to video memory.

There are loads more details on the original blog post, including plenty of resources and tips for writing your own executables with emojis. There’s also a much more involved VGA demo program made from emojis, so give it a look.

Some of you may be aware that ASCII characters can also be used in a similar way (and more flexibly, since they are not four-byte combinations like emojis). This was used in BASIC programs as a way to cleverly embed machine code in things like REM statements, creating odd-looking code that did things in BASIC that shouldn’t have been possible.