NASM Forum > Programming with NASM

excuse me,"ORG"directive's problem~

(1/2) > >>

Hack004:

--- Quote ---ORG 0
; some boot sector code
TIMES 510-($-$$) DB 0
DW 0xAA55
--- End quote ---
======================================
this code compiler prompt error:

--- Quote ---D:\Nasm>nasm 1.asm -o 1.bin
1.asm:1: error: unrecognised directive [org]
--- End quote ---
==========================================
please tell me about this is why?

Frank Kotler:
Well... "org" is recognized only in "-f bin" mode. You haven't specified "-f bin", but it's the default if no output format is specified, so I would expect it to work. It is possible to compile Nasm so that the default output format is other than "-f bin", but I don't think anybody does it. It would be possible to set an output format as part of the NASMENV environment variable... You'd probably know it if you'd done that...

I dunno. Does it work if you specify "-f bin"?

Best,
Frank

Frank Kotler:
I was not aware of any issue, but I see hpa has just now made a change to the way directives are handled. If this continues to be a problem for you, it may be worth discussing "which version" and "try the latest snapshot".

Best,
Frank

Hack004:
excuse me,,,
   still not work,,will My "Nasm" version of the problem?
   still prompt "1.asm:8: error: unrecognised directive [org]"

Frank Kotler:
I can't duplicate this problem, Hack004! In fact, I don't think I've ever seen that particular error message. The only way I can get Nasm to complain about "org" is to use some output format other than "-f bin", and then it whines about "parser: instruction expected", not "unrecognised directive". I can see where the message is generated (nasm.c, line 1500), but I've never seen it triggered (that I remember).

So, yeah... if you would, tell us what version of Nasm ("nasm -v"). May be take a look at "nasm -hf" - this will generate a list of output formats, with a '*' in front of the default - should be "bin" (a "custom build" is unlikely, but possible). Might matter "which OS?", too. The exact command line you gave Nasm - I guess you've told us that... Anything you can think of that might be "different"...

"org 0" is the default if no "org" is given, so your code might assemble properly if you just comment out that line, but "something's wrong" here! Let's see if we can track it down, if we can. Thanks for the feedback!

Best,
Frank

Navigation

[0] Message Index

[#] Next page

Go to full version