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

Recommended Answers

All 3 Replies

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?

Here can you find additional information about ORG directive.

-- tesu

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.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.