Thread: Assembly- 1st code

  1. #1
    Android geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470

    Assembly- 1st code

    Sorry, if this is not the right board.


    .MODEL SMALL
    .STACK
    .CODE

    mov ah, 1h
    mov cx, 07h
    int 10h
    mov ah, 4ch
    int 21h

    END


    I assembled above assembly code(copied it from a tutorial) on my windows xp, intel computer, and got an .obj file.
    Then tried to link it but got the following warning and error messages on masm32:

    first.obj : warning LNK4078: multiple ".data" sections found with different attributes (C0220040)
    LINK : error LNK2001: unresolved external symbol _WinMainCRTStartup
    first.exe : fatal error LNK1120: 1 unresolved externals

    Why is this please?
    Thanks.

  2. #2
    Registered User
    Join Date
    May 2004
    Posts
    2
    In your case the problem is that the linker you are using is too new. You are following a tutorial which is probably pretty old, it teaches how to write DOS applications (there is a difference between a pure DOS application and a console application). You can download an old version of link.exe here

    You also have to change your program a little bit:
    Code:
    .MODEL SMALL 
    .STACK 
    .CODE 
    
    Start:
    mov ah, 1h 
    mov cx, 07h 
    int 10h 
    mov ah, 4ch 
    int 21h 
    
    END Start
    Compile with:
    Code:
    ml /c yourfile.asm
    link yourfile.obj
    Some useful links:
    http://www.movsd.com - The masm32 package
    http://radasm.visualassembler.com - A great IDE
    http://home.t-online.de/home/Ollydbg/ - A debugger
    http://board.win32asmcommunity.net - THE assembly board
    http://win32asm.cjb.net - Some new tutorials

  3. #3
    Android geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470
    Understood.
    Thank you for the links.

  4. #4
    5|-|1+|-|34|) ober's Avatar
    Join Date
    Aug 2001
    Posts
    4,429
    There is an active ASM board over at www.flashdaddee.com/forums

  5. #5
    Android geek@02's Avatar
    Join Date
    Mar 2004
    Location
    Kurunegala Colony, Sri Lanka, Sri Lanka
    Posts
    470
    Thanks again.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Obfuscated Code Contest
    By Stack Overflow in forum Contests Board
    Replies: 51
    Last Post: 01-21-2005, 04:17 PM
  2. << !! Posting Code? Read this First !! >>
    By kermi3 in forum Linux Programming
    Replies: 0
    Last Post: 10-14-2002, 01:30 PM
  3. The relationship between C++ and assembly and machine code
    By TotalBeginner in forum C++ Programming
    Replies: 5
    Last Post: 04-22-2002, 02:46 PM
  4. << !! Posting Code? Read this First !! >>
    By biosx in forum C++ Programming
    Replies: 1
    Last Post: 03-20-2002, 12:51 PM