    .ifndef WITH_REPLAY_HUD
    .equ WITH_REPLAY_HUD,0
    .endif
    .ifndef WITH_FRAMED_PP_REPLAY
    .equ WITH_FRAMED_PP_REPLAY,0
    .endif
    .if WITH_FRAMED_PP_REPLAY
    .equ PANEL_FIRST,18
    .else
    .equ PANEL_FIRST,23
    .endif
| Big chrome "REPLAY" over the automatic goal replay (jdc 2026-10-26-r23), instead of the
| native VCR box (A <<  B ||>  C >, window plane rows 2-4, columns 2-9, tiles from $B026).
| r25: REPLAY on rows 0-2 and a smaller "X+B SKIP" (pad A + C) on rows 3-4 in the box's
| own 14 tiles (the game reloads them from ROM at every replay start).
| Called by replay.s every frame while its replay plays (ARST $A502). First playing frame:
| the 27 tiles go to the crowd meters' VRAM ($FC20, tile $7E1: crowd.s neither draws nor
| re-uploads them during the replay, and re-uploads them right after). Every frame: the
| window plane rows 1-3, columns 2-10 show them (priority, palette 0 greys) and row 4,
| columns 2-9 (the box's shadow) is cleared. On exit the game redraws its whole window panel
| there, so nothing of ours stays. Tiles: replaytitle.py (Open Sans Condensed ExtraBold
| Italic, outline, silver bands).
    .equ ARCNT,0xFFF73A
    .equ TILE,0x7E1
    .equ VDATA,0xC00000
    .equ VCTRL,0xC00004
    .text
    .globl _start
_start:
    .if WITH_REPLAY_HUD
    bra.w draw_title
    bra.w capture_panel
    .if WITH_FRAMED_PP_REPLAY
    .ascii "PPFR"                    | declared snapshot protocol; never executed
    .word 18,180
    .endif
    .endif
draw_title:
    movem.l %d0-%d5/%a0-%a1,-(%sp)
    move.w %sr,-(%sp)
    ori.w #0x700,%sr
    lea VDATA,%a1
    .if WITH_REPLAY_HUD
    bsr.w restore_panel
    .endif
    move.w 0xFFFFB026,%d5              | the VCR box's own tiles (reloaded from ROM by every replay)
    cmpi.w #1,ARCNT
    bne.s 2f
    .if WITH_REPLAY_HUD
    move.w %d5,%d0
    addi.w #14,%d0                  | native VCR allocation is76tiles, title uses14..40
    lsl.w #5,%d0
    .else
    move.w #TILE*32,%d0                | tiles, once: REPLAY to the meters' VRAM,
    .endif
    bsr.w wcmd
    lea title(%pc),%a0
    move.w #27*8-1,%d2
1:  move.l (%a0)+,(%a1)
    dbra %d2,1b
    move.w %d5,%d0                     | the hint over the box's tiles
    lsl.w #5,%d0
    .if WITH_REPLAY_HUD
    bsr.w wcmd
    .else
    bsr.s wcmd
    .endif
    lea hint(%pc),%a0
    move.w #14*8-1,%d2
11: move.l (%a0)+,(%a1)
    dbra %d2,11b
2:  moveq #0,%d3                       | rows 0..2: REPLAY, 9 tiles from column 2
    .if WITH_REPLAY_HUD
    move.w %d5,%d4
    addi.w #0x8000+14,%d4
    .else
    move.w #0x8000+TILE,%d4
    .endif
3:  bsr.s cell
    moveq #8,%d2
4:  move.w %d4,(%a1)
    addq.w #1,%d4
    dbra %d2,4b
    addq.w #1,%d3
    cmpi.w #3,%d3
    bcs.s 3b
    ori.w #0x8000,%d5                  | rows 3..4: X+B SKIP, 7 tiles, then the box's last column
5:  bsr.s cell
    moveq #6,%d2
6:  move.w %d5,(%a1)
    addq.w #1,%d5
    dbra %d2,6b
    move.w #0x07FF,(%a1)
    move.w #0x07FF,(%a1)
    addq.w #1,%d3
    cmpi.w #5,%d3
    bcs.s 5b
    move.w (%sp)+,%sr
    movem.l (%sp)+,%d0-%d5/%a0-%a1
    rts
cell:                                  | d3 = row -> VDP write at the window plane, column 2
    move.w 0xFFFFB00E,%d1              | log2 of the plane width
    move.w %d3,%d0
    lsl.w %d1,%d0
    addq.w #2,%d0
    add.w %d0,%d0
    add.w 0xFFFFB00C,%d0
wcmd:                                  | d0 = VRAM address -> write command
    moveq #0,%d1
    move.w %d0,%d1
    lsl.l #2,%d1
    lsr.w #2,%d1
    swap %d1
    ori.l #0x40000000,%d1
    move.l %d1,VCTRL
    rts
    .if WITH_REPLAY_HUD
| Caller owns the declared90/180-byte map on its stack; preserve full ABI.
| F670..F673 is a transient pointer, separate from shootout F65C..F66F.
capture_panel:
    movem.l %d0-%d3/%a0-%a1,-(%sp)
    move.w %sr,-(%sp)
    ori.w #0x700,%sr
    move.l %a0,0xFFFFF670
    lea VDATA,%a1
    move.w #0x8F02,VCTRL
    moveq #PANEL_FIRST,%d3
capture_row:
    bsr.w panel_address
    andi.l #0xBFFFFFFF,%d1
    move.l %d1,VCTRL
    moveq #8,%d2
capture_word:
    move.w (%a1),(%a0)+
    dbra %d2,capture_word
    addq.w #1,%d3
    cmpi.w #28,%d3
    bcs.s capture_row
    move.w (%sp)+,%sr
    movem.l (%sp)+,%d0-%d3/%a0-%a1
    rts
restore_panel:
    move.w #0x8F02,VCTRL
    movea.l 0xFFFFF670,%a0
    move.l %a0,%d0
    beq.s restore_done
    moveq #PANEL_FIRST,%d3
restore_row:
    bsr.s panel_address
    move.l %d1,VCTRL
    moveq #8,%d2
restore_word:
    move.w (%a0)+,(%a1)
    dbra %d2,restore_word
    addq.w #1,%d3
    cmpi.w #28,%d3
    bcs.s restore_row
restore_done:
    rts
panel_address:
    moveq #0,%d1
    move.w %d3,%d1
    lsl.w #7,%d1
    swap %d1
    ori.l #0x60000003,%d1
    rts
    .endif
    .even
title:
    .long 0x00000000,0x00000000,0x00000000,0x00000044,0x00000041,0x00000041,0x00000441,0x00000411
    .long 0x00000000,0x00000000,0x00000000,0x44444440,0x11111144,0x11111114,0x11111114,0x11411114
    .long 0x00000000,0x00000000,0x00000000,0x04444444,0x04111111,0x04111111,0x44111111,0x41111444
    .long 0x00000000,0x00000000,0x00000000,0x44444444,0x14411111,0x14411111,0x14411111,0x44111141
    .long 0x00000000,0x00000000,0x00000000,0x44400444,0x11440411,0x11140411,0x11144411,0x11144111
    .long 0x00000000,0x00000000,0x00000000,0x44400000,0x11400000,0x11400004,0x14400004,0x14000004
    .long 0x00000000,0x00000000,0x00000000,0x44444440,0x41111140,0x41111140,0x11111140,0x11111140
    .long 0x00000000,0x00000000,0x00000000,0x44444404,0x41111444,0x41111441,0x41111441,0x41111411
    .long 0x00000000,0x00000000,0x00000000,0x44444000,0x11114000,0x11144000,0x11440000,0x11400000
    .long 0x00000433,0x00000455,0x00000455,0x00004466,0x00004666,0x00004555,0x00004333,0x00004333
    .long 0x33433334,0x55455554,0x55455554,0x66666644,0x66666644,0x55555444,0x33333404,0x33333404
    .long 0x43333400,0x45555444,0x45555555,0x46666666,0x66666664,0x55554444,0x33334000,0x33334000
    .long 0x04333343,0x44555545,0x44555545,0x44666666,0x46666666,0x45555555,0x43333444,0x43334400
    .long 0x33344333,0x55544555,0x55544555,0x66444666,0x64446666,0x44045555,0x40043333,0x00043333
    .long 0x34000044,0x54000045,0x54000445,0x44000466,0x40004466,0x40004555,0x40004333,0x40044333
    .long 0x33333340,0x55555540,0x55455540,0x66466640,0x66466640,0x54455540,0x33333340,0x33333340
    .long 0x44333333,0x04555555,0x04555555,0x04666666,0x04666664,0x04555544,0x04333340,0x04333340
    .long 0x34400000,0x54000000,0x44000000,0x40000000,0x40000000,0x00000000,0x00000000,0x00000000
    .long 0x00044111,0x00041111,0x00043333,0x00043333,0x00044444,0x00000000,0x00000000,0x00000000
    .long 0x41111444,0x44111141,0x44333343,0x44333343,0x44444444,0x00000000,0x00000000,0x00000000
    .long 0x11144444,0x11111114,0x33333344,0x33333344,0x44444444,0x00000000,0x00000000,0x00000000
    .long 0x41114000,0x11114000,0x33334000,0x33334000,0x44444000,0x00000000,0x00000000,0x00000000
    .long 0x00441114,0x00411111,0x00433333,0x00433333,0x00444444,0x00000000,0x00000000,0x00000000
    .long 0x44441111,0x11141111,0x33333334,0x33433334,0x44444444,0x00000000,0x00000000,0x00000000
    .long 0x11111140,0x44411140,0x44333340,0x04333340,0x04444440,0x00000000,0x00000000,0x00000000
    .long 0x04111140,0x04111140,0x44333440,0x43333400,0x44444400,0x00000000,0x00000000,0x00000000
    .long 0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000,0x00000000
| end of title
hint:
    .long 0x55555555,0x56666666,0x56444444,0x56444444,0x56334433,0x56334433,0x56433334,0x56443344
    .long 0x55555555,0x66666666,0x44444444,0x44444444,0x44444444,0x44433444,0x44433444,0x43333334
    .long 0x55555555,0x66666666,0x44444444,0x44444444,0x33333444,0x33443344,0x33443344,0x33333444
    .long 0x55555555,0x66666666,0x44444444,0x44444444,0x44433334,0x44334433,0x44334444,0x44433334
    .long 0x55555555,0x66666666,0x44444444,0x44444444,0x43344334,0x43343344,0x43333444,0x43334444
    .long 0x55555555,0x66666666,0x44444444,0x44444444,0x33333343,0x44334443,0x44334443,0x44334443
    .long 0x55555555,0x66666665,0x44444465,0x44444465,0x33334465,0x34433465,0x34433465,0x33334465
    .long 0x56433334,0x56334433,0x56334433,0x56444444,0x56444444,0x56444444,0x56666666,0x55555555
    .long 0x44433444,0x44433444,0x44444444,0x44444444,0x44444444,0x44444444,0x66666666,0x55555555
    .long 0x33443344,0x33443344,0x33333444,0x44444444,0x44444444,0x44444444,0x66666666,0x55555555
    .long 0x44444433,0x44334433,0x44433334,0x44444444,0x44444444,0x44444444,0x66666666,0x55555555
    .long 0x43333444,0x43343344,0x43344334,0x44444444,0x44444444,0x44444444,0x66666666,0x55555555
    .long 0x44334443,0x44334443,0x33333343,0x44444444,0x44444444,0x44444444,0x66666666,0x55555555
    .long 0x34444465,0x34444465,0x34444465,0x44444465,0x44444465,0x44444465,0x66666665,0x55555555
| end of hint
