Vertical Rupture
Vertical rupture is the technique of running more than one CRTC cycle inside a single TV frame by reprogramming R4 (vertical total) mid-frame. Each cycle has its own R12/R13 screen-start, so a single physical screen can show two or more independent windows — typically a hardware-scrolling playfield and a stationary status panel. Term originates in the Amstrad CPC demo scene (retrosoftware-smooth-vscroll).
This is the foundation for smooth-vertical-scroll and most raster-split tricks on the Beeb.
Why it works
Three properties of the 6845 combine:
- R12/R13 are loaded into VMA when
C4=C9=C0=0(see crtc-internal-counters for the counter model). Each new CRTC cycle re-loads VMA from the current R12/R13 — so writing R12/R13 during a cycle changes the address used by the next cycle, not the current one. - R4, R6, R7 are read at specific cycle phases — not pre-latched. Per the per-register write-window summary in crtc-6845-advanced: R4 affects the Last-Line verdict only when written at C0<2 of the candidate scanline; R6 affects display-off any time; R7 has a C0vs<2 (block) vs C0vs≥2 (trigger mid-line) dichotomy (see triggered-vsync).
- The TV is locked to the CRTC’s HSYNC/VSYNC; provided you keep
Σ(R4+1)(R9+1) + ΣR5 = 312over the frame, the picture stays in lock.
So: at any time during a CRTC cycle, write the next cycle’s R12/R13; cut the current cycle short with a new R4 (timed to land at C0<2 of the would-be Last-Line scanline); the chip ends that cycle, loads VMA from the new R12/R13, and begins a fresh cycle with the new start address.
Register-write windows for safe rupture
For each register you’ll touch during a rupture, where the write must land on the scanline that should end the cycle (per accc-compendium §11-§16, summarised on crtc-6845-advanced):
| Register | Required write phase | If you miss the window |
|---|---|---|
| R4 (cut cycle short) | C0<2 of the candidate Last-Line scanline | Chip uses old R4, cycle extends by one scanline. Causes the “+1-raster drift” bug. |
| R6 (cut visible rows) | Any phase before C4 reaches R6 | Cycle still displays old number of rows this scanline |
| R7 (move VSync) | Anywhere safe, but avoid C0vs<2 of the line where C4=R7 | C0vs<2 + R7=C4 blocks VSync for the field (see triggered-vsync) |
| R12/R13 | Anywhere before the C4=C9=C0=0 boundary that starts the next cycle | VMA loads from old R12/R13 for next cycle |
| R5 (adjust scanlines) | Before C0=2 of the last frame line | Adjust isn’t applied this frame |
The “land at C0<2 of the candidate scanline” requirement for R4 is the chief footgun. A back-to-back STA &FE01 costs 6 cycles and every CRTC write lands on a 1 MHz boundary (an even C0) — jsbeeb 2.10.2 Master, measured by phX (beeb-port-kit-hardware-facts-2026-11 §1) — so with ~5c of instruction setup the window is a couple of 1 MHz slots: manageable but not generous. Superseded: this paragraph said “8-cycle-stretched STA accesses”, unmeasured. In jsbeeb the latch is at exactly C0 = 1; on a real Master an R4 for the next frame written at C0 54 of the last line is safe (phX, both of KC’s Masters, card 8).
The “Last Line” state — what actually arms the cycle boundary
Per crtc-internal-counters: the chip evaluates C9=R9 AND C4=R4 at C0=0,1 of every scanline. If true, “Last Line” is armed and that scanline ends the current cycle (C9/C4 reset to 0, VMA loads from R12/R13). If false, the scanline is treated as a continuing row.
To cut a cycle short via R4:
- Decide which scanline of the cycle should be the last.
- Compute the R4 value that satisfies
C4=R4on that scanline. - Write the new R4 before C0=2 of that scanline (typically: during the previous scanline, near C0=R0).
For 8-scanline cycles (R9=7) you have 7 scanlines of slack before the Last-Line evaluation. For 1-scanline cycles (R9=0, single-scanline rupture) there’s no slack at all — see single-rasterline-rupture for the specialised timing discipline.
The R7-rewrite caveat
The Hitachi datasheet classifies R7 mid-frame rewrites as NG, but the precise mechanism per accc-compendium §16.4.1.1 is:
- R7 written at C0vs<2 with value=C4 blocks VSync for that field (no firing).
- R7 written at C0vs≥2 with value=C4 triggers VSync immediately mid-line.
- R7 written with value≠C4 simply moves the VSync trigger point for the field.
For vertical rupture, the safe pattern is to write R7 well before the cycle whose VSync position is being changed reaches C4=R7−1. The retrosoftware demo writes R7 during the preceding cycle which sidesteps both pathologies. See triggered-vsync for the full breakdown.
Worked example — MODE 2, 16-row split
From raw/code/vrupt.6502 (rupture demo accompanying retrosoftware-smooth-vscroll). Top 16 rows hardware-scroll a &5800-&7FFF playfield (uses the &8000 wraparound — requires the 10K-screen latch). Bottom 16 rows show a stationary panel at &3000.
PAL frame = 39 char rows = 312 scanlines
Cycle 1 (top, scrolled): 16 rows = 128 scanlines, R12/R13 = playfield_addr/8
Cycle 2 (bottom, static): 23 rows = 184 scanlines, R12/R13 = &3000/8, VSync inside this cycle
--
39 rows ✓
Setup (run once)
SEI
LDA #&7F : STA &FE4E ; disable all System VIA IRQ sources
LDA #&A2 : STA &FE4E ; enable CA1 (vsync) + T2 only
LDA #255 : STA &FE48 : STA &FE49 ; quiesce T2
LDA #0 : STA &FE4B ; ACR = T2 one-shot (timed interrupt mode)
LDA #4 : STA &FE4C ; (no PB7 squarewave)
LDA #15 : STA &FE42 ; DDRB: low nibble = outputs (addressable latch driver)
; 10K-screen wraparound: set latch bits 4 then 5 (clear bit 4 + set bit 5)
LDA #12 : STA &FE40 ; latch: clear bit 4
LDA #13 : STA &FE40 ; latch: set bit 5
LDA #irq AND 255 : STA &204 ; IRQ1V → our handler
LDA #irq DIV 256 : STA &205
LDA #0 : STA addr ; addr = &5800/8 (top playfield base)
LDA #&58/8 : STA addr+1
CLIFlagged 2026-09-07 — the two latch comments above are wrong, the code is right.
12=%1100is value 1 on line 4 and13=%1101is value 1 on line 5: both writes set their line ((V << 3) | N, see system-via). Lines 4/5 = 1/1 selects the 10K wrap to&5800, which is exactly what this demo’s&5800-&7FFFplayfield needs. Measured table (Edge Grinder, jsbeeb, 2026-09-04; the 10K case independently in Paradroid’s Layer 3): 0/0 →&400016K, 1/0 →&60008K, 0/1 →&300020K, 1/1 →&580010K — beeb-port-kit-hardware-facts §3. The original comment text is kept above for the record.
IRQ handler (three entry paths via whichtimer state)
On VSync: latch R12/R13 to the new playfield address, then start a T2 timer for 2560 1MHz ticks (5 char rows × 8 scanlines × 64 ticks/scanline) to wake us once the new CRTC cycle has begun.
.irq
LDA &FE4D : AND #2 : BEQ timer ; bit 1 = CA1 vsync
STA &FE4D ; clear vsync flag
STA vsync ; signal main loop
STA whichtimer ; mark: next timer = "first"
; latch top playfield start
LDA #12 : STA &FE00 : LDA addr+1 : STA &FE01
LDA #13 : STA &FE00 : LDA addr : STA &FE01
; T2 = 2560 ticks → IRQ once cycle 1 has begun
LDA #<2560 : STA &FE48
LDA #>2560 : STA &FE49
LDA &FC : RTIFirst timer fire: we’re now inside cycle 1. Cut it to 16 rows, suppress VSync, set R6=16 displayed, and queue the bottom address into R12/R13 for cycle 2. Then T2 for 8192 ticks (16 rows × 8 × 64) to wake at the cycle-1 → cycle-2 boundary.
.timer
LDA whichtimer : BEQ secondtimer
LDA #4 : STA &FE00 : LDA #15 : STA &FE01 ; R4 = 15 → 16-row cycle
LDA #7 : STA &FE00 : LDA #255 : STA &FE01 ; R7 huge → no VSync this cycle
LDA #6 : STA &FE00 : LDA #16 : STA &FE01 ; R6 = 16 → display all 16 rows
LDA #12 : STA &FE00 : LDA #&30/8 : STA &FE01 ; queue bottom address
LDA #13 : STA &FE00 : LDA #0 : STA &FE01
STA whichtimer ; A=0 → flag "second timer next"
LDA #<8192 : STA &FE48
LDA #>8192 : STA &FE49
LDA &FC : RTISecond timer fire: we’re now in cycle 2 (bottom panel). Restore normal CRTC values for the remaining 23 rows: VSync position back where MODE 2 expects it (so the TV stays locked frame-to-frame).
.secondtimer
LDA #&20 : STA &FE4D ; clear T2 flag
LDA #4 : STA &FE00 : LDA #22 : STA &FE01 ; R4 = 22 → 23 rows
LDA #6 : STA &FE00 : LDA #16 : STA &FE01 ; R6 = 16 displayed
LDA #7 : STA &FE00 : LDA #18 : STA &FE01 ; R7 = 23 - 5 = 18 (VSync 5 rows before cycle end)
LDA &FC : RTIThe 23 - 5 = 18 is the key timing identity: default MODE 2 has 5 char rows after VSync, so placing VSync 5 rows before the end of cycle 2 keeps the TV in identical phase to a normal MODE 2 frame.
Row budget table (this example)
| Cycle | R4 | Rows | R6 displayed | R7 (VSync) | Notes |
|---|---|---|---|---|---|
| 1 (top, scrolled) | 15 | 16 | 16 | 255 (suppressed) | playfield in &5800-&7FFF, wraps at &8000 |
| 2 (bottom, static) | 22 | 23 | 16 | 18 | panel at &3000, VSync near end |
| Total | 39 ✓ | matches PAL frame |
Pitfalls
- Cycle-row totals MUST sum to 39 (or
38 + R5in residue-mode setups). Even one extra row drifts the picture — slow roll on the TV. - R5 must sum to 0 (or 8, or multiples) if you’re using rupture without smooth-scroll. Mismatched R5 across cycles desynchronises the field.
- Timing tolerance: the 2560/8192-tick waits are bounded above by “before the current cycle ends” and below by “after the new cycle has actually started”. Talbot-Watkins notes the tolerance is generous, but tight timing is needed if you reduce status-panel height — a status panel acts as slack.
- R12/R13 is the easiest mid-frame rewrite to time because VMA only loads at C4=C9=C0=0 boundaries. R4/R6/R7 rewrites have stricter per-register timing windows — see “Register-write windows” above and crtc-6845-advanced for the full breakdown. Don’t move them earlier or later without thinking through which cycle samples them.
The extreme version: single-rasterline rupture
The technique above splits a frame into 2-3 CRTC cycles for status panels and similar. The same mechanism scales to 64, 128, or 256 cycles per frame, each cycle just 1-4 scanlines tall, used to display tiny pre-rendered buffers or beam-raced 80-byte scanline buffers over the whole screen. That’s the basis of essentially every Twisted-Brain-style demo effect — see single-rasterline-rupture for the chassis and twisted-brain for an inventory of effects built on it.
Builds on / used by
- smooth-vertical-scroll — two-cycle rupture + R5 manipulation for sub-row vertical motion.
- single-rasterline-rupture — the extreme version of this technique used by modern Beeb demos.
- rvi — per-line C9 selection on top of single-scanline rupture, exploits the same Last-Line semantics.
- triggered-vsync — R7 mid-line trigger / blocked-VSync gotcha; relevant when the rupture timing intersects the C4=R7 boundary.
- crtc-counter-freeze — sibling experimental technique (R0=0 to suspend the chip entirely).
- crtc-internal-counters — the C0/C4/C9 counter model and Last-Line semantics that underpin the technique.
- crtc-6845, crtc-6845-advanced — chip-level latching behaviour.
- hardware-scrolling — the address arithmetic this technique splits across cycles.
- system-via — addressable latch bits for 10K/16K/20K screen wraparound select.
- via-timers — System VIA T2 one-shot used for the inter-cycle waits.
Measured in practice — two C64 → BBC ports (2026)
Source: beeb-port-kit-hardware-facts — facts measured during Kieran Connell’s two C64 → BBC ports, Paradroid (BBC Model B, August 2026) and Edge Grinder (BBC Master 128, September 2026). Instrument is jsbeeb driven through an MCP unless the entry says otherwise; b-em and b2 were the cross-checks. Each entry gives the date (or the port’s layer where the write-up carries no date), the emulator or hardware, and the port’s own write-up. Both ports are ruptures of exactly this kind: Paradroid a three-cycle MODE 1 rupture with a 10K hardware-scrolled strip (16 rows) on a Model B; Edge Grinder a two-cycle MODE 2 rupture (5-row panel at &3000 in both shadow banks, 34-row tail with a 20-row play area) on a Master 128, with a four-cycle variant on its title page.
- The per-register write windows, as they held after two wrong builds: R4 inside its own cycle before C4 reaches it; R6, R7 and R12/R13 inside the previous cycle (for R6 and R7 the precise rule is “before C4 reaches that row”, so the current cycle is fine while the row is still ahead: KC, 2026-09-07); R5 anywhere in the cycle but not near a boundary. Symptoms when wrong (R7 late: VSync never fires, the chip free-runs on the last cycle’s shape and the picture rolls; R6 late: display enable is a flip-flop cleared on match and cannot be re-raised) and the R5 trap (~29 extra scanlines from the 5-bit wrap) are written up on crtc-6845-advanced. These agree with the C0<2 / previous-cycle rules in the table above and add the failure modes (Paradroid Layer 3, jsbeeb; reconfirmed Edge 2026-09-02).
- Rows must sum to 39 or the picture rolls — confirmed by counting VSyncs: 1,000 fields in 39,936,000 cycles exactly (Paradroid Layer 3). The “R5 must sum to 0 or 8” pitfall above is the same constraint.
- Use T1 in continuous mode, not T2, for the inter-cycle waits. The worked example above uses T2 one-shot, as the retrosoftware demo does. Paradroid tried T2 first and moved to T1: T2 is one-shot only, so the interval starts when the handler writes
T2C-Hand every interrupt’s service latency feeds into the next interval. T1 auto-reloads from its latch at underflow, so the period is exact however late the service; restart it at VSync and the fires stay phase-locked. A latch write takes effect one reload later, so intervals are set one fire ahead (Paradroid Layer 3, jsbeeb, layer-3-scroll.md). See via-timers. - The VSync CA1 interrupt is serviced about 4 scanlines after the VSync edge; the timer chain itself is exact. Both ports carry a
-4 * SLterm for it. Timer fires that must land in a cycle should overshoot the boundary by a few rows — sized to reach it exactly, IRQ latency carried them into the previous cycle. The two ports’ T1 constants are tabulated on field-timing. - R7 for the panel cycle must go in at VSync, not at the first timer fire, or a panel cycle that reaches the stale R7 fires a second VSync and re-enters the handler mid-frame (Paradroid, 2026-08-21).
- Switching CRTC shapes costs malformed fields unless the writes are aligned to row 0 of a fresh frame, and a right-length field can still be in the wrong phase — jsbeeb showed no fault; b2 rolled and KC photographed it. Suppress VSync (
R7 = 255) across the intermediate cycles, exactly as the worked example does for cycle 1 (Paradroid, 2026-08-31). Details on crtc-6845-advanced; which emulator sees what on emulators. - Interlace must be off (
R8 = 0): the MOS leaves MODE 1 atR8 = 1, which moves VSync by half a scanline on alternate fields and a timer-placed split with it (Paradroid Layer 3). - Do the last disc load before the rupture is armed. With R7 parked where VSync never fires, DFS’s 8271 status poll at
&ACAEhung the second*LOADforever (Paradroid Layer 3, jsbeeb, bug-map-corruption.md). See filing-systems. Later (2026-09-09, jsbeeb 1.25.0): stopping VSync with R7 alone no longer reproduces the hang, so the cause is not pinned to VSync; and a rupture’s own T1 cadence cannot run across a filing-system call on a Master (changing T1 hung jsbeeb’s MOS) — keep loads away from the rupture either way (beeb-port-kit-hardware-facts-2026-11 §6). - Taking IRQ1V outright (both ports do) means disabling every interrupt source on both VIAs except System VIA CA1 and T1, or anything unserviced holds the IRQ line asserted forever. The MOS saves the interrupted A in
&FCbut not X or Y (Paradroid Layer 3). See interrupts.
Measured in practice — later ports (2026-09 to 2026-11)
From beeb-port-kit-hardware-facts-2026-11 §1: 1942 (Master 128, Sept 2026, built with the kit), Stryker’s Run (a 1986 BBC game rebuilt from disassembly, Oct 2026) and phX (Nov 2026).
The vertical total adjust displays — and where that puts the scrolling area
The primary source is Rich Talbot-Watkins’s write-up Line by line vertical scrolling on the Beeb and his working demo smoothscroll.ssd, which the kit had not cited before 1942 read them. See also smooth-vertical-scroll.
R6 = displayed rows + 1, because the vertical total adjust counts as one more character row for the R6 compare. Display enable then survives into the adjust and the CRTC fetches the next buffer row’s toplinescanlines — the bottom sliver a 1-scanline scroll needs. Rich’s demo setsR6 = 24 + 1for a 24-row window. Measured by 1942 (2026-09-08, jsbeeb 1.25.0, Master: 0 wrong of 14,784 pixels fetched by the adjust, all eight values ofline, field 39,936.00 cycles) and by the kit’stemplate/examples/vscrollon a Model B (15-row cycle,R6 = 16: 0 of 38,400 pixels wrong, 0 of 19,840 in the adjust). jsbeeb 1.25.0 only — not b2, beebjit or real hardware; Rich’s demo relies on it and runs, which is evidence about the 6845 but not a measurement of the sliver.- Put the scrolling area FIRST in the frame. The adjusts are
lineon the scrolling cycle and8 - lineon the other. With a static panel above the scrolling area the8 - linelands between them, visible, and must be blanked — a gap of up to 8 scanlines. Scrolling area first, and the same adjust falls at the end of the panel cycle, in the top border; the first visible line then sits a fixed distance from VSync whateverlineis. 1942 built both shapes: Rich’s — 2 CRTC cycles, 3 T1 fires, 272 lit lines with no gaps, 40 lines of blanking; the Paradroid-shaped first cut — 3 cycles, 6 fires, two visible 8-line gaps, 16 lines of blanking. - Only one R8 edge has to land on an exact scanline in that frame (the unblank at the first visible line); the panel-first shape needed four.
- Paradroid’s refusal to display the adjust cost it a row of play area, but its cost came from its own frame (a 10K wrap making the strip exactly 16 rows, and a panel above the play area forcing three cycles), not from the technique.
- The R5 worst case: a fire that lands in the adjust’s own last scanline. Rich’s demo writes the scrolling cycle’s R5 there and gets away with it by instruction order (R8, timer, R4, R5); 1942 writes it mid-cycle instead.
- Overscan: 1942 lights 272 lines (256-line playfield first, 16-line panel below, 40 lines of blanking) in an unchanged 312-line field, played on a real Master and display from 2026-09-28 — see monitor-crt.
Frame ends
- The 6845 decides a frame has ended at its last scanline’s C0 = 1, so in a one-row frame R4 must be rewritten before that row’s last scanline (Stryker’s Run’s one-row HUD frame, jsbeeb 2.10.2, 2026-10-23; seen right on b2). In one-line frames, entering them must happen in the current frame’s last line after C0 = 1, with no vertical adjust in the tail (phX, jsbeeb) — see single-rasterline-rupture.
- jsbeeb 2.10’s 6845 starts VSync the instant C4 = R7, so
R7 = 0may be written only once the last CRTC cycle is past its row 0, and a cycle’s R4 must be in place before that cycle’s row 0 ends (Isometrikum, jsbeeb 2.10.2, 2026-11-07; not tried on real hardware). See triggered-vsync.
This wiki is curated by Claude following the LLM-Wiki methodology — a human curates source documents, the LLM compiles structured cross-linked markdown. Content may contain errors, omissions, or stale claims. For authoritative information refer to the original source documents in the bbc-documents GitHub archive.