nasm segment directive



Hello,

If I try to assemble to following code with nasm, I get the errors:

u2.asm:5: error: symbol `.data' undefined
u2.asm:16: error: phase error detected at end of assembly.

I read the nasm manual but I still have no clue what I am doing wrong. I
would be pleased if someone could give me a hint how to make the code
work.


Code:

SEGMENT .data
text db 'Hello world$'

SEGMENT .code
mov ax, .data
mov ds, ax
mov dx, [text]
mov ah, 09h
int 21h
mov ah, 08h
keyin: int 21h
cmp al, 27
jne keyin
mov ah, 04ch
mov al, 0h
int 21h


Regards,
Timo
.



Relevant Pages

  • Re: which book to start with...?
    ... mov eax, 4 ... just installed nasm 16 bit and 32 bit bins under dosemu. ... .bss wont accept initialisations while .data will but no garantee for modification at runtime. ... Section .bss is nominally "uninitialized" data, but is in fact cleard to zero. ...
    (alt.lang.asm)
  • Re: Why is my nasm program killing itself?
    ... Nasm is like a sewer, Phil - what you get out of it depends on what you put in. ... If you pour source code suitable for a dos .com file into Nasm, you'll get a dos .com file out. ... orig equ $08048000 ... mov byte,49;working once ...
    (alt.lang.asm)
  • Re: newbie questions
    ... MOV AH,4EH; ... instruction operands must be the same size" this error is in line " INT 21H", because it points everything whats after mov dx, offset mask. ... X86 addresses *always* involve a segment register, ... The examples in your book will need some alteration to work with Nasm. ...
    (alt.lang.asm)
  • Re: 16/32 processor operating mode
    ... Looking back over your posts, you started out asking why we need to give a ".model" directive in Tasm, but not in Nasm. ... The most common case where you'd need to override the defaults would be making a 32-bit Windows file in "-f obj" mode. ... mov eax, cr0 ... "mov ax, bx" and "mov eax, ebx" are the same instruction. ...
    (alt.lang.asm)
  • Re: tsr program
    ... NASM took the multi-character constant '00' and character constant addition ... which will assemble the following code (hopefully they once will add ... mov,eax ... int08: push es ...
    (alt.lang.asm)