Release 2026-11-04-r2 · SHA256 0247dd40eaf1764a574192dcbb22c4234b18ab91f7ad19a92ba6a3071c8b82aa · Click a line number for a direct link.
1 .ifndef FINISH_POSITION_ENABLED2 .equ FINISH_POSITION_ENABLED,13 .endif4| Native receiving is retained; brake only while already within8units of the5| future pass course. Near the actual puck, cap the separate native target6| cache to2ticks (the established Hard steering cadence) and meet it normally.7| No direct position/velocity writes; native103C8 applies motion/turn/braking.8 .text9 .globl _start10_start:11 .if FINISH_POSITION_ENABLED12 bra.w steer13 .else14 bra.w no_steer15 .endif16 .if FINISH_POSITION_ENABLED17 bra.w close_receive18 .else19 bra.w no_steer20 .endif21 bra.w geometry22steer:23 movem.l %d0-%d7/%a0-%a1,-(%sp)24 clr.l (%sp)25 move.w (%a3),%d026 move.w 0x14(%a3),%d127 move.w 0xFFFFB74A,%d228 move.w 0xFFFFB75E,%d329 move.w 0xFFFFB772,%d430 move.w 0xFFFFB774,%d531 bsr.w geometry32 tst.w %d233 beq.s steer_done34 sub.w (%a3),%d035 cmpi.w #-8,%d036 blt.s steer_done37 cmpi.w #8,%d038 bgt.s steer_done39 sub.w 0x14(%a3),%d140 cmpi.w #-8,%d141 blt.s steer_done42 cmpi.w #8,%d143 bgt.s steer_done44 move.l #1,(%sp)45 movem.l 4(%sp),%d1-%d7/%a0-%a146 jsr 0x105A2 | retain real interception/facing before native braking47 movem.l 4(%sp),%d1-%d7/%a0-%a148 moveq #9,%d049 jsr 0x10750 | native brake, no direct position/velocity writes50steer_done:51 movem.l (%sp)+,%d0-%d7/%a0-%a152 tst.w %d053 rts5455| D0/D1 receiver point,D2/D3 puck,D4/D5 native signed velocity lowwords.56| D0/D1 closest point if within32units/component, D2 boolean. Other GPR/SR57| preserved; input upperwords D0/D1 retained. Invalid or nonapproaching ->false.58geometry:59 move.w %sr,-(%sp)60 link.w %a6,#-2461 movem.l %d3-%d7,-(%sp)62 move.l %d0,-4(%a6)63 move.l %d1,-8(%a6)64 cmpi.w #-192,%d065 blt.w invalid66 cmpi.w #192,%d067 bgt.w invalid68 cmpi.w #-352,%d169 blt.w invalid70 cmpi.w #352,%d171 bgt.w invalid72 cmpi.w #-192,%d273 blt.w invalid74 cmpi.w #192,%d275 bgt.w invalid76 cmpi.w #-352,%d377 blt.w invalid78 cmpi.w #352,%d379 bgt.w invalid80 sub.w %d2,%d081 sub.w %d3,%d182 move.w %d0,-10(%a6)83 move.w %d1,-12(%a6)84normalize:85 move.w %d4,%d686 bpl.s norm_vx87 neg.w %d688norm_vx:89 move.w %d5,%d790 bpl.s norm_vy91 neg.w %d792norm_vy:93 or.w %d7,%d694 cmpi.w #127,%d695 bls.s normalized96 asr.w #1,%d497 asr.w #1,%d598 bra.s normalize99normalized:100 move.w %d4,%d6101 muls.w %d4,%d6102 move.w %d5,%d7103 muls.w %d5,%d7104 add.l %d7,%d6105 beq.w invalid106 move.w %d6,-18(%a6)107 move.w %d0,%d6108 muls.w %d4,%d6109 move.w %d1,%d7110 muls.w %d5,%d7111 add.l %d7,%d6112 ble.w invalid113 move.w %d0,%d6114 muls.w %d5,%d6115 move.w %d1,%d7116 muls.w %d4,%d7117 sub.l %d7,%d6118 move.l %d6,-16(%a6)119 | Cross can exceed a signed word. Divide its products safely using120 | native32/16 quotient: delta bounded by world geometry (<1024).121 move.l %d6,%d7122 | 68000MULS consumes only lowword. Cross up to122k needs32xword product.123 bsr.w multiply_cross_vy124 divs.w -18(%a6),%d7125 cmpi.w #-32,%d7126 blt.s invalid127 cmpi.w #32,%d7128 bgt.s invalid129 move.w %d7,-20(%a6)130 move.l -16(%a6),%d6131 bsr.w multiply_cross_vx132 divs.w -18(%a6),%d7133 cmpi.w #-32,%d7134 blt.s invalid135 cmpi.w #32,%d7136 bgt.s invalid137 move.l -4(%a6),%d0138 move.l -8(%a6),%d1139 sub.w -20(%a6),%d0140 add.w %d7,%d1141 moveq #1,%d2142 bra.s geometry_done143invalid:144 move.l -4(%a6),%d0145 move.l -8(%a6),%d1146 moveq #0,%d2147geometry_done:148 movem.l (%sp)+,%d3-%d7149 unlk %a6150 move.w (%sp)+,%sr151 rts152| Signed32 cross x signed16 bounded normalized velocity -> signed32 product.153| cross32 is split high16/low16. Use unsigned lowword plus signed highword.154multiply_cross_vy:155 move.w %d5,%d3156 bra.s multiply_cross157multiply_cross_vx:158 move.w %d4,%d3159multiply_cross:160 move.l %d6,%d7161 move.l %d6,%d0162 swap %d0163 eor.w %d3,%d0164 move.w %d0,-22(%a6)165 tst.l %d7166 bpl.s cross_magnitude167 neg.l %d7168cross_magnitude:169 tst.w %d3170 bpl.s multiplier_magnitude171 neg.w %d3172multiplier_magnitude:173 move.l %d7,%d0174 swap %d0175 andi.l #0xFFFF,%d0176 mulu.w %d3,%d0177 swap %d0178 clr.w %d0179 andi.l #0xFFFF,%d7180 mulu.w %d3,%d7181 add.l %d0,%d7182 tst.w -22(%a6)183 bpl.s multiply_done184 neg.l %d7185multiply_done:186 rts187188no_steer:189 moveq #0,%d0190 rts191192close_receive:193 movem.l %d1-%d7/%a0-%a3,-(%sp)194 cmpi.b #2,0x42(%a3)195 ble.s native196 move.b #2,0x42(%a3)197native:198 jsr 0x105A2199 movem.l (%sp)+,%d1-%d7/%a0-%a3200 moveq #1,%d0201 rts202