Skip to content

A side: Making choices and repeating

A cassette tape with a handwritten label: "A Side. Assembly - the first language of the machine."

A A side · Assembly · The first language of the machine

How do you say "if" and "again"?

13 Assembly words in this segment
13 Fortran words for the same job

What Assembly says well here

  • The grammar is small and clear: compare two values, then jump to a label.
  • You see each branch that the processor takes.

What is hard to say

  • There is no IF ... ELSE block. A jump to the wrong label is an easy mistake.

One sentence in Assembly

cmp word [fuel], 0
je no_fuel

It says: Compare fuel with 0. If they are equal, go to the label no_fuel.

The words, by part of speech

Verbs (10) · An instruction: one step that the processor does, for example MOV or ADD.

WordMeaningExample
CMPCompare two values. It subtracts but keeps only the flags.cmp ax, 10
TESTCompare the bits of two values. It does an AND but keeps only the flags.test al, 8
JMPGo to a label.jmp game_loop
JE / JZGo to a label if the compared values are equal (the zero flag is 1).je no_fuel
JNE / JNZGo to a label if the compared values are not equal.jne again
JL / JGGo to a label if less / greater (numbers with a sign).jl too_low
JB / JAGo to a label if below / above (numbers with no sign).jb too_low
LOOPSubtract 1 from CX. If CX is not 0, go to the label.loop again
CALLGo to a subroutine and remember the return address.call draw_ship
RETReturn to the instruction after the CALL.ret

Nouns (2) · A register, a flag, a port or a place in memory, for example AX.

WordMeaningExample
ZFZero flag. It is 1 when the last result is zero.
SFSign flag. It is 1 when the last result is negative.

Grammar marks (1) · Commas between operands, [square brackets] for memory, a colon after a label.

WordMeaningExample
label:A name for a place in the program. A colon ends it.again:

Watch out: what the review found

These notes come from the review of the AI-written guides. They show traps that are easy to miss.

  • D02-M7 major On real PCs, DRAM refresh, ISA wait states, the 8088 prefetch queue and 486 caches make exact cycle counts not practical. The claim is true on the C64 and NES. It is not true on the DOS target that the roadmap uses.