The MASM Forum Archive 2004 to 2012

Miscellaneous Forums => 16 bit DOS Programming => Topic started by: Ajax on May 09, 2007, 09:05:23 PM

Title: noobie help
Post by: Ajax on May 09, 2007, 09:05:23 PM
Im new so I really need help with Masm and all its ways so I got a code for assembly.  Can anyone tell me whats wrong with it?  It keeps giving me error.  Its from a tutorial to add.

.model small
.stack
.data
message   db "Hello world, I'm learning Assembly !!!", "$"

.code

main   proc
   mov   ax,seg message
   mov   ds,ax

   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
main   endp
end main
Title: Re: noobie help
Post by: eek on May 10, 2007, 01:09:34 AM
Could be your boilerplate stuff, you have no org 100h


; hello.asm: Display the message Hello World
; Author:   Joe Carthy
; Date:     Feb 2003



.model small

.stack 100h

.data

message db "Hello World", 13, 10, "$"

.code

start:           

mov   ax, @data

mov   ds, ax

mov   dx, offset message      ; copy address of message to dx

mov   ah, 9h                  ; subprogram for string output

int   21h                     ; call ms-dos to display string

mov   ax, 4c00h

int   21h

end   start



http://www.cs.ucd.ie/staff/jcarthy/home/alp/ALP%20project%202002.htm
Title: Re: noobie help
Post by: MichaelW on May 10, 2007, 08:16:42 AM
Ajax,

Your code, as posted, assembles, links, and runs OK. I have no idea what you may be doing wrong, but  this post (http://www.masm32.com/board/index.php?topic=7245.msg53711#msg53711) may provide a solution.

Title: Re: noobie help
Post by: Ajax on May 10, 2007, 07:58:07 PM
Okay I changed it a little bit but I get the error saying that message in line 9 is an unidentified symbol.

.model small
.stack 200h
.data
message   db "Hello world, I'm learning Assembly !!!", "$"

.code

_main   proc
   mov   ax,seg message
   mov   ds,ax

   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
_main   endp
end _main
Title: Re: noobie help
Post by: MichaelW on May 11, 2007, 02:41:22 AM
Using MASM and the 16-bit linker, the code copied directly from your last post assembles, links, and runs OK.

D:\MASMDOS>ML /c ajax.asm
Microsoft (R) Macro Assembler Version 6.14.8444
Copyright (C) Microsoft Corp 1981-1997.  All rights reserved.

Assembling: ajax.asm

D:\MASMDOS>pause
Press any key to continue . . .

D:\MASMDOS>LINK16 ajax.obj;

Microsoft (R) Segmented Executable Linker  Version 5.60.339 Dec  5 1994
Copyright (C) Microsoft Corp 1984-1993.  All rights reserved.


D:\MASMDOS>pause
Press any key to continue . . .

D:\MASMDOS>debug ajax.exe
-g
Hello world, I'm learning Assembly !!!
Program terminated normally
-

Title: Re: noobie help
Post by: Ajax on May 11, 2007, 09:08:49 PM
I dont know but could it be the IDE im using?  Im using MASM32 IDE and something from Microsoft, LINK its a Segmented Executable Linker.  Can some one tell me if thats right.
Title: Re: noobie help
Post by: MichaelW on May 11, 2007, 11:04:30 PM
Ok, that explains the error you are getting on line 9, apparently being caused by the SEG operator. For information see this and following posts:

http://www.masm32.com/board/index.php?topic=7245.msg53711#msg53711




Title: Re: noobie help
Post by: Ajax on May 12, 2007, 04:19:29 PM
Sry to say but that stuff confuses me so just in general what should I do?