Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

The command ORG

Status
Not open for further replies.
I cant understand the function of ORG exactly...

Thank you

ORG is short for Origin.

Its what the Assembler uses as the start of the Program Counter in the program.

Example:
ORG 0x0000 ; would tell the assembler to start the Program Counter at 0000

ORG 0x0004 ; would tell the assembler to start the Program Counter at 0004


Do you follow. OK.?:)
 
Last edited:
I thought ORG moves the following code up to the memory address given.

Expanding upon what I said, just for clarity, I mean that if you go

ORG 0x0004
(something)
ORG 0x0008
(something)

It'd end up compiling into NOP's until 0x0004, the instruction, then NOP's until 0x0008.
 
Last edited:
I thought ORG moves the following code up to the memory address given.

Expanding upon what I said, just for clarity, I mean that if you go

ORG 0x0004
(something)
ORG 0x0008
(something)

It'd end up compiling into NOP's until 0x0004, the instruction, then NOP's until 0x0008.

hi AG,

It wouldnt fill the gaps in ORG 0x0004 to ORG 0x0008 with NOP's if the 'something' in your example was a program/assembler instruction.
 
No, it won't create any code for those addresses - unless it's been told to.


It wouldnt fill the gaps in ORG 0x0004 to ORG 0x0008 with NOP's if the 'something' in your example was a program/assembler instruction.


Isn't that what I said.:confused::p

The program memory will be 3fff for the unused locations.
 
Last edited:
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top