experimental/shootout_rules.s

Download file

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

1    .ifndef WITH_PLAYER_BLUE_LINE2    .equ WITH_PLAYER_BLUE_LINE,03    .endif4    .ifndef WITH_STRICT_SO5    .equ WITH_STRICT_SO,06    .endif7| Attempt execution only: forward puck progress before a shot, native endings.8| +0 watches native F2F4; +4 starts each native attempt without input shortcuts.9| Twenty private transient bytes, never SRAM or controller assignments.10    .equ MAGIC,0xFFFFF65C11    .equ ACTOR,MAGIC+212    .equ PHASE,MAGIC+413    .equ STILL,MAGIC+614    .equ HIGH,MAGIC+815    .equ STARTX,MAGIC+1216    .equ STARTY,MAGIC+1417    .equ LAST,MAGIC+1618    .text19    .globl _start20_start:21    bra.w enforce22    bra.w fresh23fresh:24    .if WITH_ATTEMPT_RULES25    movem.l %d0-%d1/%a0,-(%sp)26    move.w 0xFFFFD406,%d027    cmpi.w #11,%d028    bhi.w fresh_invalid29    move.w %d0,ACTOR30    lsl.w #7,%d031    lea 0xFFFFB04A,%a032    adda.w %d0,%a033    tst.w 0x34(%a0)34    ble.w fresh_invalid35    move.w (%a0),STARTX36    move.w 0x14(%a0),STARTY37    .if WITH_PLAYER_BLUE_LINE38    move.l 0x14(%a0),%d1              | actual shooter body centre, signed16.1639    .else40    move.l 0xFFFFB75E,%d141    .endif42    btst #7,0x62(%a0)43    bne.s fresh_direction44    neg.l %d145fresh_direction:46    move.l %d1,HIGH47    move.l %d1,LAST48    clr.l PHASE49    move.w #0x5352,MAGIC50    bra.s fresh_restore51fresh_invalid:52    clr.w MAGIC53fresh_restore:54    movem.l (%sp)+,%d0-%d1/%a055    .endif56    .if WITH_STRICT_SO57    jsr 0x22200C                    | per-attempt turn history only, native setup/countdown retained58    .endif59    .if WITH_AUTO_START60    move.w #60,0xFFFFC31A61    .else62    move.w #400,0xFFFFC31A63    .endif64    rts6566    .if WITH_PLAYER_BLUE_LINE6768| Player-position rule, jdc2026-11-04. STILL is a per-attempt blue-entry latch,69| HIGH/LAST are normalized16.16 shooter positions. No puck progress/still filter.70| Native blue-line coordinate88 is used by E4F0/E4F4/E502/EC28.71| Strictly beyond88 activates; returning to/even fractionally toward the line72| then queues the existing native miss. No input, velocity, score or SRAM writes.73enforce:74    movem.l %d0-%d7/%a0-%a6,-(%sp)75    move.w %sr,-(%sp)76    .if WITH_ATTEMPT_RULES77    btst #2,0xFFFFC2F278    beq.w clear79    btst #4,0xFFFFC2F280    bne.w restore81    btst #6,0xFFFFC2F282    bne.w restore83    tst.w 0xFFFFC31A84    bpl.w restore85    move.b 0xFFFFC2EA,%d086    andi.b #0x50,%d087    bne.w restore88    move.b 0xFFFFC2EC,%d089    andi.b #0x81,%d090    bne.w restore91    move.w 0xFFFFD406,%d092    cmpi.w #11,%d093    bhi.w clear94    move.w %d0,%d195    lsl.w #7,%d196    lea 0xFFFFB04A,%a097    adda.w %d1,%a098    tst.w 0x34(%a0)99    ble.w clear100    move.l 0x14(%a0),%d2101    btst #7,0x62(%a0)102    bne.s normalized103    neg.l %d2104normalized:105    cmpi.w #0x5352,MAGIC106    bne.s initialize107    cmp.w ACTOR,%d0108    beq.s dispatch109initialize:110    move.w #0x5352,MAGIC111    move.w %d0,ACTOR112    clr.l PHASE113    move.l %d2,HIGH114    move.l %d2,LAST115    move.w (%a0),STARTX116    move.w 0x14(%a0),STARTY117 dispatch:118    cmpi.w #3,PHASE119    beq.w restore120    tst.w STILL121    bne.s crossed122    cmpi.l #0x00580000,%d2            | exactly on the line is not past it123    ble.s remember124    move.w #1,STILL                  | cannot clear by retreating across blue125    cmpi.w #2,PHASE126    beq.s crossed127    move.w #1,PHASE128crossed:129    cmp.l LAST,%d2130    blt.w fail                       | any actual centreward motion, including fractions131remember:132    move.l %d2,LAST133    cmp.l HIGH,%d2134    ble.s check_shot135    move.l %d2,HIGH136check_shot:137    cmpi.w #2,PHASE138    beq.w restore                    | puck/native flight stays native; shooter rule above still applies139    btst #5,0xFFFFC2F2140    bne.w flight141    .if WITH_STRICT_SO142    tst.w STILL143    beq.s no_spin_check              | requested unrestricted movement before blue overrides spin there144    jsr 0x222008145    tst.w %d0146    bne.w fail147no_spin_check:148    .endif149    | Retain the existing pre-shot outside-goal-mouth ending. This is a150    | spatial goal-line guard, not a new puck backwards/progress rule.151    move.w 0xFFFFB74A,%d3152    bpl.s xpositive153    neg.w %d3154xpositive:155    cmpi.w #21,%d3156    bls.w restore157    move.l 0xFFFFB75E,%d3158    btst #7,0x62(%a0)159    bne.s puck_normalized160    neg.l %d3161puck_normalized:162    cmpi.l #0x01080000,%d3163    bgt.s fail164    bra.s restore165flight:166    move.w #2,PHASE167    bra.s restore168fail:169    move.w #3,PHASE170    bset #4,0xFFFFC2F2                 | one existing native miss, no result/stat writes171    bra.s restore172clear:173    clr.w MAGIC174    .endif175restore:176    move.w (%sp)+,%sr177    movem.l (%sp)+,%d0-%d7/%a0-%a6178    movem.w %d0,-(%sp)179    move.w 0xFFFFB7AA,%d0180    jmp 0xF2FC181182    .else183184enforce:185    movem.l %d0-%d7/%a0-%a6,-(%sp)186    move.w %sr,-(%sp)187    .if WITH_ATTEMPT_RULES188    btst #2,0xFFFFC2F2189    beq.w clear190    btst #4,0xFFFFC2F2191    bne.w restore192    btst #6,0xFFFFC2F2193    bne.w restore194    tst.w 0xFFFFC31A195    bpl.w restore                     | announce/setup is not part of the approach196    move.b 0xFFFFC2EA,%d0197    andi.b #0x50,%d0                   | attempt clock uses C2FA: native C2EA stop bit stays set198    bne.w restore199    move.b 0xFFFFC2EC,%d0200    andi.b #0x81,%d0201    bne.w restore                     | pause/foreign view never charges the still counter202    move.w 0xFFFFD406,%d0203    cmpi.w #11,%d0204    bhi.w clear205    move.w %d0,%d1206    lsl.w #7,%d1207    lea 0xFFFFB04A,%a0208    adda.w %d1,%a0209    tst.w 0x34(%a0)210    ble.w clear                       | only a real designated skater211    move.l 0xFFFFB75E,%d2              | signed16.16 native puck Y, including sub-pixel motion212    btst #7,0x62(%a0)213    bne.s normalized214    neg.l %d2215normalized:216    cmpi.w #0x5352,MAGIC217    bne.s initialize218    cmp.w ACTOR,%d0219    beq.s dispatch220initialize:221    move.w #0x5352,MAGIC222    move.w %d0,ACTOR223    clr.l PHASE224    move.l %d2,HIGH225    move.l %d2,LAST226    move.w (%a0),STARTX227    move.w 0x14(%a0),STARTY228 dispatch:229    tst.w PHASE230    bne.s armed231    btst #5,0xFFFFC2F2232    bne.w flight                      | shot already released before this first observation233    cmp.w 0xFFFFB7AA,%d0234    bne.w restore                     | stationary centre puck before the first touch is legal235    move.l 0x28(%a0),%d1236    bne.s begin_approach237    move.w (%a0),%d1238    cmp.w STARTX,%d1239    bne.s begin_approach240    move.w 0x14(%a0),%d1241    cmp.w STARTY,%d1242    beq.w restore                     | native auto-possession is not a voluntary first touch243begin_approach:244    move.w #1,PHASE245    clr.w STILL246armed:247    cmpi.w #2,PHASE248    beq.w restore                     | do not cancel a shot's native flight/post/keeper deflection249    cmpi.w #3,PHASE250    beq.w restore251    .if WITH_STRICT_SO252    jsr 0x222008253    tst.w %d0254    bne.w fail                     | existing single native miss, no goal/stat writes255    .endif256    move.l HIGH,%d3257    subi.l #0x00080000,%d3             | stick/deke dead band:8 world units258    cmp.l %d3,%d2259    blt.w fail260    btst #5,0xFFFFC2F2261    bne.w flight262    move.w 0xFFFFB74A,%d3263    bpl.s xpositive264    neg.w %d3265xpositive:266    cmpi.w #21,%d3267    bls.s progress268    cmpi.l #0x01080000,%d2             | beyond the goal line outside the mouth: no wraparound retry269    bgt.s fail270progress:271    cmp.l HIGH,%d2272    ble.s compare_last273    move.l %d2,HIGH274compare_last:275    cmp.l LAST,%d2276    bgt.s advanced277    move.l %d2,LAST278    addq.w #1,STILL279    cmpi.w #12,STILL                   | tolerate render/update quantization, not a stopped attempt280    bcc.s fail281    bra.s restore282advanced:283    move.l %d2,LAST284    clr.w STILL285    bra.s restore286flight:287    move.w #2,PHASE288    clr.w STILL289    bra.s restore290fail:291    move.w #3,PHASE292    bset #4,0xFFFFC2F2                 | native watcher queues the existing miss exactly once293    bra.s restore294clear:295    clr.w MAGIC296    .endif297restore:298    move.w (%sp)+,%sr299    movem.l (%sp)+,%d0-%d7/%a0-%a6300    movem.w %d0,-(%sp)                 | original first two native F2F4 instructions301    move.w 0xFFFFB7AA,%d0302    jmp 0xF2FC303304    .endif305