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:

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.
 
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.
 
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.

The program memory will be 3fff for the unused locations.
 
Last edited:
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…