Z80 Sudoku Challenge

Primary design document for the Z80 Sudoku solver.

Sentinel Definition

UNKN EQU 0    ; 0 chosen since valid digits are 1–9

Only the low 4 bits of each cell are significant for the digit value. The upper 4 bits are available for scratch metadata during solving.

Solution Location

The solver operates in-place at address $A000.

Rationale: avoids copy overhead, simplifies HL final requirement, and leverages upper nibble for temporary metadata.

Algorithm Overview

Hybrid constraint-propagation plus depth-first backtracking.

1. Deterministic propagation: compute candidate masks and fill forced cells.2. If unresolved: choose cell with fewest candidates and recurse (DFS).

Memory Map

See sub-note: Z80-sudoku-challenge-memory-map

Algorithm Detail

See sub-note: Z80-sudoku-challenge-algorithm

Register Usage Conventions

HL: primary board pointer / return value (must contain base address at HALT).DE: secondary pointer (row/column scans).BC: counters and masks.AF: arithmetic and flag evaluation.