This guide details the steps required to write methods using NASM that can be called from DJGPP. This article is referenced by the DJGPP FAQ.


Most programmers have no trouble dealing with assembly language in real mode. Your code is in one segment, your data is in another and you have complete, unhindered access to the entire system. Things like “general protection faults”, “segment violations” and “page faults” seemed like things only Windows programmers had to deal with.

In protected mode, however, things are different. Instead of segments, we have to use selectors. You aren’t allowed to write to any memory location you please and the absolute addresses you took for granted in real mode don’t work in quite the same way. The purpose of this tutorial is to ease the real to protected mode transition and help the reader to grasp the important fundamental concepts that are important to well-behaved assembly language.

Read full post