News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

noobie help

Started by Ajax, May 09, 2007, 09:05:23 PM

Previous topic - Next topic

Ajax

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

eek

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

MichaelW

Ajax,

Your code, as posted, assembles, links, and runs OK. I have no idea what you may be doing wrong, but this post may provide a solution.

eschew obfuscation

Ajax

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

MichaelW

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
-

eschew obfuscation

Ajax

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.

MichaelW

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




eschew obfuscation

Ajax

Sry to say but that stuff confuses me so just in general what should I do?