Solved

assemble error

Posted on 2004-09-16
22
1,667 Views
Last Modified: 2009-12-16
Assembled this code and got errors shown,

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

.code

main   proc
   mov   ax, seg message  ;ERROR - SYMBOL TYPE CONFLICT
   mov   ds,ax

   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
main   endp
end main  ;ERROR - with /coff switch,  leading underscore required for start address :main
[/CODE]

-y
0
Comment
Question by:yunikon
  • 10
  • 4
  • 2
  • +4
22 Comments
 
LVL 3

Assisted Solution

by:CmdrRickHunter
CmdrRickHunter earned 40 total points
ID: 12079276
just a guess... try making main into _main like it seems to be asking?
0
 

Author Comment

by:yunikon
ID: 12083397
Thanks, that creates other errors.

-y
0
 
LVL 2

Expert Comment

by:RHenningsgard
ID: 12084778
Other errors?  OK, and what would the oterh errors be?

Odds are that the assembler is aborting on not finding a properly-named entry point _MAIN, which is why it's not reporting your other errors until you correct the entry point name error.

Rob---
0
 
LVL 2

Expert Comment

by:RHenningsgard
ID: 12084790
"oterh"?  Man, my fingers are sleepy this morning!
0
 

Author Comment

by:yunikon
ID: 12089939
I get block nesting errors.  Using QEDITOR, MASM32.

-y
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 12110427
>>  block nesting errors
Change
        main
 to
        _main
in all three places.

-- Dan
0
 

Author Comment

by:yunikon
ID: 12125027
Getting error  'symbol type conflict'  at line,

mov   ax, seg message  

after lines,
 
.code
main   proc
   
0
 
LVL 49

Accepted Solution

by:
DanRollins earned 60 total points
ID: 12126874
Try replacing all occurrences of
      main
with
      _main

It's worth a try.  If that doesn't work, try changing that line to...

     mov   ax, cs
0
 

Author Comment

by:yunikon
ID: 12128950
Program assembles when substitute mov  ax, cs.   Try to Assemble & Link or Build All.  Get  error,

'test2.obj: fatal error LNK1190: invalid fixup found, type 0x0001
-
Link error'

Also cursor always stops at line,    mov  ax, (cursor)cs
0
 

Author Comment

by:yunikon
ID: 12146447
The theory behind the problem is that message is an identifier inside segment, .data.  message defines the byte string  "Hello world, I'm learning Assembly !!!", inside .data segment.  I'm trying to load the number of the segment, .data, into register ax.   seg message is supposed to represent this numbert.

   mov ax, seg message

Assembler is seeing    seg message   as invalid.

Is there another way to represent   data segment's  number for  this mov instruction?

y
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 49

Expert Comment

by:DanRollins
ID: 12163974
One old trick is
     PUSH CS
     POP AX


0
 

Expert Comment

by:The_SharK_356
ID: 12168516
REMOVE [code]      line 1
REMOVE .stack      line 3
REMOVE [/CODE]  line 21

change "$"      line 5
to     "0"

change mov ax,seg message
to     mov ax,offset message

above "main proc"
type "start"

instead of "end main"
type "end start"
0
 

Author Comment

by:yunikon
ID: 12170574


SharK 356,

[CODE] and [/CODE] are not part of program.   They indicate that a program is within them.   Corrected program,

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

.code
start
_main   proc
   mov  ax, offset message        
   mov   ds,ax
   mov   ah,09
   lea   dx,message
   int   21h
   mov   ax,4c00h
   int   21h
_main   endp
end start


errors,

 Assembling: C:\masm32\test2.asm
C:\masm32\test2.asm(9) : error A2008: syntax error : start
C:\masm32\test2.asm(22) : error A2006: undefined symbol : start
C:\masm32\test2.asm(22) : error A2148: invalid symbol type in expression : start
 Volume in drive C has no label.
 Volume Serial Number is 000D-9CE8

 Directory of C:\masm32

09/28/2004  10:23a                 310 test2.asm
               1 File(s)            310 bytes
               0 Dir(s)  23,054,757,888 bytes free
----------------------------------------------------
Dan,

.model small

.data
message   db "Hello world, I'm learning Assembly !!!","0"

.code

_main   proc
             
   push cs
   pop ax
   mov ds,ax

   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
_main   endp
end _main

get error,

test2.obj : fatal error LNK1190:  invalid fixup found, type 0x0001

program came from this site,

http://www.xs4all.nl/~smit/asm01001.htm

Under  'Index of Section1', click  'Code Example'  on left
0
 
LVL 49

Expert Comment

