experimental/onetimer.s

Download file

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

1    .ifndef WITH_CONTACT_ATOMIC2    .equ WITH_CONTACT_ATOMIC,03    .endif4    .ifndef WITH_HUMAN_CONTACT5    .equ WITH_HUMAN_CONTACT,16    .endif7| Buffered one-timer for a human pass receiver (jdc 2026-10-25): while a pass is on8| its way to you, C (pressed, held or mashed) no longer queues the one-timer at once9| (that stops you and the lead pass slides by). The press is remembered and the10| native one-timer request (action $23) is made when the puck is close, so you keep11| skating into the pass.12| Hook $B6C8 (btst #5,d1 / beq.w $10750) = receiver input with a pass in flight;13| exits: $B6D0 (native one-timer checks and request) or $10750 (normal skating).14    .equ PEND,0xFFF736                 | word: receiver object + 1 with a remembered C15    .equ NEAR,NEAR_PX                  | |dx|+|dy| puck -> receiver that releases it (0 = on reception)16    .ifndef WITH_AI_PLAYBOOK17    .equ WITH_AI_PLAYBOOK,118    .endif19    .text20    .globl _start21_start:22    bra.w input23    bra.w frame24    bra.w gkflight25    .if WITH_HUMAN_CONTACT26    bra.w owned_shoot27    .endif2829| gkflight (switch.s, jdc r22): a3 = your skater, d4 = pad offset -> Z set (and switch.s Q cleared) when a pass from your own goalie is30| on its way (puck loose, last passer a goalie of your team). Keeps all registers.31gkflight:32    movem.l %d0-%d2/%a0,-(%sp)33    moveq #1,%d1                       | 1 = no34    tst.w 0xFFFFB7AA35    bpl.s 9f36    move.w 0xFFFFBEDA,%d037    bmi.s 9f38    lsl.w #7,%d039    movea.w #0xB04A,%a040    adda.w %d0,%a041    tst.w 0x34(%a0)                    | the passer is a goalie42    bne.s 9f43    move.b 0x62(%a0),%d0               | of your team44    move.b 0x62(%a3),%d245    eor.b %d2,%d046    btst #6,%d047    bne.s 9f48    moveq #0,%d149    lea 0xFFFFF048,%a0                 | switch.s Q: no pending switch for this pad (d4 = 0/2)50    clr.w (%a0,%d4.w)519:  tst.w %d152    movem.l (%sp)+,%d0-%d2/%a0          | (movem keeps the flags)53    rts5455| Once per frame (sprite builder, after $FD78A): the receiver with a remembered press56| has the puck now -> immediate full-power forehand one-timer (native shot $C2F2).57frame:58    jsr 0xFD78A59    .if WITH_AI_PLAYBOOK60    jsr 0x2DD01061    .endif62    move.w PEND,%d063    beq.s 9f64    subq.w #1,%d065    cmp.w 0xFFFFB7AA,%d066    beq.s 1f67    cmp.w 0xFFFFBEE0,%d0               | no longer the pass target and not caught:68    beq.s 9f                           | the pass was cut off, forget the press69    clr.w PEND70    bra.s 9f711:72    .if !WITH_HUMAN_CONTACT73    clr.w PEND74    .endif75    movem.l %d0-%d7/%a0-%a6,-(%sp)76    lsl.w #7,%d077    movea.w #0xB04A,%a378    adda.w %d0,%a379    .if WITH_CONTACT_ATOMIC80    move.w %sr,-(%sp)81    ori.w #0x700,%sr                   | keep contact sprite/flip coherent until native shot returns82    .endif83    .if WITH_HUMAN_CONTACT84    bsr.w stick_contact85    tst.w %d086    beq.s wait_contact87    clr.w PEND88    .endif89    bset #3,0x64(%a3)                  | native one-timer: release power 31 ($C35E)90    move.w #0x7FC,%d1                  | forehand slapshot animation (crit-eligible)91    jsr 0x1073A92    .if WITH_HUMAN_CONTACT93    move.w #0x18,0x5A(%a3)             | native one-timer contact/follow-through, not a new windup94    move.w #-1,0x5C(%a3)95    clr.b 0x65(%a3)                    | allow the contact sprite on the next native animation update96    .endif97    jsr 0xC2F2                         | native shot98    bclr #3,0x64(%a3)99    .if WITH_CONTACT_ATOMIC100    move.w %sr,%d7101    move.b %d7,1(%sp)                 | retain native post-shot/wait CCR; restore only prior upper SR102    move.w (%sp)+,%sr103    .endif104    movem.l (%sp)+,%d0-%d7/%a0-%a61059:  rts106    .if WITH_HUMAN_CONTACT107wait_contact:108    .if WITH_CONTACT_ATOMIC109    move.w %sr,%d7110    move.b %d7,1(%sp)                 | retain native post-shot/wait CCR; restore only prior upper SR111    move.w (%sp)+,%sr112    .endif113    movem.l (%sp)+,%d0-%d7/%a0-%a6114    rts115    .endif116117input:118    movem.l %d0/%d2,-(%sp)119    move.w 0x52(%a3),%d2120    addq.w #1,%d2                      | this object's PEND value121    btst #5,%d1122    bne.s 1f123    cmp.w PEND,%d2124    bne.s skate                        | no press now, nothing remembered1251:  move.w 0x52(%a3),%d0               | still the pass target, puck still loose?126    cmp.w 0xFFFFBEE0,%d0127    bne.s gone128    tst.w 0xFFFFB7AA129    bpl.s gone130    move.w 0xFFFFB74A,%d0              | |dx| + |dy| puck -> us131    sub.w (%a3),%d0132    bpl.s 2f133    neg.w %d01342:  move.w 0xFFFFB75E,%d2135    sub.w 0x14(%a3),%d2136    bpl.s 3f137    neg.w %d21383:  add.w %d2,%d0139    cmpi.w #NEAR,%d0140    bcs.s now141    move.w 0x52(%a3),%d0142    addq.w #1,%d0143    move.w %d0,PEND                    | far: remember and keep skating144    bra.s skate145now:146    clr.w PEND147    movem.l (%sp)+,%d0/%d2148    jmp 0xB6D0                         | native one-timer request149gone:150    move.w 0x52(%a3),%d0151    cmp.w 0xFFFFB7AA,%d0152    beq.s skate                        | we caught it: the frame hook fires153    .if WITH_HUMAN_CONTACT154    addq.w #1,%d0155    cmp.w PEND,%d0                    | another pad cannot cancel the actual receiver's request156    bne.s keep_other_request157    clr.w PEND158keep_other_request:159    .else160    clr.w PEND161    .endif162    btst #5,%d1163    beq.s skate164    movem.l (%sp)+,%d0/%d2165    jmp 0xB6D0                         | an ordinary new press: native path166skate:167    movem.l (%sp)+,%d0/%d2168    jmp 0x10750169170    .if WITH_HUMAN_CONTACT171| The native owner flag can precede the owned puck's quarter-distance follow.172| Retain the request until it reaches the current rendered stick hotspot.173| GetHot consumes the pushed object pointer and preserves a0/a1.174stick_contact:175    move.l %a3,-(%sp)176    jsr 0x106E0177    add.w (%a3),%d0178    sub.w 0xFFFFB74A,%d0179    cmpi.w #4,%d0180    bgt.s not_contact181    cmpi.w #-4,%d0182    blt.s not_contact183    add.w 0x14(%a3),%d1184    sub.w 0xFFFFB75E,%d1185    cmpi.w #4,%d1186    bgt.s not_contact187    cmpi.w #-4,%d1188    blt.s not_contact189    muls.w %d0,%d0190    muls.w %d1,%d1191    add.l %d1,%d0192    cmpi.l #16,%d0193    bhi.s not_contact194    moveq #1,%d0195    rts196not_contact:197    moveq #0,%d0198    rts199    .endif200201    .if WITH_HUMAN_CONTACT202| B810 is reached only for a newly pressed human C while owning the puck.203| An already remembered pass shot waits for contact rather than starting a204| competing ordinary windup. Outside that request, replay the exact native call.205owned_shoot:206    move.w %sr,-(%sp)207    move.l %d0,-(%sp)208    move.w 0x52(%a3),%d0209    addq.w #1,%d0210    cmp.w PEND,%d0211    bne.s ordinary_owned212    subq.w #1,%d0213    cmp.w 0xFFFFB7AA,%d0214    bne.s ordinary_owned215    move.l (%sp)+,%d0216    move.w (%sp)+,%sr217    jmp 0x10750218ordinary_owned:219    move.l (%sp)+,%d0220    move.w (%sp)+,%sr221    jsr 0xFEE60222    jmp 0xB816223    .endif224