Historic memories: how to create a DOS executable in the EDIT.COM

This is an old trick I used to do in the EDIT.COM of DOS to impress my friends. I discovery that some binary instructions could be represented in the text editor.

This is the sequence to create an executable that prints the CLAUDIA name:

ALT 180 // 180 = B4h = mov AH
ALT 02  // 2
ALT 178 // 178 = B2h = mov DL
C       // C
ALT 205 // 205 = CDh = INT
!       // ! = 33 = 21h
ALT 178 ...
L
ALT 205
!
ALT 178
A
ALT 205
!
ALT 178
D
ALT 205
!
ALT 178
I
ALT 205
!
ALT 178
A
ALT 205
!
ALT 180 // mov AH
L       // L = 4Ch 
ALT 205 // INT 21 => exit to DOS
!

This will generate this binary file sequence:

B4 02 B2 43 CD 21 B2 4C CD 21 B2 41 CD 21 B2 55
CD 21 B2 44 CD 21 B2 49 CD 21 B2 41 CD 21 B4 4C
CD 21

This assembly instructions are equivalent to assembly instruction:

MOV AH,02 ; To select subfunction 2, move the appropriate number, 2, to AH.
MOV DL,”A” ; In the interrupt list, it says that the character to output should be
INT 21h ; in register DL. So we move the character to DL.
; Finally when all the registers are set as required, we call the interrupt.

MOV AH,4Ch ; Select the subfunction
INT 21h ; Select a return value (optional but recommended)
; Call the DOS interrupt.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s