Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

TASM5 helloworld help needed, linker error

MartinNJMartinNJ Member Posts: 3
Hey..!

I have found a sample helloworld program for TASM 5.0 however it doesn't seem to work correctly, then i found a post on this forum that explained how to fix it, so i followed the steps, but failed. The solution apparently helped the other guy, but it doesn't help here. ):
The program is this:
[code].MODEL small
.STACK 100h
.DATA
HelloMessage DB 'Hello, world',13,10,'$'
.CODE
.startup ;<<<<<----- This was supposed to help but it doesn't :S
mov ax,@data
mov ds,ax ;set DS to point to the data segment
mov ah,9 ;DOS print string function
mov dx,OFFSET HelloMessage ;point to "Hello, world"
int 21h ;display "Hello, world"
mov ah,4ch ;DOS terminate program function
int 21h ;terminate the program
END[/code]

It assembles just fine, but when i try to link it i get "fatal: no program entry point" an it aborts :S

Also, i can't make TASM integrate into my command prompt, i have to write the whole path, ex.: "c: asmin asm32 progname.asm" instead of just tasm32 or tasm progname... :S
Anyone know how to fix this? :O

Hope you can help :S

Comments

  • MT2002MT2002 Member Posts: 1,444

    : It assembles just fine, but when i try to link it i get "fatal: no
    : program entry point" an it aborts :S

    In your code, after the END directive must be the entry point routine. Also, in the label [b].startup[/b], the periods (.) are usually reserved for subroutines.

    [code].MODEL small
    .STACK 100h
    .DATA
    HelloMessage DB 'Hello, world',13,10,'$'
    .CODE
    start:
    mov ax,@data
    mov ds,ax ;set DS to point to the data segment
    mov ah,9 ;DOS print string function
    mov dx,OFFSET HelloMessage ;point to "Hello, world"
    int 21h ;display "Hello, world"
    mov ah,4ch ;DOS terminate program function
    int 21h ;terminate the program

    END start[/code]

    I havnt used TASM in awhile so I hope I got it right :)

    : Also, i can't make TASM integrate into my command prompt, i have to
    : write the whole path, ex.: "c: asmin asm32 progname.asm" instead
    : of just tasm32 or tasm progname... :S
    : Anyone know how to fix this? :O

    Just add it to the Windows PATH system variable.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.brokenthorn.com]Website :: OS Development Series[rightbr][/link][/size]
  • MartinNJMartinNJ Member Posts: 3
    :
    : I havnt used TASM in awhile so I hope I got it right :)
    :

    Well.. it assembles fine. but linker gives same error, about no entry point :S i have searched google, and all seems to be able to solve the problem by writing that start label... :S


    : : Also, i can't make TASM integrate into my command prompt, i have to
    : : write the whole path, ex.: "c: asmin asm32 progname.asm" instead
    : : of just tasm32 or tasm progname... :S
    : : Anyone know how to fix this? :O
    :
    : Just add it to the Windows PATH system variable.

    How do i do that? :)




  • MT2002MT2002 Member Posts: 1,444
    : Well.. it assembles fine. but linker gives same error, about no
    : entry point :S i have searched google, and all seems to be able to
    : solve the problem by writing that start label... :S

    Did the code I give you work?

    : : : Also, i can't make TASM integrate into my command prompt, i have to
    : : : write the whole path, ex.: "c: asmin asm32 progname.asm" instead
    : : : of just tasm32 or tasm progname... :S
    : : : Anyone know how to fix this? :O
    : :
    : : Just add it to the Windows PATH system variable.
    :
    : How do i do that? :)

    Windows XP:

    Go to your system properties, Advanced tab. On the bottom, you
    will see two buttons: Environmental variables and Error Reporting.

    Go to, of course, environmental variables. Its dialog should open.

    Under [b]System variables[/b], scroll down until you see [b]Path[/b].
    Highlight it, and hit [b]Edit[/b]. Its dialog will pop up.

    Here you can edit the variable name or its value. Do not edit its name.

    The value of the variable is a single string. Each should be a directory to a program for the system to search for when executing a command. This must be separated by a semicolen, WITHOUT spaces. ie, this is fine:

    [code]
    %SystemRoot%system32;%SystemRoot%;%SystemRoot%System32Wbem;c:microos ools
    asm;c:microos oolspcopy02;
    [/code]

    Notice there are no spaces. Just use a semicolen to separate them. The above is from my system, which includes my NASMs directory (Where its *.exe is located at)

    Hit Ok, Ok, then Apply. From here on out, if you type NASM in the command prompt, the system searches all directories in its %path% variable. It should find nasm.exe in the NASM path that you set in the variable.

    [hr][size=1][leftbr].:EvolutionEngine[rightbr][leftbr].:MicroOS Operating System[rightbr][leftbr][link=http://www.brokenthorn.com]Website :: OS Development Series[rightbr][/link][/size]
  • MartinNJMartinNJ Member Posts: 3
    Thanks for the guide.. that PATH thing works fine now :)

    OH CRAZY!!
    After i fixed the path option thing, the linker works just fine :)
    And the EXE's work fine most of the time too ^^
    Do you know how to make the linker write the files in small instead of capital letters? :P
Sign In or Register to comment.