ASM beginner gets 24 compiler errors on hello world...

This is a discussion on ASM beginner gets 24 compiler errors on hello world... within the Tech Board forums, part of the Community Boards category; Hey guys. I've wanted to learn ASM for a while and every time I try, I always get flooded with ...

  1. #1
    Registered User
    Join Date
    May 2006
    Posts
    903

    ASM beginner gets 24 compiler errors on hello world...

    Hey guys. I've wanted to learn ASM for a while and every time I try, I always get flooded with tons and tons of errors, no matter whose code I use. I have downloaded TASM 3.1 and I am currently following the tutorial located here:

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

    I have basically recopied the whole source code SciTE, a code editor, and tried compiling with both "tasm test.asm" and "tasm -b test.asm" but it returns many many many errors that I have no clue how to fix. Could someone indicate me how in hell it cannot understand a single symbol inside the code ?

    Here's the code:
    Code:
    .model small
    .stack
    .data
    message db "Hello world", "$"
    
    .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
    And here's the junk it outputs:
    TASM Assembler. Version 3.1 February, 1998.
    Copyright (C) 1998 Squak Valley Software
    tasm: pass 1 complete.
    projects/test.asm line 0001: unrecognized directive. (.MODEL)
    projects/test.asm line 0002: unrecognized directive. (.STACK)
    projects/test.asm line 0003: unrecognized directive. (.DATA)
    projects/test.asm line 0004: Label not found: (message)
    projects/test.asm line 0004: label value misalligned. (message)
    projects/test.asm line 0004: unrecognized instruction. (message)
    projects/test.asm line 0006: unrecognized directive. (.CODE)
    projects/test.asm line 0008: Label not found: (main)
    projects/test.asm line 0008: label value misalligned. (main)
    projects/test.asm line 0008: unrecognized instruction. (main)
    projects/test.asm line 0009: unrecognized instruction. (MOV)
    projects/test.asm line 0010: unrecognized instruction. (MOV)
    projects/test.asm line 0012: unrecognized instruction. (MOV)
    projects/test.asm line 0013: unrecognized instruction. (LEA)
    projects/test.asm line 0014: unrecognized instruction. (INT)
    projects/test.asm line 0016: unrecognized instruction. (MOV)
    projects/test.asm line 0017: unrecognized instruction. (INT)
    projects/test.asm line 0018: Label not found: (main)
    projects/test.asm line 0018: label value misalligned. (main)
    projects/test.asm line 0018: unrecognized instruction. (main)
    projects/test.asm line 0019: Label not found: (end)
    projects/test.asm line 0019: label value misalligned. (end)
    projects/test.asm line 0019: unrecognized instruction. (end)
    tasm: line 0019 No END directive before EOF.
    tasm: pass 2 complete.
    tasm: Number of errors = 24
    Can anyone please help me ? I'd be very grateful !
    Thanks.

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    I'd consider moving up to a more modern assembler and more modern assembly programming. At the very least, let DOS die.

    The TASM version I have is version 5.3, and I have it packaged with Borland's command line tools.

    The following assembles and runs perfectly, and of note, it uses C functions (which allows you to spend more time studying the actual language):

    Code:
    .586
    .model flat
    
    extern _printf:near
    public _main
    
    .data
    	msg_hello	db	"Hello, world!",10,0
    .code
    
    _main proc
    	push offset msg_hello
    	call _printf
    	add esp, 4
    	xor eax, eax
    	ret
    _main endp
    end

  3. #3
    Registered Abuser
    Join Date
    Jun 2006
    Location
    Toronto
    Posts
    591
    could have to do with the spacing. It looks like he's inserting tabs between label and instruciton and arguments. As petty as it sounds, I've used a couple assembly languages that require proper spacing such as this to assemble.

  4. #4
    Registered User
    Join Date
    May 2006
    Posts
    903
    Replaced the tabs with spaces but I get the same output. As for the newer compiler, does anyone have a clue where I can find one ? I've googled a bit but I don't get much results =/

  5. #5
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    http://winasm.chat.ru/

    When used in combination with Borland's C/C++ compiler, it can be pretty nifty to write C programs that call routines written in assembly.

    Edit: Looks like they link to a missing page.... Oh well.

    Edit2: Supposedly you can get it right from Borland's website for free, but their site sucks for finding this stuff out.... The "Order now" button on one page of their site is great. Takes you to a page where you can select your country/region and then leave your contact info for some sales rep to get in touch with you. Looks quite archaic.
    Last edited by MacGyver; 06-12-2007 at 12:37 AM.

  6. #6
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    Has nobody here ever heard of nasm?

    Yeah, the version number is pre 1.0, but that's because the nasm folks are a bunch of chickens. It's been around, and stable, for years and years. It's free and cross platform and it supports the object format of your choice. Who would prefer some commercial anachronism to that?

  7. #7
    Registered /usr
    Join Date
    Aug 2001
    Location
    Newport, South Wales, UK
    Posts
    1,266
    It's a case of personal preference. NASM can be hyper-anal about certain things which may grind against you, especially if you were raised on MASM, which is the devil's own as far as weird directives go.

  8. #8
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    Quote Originally Posted by SMurf View Post
    It's a case of personal preference. NASM can be hyper-anal about certain things which may grind against you, especially if you were raised on MASM, which is the devil's own as far as weird directives go.
    Maybe, but I doubt he was "raised on MASM" since he claims to be just starting to learn.

  9. #9
    Registered User
    Join Date
    May 2006
    Posts
    903
    I think I'll just give up on ASM for ever.. Ahah. I've never actually managed to compile a single damned program. I've tried every stupid compiler I could download and tried code from dozens of place around the net and *******NONE******** ever compiled.

  10. #10
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    Perhaps a stupid question, but did you try MASM?

  11. #11
    Registered User
    Join Date
    May 2006
    Posts
    903
    I don't know, I know I've tried TASM and NASM. I've probably tried MASM and every other compiler in the world. ASM doesn't like me =(

  12. #12
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211

  13. #13
    Registered User
    Join Date
    May 2006
    Posts
    903
    The problem is that I need to follow a tutorial to learn the language... And there are so many different damned versions of the language that I never seem to find a tutorial whose code compiles under the compiler I have =/ Do you know of any good links on ASM ? Googling has only turned crap for me as of me. =/

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem solving compiler errors
    By Jan79 in forum C++ Programming
    Replies: 1
    Last Post: 07-02-2003, 11:59 AM
  2. Compiler errors
    By JaWiB in forum Windows Programming
    Replies: 3
    Last Post: 03-02-2003, 01:28 AM
  3. A bunch of compiler errors
    By Dimeslime99 in forum Game Programming
    Replies: 4
    Last Post: 07-15-2002, 12:01 AM
  4. Classes Compiler Errors
    By taiDasher in forum C++ Programming
    Replies: 5
    Last Post: 07-03-2002, 09:11 AM
  5. Compiler errors
    By BellosX in forum C Programming
    Replies: 2
    Last Post: 09-21-2001, 04:24 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21