Z80 Assembly 14: Directives, Labels, and Debugging Techniques

Assembler Directives: Structuring Your Code Assembler directives are commands that are read and acted upon by the assembler program, not the Z80 CPU. They organize code, reserve memory, and define data. Directive Action Purpose ORG NNNNH Sets the origin (starting address) where the following code should be placed in memory. Essential for defining where your program loads. EQU symbol, value Equates a symbolic name to a numerical value. Defines constants like port addresses or screen dimensions (SCREEN_WIDTH EQU 32). DB val1, val2, ... Define Byte: Reserves memory and places 8-bit data bytes (numbers or ASCII characters). Used to define text strings or data tables. DW val1, val2, ... Define Word: Reserves memory and places 16-bit words (often addresses). Used for jump tables or storing address pointers. DEFS N Define Space: Reserves N bytes of uninitialized memory. Used for buffers, variables, or the stack area. Example: Data Definition ...

September 27, 2025