Z80 Assembly 94: Bubble Sort (The Simplest Sorting Algorithm)

The Need for Sorting Sorting arrays of data (e.g., high scores, tile IDs, or inventory items) is a fundamental task. While complex algorithms exist, Bubble Sort is the simplest to implement on the Z80 due to its minimal memory requirements and straightforward logic. The Principle: Bubble Sort works by repeatedly stepping through the list, comparing adjacent elements, and swapping them if they are in the wrong order. This process is repeated until no swaps are needed, meaning the list is sorted. ...

September 28, 2025

Z80 Assembly 01: Your First Step and the Register Crew

Your CPU’s Workspace: The Registers Think of the Z80’s registers as a small, specialized crew of fast workers who hold all your data. They are faster than memory, so we want them to do most of the work. The Main Workers (8-bit) Register Analogy Key Function A (Accumulator) The Calculator Where math always happens. If you add, subtract, or compare, it happens here. B, C, D, E, H, L The General Storage Used to hold temporary numbers or counts. The Main Address Book (16-bit) ...

September 27, 2025