Page 1 of 1

[ORG] gives error

Posted: Thu Mar 05, 2009 2:46 am
by evilhamburger
When I compile a file from this site written in assembly (using NASM), it gives this error: Unrecognised directive "[ORG]" this is for the line "[ORG 0x7c00]"

I have used the most recent version of NASM and also a version that the wiki says.

Re: [ORG] gives error

Posted: Thu Mar 05, 2009 3:03 am
by AJ
Hi,

An ORG directive will fail in NASM if you are trying to assemble something other than a flat binary. Try adding -f bin to your assembly command line. For some (all?) file formats, the ORG directive will also fail if you include two in the same assembly file.

Cheers,
Adam

Re: [ORG] gives error

Posted: Thu Mar 05, 2009 9:27 am
by JohnnyTheDon
AJ wrote: For some (all?) file formats, the ORG directive will also fail if you include two in the same assembly file.
All formats. From the NASM docs
NASM 6.1.1 wrote:Unlike the ORG directive provided by MASM-compatible assemblers, which allows you to jump around in the object file and overwrite code you have already generated, NASM's ORG does exactly what the directive says: origin. Its sole function is to specify one offset which is added to all internal address references within the section; it does not permit any of the trickery that MASM's version does. See section 10.1.3 for further comments.

Re: [ORG] gives error

Posted: Thu Mar 05, 2009 9:40 am
by Troy Martin
Duuuude, old manual, you should download/read the new one: http://www.nasm.us/doc

Re: [ORG] gives error

Posted: Thu Mar 05, 2009 1:52 pm
by Dex
Are you sure you did not type 0 instead of O, it as been known.
And have your tryed
org 7C00h

Re: [ORG] gives error

Posted: Thu Mar 05, 2009 2:42 pm
by JohnnyTheDon
Troy Martin wrote:Duuuude, old manual, you should download/read the new one: http://www.nasm.us/doc
Its copied verbaitim to section 7.1.1 in the new manual...

Re: [ORG] gives error

Posted: Thu Mar 05, 2009 5:47 pm
by neon
JohnnyTheDon wrote:
Troy Martin wrote:Duuuude, old manual, you should download/read the new one: http://www.nasm.us/doc
Its copied verbaitim to section 7.1.1 in the new manual...
Perhaps they have not updated their manual. The newer NASM assemblers do not seem to support it for any format but flat binaries.

Re: [ORG] gives error

Posted: Mon Mar 09, 2009 9:58 pm
by weezo
i faced that before when using bos boot sector and loader and i use windows ,i found the proplem may be about windows newlines try to unident [org]