[ORG] gives error

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
evilhamburger
Posts: 6
Joined: Thu Mar 05, 2009 2:42 am

[ORG] gives error

Post 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.
User avatar
AJ
Member
Member
Posts: 2646
Joined: Sun Oct 22, 2006 7:01 am
Location: Devon, UK
Contact:

Re: [ORG] gives error

Post 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
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: [ORG] gives error

Post 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.
User avatar
Troy Martin
Member
Member
Posts: 1686
Joined: Fri Apr 18, 2008 4:40 pm
Location: Langley, Vancouver, BC, Canada
Contact:

Re: [ORG] gives error

Post by Troy Martin »

Duuuude, old manual, you should download/read the new one: http://www.nasm.us/doc
Image
Image
Solar wrote:It keeps stunning me how friendly we - as a community - are towards people who start programming "their first OS" who don't even have a solid understanding of pointers, their compiler, or how a OS is structured.
I wish I could add more tex
User avatar
Dex
Member
Member
Posts: 1444
Joined: Fri Jan 27, 2006 12:00 am
Contact:

Re: [ORG] gives error

Post by Dex »

Are you sure you did not type 0 instead of O, it as been known.
And have your tryed
org 7C00h
JohnnyTheDon
Member
Member
Posts: 524
Joined: Sun Nov 09, 2008 2:55 am
Location: Pennsylvania, USA

Re: [ORG] gives error

Post 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...
User avatar
neon
Member
Member
Posts: 1567
Joined: Sun Feb 18, 2007 7:28 pm
Contact:

Re: [ORG] gives error

Post 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.
OS Development Series | Wiki | os | ncc
char c[2]={"\x90\xC3"};int main(){void(*f)()=(void(__cdecl*)(void))(void*)&c;f();}
weezo
Posts: 9
Joined: Wed Jul 23, 2008 4:33 am
Location: Egypt

Re: [ORG] gives error

Post 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]
Post Reply