flat assembler
Message board for the users of flat assembler.

Index > DOS > Problem outputting strings

Author
Thread Post new topic Reply to topic
Yawgmoth



Joined: 20 Aug 2003
Posts: 37
Yawgmoth 22 Aug 2003, 08:17
My program is as follows:
Code:

mov dx,msg
mov ah,9
int 21h ;Prints message
mov ah,8
int 21h    ;Inputs character
mov dx, mg
mov ah,9
int 21h   ;Prints 2nd message
mov dl,al
mov ah,2
int 21h  ;Prints character entered
mov ah,4Ch
int 21h    ;Quits


msg db 'Enter a character $'
mg db 'You entered: $' 
    


Its output is a bunch of nontypable characters, followd by "Enter a character:". Then, after I enter a charcter, it prints out more gibberish.
Post 22 Aug 2003, 08:17
View user's profile Send private message Reply with quote
keyoke



Joined: 18 Jun 2003
Posts: 56
Location: London
keyoke 22 Aug 2003, 08:59
this mite work not the best way but it works.
Code:
org 100h
use16

mov dx,msg
mov ah,9
int 21h ;Prints message

mov ah,8
int 21h    ;Inputs character

push ax

mov dx, mg
mov ah,9
int 21h   ;Prints 2nd message

pop ax
mov dl,al
mov ah,2
int 21h  ;Prints character entered

mov ah,4Ch
int 21h    ;Quits


msg db 'Enter a character ',24h
mg  db 'You entered:',24h     

    
Post 22 Aug 2003, 08:59
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8358
Location: Kraków, Poland
Tomasz Grysztar 23 Aug 2003, 23:01
Or you can add the following lines at the beginning of your source:
Code:
format MZ
push cs
pop ds    

It depends whether you want to make EXE-style or COM-style program.
Post 23 Aug 2003, 23:01
View user's profile Send private message Visit poster's website Reply with quote
Yawgmoth



Joined: 20 Aug 2003
Posts: 37
Yawgmoth 23 Aug 2003, 23:22
Thanks for your help guys.
Post 23 Aug 2003, 23:22
View user's profile Send private message 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.