Welcome Guest ( Log In | Register)



 
Reply to this topicStart new topic
> Can't Compile Assembly Programs.
Nicolas
post Apr 30 2006, 01:29 PM
Post #1


Newbie
*

Group: Members
Posts: 1
Joined: 30-April 06
Member No.: 22,802



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>

This post has been edited by Nicolas: Apr 30 2006, 01:31 PM
Go to the top of the page
 
+Quote Post
True2Earn
post Apr 30 2006, 01:42 PM
Post #2


Advanced Member
*******

Group: Members
Posts: 141
Joined: 25-April 06
Member No.: 22,477



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 (wink.gif.
Go to the top of the page
 
+Quote Post
WindAndWater
post Apr 30 2006, 02:51 PM
Post #3


Advanced Member
*******

Group: Members
Posts: 106
Joined: 1-April 06
Member No.: 21,148



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.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic

Collapse

> Similar Topics

Topics Topics
  1. Can A Windows Compiler Compile For Linux?(6)
  2. Buffer Overflow In Action Tutorial(0)
  3. Programs(4)
  4. Simple C++ Programs.(17)
  5. C++ Programmers(1)
  6. Mouse Input In C Programs(5)


 



- Lo-Fi Version Time is now: 25th July 2008 - 08:06 PM