CodeGuru Forums -
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic Newsletters VB Forums Developer.com


Newest CodeGuru.com Articles:

  • Installing SQL Server 2008
  • Writing UDFs for Firebird Embedded SQL Server
  • [Updated] Shutdown Manager
  • Building Windows Azure Cloud Service Applications with Azure Storage and the Azure SDK

  • Search CodeGuru:
     



    Go Back   CodeGuru Forums > Other Programming > Assembly
    FAQ Members List Calendar Search Today's Posts Mark Forums Read

    Assembly Questions and Answers for Assembly here!

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1    
    Old December 20th, 2004, 01:52 PM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    Linker problem

    Problem with the masm32 linker.

    I just wanted to test the masm32 assembler, my code couldn't be simpler:

    dosseg
    .model small
    .stack 200h
    .data
    .code

    start:
    mov ax, 4c00h
    int 21h
    end start



    This (called simple.asm) assembles fine, but f^*"s up on linking, I'll give you the compile log exactly as it appears in the command line:



    c:\Secondary\masm32\BIN>ml simple.asm
    Microsoft (R) Macro Assembler Version 6.14.8444
    Copyright (C) Microsoft Corp 1981-1997. All rights reserved.

    Assembling: simple.asm
    Microsoft (R) Incremental Linker Version 5.12.8078
    Copyright (C) Microsoft Corp 1992-1998. All rights reserved.

    /z2
    "simple.obj"
    "simple.exe"
    NUL
    LINK : warning LNK4044: unrecognised option "z2"; ignored
    simple.obj : warning LNK4033: converting object format from OMF to COFF
    simple.obj : warning LNK4078: multiple ".data" sections found with different attributes (C0220040)
    LINK : fatal error LNK1181: cannot open input file "simple.exe"

    c:\Secondary\masm23/BIN>






    What did I do wrong? I'd really appreciate any help!
    Reply With Quote
      #2    
    Old December 20th, 2004, 02:13 PM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: Linker problem

    How do you call your linker?
    I think this page might be interesting to you.

    Another point: Are you trying to compile 16bit code with a 32 bit assembler? If so you rather should use Netwide Assembler or Flat Assembler. They are more reliable than the Microsoft Assembler.

    / This is my 666 post . Hope Simon don't sees this.
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
      #3    
    Old December 20th, 2004, 03:06 PM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    Re: Linker problem

    i'm afraid that didn't help, thanks anyway!

    the nasm doesn't work either! It doesn't even assemble!
    Reply With Quote
      #4    
    Old December 20th, 2004, 03:09 PM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: Linker problem

    Quote:
    Originally Posted by Fatboy
    i'm afraid that didn't help, thanks anyway!

    the nasm doesn't work either! It doesn't even assemble!
    nasm simple.asm -o simple.exe

    Worked for me! . It creates a flat exe (.com, .bin) if you want other object files to be created use the -f command line option.
    Yes it does assemble but everything runs in the background

    for example:
    nasm simple.asm -o simple.obj -f win32

    Now you can give this another linker as input to create a 32 bit windows application. But to get this work you need additional modifcations in your source code:

    Code:
    [Bits 32]
    This directive shows the assembler to create 32 bit application. It this case you should use eax instead of ax. A 32bit application does not support any dos or bios interrupts. So I think a 16bit dos application is the right for you.
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!

    Last edited by NoHero; December 20th, 2004 at 03:14 PM.
    Reply With Quote
      #5    
    Old December 20th, 2004, 03:48 PM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    Re: Linker problem

    Which nasm assembler did you use?
    Can you tell me the ftp URL?
    Thanks
    Reply With Quote
      #6    
    Old December 21st, 2004, 08:25 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: Linker problem

    http://nasm.sourceforge.net

    I use the Win32 compilat.
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
      #7    
    Old December 21st, 2004, 02:31 PM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    Re: Linker problem

    Is there absolutely no way of assembling it with masm32? By twiddling with some linker options?


    Is there a place I can download the tasm assembler from?
    Reply With Quote
      #8    
    Old December 21st, 2004, 02:36 PM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: Linker problem

    Quote:
    Originally Posted by Fatboy
    Is there absolutely no way of assembling it with masm32? By twiddling with some linker options?
    For shure you could use MASM32. But I have never worked with it. And you might search the MSDN for some command line options. Sorry for forcing you to use nasm, but I really appreciate this compiler with its high level of compatibility and simpliness.

    Quote:
    Originally Posted by Fatboy
    Is there a place I can download the tasm assembler from?
    Take a look at the following FAQ


    / Like Andreas ...
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!
    Reply With Quote
      #9    
    Old December 21st, 2004, 04:07 PM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    Re: Linker problem

    Nope, still can't find tasm

    See, I tried nasm, it just doesn't even assemble! At least masm32 assembles it into an obj file! Nasm always gives something like:

    parser: instruction expected

    I don't know what that means.
    Reply With Quote
      #10    
    Old December 22nd, 2004, 08:52 AM
    NoHero's Avatar
    NoHero NoHero is offline
    Moderator
     
    Join Date: Mar 2004
    Location: (Upper-) Austria
    Posts: 2,899
    NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)NoHero has much to be proud of (1500+)
    Re: Linker problem

    Of course you cannot use the following instructions in nasm:

    Code:
    dosseg
    .model small
    .stack 200h
    .data
    .code
    This is not legal in nasm, because these directives are compiler dependend. Try to search through the NASM help for similar directives.
    TASM
    __________________
    I am not offering technical guidiance via email or IM
    Come on share your photo with us! CG members photo album!
    Use the Code Tags!

    Last edited by NoHero; December 22nd, 2004 at 09:00 AM.
    Reply With Quote
      #11    
    Old December 23rd, 2004, 08:56 PM
    rxbagain's Avatar
    rxbagain rxbagain is offline
    Senior Member
     
    Join Date: Apr 2003
    Location: Ontario, Canada
    Posts: 1,755
    rxbagain  is a jewel in the rough (300+)rxbagain  is a jewel in the rough (300+)rxbagain  is a jewel in the rough (300+)rxbagain  is a jewel in the rough (300+)
    Smile Re: Linker problem

    Use MASM with DOS support. Go to THIS SITE and download MASM 6.11.

    I Compiled ur code like this (simple.asm is in C:\MASM611 folder)
    Code:
    C:\MASM611>bin\ml /c simple.asm
    Microsoft (R) Macro Assembler Version 6.11
    Copyright (C) Microsoft Corp 1981-1993.  All rights reserved.
    
     Assembling: simple.asm
    
    C:\MASM611>binr\link simple.obj,,,,,
    
    Microsoft (R) Segmented Executable Linker  Version 5.31.009 Jul 13 1992
    Copyright (C) Microsoft Corp 1984-1992.  All rights reserved.
    Hope it will help you
    __________________
    Rex Bagain

    Last edited by rxbagain; December 23rd, 2004 at 09:03 PM.
    Reply With Quote
      #12    
    Old December 24th, 2004, 04:43 PM
    Fatboy Fatboy is offline
    Member
     
    Join Date: Aug 2004
    Posts: 138
    Fatboy is on a distinguished road (10+)
    Re: Linker problem

    What's the five commas after simple.obj for? And why \binr? Why the "r"? I don't have a folder called binr. So all in all, it still doesn't assemble.

    You guys, I really appreciate your help by the way, thank a lot!
    Reply With Quote
      #13    
    Old December 24th, 2004, 10:42 PM
    rxbagain's Avatar
    rxbagain rxbagain is offline
    Senior Member
     
    Join Date: Apr 2003
    Location: Ontario, Canada
    Posts: 1,755
    rxbagain  is a jewel in the rough (300+)rxbagain  is a jewel in the rough (300+)rxbagain  is a jewel in the rough (300+)rxbagain  is a jewel in the rough (300+)
    Re: Linker problem

    You have to install it with the DOS/Windows & NT to get the binaries for DOS (BINR folder).

    The commas I used mean that I did not specify values for exefile, mapfile, libs, deffile and it will use default values if necessary.

    Hope it will help you.
    __________________
    Rex Bagain
    Reply With Quote
    Reply

    Bookmarks
    Go Back   CodeGuru Forums > Other Programming > Assembly


    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 03:37 AM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy


    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
    Copyright WebMediaBrands Inc. 2002-2009