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.
##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.