experimental/ai_defence.s

Download file

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

1| AI weak-side winger covers the low slot / a far-side receiver on deep rushes.2| Hook D086 replaces LEA CF98(pc),A0 / MOVE.W puckx,D2. Inputs D0/D1 are the3| native wing target; A3 is the skater. All guards fall back to the native target.4| No new RAM, ratings, RNG, speed/shot/goalkeeper changes or player-control writes.5    .text6    .globl _start7_start:8    lea 0xCF98,%a09    movem.l %d2-%d7/%a1-%a2,-(%sp)10    cmpi.w #1,0xFFFFF07A               | Hard only; Normal/Easy keep native positioning11    bne.w done12    btst #3,0x62(%a3)                 | never steer a human-controlled skater13    bne.w done14    btst #5,0x62(%a3)15    bne.w done16    btst #2,0x63(%a3)17    bne.w done18    btst #0,0xFFFFC2EA                | no decisions through whistles19    bne.w done20    btst #7,0xFFFFC2EC                | no replay/menu view intervention21    bne.w done22    btst #2,0xFFFFC2FA                | no penalty-shot/shootout intervention23    bne.w done24    cmpi.w #3,0x34(%a3)25    beq.s winger26    cmpi.w #5,0x34(%a3)27    bne.w done28winger:29    .if WITH_PASS_CONTINUITY30    bsr.w flight_owner31    .else32    move.w 0xFFFFB7AA,%d233    .endif34    cmpi.w #11,%d235    bhi.w done                        | loose/invalid puck36    move.w 0x52(%a3),%d337    cmpi.w #6,%d338    bcc.s visitor39    cmpi.w #6,%d240    bcs.w done                        | teammate carries41    lea 0xFFFFB34A,%a142    bra.s opponent43visitor:44    cmpi.w #6,%d245    bcc.w done46    lea 0xFFFFB04A,%a147opponent:48    move.w %d0,%d6                    | native wing-side sign in world coordinates49    move.w 0xFFFFB74A,%d350    move.w %d3,%d451    bpl.s positive_x52    neg.w %d453positive_x:54    cmpi.w #56,%d455    bcs.w done                        | puck near middle: keep native shape56    cmpi.w #144,%d457    bhi.w done                        | out-of-rink puck58    eor.w %d6,%d359    bpl.w done                        | puck-side winger keeps the native job60    move.w 0xFFFFB75E,%d361    btst #7,0x62(%a3)62    bne.s depth63    neg.w %d364 depth:65    cmpi.w #-160,%d366    bgt.w done67    cmpi.w #-296,%d368    blt.w done69    moveq #32,%d0                     | no marked threat: compact weak-post support70    tst.w %d671    bpl.s side_ready72    neg.w %d073side_ready:74    move.w #-216,%d175    move.w #0x7FFF,%d576    .if WITH_REAL_ACTORS77    moveq #5,%d778    .else79    moveq #4,%d780    .endif81scan:82    tst.w 0x34(%a1)83    ble.w next                        | boxed/empty players and goalies are not threats84    btst #2,0x63(%a1)85    bne.w next86    move.w 0x52(%a1),%d287    cmp.w 0xFFFFB7AA,%d288    beq.w next                        | never duplicate pressure on the carrier89    move.w (%a1),%d290    move.w %d2,%d491    bpl.s abs_x92    neg.w %d493abs_x:94    cmpi.w #16,%d495    bcs.w next96    cmpi.w #88,%d497    bhi.w next98    move.w %d2,%d499    eor.w %d6,%d4100    bmi.w next                        | only far-side receivers101    move.w 0x14(%a1),%d3102    btst #7,0x62(%a3)103    bne.s threat_depth104    neg.w %d3105threat_depth:106    cmpi.w #-150,%d3107    bgt.w next108    cmpi.w #-260,%d3109    blt.w next110    move.w 0x28(%a1),%d4111    asr.w #8,%d4112    asr.w #1,%d4                      | short look-ahead from actual skater velocity113    add.w %d4,%d2114    move.w 0x2A(%a1),%d4115    asr.w #8,%d4116    asr.w #1,%d4117    btst #7,0x62(%a3)118    bne.s velocity_depth119    neg.w %d4120velocity_depth:121    add.w %d4,%d3122    move.w %d3,%d4123    addi.w #224,%d4124    bpl.s abs_depth125    neg.w %d4126abs_depth:127    add.w %d4,%d4128    tst.w %d2129    bpl.s cost_x130    neg.w %d2131    add.w %d2,%d4132    neg.w %d2133    bra.s compare134cost_x:135    add.w %d2,%d4136compare:137    cmp.w %d5,%d4138    bcc.s next139    move.w %d4,%d5140    move.w %d2,%d0141    move.w %d2,%d4142    asr.w #2,%d4143    sub.w %d4,%d0                     | stand inside the receiver's passing lane144    tst.w %d6145    bmi.s clamp_left146    cmpi.w #16,%d0147    bge.s right_max148    moveq #16,%d0149right_max:150    cmpi.w #64,%d0151    ble.s target_y152    moveq #64,%d0153    bra.s target_y154clamp_left:155    cmpi.w #-16,%d0156    ble.s left_min157    moveq #-16,%d0158left_min:159    cmpi.w #-64,%d0160    bge.s target_y161    moveq #-64,%d0162 target_y:163    move.w %d3,%d1164    subi.w #12,%d1                    | goal-side of the predicted receiver165    cmpi.w #-180,%d1166    ble.s y_min167    move.w #-180,%d1168 y_min:169    cmpi.w #-236,%d1170    bge.s next171    move.w #-236,%d1172next:173    adda.w #128,%a1174    dbra %d7,scan175    btst #7,0x62(%a3)176    bne.s done177    neg.w %d1                        | native world direction at the other end178 done:179    movem.l (%sp)+,%d2-%d7/%a1-%a2180    move.w 0xFFFFB74A,%d2             | displaced native instruction181    rts182183    .if WITH_PASS_CONTINUITY184flight_owner:185    jsr 0x2DD680186    rts187    .endif188