T
T
Type Programmer2017-06-08 13:25:55
assembler
Type Programmer, 2017-06-08 13:25:55

What is org and questions about it?

Everything you asked for was answered below!
- org is a location (offset) in memory? (Solved)
- org from the value of org something changes in the code? (Resolved)
- how much and what between org 500 org 600, org 700? (Resolved)
- When booting from a disk, hard drive, floppy disk in real time, can all available RAM memory be used cleanly? (Resolved)
I'm making a mini OS, I'm interested in what and how ...
(In assembler, a beginner)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrew, 2017-06-08
@MegaCraZy6

When the compiler converts instructions (and data) to binary code, it calculates the offsets of instructions and data from the beginning of the segment. By default, it considers that the block is loaded at the very beginning of the segment and starts counting from 0.
For example, if the first command occupies 3 bytes, the second - 2, the third - 4, then the offset of the first four in the code segment will be [0, 3, 5, 9] respectively.
The ORG directive increments this virtual counter by that value. which is indicated in it.
The simplest example: for COM files, the code segment is loaded into RAM not from offset 0, but from offset 256 from the beginning of the segment allocated to the program. Accordingly, when writing a COM file, you need to precede the code segment with ORG 256 so that it understands that the positions of the commands (from the example above) in the segment when the program starts will be - [256, 259, 261, 265].

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question