|
-
Aug 5th, 2002, 06:11 PM
#1
Thread Starter
PowerPoster
Segment reference in NASM
I am using NASM now instead of TASM but the syntax is pretty different. I am trying to a usual "Hello World" program but it gives me an error when I try to get the segment of a variable or symbol (although NASM supports that).
Here's the code:
PHP Code:
bits 32
section.data:
message db "Hello", "$"
section.text:
_start:
mov ax, seg message
mov ds, ax
mov dx, message
mov ah, 9h
int 21h
mov ax, 4c00h
int 21h
It gives me this error:
a.asm:6: error: binary output format does not support segment base references
Line 6 is mov ax, seg message
-
Aug 20th, 2002, 02:22 PM
#2
Lively Member
In Nasm
it should be
Code:
bits 32
section.data:
message db "Hello", "$"
section.text:
_start:
mov ax, [message]
mov ds, ax
mov dx, message
mov ah, 9h
int 21h
mov ax, 4c00h
int 21h
basically segment offset are done with a [] on Nasm
i think im still quite new to assembly hope this helps
Peter
"Let's all join forces, rule with an iron hand...and prove to all the world, metal rules the land..."
-- Judas Priest
My email is [email protected]
-
Aug 29th, 2002, 05:57 AM
#3
Thread Starter
PowerPoster
Unfortunately, [message] doesn't refer to the segment of "message". It's used to access the actual value of "message" which is "Hello". I need the segment address of "message"...I already got the offset using just message.
-
Jun 6th, 2003, 01:40 PM
#4
Fanatic Member
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|