Skip to content

A side: Organizing a program

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 divide a long text into parts with names?

11 Assembly words in this segment
16 Fortran words for the same job

What Assembly says well here

  • Labels and macros give names to groups of instructions.
  • One routine serves the game and the test. The test runs the same words as the game, so the check tests the real code.

What is hard to say

  • The program is one long list. The language does not enforce a structure. You must keep the order yourself.
  • A table from the B side is a promise between the two sides. The A side cannot check the format. Write the size, the byte order, the kind and the rounding rule next to the table: sine.bin has 256 values, 2 bytes each, low byte first, NINT(256 * sin).

One sentence in Assembly

%macro wait_key 0
mov ah, 0
int 16h
%endmacro

It says: Give the name wait_key to two instructions that wait for a key.

The words, by part of speech

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

WordMeaningExample
;Starts a comment. The assembler ignores the rest of the line.; draw the ship
,Separates the destination (first) from the source (second).mov ax, bx
hAt the end of a number, h marks base 16 (hexadecimal). 10h is 16.mov ax, 13h

Note to the translators (8) · An assembler directive, for example ORG, DB or %macro.

WordMeaningExample
ORGTell the assembler the start address of the program. A DOS .COM program starts at 100h.org 100h
BITSSelect 16-bit or 32-bit translation.bits 16
SECTIONPut the next lines in a named part of the file, for code or for data.section .data
%defineGive a name to a piece of text.%define SCREEN 0A000h
%macroGive a name to a group of instructions. Then use the name as one word.%macro wait_key 0
%includeRead a different file at this point.%include "vga.inc"
TIMESDo the rest of the line again, a number of times.times 10 db 0
INCBINPut the bytes of a file into the program at this place. This is how the A side reads a table that the B side made.sine_table: incbin "sine.bin"

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.

  • D01-M5 major In practice this is false. GFortran coarrays need OpenCoarrays, built on MPI (a third-party message-passing library). The Intel implementation uses Intel MPI. MPI+OpenMP dominates production HPC (high-performance computing), so coarrays are niche. The plan puts "distributed memory scaling via coarrays" in weeks 9 to 12, and that goal is aspirational.
  • D01-M7 major LFortran was still pre-1.0 (alpha/beta) at the date of the cited sources. The document recommends it to a 90-day learner as equal to Python/Julia interactivity. That overstates its maturity.
  • D15-C4 critical The 5A22 has a hardware multiplier at $4202/$4203 (8 x 8, result at $4216/$4217, 8 cycles) and a divider at $4204 to $4206 (16 / 8, quotient at $4214/$4215). The reviewer fetched the nesdev "Multiplication" page for the multiplier. A binary to decimal conversion is a few hardware divisions, not 320 cycles. The video says only that BCD "makes the math so much easier" [31:44] and that INC and DEC ignore the decimal flag [32:05]. None of the four chart values is in the video or in report 14. The chart is a picture of an invention.