Sponsoring website: Emergency Boot CD



New Resource: Freeware version of IDA Pro Disassembler!

How PC Programs Work:
Understanding x86 (Intel)
Machine Code

    This area of  The Starman's Realm could also be called Assembly Language 101. Though most of these pages will deal with pre-existing programs and figuring out how they work rather than teaching you how to create them, we've finally added a page about assembling and compiling x86 Assembly source code under MASM (which is FREE if you know where to look for it; don't worry, we'll show you!). You'll come to understand much about Intel 8086 and other x86 Assembly instructions as you learn how the example programs function on a PC.

Whether you want to create your own programs or simply try to understand how others work, you must have a listing of all the basic Intel x86 Opcodes and a copy of Ralf Brown's famous Interrupt List  (see the References section below for obtaining free downloads of both items). If you move on to C/C++ or Win32 Assembly (see below) programming for Windows®, you'll also need to know about Windows API calls!

Many years ago, I created a web page which taught how one could use the BOCHS PC Emulator to learn Linux commands under a PC's current OS without having to install Linux. Well, BOCHS can also be very useful in debugging boot code, such as that found in the Master Boot Record of a PC. "Thinking inside the Bochs!" is like being able to stop a running PC and examine its registers! Bochs comes with its own BIOS code that simulates many of the resources you'd use to run your code on a PC, and even step through it one assembly instruction at a time; just like you could for older 8086 code under MS-DEBUG, but in exactly the same memory locations it would normally run! Yes, run your boot-code in segment ZERO; no more having to worry about side-stepping instructions like, mov SS,AX (when AX is zero). And the Bochs debugger understands 32-bit instructions too!

Download this fantastic tool from: http://sourceforge.net/projects/bochs/ (for Windows or Linux based PCs).

Another valuable resource for many students will be the IDA PRO Disassembler, created by Ilfak Guilfanov has released a FREEWARE (for noncommercial use) version of IDA PRO (v. 5.0 - 15.6 MiB (16,371,302 bytes) Windows® install file); download it from here (or search for other download sites):
http://www.hex-rays.com/idapro/idadownfreeware.htm (MD5=15bed40e1fd1c8d095b1d7d9f47fef18). This version still allows you to perform an interactive disassembly of x86 code under Windows® (9x/Me thru XP).
    Though it will take some time to learn how to use (it's not like a simple text editor), IDA Pro can save you time later on because it will automatically update every cross reference to the same label whenever you rename it! IDA Pro understands all the later Intel instructions which DEBUG chokes on, and it will also create and save various .lst, .ASM, .map, etc. files for your disassembly project.

 

Pages in this Area

Important x86 (PC) Tools and References:


 

 

This page updated: December 16, 2007.
Minor Updates: September 6, 2010.
Updated: 20 November, 2010 (20.11.10).


The Starman's Realm Index Page