experimental/quickgame.s

Download file

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

1    .ifndef WITH_QUICKGAME_CPU2    .equ WITH_QUICKGAME_CPU,03    .endif4    .ifndef WITH_ALLSTAR_CPU5    .equ WITH_ALLSTAR_CPU,06    .endif7| Current policy: Quickgame human splits; Allstar also offers1vsCPU.8| Legacy builds retain the preceding Quickgame-only CPU option exactly.9| +0 enter, +4 player label, +8 player step, +12 side commit.10| F84C active, F84E choice0..3 humans, optional4 CPU. Both survive native game-RAM clearing B000..D03D.11    .equ ACTIVE,0xFFFFF84C12    .equ CHOICE,0xFFFFF84E13    .text14    .globl _start15_start:16    bra.w enter17    bra.w label18    bra.w step19    bra.w sides20    bra.w gameend21    bra.w table_gate22    bra.w prelist_gate23    bra.w shootout_pad24    bra.w attempt_gate25    bra.w demo_gate26effective:27    move.w CHOICE,%d028    .if WITH_QUICKGAME_CPU29    .if WITH_ALLSTAR_CPU30    cmpi.w #1,0xFFFFF85031    bne.s human_choice            | CPU is available ONLY in the selected Allstar mode32    .else33    tst.w 0xFFFFF850               | Allstar retains exactly its four human splits34    bne.s human_choice35    .endif36    cmpi.w #4,%d037    beq.s ready                   | CPU opponent works with ordinary two-port pads too38human_choice:39    .endif40    cmpi.w #3,%d041    bls.s choice_valid42    moveq #0,%d043choice_valid:44    tst.w 0xFFFFD04645    bne.s ready46    moveq #0,%d0                   | without adapter only two physical pads exist47ready:48    rts49encoding:50    .if WITH_QUICKGAME_CPU51    cmpi.w #4,%d052    bne.s human_encoding53    moveq #1,%d3                  | native one human, home side; CPU away54    move.w %d3,0xFFFFD04A55    clr.w 0xFFFFF07C56    rts57human_encoding:58    .endif59    move.w %d0,%d360    cmpi.w #2,%d361    bcs.s short_count62    moveq #2,%d363short_count:64    addq.w #4,%d3                  | native4=two opponents,5=three,6=four65    move.w %d3,0xFFFFD04A66    clr.w 0xFFFFF07C               | never dispatch the cooperative count override67    rts68enter:69    move.w #1,ACTIVE70    clr.w 0xFFFFD048               | native exhibition uses regular-game engine71    clr.w 0xFFFFD07472    movem.l %d0/%d3,-(%sp)73    .if WITH_QUICKGAME_CPU74    bsr.w effective75    move.w %d0,CHOICE76    bsr.w encoding77    .else78    bsr.s effective79    bsr.s encoding80    .endif81    movem.l (%sp)+,%d0/%d382    rts83label:84    move.l %a0,-(%sp)85    .if WITH_QUICKGAME_CPU86    bsr.w effective87    .else88    bsr.s effective89    .endif90    mulu.w #22,%d091    lea labels(%pc),%a092    adda.w %d0,%a093    move.l %a0,%d094    movea.l (%sp)+,%a095    rts96step:97    movem.l %d0-%d1,-(%sp)98    .if WITH_QUICKGAME_CPU99    bsr.w effective100    .else101    bsr.s effective102    .endif103    tst.w 0xFFFFD046104    .if WITH_QUICKGAME_CPU105    bne.s adapter_step106    .if WITH_ALLSTAR_CPU107    cmpi.w #1,0xFFFFF850108    bne.s selected                | no adapter: human-only Quickgame remains1v1109    .else110    tst.w 0xFFFFF850111    bne.s selected                | legacy no adapter: Allstar remains1v1112    .endif113    eori.w #4,%d0                 | permitted mode:1v1 <->1vsCPU114    bra.s selected115adapter_step:116    .else117    beq.s selected118    .endif119    tst.w %d2120    bmi.s left121    addq.w #1,%d0122    bra.s wrap123left:124    subq.w #1,%d0125wrap:126    .if WITH_QUICKGAME_CPU127    .if WITH_ALLSTAR_CPU128    cmpi.w #1,0xFFFFF850129    bne.s four_humans             | Quickgame remains exactly its four human splits130    .else131    tst.w 0xFFFFF850132    bne.s four_humans133    .endif134    tst.w %d0135    bpl.s cpu_wrap_high136    moveq #4,%d0137    bra.s selected138cpu_wrap_high:139    cmpi.w #4,%d0140    bls.s selected141    moveq #0,%d0142    bra.s selected143four_humans:144    .endif145    andi.w #3,%d0146selected:147    move.w %d0,CHOICE148    .if WITH_QUICKGAME_CPU149    bsr.w encoding150    .else151    bsr.s encoding152    .endif153    movem.l (%sp)+,%d0-%d1154    rts155sides:156    jsr 0x2EA614                   | reset all adapter keeper input latches on new game157    movem.l %d0/%a0,-(%sp)158    bsr.w effective159    lsl.w #3,%d0160    lea assignments(%pc),%a0161    adda.w %d0,%a0162    move.l (%a0)+,0xFFFFC328163    move.l (%a0)+,0xFFFFC32C164    clr.w 0xFFFFF07C165    lea 0xFFFFCE66,%a0166    moveq #7,%d0167no_other_matches:168    move.w #4,8(%a0)              | no CPU-only other-game highlights in an exhibition169    adda.w #16,%a0170    dbra %d0,no_other_matches171    movem.l (%sp)+,%d0/%a0172    rts173assignments:174    .word 1,2,0,0                 | P1 home / P2 away175    .word 1,2,2,0                 | P1 home / P2,P3 away176    .word 1,2,2,2                 | P1 home / P2,P3,P4 away177    .word 1,1,2,2                 | P1,P2 home / P3,P4 away178    .if WITH_QUICKGAME_CPU179    .word 1,0,0,0                 | P1 home versus entirely CPU away180    .endif181labels:182    .word 22183    .ascii "1 vs 1 - Humans     "184    .word 22185    .ascii "1 vs 2 - Humans     "186    .word 22187    .ascii "1 vs 3 - Humans     "188    .word 22189    .ascii "2 vs 2 - Humans     "190191    .if WITH_QUICKGAME_CPU192    .word 22193    .ascii "1 vs CPU            "194    .endif195196gameend:197    tst.w ACTIVE198    bne.s exhibition_end199    jmp 0x2F8000                  | unchanged native season write code and every legacy PC200exhibition_end:201    jmp 0xFF88E                   | replay native housekeeping, record no season game202table_gate:203    tst.w ACTIVE204    bne.s no_season_table205    jmp 0x2FC000                  | unchanged season table/standalone tree206no_season_table:207    rts208prelist_gate:209    tst.w ACTIVE210    beq.s ordinary_prelist211    lea 0x22B000,%a0212    movea.l (%a0,%d0.w),%a0213    rts214ordinary_prelist:215    jmp 0x2AA010                  | unchanged slot helper and SRAM commit addresses216217| Native OT keeps its AI keeper and attempt rules. Every shooting team must218| choose a real pad from its original side, including P3/P4 in2v2 and1v3.219shootout_pad:220    move.w %sr,-(%sp)221    movem.l %d0-%d7/%a0-%a4,-(%sp)222    tst.w ACTIVE223    beq.w so_done224    cmpi.w #1,0xFFFFF090225    bne.w so_done                 | leave native standalone/penalty shots unchanged226    bsr.w effective227    lsl.w #3,%d0228    lea assignments(%pc),%a1229    adda.w %d0,%a1230    move.w 0xFFFFD594,%d7231    addq.w #1,%d7                 | shooting side1/2232    moveq #0,%d2233    moveq #0,%d4234so_count:235    cmp.w (%a1,%d4.w),%d7236    bne.s so_next_count237    addq.w #1,%d2238so_next_count:239    addq.w #2,%d4240    cmpi.w #8,%d4241    bcs.s so_count242    tst.w %d2243    beq.w so_done                 | invalid context: no division by zero244    move.w %d7,%d0245    subq.w #1,%d0246    add.w %d0,%d0247    lea 0xFFFFF09C,%a0248    moveq #0,%d1249    move.w (%a0,%d0.w),%d1250    divu.w %d2,%d1251    swap %d1                      | own-side attempt index modulo actual pad count252    moveq #0,%d4253so_choose:254    cmp.w (%a1,%d4.w),%d7255    bne.s so_next_choice256    subq.w #1,%d1257    bmi.s so_selected258so_next_choice:259    addq.w #2,%d4260    cmpi.w #8,%d4261    bcs.s so_choose262    bra.s so_done263so_selected:264    move.w 0xFFFFD406,%d5          | real native designated shooter; never invent an actor265    cmpi.w #11,%d5266    bhi.s so_done267    lea 0xFFFFC320,%a2268    lea 0xFFFFC328,%a3269    moveq #3,%d6270so_release_old:271    move.w (%a2),%d1272    moveq #-1,%d0273    jsr 0xC0F8                    | native ownership release, including object human flag274    move.w %d0,(%a2)+275    clr.w (%a3)+276    dbra %d6,so_release_old277    move.w %d5,%d0278    moveq #-1,%d1279    jsr 0xC0F8                    | native human actor admission280    lea 0xFFFFC320,%a2281    lea 0xFFFFC328,%a3282    move.w %d0,(%a2,%d4.w)283    move.w %d7,(%a3,%d4.w)284so_done:285    movem.l (%sp)+,%d0-%d7/%a0-%a4286    move.w (%sp)+,%sr287    rts288289attempt_gate:290    jsr 0x2DAA04                  | unchanged native countdown/rules preparation291    jmp shootout_pad292293| Native7C58 already checkedP1/P2. A sole P3/P4 shooter is human too:294| skip the attract/demo any-button exit, retaining the normal actor loop.295demo_gate:296    tst.w ACTIVE297    beq.s original_demo_poll298    tst.w 0xFFFFC32C299    bne.s human_extra_pad300    tst.w 0xFFFFC32E301    beq.s original_demo_poll302human_extra_pad:303    addq.l #4,%sp                 | discard only the replaced7C68JSR return304    jmp 0xA9D4                    | exact original human-present destination305original_demo_poll:306    jmp 0x11340                   | original poll, original7C6Ereturn untouched307