flat assembler
Message board for the users of flat assembler.

Index > DOS > Hello World! Program not working, plz help

Author
Thread Post new topic Reply to topic
Yawgmoth



Joined: 20 Aug 2003
Posts: 37
Yawgmoth 13 Sep 2003, 21:55
When I try to compile this:

Code:
org 100h
__pause db 'Press any key to continue...$'
mov dx,msg_a
mov ah,9
int 21h
msg_a db 'Hello World',0Dh,0Ah,'$'
mov dx, __pause
mov ah, 07h
int 21h
mov ah, 07h
int 21h
mov dx,msg_b
mov ah,9
int 21h
msg_b db 'Hi again',0Dh,0Ah,'$'
mov dx, __pause
mov ah, 07h
int 21h
mov ah,4Ch
int 21h
                    
    


and try to execute the .com file, it just exits w/o displaying anything.
Post 13 Sep 2003, 21:55
View user's profile Send private message Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8354
Location: Kraków, Poland
Tomasz Grysztar 13 Sep 2003, 22:08
You have put data at the beginning of your program, and it gets executed before your actual code. I shouldn't have to say that this can be very dangerous. If you don't want to move your data to the end of your program, you can just skip it with jump instruction, so it won't get executed:
Code:
org 100h 
jmp start
__pause db 'Press any key to continue...$' 
start:
; and here the rest of program...    

PS. Have you seen my DOS tutorial preliminary? I'm trying to clarify such things there, it's posted in this thread: http://board.flatassembler.net/topic.php?t=118.
Post 13 Sep 2003, 22:08
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.