
Write Counted Loops on the 6502 With DEX and BNE
Write counted loops on the 6502 with DEX and BNE: count down to zero, avoid the 256-iteration trap, nest loops for counts above 255 and work out the cycle cost.
Tag
6 posts

Write counted loops on the 6502 with DEX and BNE: count down to zero, avoid the 256-iteration trap, nest loops for counts above 255 and work out the cycle cost.

Learn the 6502 addressing modes: immediate, zero page, absolute, indexed with X and Y, indirect indexed and indexed indirect, with traced examples.

Write, assemble and step through your first 6502 program in the Easy 6502 browser simulator, from a single pixel to a loop that fills a whole row.

Learn every 6502 register and status flag: what A, X, Y, SP, PC and the N V B D I Z C bits do, which instructions change them, and how to trace them.

A 1975 processor with 56 instructions still teaches what every modern CPU builds on: flags, addressing modes, the stack, memory-mapped I/O and interrupts.

Learn assembly language on the 6502 and Z80, from registers and flags to loops, 16-bit math, subroutines, interrupts and tooling, with worked programs for each.