What does ORG Assembly Instruction do?

前端 未结 5 1383
花落未央
花落未央 2021-02-01 01:12

can anyone give me a comprehensive description about ORG directive?
When and why is it used in assembly written applications?

Using Nasm on x86 or AMD64.

5条回答
  •  醉梦人生
    2021-02-01 01:50

          During the assemble time ORG directive resets the MLC (memory location counter) to the address specified in the ORG directive.
    

    Syntax: ORG note: may be a unsigned absolute value or any symbol or symbol + .

    example:- to observe this instruction working you need any assemble listing which uses ORG directive.

    location
    0000A4 00 89 TAB DC 256AL1(*-TAB)
    0001A4 00000194 90 ORG TAB+240
    000194 F0F1F2F3F4F5F6F7 91 DC C'1234567'

    Here in the above the TAB symbol is assigned to MLC address 0A4. in the next instruction ORG sets the MLC to TAB+240 address location which is x'194' (~ x'A4' + 240 in decimal). basically this set up is setup a table with length 256 and from 240 th location to store some character constants so that I can use it for TR instruction.

提交回复
热议问题