Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MSDOS "Hello World" EXE

Tags:

dos

I want to compile a "Hello World" MS-DOS exe.

Not a program that runs in XP 16bit mode, or in MS-DOS mode on top of Windows OSs.

A HELOWRLD.EXE that I can run on my MS-DOS box.

like image 903
divinci Avatar asked Apr 15 '10 12:04

divinci


3 Answers

I think DEBUG.EXE still ships with windows (at least it does with XP). Run debug and enter something along the lines of the following transcript:

c:\src> debug
-a 100
1373:0100 mov ah,9
1373:0102 mov dx,108
1373:0105 int 21
1373:0107 ret
1373:0108 db "Hello world!$"
1373:0115
-n c:\hi.com
-r bx
BX 0000
:0
-r cx
CX 0000
:15
-w
Writing 00015 bytes
-q

c:\src> c:\hi.com
Hello world!

c:\src> _

Read more on DEBUG.EXE at: http://en.wikipedia.org/wiki/Debug_(command)

And the INT 21 display string http at: http://www.uv.tietgen.dk/staff/mlha/PC/Prog/asm/int/21/09.htm

like image 181
Niels Castle Avatar answered Nov 15 '22 11:11

Niels Castle


Follow these steps:

  1. Get and install Turbo C 2.0 from here, legally.
  2. Copy this code (*)
  3. Compile it.
  4. Your hello.exe is ready to run.

This is code you should copy (*):

int main(int argc, char **argv)
{
   printf("Hello, world.\n");
   return 0;
}
like image 9
Pablo Santa Cruz Avatar answered Nov 15 '22 10:11

Pablo Santa Cruz


DJGPP is a complete 32-bit C/C++ development system for Intel 80386 (and higher) PCs running DOS. It includes ports of many GNU development utilities. The development tools require a 80386 or newer computer to run, as do the programs they produce. In most cases, the programs it produces can be sold commercially without license or royalties.

http://www.delorie.com/djgpp/

like image 4
Simone Margaritelli Avatar answered Nov 15 '22 09:11

Simone Margaritelli