3 Simple Ways to
Share What You Make

With Instructables you can share what you make with the world — and tap into an ever-growing community of creative experts.

PhotosPhotos

Share one or more photos of a project, recipe, or whatever you've made, quickly and easily.

Step by StepStep-By-Step

Share your step-by-step photos with text instructions of what you made so others can do it too!

VideoVideo

Share your how-to video. You'll need your embed code from a video site such as YouTube.

How to write the world's smallest "Hello World!" executable for PC

How to write the world\
Ok, it may sound useless for modern PCs... but is amazing to watch how a 21 bytes .COM file can display text on screen. even on a 286 if you still have them :)
This guide will use "debug.exe", a nice app that comes after DOS 2.0 and you possibly have it on Windows folder if your running Windows OS. So, no need to download fancy assemblers or compilers.
I'll try to explain each step... but dont expect more that a text on screen...

A nice description about DEBUG.EXE can be found in...
http://mirror.href.com/thestarman/asm/debug/debug.htm
and http://en.wikipedia.org/wiki/DEBUG
hellow.zip639 bytes
 
Remove these adsRemove these ads by Signing Up
 

Step 1Undestanding DEBUG.EXE

Undestanding DEBUG.EXE
«
  • helloworld10.gif
  • helloworld11.gif
Our task should be creating a very small executable (in this case is a .COM file) in x86 assembly that should print "Hello World!" on the screen.

We will be using DEBUG.EXE that was released after DOS 2.0, it's mainly used to debug 16-bits applications.

You possibly have it on Windows System folder if your running Windows OS.
In Windows XP, it can be found in C:\WINDOWS\SYSTEM32\DEBUG.EXE

Enter in command-lines (I hope you know how to do this... if not, maybe this tutorial isn't good for you), first step should be calling DEBUG.EXE, since C:\WINDOWS\SYTEM32 is included in "PATH" enviroment, you can call it any path or drive:

C:\> debug.exe
-

You can type "?" then press ENTER to see the help.

(Again) A nice description about DEBUG.EXE can be found in...
http://mirror.href.com/thestarman/asm/debug/debug.htm
and http://en.wikipedia.org/wiki/DEBUG
hellow.zip639 bytes
« Previous StepDownload PDFView All StepsNext Step »
21 comments
Dec 22, 2008. 5:36 PMdahdash says:
Thanks!
Oct 21, 2008. 5:00 PMN3kk3tsu says:
I liked it very much! Where can i find more tutorials and examples about Debug.exe? Where can i find more of your tutorials? Thank you!
Oct 23, 2008. 12:00 AMN3kk3tsu says:
Thank you so much ;D
May 10, 2008. 2:15 AMdx340 says:
try this:

@Echo Off
msg * Hello World
pause

=)
Jun 28, 2007. 4:00 PMduct tape says:
most assemblers have some quality of code checking to make sure that the code doesn't do much other than intended. Debug however, does not. This makes it dangerous to use to much, as I learned first hand a while ago. I was doing something like this, and I typed in the wrong register. When I ran it, garbage characters spewed across the screen and made a very annoying sound. It was even more annoying that you couldn't close out the program without shutting off the computer. Of course, the next day I loaded it into my bro's computer and changed the registry to start it on boot. ;)
May 18, 2007. 7:36 AMBolicao says:
Hello World! I liked it! :) Could ne1 explain me how to ask for two numbers and sum them using windows xp debuger? Thank you
May 5, 2007. 11:15 PMaceman 569 says:
I didn't understand a thing you said in this instructable.... :'(
Jul 17, 2006. 6:08 PMmikesty says:
echo Hello World! ;) Pretty neat stuff though. You know quite a bit about this :)
Jul 18, 2006. 1:14 PMmikesty says:
Bahaha, did gates not once say, "No one will ever need more than 640K!" or something like that?
Sep 24, 2006. 11:00 AMMz3FRS says:
HAHA-back in the day, trying to configure your system to free up more conventional memory was half the fun of playing games! nearly makes me miss DOS.
Jan 11, 2007. 1:20 PMmark101 says:
when did you pick that picture of "Cosmo Kramer" as an avatar?
for those who haven't seen the N-bomb http://www.friedbrains.com/video35.htm
Jan 3, 2007. 6:25 AMMr.Devious says:
I made a dos executable a couple years back. It was a nasty hd bomber. Wiped a few people's drives with it, they pissed me off.
Jan 6, 2007. 8:17 AMMr.Devious says:
Yea that would scare me. And it wasn't exactly a hd bomber, but it did just that. I wanted to test it to see if it worked and all it was somewhat simple format command and it wrecked the guys hd because it was too late when he canceled it. I'm not out to wreck people's computers nor am I a hacker. I was just a nasty little shit back then :-P
Aug 19, 2006. 4:59 PMMetalbrain says:
You can cut one more byte replacing MOV AH, 09h with XCHG AX,BP
Oct 3, 2006. 3:09 PMDelta629 says:
Cool, I haven't seen debug used since the late '80s.

Pro

Get More Out of Instructables

Already have an Account?

close

All Steps Viewing
View all steps of an Instructable on the same page when you're a Pro Member.

Upgrade to Pro today!
0
Followers
1
Author:JustBurn