experimental/pass_charge.s

Download file

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

1| Optional human B hold/release power. No CPU pass or physics hook.2| Exports begin, input, scale, load, put, reserved, assisted, reset.3| F008 option; F110..F12F four transient physical-pad records, menu scratch.4| SRAM logical4D22..4D29: four complemented records, native/Full/Light/Mini.5| This is inside Light's excluded shared-profile gap4D20..4E1F, not goalie data.6    .equ VALUE,0xFFFFF0087    .equ RECORDS,0xFFFFF1108    .equ MAP,0xA130F19    .text10    .globl _start11_start:12    bra.w begin13    bra.w input14    bra.w scale15    bra.w load16    bra.w put17    bra.w reset18    bra.w assisted19    bra.w reset2021| A0=record, D0=0 valid; all callers save scratch registers/SR.22pad_record:23    move.w %d4,%d024    andi.w #0xFFFD,%d025    bne.w invalid26    move.w %d4,%d027    tst.w 0xFFFFC31828    bmi.s first_bank29    addq.w #4,%d030first_bank:31    lsl.w #2,%d032    lea RECORDS,%a033    adda.w %d0,%a034    moveq #0,%d035    rts36eligible:37    cmpi.w #1,VALUE38    bne.w invalid39    btst #3,0x62(%a3)40    beq.w invalid41    tst.w 0x34(%a3)42    bmi.w invalid43    move.w 0x52(%a3),%d044    cmp.w 0xFFFFB7AA,%d045    bne.w invalid46    tst.w 0xFFFFD41247    bne.w invalid48    btst #0,0xFFFFC2FA49    bne.w invalid50    btst #2,0xFFFFC2F251    bne.w invalid52    btst #3,0xFFFFC2F653    bne.w invalid54    move.b 0xFFFFC2EA,%d055    andi.b #0x11,%d056    bne.w invalid57    move.b 0xFFFFC2EC,%d058    andi.b #0x81,%d059    bne.w invalid60    btst #0,0x63(%a3)61    bne.w invalid62    moveq #0,%d063    rts64invalid:65    moveq #-1,%d066    rts6768begin:                               | exact original B-press accounting first69    jsr 0xFEE6070    move.w %sr,-(%sp)71    movem.l %d0/%a0,-(%sp)72    bsr.w pad_record73    bne.s begin_done74    clr.l (%a0)75    clr.l 4(%a0)76    bsr.w eligible77    bne.s begin_done78    move.l %a3,(%a0)79    move.w #1,6(%a0)80begin_done:81    movem.l (%sp)+,%d0/%a082    move.w (%sp)+,%sr83    rts8485input:86    move.w %sr,-(%sp)87    movem.l %d0/%a0,-(%sp)88    bsr.w pad_record89    bne.w legacy_input90    cmp.l (%a0),%a391    bne.w legacy_input92    cmpi.w #1,6(%a0)93    bne.w legacy_input94    bsr.w eligible95    bne.s cancel96    | Native D0 bit3 means no directional key. Retain last aim in that case.97    move.l (%sp),%d098    btst #3,%d099    bne.s aim_ready100    andi.w #7,%d0101    move.w %d0,0xFFFFBEDC102aim_ready:103    btst #4,%d3                     | actual held mask, not the edge mask104    beq.s release105    cmpi.w #30,4(%a0)106    bcc.s wait107    addq.w #1,4(%a0)108wait:109    movem.l (%sp)+,%d0/%a0110    move.w (%sp)+,%sr111    jmp 0xBC3E112release:113    move.w #2,6(%a0)                | consumed once by the human power path114    movem.l (%sp)+,%d0/%a0115    move.w (%sp)+,%sr116    jmp 0x2E6824                    | existing human emit/cone/mode dispatch117cancel:118    clr.l (%a0)119    clr.l 4(%a0)120legacy_input:121    movem.l (%sp)+,%d0/%a0122    move.w (%sp)+,%sr123    jmp 0x2E6820                    | exact original r9 input gate124125| Called only inside a human native/custom pass, before native intercept solve.126| D4 is still the physical input bank at both human-only call sites.127scale:128    move.w %sr,-(%sp)129    movem.l %d0-%d1/%a0,-(%sp)130    bsr.w pad_record131    bne.s scaled132    cmp.l (%a0),%a3133    bne.s scaled134    cmpi.w #2,6(%a0)135    bne.s scaled136    cmpi.w #1,VALUE137    bne.s scaled138    moveq #0,%d1139    move.w 4(%a0),%d1140    cmpi.w #30,%d1141    bhi.s scaled142    addi.w #10,%d1143    moveq #0,%d0144    move.w 0xFFFFBEDE,%d0145    mulu.w %d1,%d0146    divu.w #40,%d0                  | 25% tap ..100% after30 held input ticks147    move.w %d0,0xFFFFBEDE148    clr.l (%a0)149    clr.l 4(%a0)150scaled:151    movem.l (%sp)+,%d0-%d1/%a0152    move.w (%sp)+,%sr153    rts154155assisted:                            | called after restoring original input D0/SR156    move.w %sr,-(%sp)157    movem.l %d0/%a0,-(%sp)158    bsr.w pad_record159    bne.s native_pass160    cmp.l (%a0),%a3161    bne.s native_pass162    cmpi.w #2,6(%a0)163    bne.s native_pass164    cmpi.w #1,VALUE165    bne.s native_pass166    movem.l (%sp)+,%d0/%a0167    move.w (%sp)+,%sr168    movem.l %d0-%d5/%a0-%a1,-(%sp)169    bclr #2,0xFFFFC2EC170    st.b 0xFFFFB7AA171    move.b #0x10,0x5E(%a3)172    move.w 0x52(%a3),0xFFFFBEDA173    bclr #3,0xFFFFC2F6174    moveq #8,%d0175    tst.w 0x34(%a3)176    beq.s power177    move.b 0x6E(%a3),%d0178power:179    asl.w #2,%d0180    asr.w #1,%d0181    addi.w #0xA0,%d0182    move.w %d0,0xFFFFBEDE183    btst #0,0x6E(%a3)184    beq.s power_ready185    asr.w #4,%d0186    add.w %d0,0xFFFFBEDE187power_ready:188    bsr.w scale189    jmp 0xBCD8                      | actual native receiver search/solver/outlet190native_pass:191    movem.l (%sp)+,%d0/%a0192    move.w (%sp)+,%sr193    jmp 0xBC64194195record:196    lea 0x209A45,%a0                | logical4D22 native, then per season1/2/3197    tst.w 0xFFFFF06C198    beq.s record_done199    move.w 0xFFFFF06A,%d0200    subq.w #1,%d0201    cmpi.w #2,%d0202    bhi.s record_done203    addq.w #1,%d0204    lsl.w #2,%d0205    adda.w %d0,%a0206record_done:207    rts208load:                                | mapper already enabled by existing menu load209    move.w %sr,-(%sp)210    movem.l %d0-%d1/%a0,-(%sp)211    clr.w VALUE212    clr.l RECORDS213    clr.l RECORDS+4214    clr.l RECORDS+8215    clr.l RECORDS+12216    clr.l RECORDS+16217    clr.l RECORDS+20218    clr.l RECORDS+24219    clr.l RECORDS+28220    bsr.s record221    moveq #0,%d0222    move.b (%a0),%d0223    move.w %d0,%d1224    andi.w #0xFE,%d1225    cmpi.w #0x60,%d1226    bne.s loaded227    not.b %d0228    cmp.b 2(%a0),%d0229    bne.s loaded230    not.b %d0231    andi.w #1,%d0232    move.w %d0,VALUE233loaded:234    movem.l (%sp)+,%d0-%d1/%a0235    move.w (%sp)+,%sr236    rts237put:                                 | mapper already on; checksum only Light's bank238    move.w %sr,-(%sp)239    movem.l %d0-%d1/%a0,-(%sp)240    bsr.w record241    moveq #0x60,%d0242    cmpi.w #1,VALUE243    bne.s write244    addq.w #1,%d0245write:246    move.b %d0,(%a0)247    not.b %d0248    move.b %d0,2(%a0)249    lea 0x208001,%a0250    moveq #0,%d0251    move.w #0x1FFD,%d1252sum:253    add.b (%a0),%d0254    addq.l #2,%a0255    dbra %d1,sum256    not.b %d0257    move.b %d0,(%a0)258    not.b %d0259    move.b %d0,2(%a0)260    movem.l (%sp)+,%d0-%d1/%a0261    move.w (%sp)+,%sr262    rts263reset:264    move.w 0xFFFFF06C,-(%sp)265    move.w #1,0xFFFFF06C             | fresh season from native must not clear native preference266    clr.w VALUE267    bsr.w put268    move.w (%sp)+,0xFFFFF06C269    rts270