!cpu 6502 !ct "src/lcase.ct" !to "build/ANTI.M.SYSTEM",plain *=$2000 ;------------------------------- ; Anti-M ; a 4am hack ; (c) 2019-2024 by 4am ; ; Permission is hereby granted, free of charge, to any ; person obtaining a copy of this software and associated ; documentation files (the "Software"), to deal in the ; Software without restriction, including without limitation ; the rights to use, copy, modify, merge, publish, ; distribute, sublicense, and/or sell copies of the ; furnished to do so, subject to the following conditions: ; ; The above copyright notice and this permission notice ; shall be included in all copies or substantial portions of ; the Software. ; ; THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY ; KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE ; WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR ; PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS ; OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR ; OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR ; OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE ; SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ; ;------------------------------- ; Addresses we read/call MLI = $BF00 DEVNUM = $BF30 KEY = $C000 STROBE = $C010 BUTTON0 = $C061 BUTTON1 = $C062 TEXT = $FB2F MACHINEID = $FBB3 HOME = $FC58 COUT = $FDED cmp1 = $F8 ; word cmp2 = $FA ; word tmp = $FC ; byte lda #$00 sta $85FF ; boot drive 1 jsr TEXT lda BUTTON0 ora BUTTON1 bmi @showprompt lda DEVNUM cmp #$60 bne Boot jsr CheckDrive2 bcs Boot2 @showprompt jsr HOME lda MACHINEID cmp #$06 beq @haslowercase lda #$DF sta kForceLower @haslowercase lda #s_header jsr PrintByID lda #s_mainmenu jsr PrintByID bit STROBE - lda KEY bpl - bit STROBE cmp #$8D ; return beq Boot cmp #$B1 ; 1 beq Boot cmp #$B2 ; 2 beq Boot2 jsr MLI !byte $65 !word .quitparm .quitparm !byte $04,$00,$00,$00,$00,$00,$00 Boot2 inc $85FF ; boot drive 2 Boot jsr HOME ldx #$00 - lda $C600,x sta $8600,x inx bne - lda $865C cmp #$80 bne @check2 lda #$18 sta $865C lda #$08 sta $865D lda #$F7 sta $8666 lda #$D9 sta $8682 lda #$BE sta $869D ldx #$B8 stx $86A3 dex stx $86A5 @check2 lda $85FF beq @skip2 ldx #$C8 lda $860F cmp #$5A bne + lda #$EA sta $860F stx $8616 ;select drive 2 on IIc + lda $8619 cmp #$78 bne + stx $8619 ;select drive 2 on IIGS + lda $8636 cmp #$8A bne @skip2 inc $8636 ;select drive 2 on II @skip2 lda #Tracer ldy $86F8 cpy #$4C bne @iigs ; entry point for Disk II controller sta $86F9 ; lo byte of callback stx $86FA ; hi byte of callback beq @tryboot @iigs ldy $86FB cpy #$4C bne @unknowncontroller ; entry point for IIgs smart controller sta $86FC ; lo byte of callback stx $86FD ; hi byte of callback @tryboot jmp IDBoot @unknowncontroller jmp $C600 CheckDrive2 lda $C0E9 lda $C0EB jsr @spinup jsr @seek ldx #21 ldy #0 --- iny bne + clc dex bmi @driveoff + - lda $C0EC bpl - -- cmp #$D5 bne --- - lda $C0EC bpl - cmp #$AA bne -- - lda $C0EC bpl - cmp #$AD bne -- @driveoff lda $C0E8 rts step=$fd phase=$fe tmptrk=$ff tmpsec=$3c @seek ldy #0 sty step sty phase lda #$44 sta tmptrk @copy_cur lda tmptrk sta tmpsec sec sbc phase beq +++ bcs + eor #$ff inc tmptrk bcc ++ + sbc #1 dec tmptrk ++ cmp step bcc + lda step + cmp #8 bcs + tay sec + jsr ++++ lda step1, y jsr @delay lda tmpsec clc jsr +++++ lda step2, y jsr @delay inc step bne @copy_cur +++ jsr @delay clc ++++ lda tmptrk +++++ and #3 rol tax lda $C0E0, x rts @spinup ldy #6 - jsr @delay dey bpl - @delay -- ldx #$11 - dex bne - inc $46 bne + inc $47 + sec sbc #1 bne -- @knownret rts step1 !byte 1, $30, $28, $24, $20, $1e, $1d, $1c step2 !byte $70, $2c, $26, $22, $1f, $1e, $1d, $1c Tracer jsr IDBroderbund bcc BeginTheBoot jsr IDSpiraDisc bcc BeginTheBoot jsr IDIDSI bcc BeginTheBoot jsr IDSirius bcc BeginTheBoot jsr IDProDOS bcc BeginTheBoot jsr IDProgame bcc BeginTheBoot jsr IDAlphaBeta bcc BeginTheBoot ; [execution falls through here] ; [and runs anyway] BeginTheBoot lda #$CD ;Virtual II fixes sta $9D sta $A2 lda #4 sta $AC lda #$11 ;Virtual II fix pha plp ;match boot-time flags and registers lda $800 ;might not be 1 ldy #0 ldx #$60 jmp $0801 Tracer13 jsr PatchBoot13 jsr IDPersonal bcc BeginTheBoot13 jsr IDBoot13 bcc BeginTheBoot13 jsr IDSensible bcc BeginTheBoot13 ; [execution falls through here] ; [and runs anyway] BeginTheBoot13 lda #$CD ;Virtual II fixes sta $9D sta $A2 lda #4 sta $AC ldx #$33 ;Sensible Software fix ldy $0300 jmp $0301 PrintByID cmp #STRINGCOUNT bcs @exit asl tax lda StringTable,x sta @print+1 lda StringTable+1,x sta @print+2 @print lda $FFFF ; SMC beq @done cmp #$E1 bcc @noforce and kForceLower @noforce jsr COUT inc @print+1 bne @print inc @print+2 bne @print @done clc @exit rts kForceLower !byte $FF ; AND mask for lowercase letters ; ; String IDs ; (pass in accumulator to PrintByID) ; s_header = $00 s_mainmenu = $01 STRINGCOUNT = $02 StringTable !word @header !word @mainmenu @header !text "Anti-M v2.2 by 4am 2024-02-27" !text "________________________________________",$8D !text $8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D,$00 @mainmenu !text " Insert original disk in slot 6 drive 1",$8D !text $8D !text " and press to boot",$8D,$00 !src "src/compare.a" !src "src/idbroderbund.a" !src "src/idspiradisc.a" !src "src/ididsi.a" !src "src/idsirius.a" !src "src/idboot.a" !src "src/idprodos.a" !src "src/idprogame.a" !src "src/idpersonal.a" !src "src/idalphabeta.a" !src "src/idsensible.a"