nasm org directive - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

nasm org directive

buggy84buggy84 Posts: 23Member
org 100h
; some code
org 600h
; some code
does org 600h override the org 100h setting
how do i address the variables inside the org 100h block

Comments

  • ASHLEY4ASHLEY4 Posts: 254Member
    : org 100h
    : ; some code
    : org 600h
    : ; some code
    : does org 600h override the org 100h setting
    : how do i address the variables inside the org 100h block
    :
    :
    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.

    ASHLEY4.
  • buggy84buggy84 Posts: 23Member
    : : org 100h
    : : ; some code
    : : org 600h
    : : ; some code
    : : does org 600h override the org 100h setting
    : : how do i address the variables inside the org 100h block
    : :
    : :
    : 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.
    :
    : ASHLEY4.
    :
    thnx but i had already read the docs
    wanted to ask that the offset to be added can be overridden with the second org or not ne wayz i tried it out and it said something abt the multiple org directives

    tell me one more thing

    if somebuddy writes
    jmp 07c0h:start
    msg db 'blah'
    start:
    ; the rest of the code goes here
    then it means we have put in the number 07c0h in the cs reg
    when the address is calculated 07c00h + start then we aare somewhere else if the segment where the code was loaded aint 07c0h
    actually i read somewhere that the BIOS loads the boot sector in segments ne where b.w 0 and 07c0h and it said that we shud jump to a known segment so that we can go abt doing things our way
    what i feel is that we are ending up at the wrong place by modifying the seg reg


Sign In or Register to comment.