experimental/goalie_catch_control.s

Download file

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

1| A2 is a keeper after a native accepted catch; called only by cooperative2| goalie_ai.s. Restore all registers/CCR. Use native C0F8 assignment semantics3| to return a previously manual keeper to AI and his pad to a free skater.4| Explicit Y after this catch remains available; special modes stay native.5    .equ OBJ,0xFFFFB04A6    .text7    .globl _start8_start:9    move.w %sr,-(%sp)10    movem.l %d0-%d7/%a0-%a6,-(%sp)11    ori.w #0x700,%sr12    tst.w 0x34(%a2)13    bne.w done14    tst.w 0xFFFFD05215    bne.w done16    btst #3,0x62(%a2)17    beq.w done18    btst #0,0xFFFFC2FA19    bne.w done20    tst.w 0xFFFFD41221    bne.w done22    move.b 0xFFFFC2EA,%d023    andi.b #0x11,%d024    bne.w done25    move.w 0x52(%a2),%d726    cmp.w 0xFFFFB7AA,%d727    bne.w done28    moveq #1,%d429    cmpi.w #5,%d730    beq.s side_ready31    moveq #2,%d432    cmpi.w #11,%d733    bne.w done34side_ready:35    lea 0xFFFFC328,%a036    moveq #3,%d037    moveq #0,%d138sides:39    move.w (%a0)+,%d240    beq.s next_side41    cmp.w %d4,%d242    bne.w done                     | opposing humans retain native control policy43    moveq #1,%d144next_side:45    dbra %d0,sides46    tst.w %d147    beq.w done48    lea 0xFFFFC320,%a449    moveq #3,%d050find_pad:51    cmp.w (%a4)+,%d752    dbeq %d0,find_pad53    bne.w done54    lea OBJ,%a055    cmpi.w #1,%d456    beq.s objects57    adda.w #0x300,%a058objects:59    moveq #-1,%d5                  | selected object60    moveq #-1,%d6                  | unsigned minimum squared distance61    moveq #5,%d362candidate:63    tst.w 0x34(%a0)64    ble.s next_object65    btst #3,0x62(%a0)66    bne.s next_object              | never another human's player67    btst #2,0x63(%a0)68    bne.s next_object69    btst #5,0x62(%a0)70    bne.s next_object71    move.w (%a0),%d072    sub.w (%a2),%d073    muls.w %d0,%d074    move.w 0x14(%a0),%d175    sub.w 0x14(%a2),%d176    muls.w %d1,%d177    add.l %d1,%d078    cmp.l %d6,%d079    bhi.s next_object80    move.l %d0,%d681    move.w 0x52(%a0),%d582next_object:83    adda.w #0x80,%a084    dbra %d3,candidate85    | With no free skater, native -1 detaches the pad safely; keeper still becomes AI.86    move.b 0x63(%a2),-(%sp)87    bclr #3,0x63(%a2)              | native assignment must not reject a passing/recovery keeper88    move.w %d7,%d189    move.w %d5,%d090    jsr 0xC0F8                     | clears keeper human flag, arms ordinary AI job, selects skater91    move.b (%sp)+,0x63(%a2)92    lea 0xFFFFC320,%a093    lea 0xFFFFC328,%a194    moveq #3,%d195assign:96    move.w (%a1)+,%d297    cmp.w (%a0),%d798    bne.s next_pad99    cmp.w %d4,%d2100    bne.s next_pad101    move.w %d0,(%a0)               | also updates any temporary native P3/P4 mirror of this keeper102next_pad:103    addq.l #2,%a0104    dbra %d1,assign105done:106    movem.l (%sp)+,%d0-%d7/%a0-%a6107    move.w (%sp)+,%sr108    rts109