    .ifndef WITH_REFINEMENTS
    .equ WITH_REFINEMENTS,0
    .endif
| Finished slots are read-only results, not another native Regular Season match.
| +0 main-menu Start; +4 isfinished; +8 label; +12 Game text; +16 completed menu lock;
| +20 hush (all sound off, for seasonend.s statistics; moved here r9: seasonend.s is full);
| +24 setup (r10: table.s screen set-up $2FC004, then the SPORTS background at half brightness).
| r10 (jdc): text goes to the FRONT plane ($E000, B02E = 0). In the back plane ($C000) each
| glyph replaced a background cell, so its transparent pixels showed the dark backdrop: dark
| boxes behind every letter. In front the background shows between the letters.
    .equ HDR,0xFFE500
    .equ TEAM,0xFFE532
    .equ STR,0xFFE540
    .equ SEL,0xFFE3FC                  | menu-only word; no SRAM format change
    .equ SLOT,0xFFF06A
    .equ BG,0xFFE5C0                   | 4 saved background words of the marker cells
    .equ NEWPICK,0xFFE3FE              | r39: $4E57 = the main menu's Play Mode shows "Start New ..."
    .equ PICKED,0x4E57
    .text
    .globl _start
_start:
    bra.w entry
    bra.w isfinished
    bra.w label
    bra.w gametext
    bra.w lockmenu
    bra.w hush
    bra.w setup
    bra.w step                          | +28 r39: Play Mode step inside a finished slot
    bra.w arrive                        | +32 r39: entering a slot from the right
entry:
    movem.l %d0-%d7/%a0-%a6,-(%sp)
    bsr.w isfinished
    movem.l (%sp)+,%d0-%d7/%a0-%a6
    beq.s view
    .if WITH_TRANSFERS
    move.w %sr,-(%sp)
    movem.l %d0-%d7/%a0-%a6,-(%sp)
    jsr 0x250000
    tst.l %d0
    beq.s transfer_continue
    movem.l (%sp)+,%d0-%d7/%a0-%a6
    move.w (%sp)+,%sr
    jmp 0x172FA
transfer_continue:
    movem.l (%sp)+,%d0-%d7/%a0-%a6
    move.w (%sp)+,%sr
    .endif
    jsr 0x2EB03C                       | freeze/restore season settings before native Auto conversion
    .word 0x3F38,0xD052,0x31D7,0xD05A | displaced Start prologue, before the native settings-save call
    jmp 0xF8446                       | live/new/native games retain the complete original Start path
view:
    cmpi.w #PICKED,NEWPICK            | r39 (jdc): "Start New Full Season" chosen in the main menu:
    bne.s 0f                          | straight to the confirmation; cancel = back to the menu
    clr.w NEWPICK
    move.w #0x7F,SEL
    bra.w confirm
0:  lea HDR,%a0
    move.l #0x1000,%d0
    moveq #16,%d1
    jsr 0x1A244
    move.w HDR+6,%d0
    subq.w #1,%d0
    move.w %d0,TEAM
    clr.w SEL                         | 2026-10-26-r6: straight to this menu (jdc); the results
    bra.s redraw                      | only on See Results
results:
    move.w #1,0xFFE536                | seasonend.s DIRECT (r11): club page, Start = back here
    bra.s 1f
leaders:
    move.w #2,0xFFE536                | scoring leaders of that season first (r11, jdc)
1:  jsr 0x2E3008                      | existing all-club statistics / leaders, never writes a save
    clr.w 0xFFE536
redraw:
    bsr.w setup
    lea title(%pc),%a0
    moveq #4,%d0
    moveq #10,%d1
    bsr.w line
    lea again(%pc),%a0
    moveq #11,%d0
    moveq #6,%d1
    bsr.w line
    lea lead(%pc),%a0
    moveq #14,%d0
    moveq #6,%d1
    bsr.w line
    moveq #17,%d0
    moveq #6,%d1
    lea nfull(%pc),%a0
    cmpi.w #2,SLOT
    bne.s 1f
    lea nlight(%pc),%a0
1:  cmpi.w #3,SLOT
    bne.s 2f
    lea nmini(%pc),%a0
