This is the checklist to run through every time you start a new program, until the steps are automatic. It gathers the lessons of the whole tutorial series into one page. If you have not installed Emu8086 yet, start with the install guide; the download there is through the community mirror linked from this site, and the mirror may ask you to sign in.
Before you type anything
- Choose the template first: .COM for a short exercise, .EXE for a multi-segment program. The .COM vs .EXE guide explains the choice.
- Decide which registers hold your inputs and which one will hold the answer, before you write the first instruction.
- If you plan to use
PRINT,PUTCorPRINTN, the include line foremu8086.incmust be in the file. If you use none of them, leave it out.
While you write
- A .COM program starts with
ORG 100hand ends withRET; an .EXE program sets DS and exits with function 4Ch. - Every
CALLneeds a matchingRET, and everyPUSHneeds a matchingPOP. - Strings for function 09h end with
$; strings walked by hand end with a zero byte. Do not mix the two terminators. - No placeholder gaps: a program with a missing middle section cannot be assembled or tested, so write each part completely, even if it is short.
Assemble, then step before you run
Assemble first and read any error message literally: an unknown symbol usually means a missing include line or a misspelled label, and a segment-directive error usually means the wrong template. Then single-step the program once, as described in the step debugging tutorial, watching the registers and flags at each instruction. Only run at full speed after the single-step behaved as expected.
A complete final example
The program below combines several series lessons: it uses macros, so it includes emu8086.inc; it does a small calculation; and it converts the numeric result to a printable character by adding the character code for zero. Run it, step it, and confirm each expectation before moving on.
include 'emu8086.inc' ORG 100h PRINT '2 + 3 = ' MOV AL, 2 ADD AL, 3 ADD AL, '0' PUTC PRINTN RET
What you should see
The emulator window should show 2 + 3 = 5. The digit appears because adding the character code for '0' to the value 5 gives the character code for '5', which is what PUTC prints. This only works for single digits from 0 to 9; larger results need a proper number-to-string conversion, which is a good second project once this checklist feels easy.
When it does not work
- Nothing prints: check the template, the include line, and whether the program reached a
RETbefore the printing code. - Wrong digit: check whether the value in AL was still the sum when
PUTCran, or whether an instruction in between overwrote it. - Assembler error on the first line: check the include line spelling and that the file is a .COM template.
- Program runs past the end: check that every path through the code reaches a
RETor a proper exit.
Where to go next
For deeper reading, the buying guide at best books for learning 8086 assembly collects book suggestions for continued study. The tutorial series itself continues from here into larger programs; revisit Hello World and registers and segments whenever a new program surprises you, and keep the opcode reference open while you work.
Next steps
That is the whole first-program workflow in one place. Return to the home page for the full series, and use step debugging whenever a new program misbehaves.
