flat assembler
Message board for the users of flat assembler.

Index > Main > ORG directive ... "end org" ?

Author
Thread Post new topic Reply to topic
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji
hi Wink

how to use the "org" directive in a section of code ...
with a beginning and ... a end

"normal" code
JMP toto
;-------------------
org 0000h <--- beginning

my code (origin 0h)

end org ? <--- here is my question ... how close the Directive ??
;-------------------
toto:
resumption of "normal" code
Post 29 Mar 2009, 17:57
View user's profile Send private message Send e-mail Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
Code:
old = $

org new_base_address

; your code

org $ - $$ + old    
Post 29 Mar 2009, 18:35
View user's profile Send private message Reply with quote
ouadji



Joined: 24 Dec 2008
Posts: 1081
Location: Belgium
ouadji

LocoDelAssembly ... beautiful ! Shocked
I never thought about that !
thank you very much for this solution Razz
Post 29 Mar 2009, 19:03
View user's profile Send private message Send e-mail Reply with quote
Azu



Joined: 16 Dec 2008
Posts: 1159
Azu
LocoDelAssembly wrote:
Code:
old = $

org new_base_address

; your code

org $ - $$ + old    

I don't understand.. why not just do org old? Confused
Post 21 May 2009, 10:55
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger ICQ Number Reply with quote
LocoDelAssembly
Your code has a bug


Joined: 06 May 2005
Posts: 4633
Location: Argentina
LocoDelAssembly
This code will tell you why:
Code:
org $100

  mov  ah, 9
  mov  dx, msg1
  int  $21

  mov  ah, 9
  mov  dx, msg2
  int  $21

  xor  ax, ax
  int  $16

  int  $20

msg1 db "Message one", 13, 10, '$'

old = $

org $7c00

 db "Hidden message that shouldn't be seen", 13, 10, '$'

org old
msg2 db "Message two", 13, 10, '$'    
Post 21 May 2009, 12:40
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.