2:  bsr.w line
    lea back(%pc),%a0
    moveq #20,%d0
    moveq #6,%d1
    bsr.w line
    lea help(%pc),%a0
    moveq #25,%d0
    moveq #1,%d1
    bsr.w line
    bsr.w keepbg
    move.w SEL,%d0
    mulu.w #3,%d0
    addi.w #11,%d0
    moveq #3,%d1
    lea marker(%pc),%a0
    bsr.w line
    bsr.w fade
loop:
    bsr.w keys
    .if WITH_REFINEMENTS
    btst #7,%d1
    beq.s finished_keep_choice
    jmp 0x172FA
finished_keep_choice:
    .endif
    btst #0,%d1
    beq.s 1f
    bsr.w unmark                       | 2026-10-26-r5: Up/Down only move the marker
    subq.w #1,SEL                      | (was a full redraw and fade for every step)
    bpl.s 3f
    move.w #3,SEL
    bra.s 3f
1:  btst #1,%d1
    beq.s 2f
    bsr.w unmark
    addq.w #1,SEL
    cmpi.w #4,SEL
    bcs.s 3f
    clr.w SEL
3:  lea marker(%pc),%a0
    bsr.w markat
    bra.s loop
2:  .if WITH_REFINEMENTS
    andi.w #0x20,%d1                | XboxB/nativeC selects; A/Start backs out.
    .else
    andi.w #0xA0,%d1                | Legacy Start or GenesisC selects.
    .endif
    beq.s loop
    tst.w SEL
    beq.w results
    cmpi.w #1,SEL
    beq.w leaders
    cmpi.w #2,SEL
    beq.s confirm
    jmp 0x172FA
confirm:
    bsr.w setup
    lea replace(%pc),%a0
    moveq #9,%d0
    moveq #3,%d1
    bsr.w line
    lea keep(%pc),%a0
    moveq #12,%d0
    moveq #3,%d1
    bsr.w line
    lea yes(%pc),%a0
    moveq #17,%d0
    moveq #3,%d1
    bsr.w line
    lea no(%pc),%a0
    moveq #20,%d0
    moveq #3,%d1
    bsr.w line
    bsr.w fade
1:  bsr.w keys                       | do not carry the selection press into confirmation
    andi.w #0xE0,%d3
    bne.s 1b
2:  bsr.w keys
    btst #7,%d1
    beq.s 3f
    cmpi.w #0x7F,SEL                  | came from the main menu: Start cancels back to it
    bne.w redraw
    jmp 0x172FA
3:
    .if WITH_REFINEMENTS
    btst #5,%d1
    beq.s 2b
    .else
    andi.w #0x60,%d3
    cmpi.w #0x60,%d3
    bne.s 2b
    .endif
    jsr 0x2AA00C                    | existing reset of the selected slot only; others retained
    jmp 0x172FA

unmark:                                 | put back the background word saved by keepbg (the
    movem.l %d0-%d1/%a0,-(%sp)          | SPORTS pattern shares the text plane: any printed
    move.w SEL,%d0                      | glyph, even a space, leaves a dark box)
    bsr.s cell
    ori.l #0x40000000,%d1               | VRAM write
    add.w %d0,%d0
    lea BG,%a0
    move.w %sr,-(%sp)
    ori.w #0x700,%sr
    move.l %d1,0xC00004
    move.w (%a0,%d0.w),0xC00000
    move.w (%sp)+,%sr
    movem.l (%sp)+,%d0-%d1/%a0
    rts
keepbg:                                 | the three marker cells before any marker is drawn
    movem.l %d0-%d2/%a0,-(%sp)
    lea BG,%a0
    moveq #0,%d2
1:  move.w %d2,%d0
    bsr.s cell
    move.w %sr,-(%sp)
    ori.w #0x700,%sr
    move.l %d1,0xC00004                 | VRAM read
    move.w 0xC00000,(%a0)+
    move.w (%sp)+,%sr
    addq.w #1,%d2
    cmpi.w #4,%d2                       | four choices (r11)
    bcs.s 1b
    movem.l (%sp)+,%d0-%d2/%a0
    rts
cell:                                   | d0 = choice 0..2 -> d1 = VDP read command of its
    moveq #0,%d1                        | marker cell: plane $E000, 128 cells, row 11+3n col 3
    move.w %d0,%d1
    mulu.w #3,%d1
    addi.w #11,%d1
    lsl.w #8,%d1                        | 128-cell rows ($11952: row << 7, then words)
    addi.w #0xE006,%d1                  | front plane (r10; was the back plane $C000)
    lsl.l #2,%d1                        | high word = address bits 15..14
    lsr.w #2,%d1                        | low word = address bits 13..0
    swap %d1
    rts
