Thursday 1 May 2008

Assembler: Hello, World!

DOS, x86, 16bit, debug.exe

mov ax,0200
mov dx,0048
int 21
mov dx,0065
int 21
mov dx,006C
int 21
mov dx,006C
int 21
mov dx,006F
int 21
mov dx,002C
int 21
mov dx,0020
int 21
mov dx,0057
int 21
mov dx,006F
int 21
mov dx,0072
int 21
mov dx,006C
int 21
mov dx,0064
int 21
mov dx,0021
int 21
int 20

4 comments:

  1. Mmm yeah, did you think it was funny trying to output a single character at a time? Read em and weep (wrote it in 11 seconds):

    -a
    1910:0100 jmp 0
    1910:0103 db "Debug.exe can emit string literals too :P$"
    1910:012D
    -a 0100
    1910:0100 jmp 012D
    1910:0102
    -a 012D
    1910:012D mov dx, 0103
    1910:0130 mov ah, 09
    1910:0132 int 21
    1910:0134 ret
    1910:0135
    -r CX
    CX 0000
    :35
    -n Test.com
    -w
    Writing 00035 bytes
    -q

    ReplyDelete
  2. Hey, can any one tell me how to use call in debug is it equal to jump? and another two questions - i was trying to use coprocessor from debug, and got no error, but after calculations all my output was empty. i will give a workin example a warm hug.
    second question - perhaps i'd like to enter graphical mode - is it possible to code for graphical vga mode in debug? i guess not, couse ms dos in windows is a virtual 16 bit machine, but still i'll give it a try.
    Thanks people x

    ReplyDelete
  3. What's the number system in Debug.exe? I mean in "mov ah, 09" the "09" means an octal number 9 and in "int 21" the "21" means decimal number 21...

    Is Debug.exe supposing that all literals are hexadecimals w/o exception?

    ReplyDelete
  4. The numbers are hex values (there is no number 9 in an octal system).

    ReplyDelete

All comments are moderated