by:DanRollins
ID: 12174995
I think that in small model, DS will be already set the same as CS.

Se if just removing the two lines:

   mov   ax, seg message  ;ERROR - SYMBOL TYPE CONFLICT
   mov   ds,ax

will work.

All things considered, you should also try just put the message in the code segment:

.model small

.code
message   db "Hello world, I'm learning Assembly !!!","0"
_main   proc
   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
_main   endp
end _main

-- Dan

(note: I normally test code before providing it, but I have not used MASM directly for many years... It is *so much* more efficient (time-wise) to program in C and just use _asm{} blocks when doing low-level coding.

Also, 16-bit coding like this (small model) is way obsolete.  I haven't had to worry about setting segment registers since about 1995.
0
 
LVL 3

Expert Comment

by:Dawaffleman
ID: 12207774
.model small
                 
.data
message   db "Hello world, I'm learning Assembly !!!","0"

.code
start
_main   proc
   mov  ax, offset message        
   mov   ds,ax
   mov   ah,09
   lea   dx,message
   int   21h
   mov   ax,4c00h
   int   21h
_main   endp
end start

this will work but you need to place a : in front of start so it is read as a label like so..

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

.code
start:
_main   proc
   mov  ax, offset message        
   mov   ds,ax
   mov   ah,09
   lea   dx,message
   int   21h
   mov   ax,4c00h
   int   21h
_main   endp
end start

it seems that is what the assembler is bragging about

and another question (i havent used masm so i dont know if it is required) should the main part be a procedure? maybe you should try getting rid of the _main lines, unless they are neccisary when working with masm.
0
 

Author Comment

by:yunikon
ID: 12211479
Dan:-

Removing  '
  mov   ax, seg message  ;ERROR - SYMBOL TYPE CONFLICT
   mov   ds,ax
'
was usuccessful.

Tried the following correction.  Code assemble's.  When link get error,  

test2.obj : fatal error LNK1109:  invlalid fixup found, type 0x0001

CODE,

.model small

.code
 
    message   db "Hello world, I'm learning Assembly !!!","0"
 
 _main   proc
   
   mov ds,ax
   mov dx,OFFSET message          
   mov   ah,09
   lea   dx,message
   int   21h

   mov   ax,4c00h
   int   21h
_main   endp
end _main



             -------------------------------------------------

Dawaffleman:-

Application assembles only the code below.  When link get error

test2.obj : fatal error LNK1109:  invlalid fixup found, type 0x0001


CODE,

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

.code
_start:
   
   mov  ax, offset message        
   mov   ds,ax
   mov   ah,09
   lea   dx,message
   int   21h
   mov   ax,4c00h
   int   21h
   
end _start

What assembly application do you use?
0
 
LVL 12

Expert Comment

by:stefan73
ID: 12237445
Hi DanRollins,
> I think that in small model, DS will be already set the same as CS.
That's in tiny (.com) only.

But still, he won't have to modify the CS and DS. They should be OK.

Yunikon: Try tiny model, and leave out the .code and .data lines. Move your data behind the code. Don't modify CS, DS, ES.

Cheers!

Stefan
0
 
LVL 3

Expert Comment

by:Dawaffleman
ID: 12243593
or you could just change it to model medium and keep the ds cs and es
0
 

Author Comment

by:yunikon
ID: 12248038
Used tiny model and assemble.  Get error ,  ' model must precede .stack and .data directives' and also error     'must be in segment block'     for lines from       message db "Hello world, ......   to      int 21h.

Removed .data and .code.   When assemble get error     'must be in segment block'    as above.

When use model medium code assembles but get error,

test2.obj : fatal error LNK1109:  invlalid fixup found, type 0x0001.

However .data and .code must be present else get  error       'must be in segment block'     as above.
0
 

Author Comment

by:yunikon
ID: 12274726
I suspect that I need a 16 bit linker for the 32 bit masm.  Trying to find a site with the linker.

-y
0
 

Author Comment

by:yunikon
ID: 12460048
The error is that I was using a 32 bit linker for the 16 bit DOS files.
 
Microsoft ® Incremental Linker Version 5.12.8078
Copyright © Microsoft Corp 1992-1998. All rights reserved.

My files are now working ok.
Appreciate all the help.

-y
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Are you unable to connect or configure Hotmail email account in Microsoft Outlook 2010, 2007? Or Outlook.com emails are not downloading to Outlook? Lets’ see the problem and resolve Outlook Connector error syncing folder hierarchy (0x8004102A).
Find out what the Office 365 disclaimer function is, why you would use it and its limited ability to create Office 365 signatures.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now