Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with simple program in NASM

Status
Not open for further replies.

mrhegemon

Programmer
Jul 3, 2003
20
US
I am trying to learn how to program assembly and I am starting on a Linux system with the NASM compiler. I have written an include file for my program that contains macros for system calls, so I can make system calls more conveniently. Unfortunately, I am getting a compiler error at line 3 claiming that a comma is missing after an operand. I assume this is meant as line 3 of the include file and the opcode on that line is INT, which only requires 1 operand, correct? Is there something else wrong with my code? Here are my files:

##hello.asm
%include "system.inc"
section .data
msg db 'Hello, world!', 0Ah
len equ $-hello
section .text
global _start
_start:
push dword len
push dword msg
push dword stdout
s_write
push dword 0
s_exit


##system.inc
%define stdin 0
%define stdout 1
%define stderr 2
%define sexit 1
%define sread 3
%define swrite 4
%define sopen 5
%define sclose 6
section .text
access.kernel:
int 80h
ret
%macro system 1
mov eax,%1
call access.kernel
%endmacro
%macro s_exit 0
system sexit
%endmacro
%macro s_read 0
system sread
%endmacro
%macro s_write 0
system swrite
%endmacro
%macro s_open 0
system sopen
%endmacro
%macro s_close 0
system sclose
%endmacro


Thanks for any help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top