Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Newbie help with string

Status
Not open for further replies.

chrisphillipsuk

Technical User
Oct 10, 2000
2
GB
Hi all

I am trying to start to learn Assembly language, but after following a few tutorials on the net I am having big trouble with just printing a string! COIuld you please have a look at the basic code below and let me know why it doesn't work. I am using a86, and the programme compiles ok, but when I run it there is just a load of rubbish printed to the screen. Thanks in advance

Code:
string db "Hello World.$"

mov ax,SEG string
mov ds,ax
mov dx,OFFSET string
mov ah,09h
int 21h
mov ax,4c00h
int 21h
 
Hi, I don't remember why (but I will let you know). but you need to code it like this.

jmp start ; Add this line.

string db "Hello World.$"

start: ; Add this line.

mov ax,seg string
mov ds,ax
mov dx,OFFSET string
mov ah,09h
int 21h
mov ax,4c00h
int 21h Rod
 
This should work but I'm not sure since I use nasm. I don't know if it will work for a86 assembler but its still x86 code.

[org 100h] ; .com file

jmp start ; jump to label

start:

mov dx,string
mov ah,9
int 21h
mov ax,4ch
int 21h

end

string db "Hello World.",13,10,0
 
What's "a86"??

"Information has a tendency to be free. Which means someone will always tell you something you don't want to know."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top