experimental/mtap.s

Download file

Release 2026-11-04-r2 · SHA256 74a5558d111030654d456d973f6847282bb140d037c56d522782fb08f9932da3 · Click a line number for a direct link.

1| Three / Four human teammates with 4-Way Play (jdc 2026-10-26-r16).2| The game's own "Three" (Players 5) is 2 v 1 and "Four" (6) 2 v 2, and its playoff modes3| have at most two humans. Here Three / Four are teammates in every mode: after the native4| side assignment ($17E42, end $17FE0) pads 2..4 join pad 1's side. TM ($FFF07C) holds the5| count (3 / 4, else 0), set by the season menu's Players row, so it also covers the6| season's playoffs, where the game itself assigns only pads 1 and 2.7| +0 $17FE0 (movem.l (sp)+,d0-d3/a0-a1 / rts -> jmp); +4 coop: Z set when Players is8| Two - Teammates, Three or Four; +8 Players row: d3 = the native new value -> d3 = ours.9    .equ PLAYERS,0xFFFFD04A10    .equ MTAP,0xFFFFD046               | 4-Way Play present11    .equ PMODE,0xFFFFD04812    .equ TM,0xFFFFF07C13    .equ SLOTVIEW,0xFFFFF06C14    .text15    .globl _start16_start:17    bra.w sides18    bra.w coop19    bra.w row2021sides:22    .if WITH_QUICKGAME23    tst.w 0xFFFFF84C24    beq.s ordinary_sides25    jsr 0x22900C26    bra.w 9f27ordinary_sides:28    .endif29    tst.w SLOTVIEW30    bne.s adapter_check31    tst.w PMODE32    beq.s adapter_check33    cmpi.w #3,PMODE34    bhi.s adapter_check35    jsr 0x2EB028                     | standalone playoffs: own saved count, including native head-to-head36adapter_check:37    tst.w MTAP38    beq.s 9f39    jsr 0x2EA614                       | a new adapter game starts with empty goalie input latches40    tst.w PMODE                        | league: the visible Players value is authoritative41    beq.s league_count42    btst #0,0xFFFFC2FA                  | preserve two-actor shootout assignment43    bne.s 9f44    move.w TM,%d045    bra.s 1f46league_count:47    moveq #3,%d048    cmpi.w #5,PLAYERS49    beq.s 1f50    moveq #4,%d051    cmpi.w #6,PLAYERS52    bne.s 9f531:  cmpi.w #3,%d054    bcs.s 9f55    move.w 0xFFFFC328,%d1              | pad 1's side: 1 home, 2 away56    beq.s 9f57    move.w %d1,0xFFFFC32A58    move.w %d1,0xFFFFC32C59    clr.w 0xFFFFC32E60    cmpi.w #4,%d061    bcs.s 9f62    move.w %d1,0xFFFFC32E639:  movem.l (%sp)+,%d0-%d3/%a0-%a1     | the replaced native exit64    rts6566coop:                                  | Z = co-op (3, 5, 6); registers kept67    cmpi.w #3,PLAYERS68    beq.s 9f69    cmpi.w #5,PLAYERS70    beq.s 9f71    cmpi.w #6,PLAYERS729:  rts7374row:                                   | d3 = native new Players value (old one in PLAYERS)75    movem.l %d0-%d2/%a0,-(%sp)76    lea seq2(%pc),%a077    moveq #2,%d2                       | entries78    tst.w MTAP79    beq.s 1f80    lea seq4(%pc),%a081    moveq #4,%d2821:  moveq #0,%d1                       | index of the old value (default 0)832:  move.b (%a0,%d1.w),%d084    ext.w %d085    cmp.w PLAYERS,%d086    beq.s 3f87    addq.w #1,%d188    cmp.w %d2,%d189    bcs.s 2b90    moveq #0,%d1913:  move.w PLAYERS,%d0                 | Right: old + 1 (6 wraps to 0), else Left92    addq.w #1,%d093    cmp.w %d0,%d394    beq.s 4f95    cmpi.w #6,PLAYERS96    bne.s 5f97    tst.w %d398    bne.s 5f994:  addq.w #1,%d1100    cmp.w %d2,%d1101    bcs.s 6f102    moveq #0,%d1103    bra.s 6f1045:  subq.w #1,%d1105    bpl.s 6f106    move.w %d2,%d1107    subq.w #1,%d11086:  move.b (%a0,%d1.w),%d3109    ext.w %d3110    clr.w TM111    cmpi.w #5,%d3112    bne.s 7f113    move.w #3,TM1147:  cmpi.w #6,%d3115    bne.s 8f116    move.w #4,TM1178:  movem.l (%sp)+,%d0-%d2/%a0118    rts119seq2: .byte 1,3120seq4: .byte 1,3,5,6121    .even122