◄ WORLD V · SONNY 5DART 462 · a helldive at the net

THE PROGRAM BANK code crosses banks too — a 24-bit program counter, JML and JSL

Data is not the only thing that outgrew 64KB — so did code. The 65816 adds the Program Bank Register (PBR, or K): the program counter is now PBR : PC, 24 bits, so a program can span the full 16MB. New long control-flow reaches across banks: JML (jump long) and JSL (jump-to-subroutine long). And because a long call may return to a different bank, JSL pushes three bytes (bank + high + low) where the 6502’s JSR pushed two — the return address grew a bank. Code, banked.

THE TECHNIQUE PC = PBR : PC (24-bit); JSL pushes 3 return bytes vs JSR’s 2

The demo forms a long jump target (bank 3, $8000 → 0x038000) and shows JSL pushes one more byte than JSR: live demo


HISTORY & CREDIT 65C816 PBR · JML / JSL

“A jump is a jump.” — a long jump carries a bank, and a long call must push it too, so the return address is three bytes. cited

the register · PBR holds the code bank — PC is 24 bits.
long control flow · JML/JSL reach any bank; RTL returns across one.
the return · JSL pushes 3 bytes (bank+PCH+PCL); JSR pushed 2.

A program counter with a bank on top — code that jumps across the whole 16MB, its return address grown a byte. banked code

RECOMMEND FOR I-13 the long jump, on the compiler

On the canonical compiler, JML to bank 3 $8000 forms 0x038000 (229376), and JSL pushes 3 bytes to JSR’s 2:

$ i13 run pm_programbank.i13 # (bank<<16)|pc ; JSL vs JSR RUN OK · 26 step(s) · peak stack 4 · call depth 1 target = 229376 -- 0x038000, bank 3 jsl_pushes = 3 jsr_pushes = 2 long_call = 1
Recommend as a NULL — code addressing, same family as the data bank. The program bank extends the PC the way DBR extends data addresses (resource + encoding, B40/B44); the extra pushed byte is a consequence of the wider return address, not a new invariant. NULL — the permutation banking code as well as data.