experimental/faceoff_dots.s

Download file

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

1    .ifndef WITH_REFINEMENTS2    .equ WITH_REFINEMENTS,03    .endif4| Optional painted-dot alignment after the native stoppage point policy.5| Runtime writes only BF94/BF96; option F848, own preference4D4A..4D51.6    .equ VALUE,0xFFFFF8487    .text8    .globl _start9_start:10    bra.w commit11    bra.w geometry12    bra.w load13    bra.w put14    bra.w reset1516| Displaced native1255A: BSR1257E; CLR.WC3E6. Native corrections run first.17| All native GPR/SP/X/IRQ contracts survive; final CLR supplies native NZVC.18commit:19    jsr 0x1257E20    cmpi.w #1,VALUE21    bne.s committed22    tst.w 0xFFFFF090             | actual tied-overtime shootout state23    bne.s committed24    btst #0,0xFFFFC2FA           | native standalone shootout25    bne.s committed26    btst #2,0xFFFFC2FA           | native special attempt (F2A8 sets bit2)27    bne.s committed28    movem.l %d0-%d1,-(%sp)29    move.w 0xFFFFBF94,%d030    move.w 0xFFFFBF96,%d131    bsr.w geometry32    move.w %d0,0xFFFFBF9433    move.w %d1,0xFFFFBF9634    movem.l (%sp)+,%d0-%d135committed:36    clr.w 0xFFFFC3E637    rts3839| Pure signed lowword X/Y -> nearest painted point in native chosen region.40| Upperwords, all other GPR/SP/SR and all RAM/RNG are preserved.41geometry:42    move.w %sr,-(%sp)43    movem.l %d2-%d7/%a0-%a1,-(%sp)44    cmpi.w #-70,%d045    blt.w geometry_done46    cmpi.w #70,%d047    bgt.w geometry_done48    cmpi.w #-206,%d149    blt.w geometry_done50    cmpi.w #206,%d151    bgt.w geometry_done52    lea neutral(%pc),%a053    moveq #4,%d654    cmpi.w #166,%d155    bge.s end_positive56    cmpi.w #-166,%d157    bgt.s region_ready58    lea negative_end(%pc),%a059    moveq #1,%d660    bra.s region_ready61end_positive:62    lea positive_end(%pc),%a063    moveq #1,%d664region_ready:65    move.w %d0,%d266    move.w %d1,%d367    movea.l %a0,%a168    move.l #0x7FFFFFFF,%d769candidate:70    move.w (%a0),%d471    sub.w %d2,%d472    muls.w %d4,%d473    move.w 2(%a0),%d574    sub.w %d3,%d575    muls.w %d5,%d576    add.l %d5,%d477    cmp.l %d7,%d478    bcc.s next_candidate79    move.l %d4,%d780    movea.l %a0,%a181next_candidate:82    addq.l #4,%a083    dbra %d6,candidate84    move.w (%a1),%d085    move.w 2(%a1),%d186geometry_done:87    movem.l (%sp)+,%d2-%d7/%a0-%a188    move.w (%sp)+,%sr89    rts9091| Native end region stays in that end; neutral policy uses five neutral dots.92| Equal distances keep first entry: centre, then +Y/right/left,-Y/right/left.93neutral:94    .word 0,0,70,65,-70,65,70,-65,-70,-6595positive_end:96    .word 70,206,-70,20697negative_end:98    .word 70,-206,-70,-20699100record:101    lea 0x209A95,%a0              | native/Full/Light/Mini logical4D4A..51102    tst.w 0xFFFFF06C103    beq.s record_done104    move.w 0xFFFFF06A,%d0105    subq.w #1,%d0106    cmpi.w #2,%d0107    bhi.s record_done108    addq.w #1,%d0109    lsl.w #2,%d0110    adda.w %d0,%a0111record_done:112    rts113load:114    move.w %sr,-(%sp)115    movem.l %d0-%d1/%a0,-(%sp)116    .if WITH_REFINEMENTS117    move.w #1,VALUE118    .else119    clr.w VALUE120    .endif121    bsr.s record122    moveq #0,%d0123    move.b (%a0),%d0124    move.w %d0,%d1125    andi.w #0xFE,%d1126    cmpi.w #0x78,%d1127    bne.s loaded128    not.b %d0129    cmp.b 2(%a0),%d0130    bne.s loaded131    not.b %d0132    andi.w #1,%d0133    move.w %d0,VALUE134loaded:135    .if WITH_REFINEMENTS136    move.w #1,VALUE                   | permanent user-selected rule; old saved Off cannot disable it137    .endif138    movem.l (%sp)+,%d0-%d1/%a0139    move.w (%sp)+,%sr140    rts141put:142    move.w %sr,-(%sp)143    movem.l %d0-%d1/%a0,-(%sp)144    bsr.w record145    moveq #0x78,%d0146    cmpi.w #1,VALUE147    bne.s write148    addq.w #1,%d0149write:150    move.b %d0,(%a0)151    not.b %d0152    move.b %d0,2(%a0)153    lea 0x208001,%a0154    moveq #0,%d0155    move.w #0x1FFD,%d1156sum:157    add.b (%a0),%d0158    addq.l #2,%a0159    dbra %d1,sum160    not.b %d0161    move.b %d0,(%a0)162    not.b %d0163    move.b %d0,2(%a0)164    movem.l (%sp)+,%d0-%d1/%a0165    move.w (%sp)+,%sr166    rts167reset:168    move.w %sr,-(%sp)169    move.w 0xFFFFF06C,-(%sp)170    move.w #1,0xFFFFF06C171    .if WITH_REFINEMENTS172    move.w #1,VALUE173    .else174    clr.w VALUE175    .endif176    bsr.w put177    move.w (%sp)+,0xFFFFF06C178    move.w (%sp)+,%sr179    rts180