markat:                                 | A0 at the selected row's marker column
    move.w SEL,%d0
    mulu.w #3,%d0
    addi.w #11,%d0
    moveq #3,%d1
    bra.w line
hush:                                  | every sound channel ends ($D3D4: 8 x pointer.l, delay.w;
    movem.l %d3/%a1,-(%sp)             | -1 = free, as $1A304 does for the music channel), then
    move.w %sr,-(%sp)                  | the voices are silenced ($1A264, the pause's sound off)
    move.w #0x2700,%sr
    lea 0xFFD3D4,%a1
    moveq #7,%d3
1:  move.l #-1,(%a1)
    addq.w #6,%a1
    dbra %d3,1b
    clr.l 0xFFD182
    clr.b 0xFFD186
    move.w (%sp)+,%sr
    jsr 0x1A264
    movem.l (%sp)+,%d3/%a1
    rts

setup:                                  | screen set-up, then palette 3 (the SPORTS pattern: $6000
    jsr 0x2FC004                        | attribute) at 3/4 brightness in the fade target buffer
    movem.l %d0-%d5/%a0,-(%sp)
    lea 0xFFBD8A,%a0                    | palette 3, colours 1..15
    moveq #14,%d5
1:  move.w (%a0),%d0                    | each of B, G, R: n - n/4, even (0..14)
    moveq #0,%d4
    moveq #8,%d2
2:  move.w %d0,%d3
    lsr.w %d2,%d3
    andi.w #0xE,%d3
    move.w %d3,%d1
    lsr.w #2,%d1
    sub.w %d1,%d3
    andi.w #0xE,%d3
    lsl.w %d2,%d3
    or.w %d3,%d4
    subq.w #4,%d2
    bpl.s 2b
    move.w %d4,(%a0)+
    dbra %d5,1b
    movem.l (%sp)+,%d0-%d5/%a0
    rts
| D0=0/Z only for a completed Full/Light/Mini slot; preserve all other inputs.
isfinished:
    movem.l %d1-%d3/%a0-%a1,-(%sp)
    suba.w #20,%sp
    tst.w 0xFFF06C
    beq.s 8f
    movea.l %sp,%a0
    move.l #0x1000,%d0
    moveq #16,%d1
    jsr 0x1A244
    cmpi.l #0x5345534E,(%sp)
    bne.s 8f
    tst.w 12(%sp)
    bne.s 8f
    tst.w 6(%sp)
    beq.s 8f
    move.w 8(%sp),%d0
    cmp.w 10(%sp),%d0
    bcs.s 8f
    lea 16(%sp),%a0
    move.l #0x1210,%d0
    moveq #2,%d1
    jsr 0x1A244
    cmpi.w #3,16(%sp)
    bcs.s 8f
    moveq #0,%d0
    bra.s 9f
8:  moveq #-1,%d0
9:  adda.w #20,%sp
    movem.l (%sp)+,%d1-%d3/%a0-%a1
    tst.l %d0
    rts
lockmenu:
    bsr.s isfinished
    bne.s 9f
    move.w #4,0xFFE3F0
    move.w 0xFFE3E6,%d0
    subq.w #1,%d0
    move.w %d0,0xFFE3F4
    move.w %d0,0xFFD04C
    cmp.w 0xFFD04E,%d0                 | 2026-10-26-r4: a stale Away equal to your club showed
    bne.s 9f                           | "Edmonton vs Edmonton" logos on the finished menu
    addq.w #1,%d0
    andi.w #31,%d0
    move.w %d0,0xFFD04E
9:  rts
gametext:
    bsr.w isfinished
    bne.s 9f
    lea 0xFFE3A0,%a0
    lea ended(%pc),%a1
    moveq #10,%d1
1:  move.w (%a1)+,(%a0)+
    dbra %d1,1b
    moveq #0,%d0
9:  tst.l %d0
    rts
label:
    cmpi.w #PICKED,NEWPICK            | r39: the second choice of a finished slot
    bne.s 0f
    pea newfull(%pc)
    cmpi.w #2,SLOT
    bne.s 4f
    addq.l #4,%sp
    pea newlight(%pc)
4:  cmpi.w #3,SLOT
    bne.s 2f
    addq.l #4,%sp
    pea newmini(%pc)
    bra.s 2f
0:  pea oldfull(%pc)
    cmpi.w #2,SLOT
    bne.s 1f
    addq.l #4,%sp
    pea oldlight(%pc)
1:  cmpi.w #3,SLOT
    bne.s 2f
    addq.l #4,%sp
    pea oldmini(%pc)
2:  jsr 0x20961A                     | identical text-print calling convention to seasonmenu.dispsel
    movea.l (%sp)+,%a1
    addq.l #4,%sp
    jmp 0x11BA4
| step: d2 = direction. Z set = handled here (stay on the slot, the label changed),
| Z clear = go on to the next/previous slot. Keeps d1-d3.
step:
    bsr.w isfinished
    bne.s 9f
    tst.w %d2
    bmi.s 1f
    cmpi.w #PICKED,NEWPICK
    beq.s 9f                          | right from Start New: next slot
    move.w #PICKED,NEWPICK            | right from See Old: Start New
    bra.s 8f
1:  cmpi.w #PICKED,NEWPICK
    bne.s 9f                          | left from See Old: previous slot
    clr.w NEWPICK                     | left from Start New: See Old
8:  moveq #0,%d0
    rts
9:  clr.w NEWPICK
    moveq #1,%d0
    rts
arrive:
    clr.w NEWPICK
    tst.w %d2
    bpl.s 9f
    move.l %d0,-(%sp)
    bsr.w isfinished
    bne.s 8f
    move.w #PICKED,NEWPICK
8:  move.l (%sp)+,%d0
9:  rts
keys:
    jsr 0x175D8
    jsr 0x11340
    move.w %d1,-(%sp)
    move.w %d3,-(%sp)
    jsr 0x11358
    or.w (%sp)+,%d3
    or.w (%sp)+,%d1
    .if WITH_REFINEMENTS
    jsr 0x25B028
    .endif
    rts
fade:
    bclr #2,0xFFBF78
    move.w #0x18,0xFFBD26
    move.w #0x79,-(%sp)
    jsr 0x11156
    rts
line:                               | ASCIZ A0 at row D0, column D1; same native font as results
    move.w %d1,0xFFB028
    move.w %d0,0xFFB02A
    lea STR+2,%a1
1:  move.b (%a0)+,(%a1)+
    bne.s 1b
    move.l %a1,%d0
    btst #0,%d0
    beq.s 2f
    clr.b (%a1)+
2:  lea STR,%a0
    move.l %a1,%d0
    sub.l %a0,%d0
    move.w %d0,(%a0)
    movea.l %a0,%a1
    cmpi.w #25,0xFFB02A
    blo.s grey_help_positioned
    jsr 0x25D004
grey_help_positioned:
    clr.w 0xFFB02E                      | front plane (r10)
    clr.w 0xFFB02C
    jmp 0x11BA4
title:   .asciz "Season Complete"
again:   .asciz "See Results"
lead:    .asciz "Scoring Leaders"
nfull:   .asciz "Start New Full Season"
nlight:  .asciz "Start New Light Season"
nmini:   .asciz "Start New Mini Season"
back:    .asciz "Back to Main Menu"
help:
    .if WITH_REFINEMENTS
    .asciz "U/D Choose B Select A/Start Back"
    .else
    .asciz "U/D choose  Xbox B or Start select"
    .endif
marker:  .asciz "*"
replace: .asciz "Replace this finished season?"
keep:    .asciz "Other seasons are kept."
yes:     .asciz "B = start new season"
no:      .asciz "A/Start = cancel"
    .even
oldfull: .word 22
         .ascii "See Old Full Season "
oldlight:.word 22
         .ascii "See Old Light Season"
oldmini: .word 22
         .ascii "See Old Mini Season "
newfull: .word 22                       | r39: 20 characters - longer labels leave their tail
         .ascii "Restart Full Season "      | behind on the row (the menu draws only the new text)
newlight:.word 22
         .ascii "Restart Light Season"
newmini: .word 22
         .ascii "Restart Mini Season "
ended:   .word 22
         .ascii "Season finished     "
