BPL is a 6502 conditional branch. It jumps to its label when the negative flag, N, is clear (0). N is bit 7 of the status register, so BPL tests whether that bit is not set. section 4.4.2
Like other branches, BPL provides an IF-style decision: execution jumps when its flag condition is true and otherwise continues with the next instruction. Branch destinations are limited by a one-byte relative offset, allowing at most 129 bytes forward or 126 bytes backward. section 4.4.2
Wait until vBlank
BIT reads PPU_STATUS and sets N from its bit 7. The first read clears the existing vBlank flag; the loop then keeps branching back while N is clear. Once vBlank sets bit 7, N becomes set, BPL does not branch, and execution leaves the loop. section 5.12
Listing 5.13 Waiting for the first vBlank (example.s)
#1
bit PPU_STATUS
wait_vblank:
bit PPU_STATUS
bpl wait_vblank
This short polling loop shows BPL targeting its own wait_vblank label until the PPU status indicates vBlank. section 5.12
