What Is The Use Of Org (Origin)?
1 Answer

The ORG directive sets the location counter to an absolute value. The value to set is given as a parameter. If an ORG directive is given within a Data Segment, then it is the SRAM location counter which is set, if the directive is given within a Code Segment, then it is the Program memory counter which is set and if the directive is given within an EEPROM Segment, it is the EEPROM location counter which is set.

The default values of the Code and the EEPROM location counters are zero, and the default value of the SRAM location counter is the address immediately following the end of I/O address space (0x60 for devices without extended I/O, 0x100 or more for devices with extended I/O) when the assembling is started. Note that the SRAM and EEPROM location counters count bytes whereas the Program memory location counter counts words. Also note that some devices lack SRAM and/or EEPROM.


.ORG expression



 Start data segment

.ORG 0x120; 

Set SRAM address to hex 120 

variable: .BYTE 1 ; 

Reserve a byte at SRAM adr. 0x120


.ORG 0x10 ; 

Set Program Counter to hex 10 

mov r0,r1 ;

 Do something
Please log in to add an answer.