Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 4 Nov 2002 15:24:43 -0800
From:      Naydoe Maung <nyingelay@hotpop.com>
To:        FreeBSD Questions <freebsd-questions@FreeBSD.ORG>
Subject:   NASM (BSD vs. Linux)
Message-ID:  <200211041524.43350.nyingelay@hotpop.com>

next in thread | raw e-mail | index | archive | help
- FreeBSD 4.7-RELEASE #0: i386
- NASM version 0.98.33 compiled on Oct 31 2002
- Linux driver already loaded

Simple assembly code for Hello World:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
SECTION .data
msg     DB      "Hello, World!", 0Ah, 0Ah
MSGLEN  EQU     14

SECTION .text
global _start
_start:
        mov     eax, 4
        mov     ebx, 1
        mov     ecx, msg
        mov     edx, MSGLEN
        int     80h

        mov     eax, 4
        mov     ebx, 1
        mov     ecx, msg
        mov     edx, MSGLEN
        int     80h

        mov     eax, 4
        mov     ebx, 1
        mov     ecx, msg
        mov     edx, MSGLEN
        int     80h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Shell output:

bash-2.05b$ nasm -f elf hello.asm
bash-2.05b$ ld -o hello hello.o
bash-2.05b$ ./hello
bash-2.05b$ ls
hello           hello.asm       hello.o
bash-2.05b$
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

As you can see here, It compiled and linked without any errors, however n=
o=20
appropriate output is being generated.  There were no problems running it=
 on=20
Linux.  I heard some issues about different sys calls and interrupts on L=
inux=20
and BSD, but I thought since the Linux driver was loaded there should be =
no=20
problems running Linux oriented programs.  I'm very confused, and I'm sur=
e=20
I'm missing out some stuff.  Help me please.

Thank You


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200211041524.43350.nyingelay>