Reading Machine Code Assembly

Publication: Syntax
Pub Details: Syntax/Syntax ZX80 v2 n9 (Volume 2, Issue 9)
Date: September 1981
Pages: 12

Beginning machine language (ML) programmers sometimes have trouble deciphering all the numbers that make up an assembly listing. Let’s take a look at a few lines (we’ve ruled off the columns).

00F7 | FEC0   | 206 | LL7 | CP | 0C0H
00F9 | EA0801 | 207 |     | JP | PE, LL8

First of all, let’s mark off the characters in column 2 by pairs (FE C0 EA 08 01). Each pair is a hex byte and resides in a separate memory address.

Column 1 lists the memory location (or address) at which the first ML byte on that line resides. For example, address 00F7h (h stands for hex) contains ML code FEh (column 2).

Where are the other bytes? Since each byte takes up 1 address, add 1 to column 1 for every digit pair you count over to the right. For example, byte #5, 01h (column 2, line 2) is 2 bytes to the right of byte EAh. Remember to add in hex. Byte 01h resides in address 00FBh (00F9h+2h).

When you type lines into an ML assembler, you must enter numbered program lines so the computer knows which line comes before what. Your line numbers take up column 3.

Optional subroutine labels go in column 4, and ML mnemonics (program lines) appear in column 5. Here, the first line in subroutine LL7 reads “CP 0C0H”. The computer doesn’t execute these lines; they help the programmer know what the code in column 2 means.

To help others decipher their work, programmers add a 6th column (not shown here) for comments. You can distinquish ML comments (like REM in BASIC) because they’re preceded by semicolons. Sometimes comments will start to the left of column 6, but computers consider any text to the right of a semicolon to be a comment.