Answer the question
In order to leave comments, you need to log in
What is the purpose of the ORG instruction in Assembler?
Explain in a way that a newbie can understand. Google read: the ORG directive serves to reserve 100 (hex) bytes from the starting address under the PSP, sets the address counter to the desired absolute value. All this tells me little. I look forward to explanations or links to useful resources.
Answer the question
In order to leave comments, you need to log in
In ms dos, when starting a com file, the first 100H bytes before the running code are reserved for various kinds of control structures. Therefore, all addressing within the code must begin at an offset of 100H bytes.
The org 100H directive just tells the compiler that all addressing inside the code needs to be shifted to these 100H bytes.
those. for example, you have an area in your code where you are going to store something that you declare, for example,
data1 DB 30h,
which you address inside the code as
mov ax,OFFSET Data1
when compiling, the OFFSET Data1 structure is converted to a specific address to which the value from org is added
I would like to be more precise. This is not a command to the processor, that is, it does not execute it and does not waste resources (cycles). This is just an instruction to the translator (assembler), as if you are saying: "place all the code below in memory starting from address 100H".
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question