i was wondering what exactly ORG instruction do?
i know it sets where the program loads in memory,but how,when you disassemble a binary assembly file you dont see such a thing as org instruction,but when you run the binary file it gets loaded in that address you mentioned in front of ORG instruction

Edited by s_jmp: n/a

7 Years
Discussion Span
Last Post by dan63043

Basically it just makes sure that the assembled byte-code starts at "ORG". If you want to have a running COM-file under MS-DOS for instance you need exactly 100h of free mem for stuff like stack, commandline-arguments etc provided by DOS. And as this command just makes sure that IP points directly to the beginning of your code at the start of the execution. How should the computer else find out when there's no code given in the first 256 Bytes?


Actually, the ORG doesn't appear anywhere in the program. The ".COM" file extension informs MS-DOS that the first byte of the file is executable code. The ORG instruction informs the assembler that the first byte of executable code always starts at an exact offset.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.