Trouble assembling \ linking... I didn't find anything on search ..

Started by Magicle, January 31, 2010, 01:58:55 PM

Previous topic - Next topic

Magicle

When im trying to assemble or link it gives me the following error:

assembling
QuoteAssembling: C:\Documents and Settings\Schnitzel\Desktop\asd.asm
C:\Documents and Settings\Schnitzel\Desktop\asd.asm(8) : error A2004: symbol type conflict
C:\Documents and Settings\Schnitzel\Desktop\asd.asm(18) : warning A4023: with /coff switch, leading underscore required for start address : main
Volume in drive C has no label.
Volume Serial Number is B44D-7E31

Directory of C:\Documents and Settings\Schnitzel\Desktop

01/31/2010  01:26 PM               228 asd.asm
               1 File(s)            228 bytes
               0 Dir(s)   1,756,749,824 bytes free

linking:

Volume in drive C has no label.
Volume Serial Number is B44D-7E31

Directory of C:\Documents and Settings\Schnitzel\Desktop

01/31/2010  01:26 PM               228 asd.asm
               1 File(s)            228 bytes
               0 Dir(s)   1,756,749,824 bytes free


Anyone has some insight on this?
Btw, I have put the 'link16.exe' file into the bin.

The code I am trying to compile is the following

.model small
.stack
.data
message db "blablabla $"
.code

main proc
    mov ax,seg message
    mov ds, ax

    mov ah, 09
    lea dx,message
    int 21h

    mov ax,4c00h
    int 12h
main endp
end main


Magicle

This is annoying, let me try and explain what i've done.

I've downloaded MASM32 -> installed -> renamed link.exe to link32.exe -> downloaded the 16bit link and named it link.exe.
I have no idea what these error lines mean honestly. Perhaps I should just use turbo assembly?

TNick

You didn't tell us what command line you have used. Since I have little time, here is a small example program posted a while ago in another forum. I had a quick translation, but you should understand what's going on inthere.

Make.bat assumes the package is in c:\masm32\ and uses standard name (link16)

Use this to see where your problem is. If posted example does not work, please post entire output from the console.
Nick

PS
Quote from: Magicle on January 31, 2010, 03:56:18 PM
Perhaps I should just use turbo assembly?
Perhaps you should...  :toothy

Magicle

Lol, that seems to work. Putting my code as 'sort.txt' worked just fine.
It generates the correct .exe - i even used debug 'sort.exe' from cmd, and everything was fine.

Can you actually tell me how come the assembler won't do it? /cry

edit: thanks alot btw :)
and sorry im a bit new to this as you can see.
I dont have too much issues with the code, but the assembler is killing me - lol

Edit2:
Btw, about that command line...................rofl.
I just used the "assemble + link" or each one separately from project -> assemble and link on MASM32
Should I have used the ml function from the cmd window? <:

TNick


Quote from: Magicle on January 31, 2010, 06:01:16 PM
Btw, about that command line...................rofl.
I just used the "assemble + link" or each one separately from project -> assemble and link on MASM32
Should I have used the ml function from the cmd window? <:

It does, ultimately, use the command line. However, I don't use qeditor and, as I said, I don't have much time right now to look into it. My suggestion is to use a similar bat file to get you running.

To have a look at various switches aviable, use:
c:\masm32\bin\ml.exe /?
c:\masm32\bin\link16.exe /?
at the command line.

Quote from: Magicle on January 31, 2010, 06:01:16 PM
Can you actually tell me how come the assembler won't do it? /cry
qEditor will - probably - use switches appropriate for 32-bit PE exe (like /coff), but is "hiding" that from you after a menu item.

Nick

Magicle

Alright, I'll be just using the c:\masm32\bin\ml.exe filename.asm
and ...\link.exe filename.asm

I don't wanna sound retarded but...
How do I make it work? Rofl. Double click on the executable file wont do it (again, sorry for being stupid!)

dedndave

it is a 16-bit program
you need to use the 16-bit linker (and a 16-bit batch file, which isn't included with masm32, as far as i know)
coff files are strictly 32-bit - won't do for 16-bit code   :P

there are a couple different 16-bit linkers floating around, so i have included a batch file for each
if your linker is named link16.exe, use a16a.bat
if your linker is named lnk563.exe, use a16b.bat
when you have the right one, delete the other and change the name to a16.bat   :U
oh - i place mine in the masm32\bin folder so it is in the execution path

TNick

:) Don't worry about it.
A funny solution would be to

QuoteECHO OFF
C:\masm32\bin\ml.exe /c Sort.asm
IF NOT %ERRORLEVEL% == 0 GOTO STOPNOW
C:\masm32\bin\link16.exe Sort.obj
IF NOT %ERRORLEVEL% == 0 GOTO STOPNOW
Sort.exe
:STOPNOW
pause
ECHO ON
Assuming you work under Windows and you use 16-bit emulated mode. Or are you posting these messages from a dos prompt?  :bdg

Replace the Sort string with the name of your exe. It will be build and, if successfull, will run it.
To simply run the exe, just use
Sort.exe
pause


Nick

Magicle

Thank you very much dave !! :bg
Could u explain what's coff please?

@Nick
I just called my .asm file, sort - so it will directly work.
However, it does not run it when it's finished creating it (or am I missing something?)
again , really sorry if im not getting it - this is new to me  :'(

Edit:
Dave, I tried but still I get the 'ole same errors when trying to assemble and link from the MASM menu.

TNick

You should really refine your search skills.
COFF

Please post the output from the command prompt.

Nick

Magicle

I didn't even bother to search what coff was lol, thanks.

edit:
here...


dedndave

well - "coff" is a windows file format - Common Object File Format
they are the format (or one of the formats) required to link into 32-bit PE (Portable Executable) executable files
PE files are actually modifications of the COFF format

http://msdn.microsoft.com/en-us/library/ms809762.aspx

now - your problem
i haven't looked at the sort code
but - here is what i would do
write a simple 16-bit "Hello World" program and test the batch process to verify that is all up and running
it that works, you know you have a bug in the sort program   :bg

        .MODEL SMALL
        .STACK 512

;------------------------------------------------------------

        .DATA

MsgText db 'Hello World',13,10
        db 'Press any key to continue ...',13,10,36

;------------------------------------------------------------

        .CODE

_main   PROC    FAR

;set the DS register to DGROUP

        mov     ax,@DATA
        mov     ds,ax

;display the message

        mov     dx,offset MsgText
        mov     ah,9
        int     21h

;wait for a key

        mov     ah,0
        int     16h

;terminate

        mov     ax,4C00h
        int     21h

_main   ENDP

;------------------------------------------------------------

        END     _main

Magicle

Well, it gives me the same error for your program dave.
Safe to assume something in the code is not functioning as it should?

(btw Dave, if you look up - you'll see ive posted a similar source code , even simpler.)

edit:
I've tried doing it on my own through CMD , it gives me the same result.
either im doing something wrong, or i dont know what it is  :(

dedndave

using the a16 batch file, try this
get a console window into the same folder as the sort.asm file, then....

C:\whatever => a16 sort

try the same thing with the hello program....

C:\whatever => a16 hello

TNick