The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: Unkownname on May 31, 2007, 12:56:17 AM

Title: Trouble Assembling this code
Post by: Unkownname on May 31, 2007, 12:56:17 AM
Hello this is my first post wanted to say hello and stuff well anyway

This is my first day of actually going for learning asm and I would really like some help :) I found this basic asm tutorial but cannot compile it at first I had two errors but I did some debugging and now only have one but anyways the line that has problems is this.

   mov   ax,seg message

But I cant get it working for the life of me can someone help me here is the full source its really small.

.model small
.stack

.data
message   DB "Hello World!$"

.code

main:
   mov   ax,seg message
   mov   ds,ax

   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h

end



All its suppose to do is say that message I know its simple but I always like starting with this and yes I know theirs the masm way but I want to learn basics really without using to much api's I would really enjoy the feedback on this Thankyou for your time :)
Title: Re: Trouble Assembling this code
Post by: MichaelW on May 31, 2007, 01:14:42 AM
The code is for a DOS program, and it should assemble OK, so I assume you are trying to assemble it from Quick Editor, which will not work because Quick Editor is set up to create 32-bit executables. This problem has been covered many times, take a look in the 16-bit DOS Programming forum. I will be moving this topic to that forum shortly.


Title: Re: Trouble Assembling this code
Post by: Unkownname on May 31, 2007, 01:45:30 AM
Alright I got the linker from the pinned topic but how do use it?
Title: Re: Trouble Assembling this code
Post by: eek on May 31, 2007, 02:08:25 AM
Its all the same stuff from the look of it, but with different commands.
DS:DX is the pointer to message, it looks like a 32 bit pointer.

give this a go, a 16bit pointer, since it will all happen in the same segment anyway.
-------------------------------------
.model small
.stack

.data
message   DB "Hello World!$"

.code

main:
   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h

end



Title: Re: Trouble Assembling this code
Post by: Unkownname on May 31, 2007, 02:11:03 AM
yay I got it going i read other posts lol and got it going :) thanks