Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Can't Compile Assembly Programs.


3 replies to this topic

#1 Nicolas

    Newbie

  • Kontributors
  • Pip
  • 1 posts

Posted 30 April 2006 - 01:29 PM

Hi, I'm trying to learn assembly but I can't compile any "hello world" programs... And I don'n know what I'm doing wrong... I downloaded NASM ,NASMW and TASM32. The program is like this:

EXAMP1.ASM:


;title Hello World Program
; This program displays "Hello, World!"

dosseg
.model small
.stack 100h

.data
hello_message db 'Hello, World!',0dh,0ah,'$'

.code
main proc
mov ax,@data
mov ds,ax

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

mov ax,4C00h
int 21h
main endp
end main




And when I compile this occurs:


C:\>CD NICKS

C:\Nicks>nasm EXAMP1.ASM
EXAMP1.ASM:5: error: parser: instruction expected
EXAMP1.ASM:6: error: parser: instruction expected
EXAMP1.ASM:12: error: parser: instruction expected
EXAMP1.ASM:17: error: comma or end of line expected
EXAMP1.ASM:22: error: parser: instruction expected
EXAMP1.ASM:23: error: parser: instruction expected

C:\Nicks>

Edited by Nicolas, 30 April 2006 - 01:31 PM.


#2 True2Earn

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 141 posts
  • Interests:Bryan Reinhart is a veteran of the US Army (TF 1-160 SOAR(A) Ft Campbell) and served on many Spec Ops missions during the Gulf War. He is now an entrepreneur and enjoys helping people.

Posted 30 April 2006 - 01:42 PM

this would be assembled into a .COM and not an executable (.EXE). what command line switches are you using? also, which assembler are you using? this should compile under TASM v5 without any problems. just don't leave "EXAMP1.ASM:" in the source code unless you put a semicolon in front of it (<_<.

#3 WindAndWater

    Advanced Member

  • Kontributors
  • PipPipPipPipPipPipPip
  • 106 posts

Posted 30 April 2006 - 02:51 PM

Also, make sure that you're using the right assembly for your processor: IA-32, IA-64, x86-32, and x86-64 are all different. I'm not sure how much some assemblers can compensate for the discrepencies as I've only ever used ASM embedded in C with gcc.

#4 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 23 November 2009 - 06:39 AM

Carbage is coming out as output when executed under tasmCan't Compile Assembly Programs.

Hi!

I am beginning to execute 8086 assembler programs with Tasm .The following program when executed does not give output except some carbages.Please tell me what to do.

.Model small

.Stack

.Data

sum db ?

.Code

movax,@data

mov ds,ax

mov ss,ax

movax,0009h

add ax,00009

mov sum,ax

mov ah,09h

lea dx,sum

int 21h

mov ah,4ch

int 21h

end

 

-question by gtrajan




Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users