Mary Ryllo
Mary Ryllo

Reputation: 2371

How does assembler process "org 100h" directive?

I know, what this directive is do. As I know program-loader doesn't see this directive, so, how assembler process it?

Upvotes: 4

Views: 14916

Answers (3)

vzezin
vzezin

Reputation: 21

"org <100h>" instructs the compiler with the to-be runtime information to evaluate addresses, as binary image will be loaded with offset (and first 100h bytes possibly to be used for PSP etc. in your context)

This comes in hand to access any data in the same segment (usually when DS=CS, especially true for com files when "you know nothing except your CS"), or when doing a JMP to absolute offset in rare cases.

In other words, it makes all further labels in a segment to account from the specific offset: just that.

Upvotes: 1

user11031698
user11031698

Reputation: 1

Mostly programs when loaded in Windows it used to start from 100 So when we wrote org 100h it tells in run time to compiler to store data starting from 100 .i.e if u use 60h or 70h Compiler will produce error of data may be present at 60 or your given location

Upvotes: -2

Jens Bj&#246;rnhager
Jens Bj&#246;rnhager

Reputation: 5648

It sets the current address during assembly to be 100h. That's all it is. A simple assignment.

Elaboration:

The directive does not control where in the result image the following instructions will be placed, but rather where the instructions would be placed after being loaded into memory.

Upvotes: 7

Related Questions