anti-m/src/anti-m.a

368 lines
8.6 KiB
Plaintext
Raw Permalink Normal View History

2019-03-09 20:09:16 +00:00
!cpu 6502
!ct "src/lcase.ct"
!to "build/ANTI.M.SYSTEM",plain
*=$2000
;-------------------------------
; Anti-M
; a 4am hack
; (c) 2019-2024 by 4am
2019-03-09 20:09:16 +00:00
;
; 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
2019-03-13 15:45:01 +00:00
DEVNUM = $BF30
2019-03-09 20:09:16 +00:00
KEY = $C000
STROBE = $C010
BUTTON0 = $C061
BUTTON1 = $C062
2019-03-09 20:09:16 +00:00
TEXT = $FB2F
2019-03-13 15:45:01 +00:00
MACHINEID = $FBB3
2019-03-09 20:09:16 +00:00
HOME = $FC58
COUT = $FDED
2019-03-10 02:30:04 +00:00
cmp1 = $F8 ; word
cmp2 = $FA ; word
tmp = $FC ; byte
2019-04-10 23:43:19 +00:00
lda #$00
sta $85FF ; boot drive 1
2019-03-09 20:09:16 +00:00
jsr TEXT
lda BUTTON0
ora BUTTON1
bmi @showprompt
2019-03-12 18:05:47 +00:00
lda DEVNUM
cmp #$60
bne Boot
2019-04-10 23:43:19 +00:00
jsr CheckDrive2
2021-05-20 15:46:48 +00:00
bcs Boot2
@showprompt
2019-03-12 18:09:17 +00:00
jsr HOME
2019-03-13 15:45:01 +00:00
lda MACHINEID
cmp #$06
beq @haslowercase
lda #$DF
sta kForceLower
@haslowercase
2019-03-12 18:09:17 +00:00
lda #s_header
jsr PrintByID
2019-03-09 20:09:16 +00:00
lda #s_mainmenu
jsr PrintByID
bit STROBE
- lda KEY
bpl -
bit STROBE
cmp #$8D ; return
beq Boot
2019-04-12 14:39:11 +00:00
cmp #$B1 ; 1
beq Boot
2019-04-10 23:43:19 +00:00
cmp #$B2 ; 2
beq Boot2
2019-03-09 20:09:16 +00:00
jsr MLI
!byte $65
!word .quitparm
.quitparm
!byte $04,$00,$00,$00,$00,$00,$00
2019-04-10 23:43:19 +00:00
Boot2
inc $85FF ; boot drive 2
2019-03-09 20:09:16 +00:00
Boot
2019-03-11 12:54:25 +00:00
jsr HOME
2019-03-09 20:09:16 +00:00
ldx #$00
- lda $C600,x
sta $8600,x
2019-03-09 20:09:16 +00:00
inx
bne -
lda $865C
2019-03-12 03:59:36 +00:00
cmp #$80
2019-04-10 23:43:19 +00:00
bne @check2
lda #$18
sta $865C
2019-03-12 03:59:36 +00:00
lda #$08
sta $865D
lda #$F7
sta $8666
lda #$D9
sta $8682
lda #$BE
sta $869D
ldx #$B8
stx $86A3
dex
stx $86A5
2019-04-10 23:43:19 +00:00
@check2
lda $85FF
beq @skip2
2019-04-10 00:10:48 +00:00
ldx #$C8
lda $860F
cmp #$5A
2019-04-10 23:43:19 +00:00
bne +
2019-04-10 00:10:48 +00:00
lda #$EA
sta $860F
stx $8616 ;select drive 2 on IIc
2019-04-10 23:43:19 +00:00
+ lda $8619
2019-04-10 00:10:48 +00:00
cmp #$78
bne +
stx $8619 ;select drive 2 on IIGS
+ lda $8636
cmp #$8A
2019-04-10 23:43:19 +00:00
bne @skip2
2019-04-10 00:10:48 +00:00
inc $8636 ;select drive 2 on II
2019-04-10 23:43:19 +00:00
@skip2
lda #<Tracer
2019-03-10 02:30:04 +00:00
ldx #>Tracer
ldy $86F8
2019-03-09 20:09:16 +00:00
cpy #$4C
bne @iigs
2019-03-09 21:53:54 +00:00
; entry point for Disk II controller
sta $86F9 ; lo byte of callback
stx $86FA ; hi byte of callback
2019-03-12 20:35:43 +00:00
beq @tryboot
2019-03-09 20:09:16 +00:00
@iigs
ldy $86FB
2019-03-09 20:09:16 +00:00
cpy #$4C
bne @unknowncontroller
2019-03-09 21:53:54 +00:00
; entry point for IIgs smart controller
sta $86FC ; lo byte of callback
stx $86FD ; hi byte of callback
2019-03-12 20:35:43 +00:00
@tryboot
jmp IDBoot
2019-03-09 20:09:16 +00:00
@unknowncontroller
jmp $C600
2019-03-09 20:09:16 +00:00
2019-04-10 23:43:19 +00:00
CheckDrive2
lda $C0E9
lda $C0EB
2021-05-20 15:46:48 +00:00
jsr @spinup
jsr @seek
ldx #21
2021-05-20 15:46:48 +00:00
ldy #0
--- iny
bne +
clc
dex
bmi @driveoff
+
- lda $C0EC
bpl -
-- cmp #$D5
bne ---
- lda $C0EC
bpl -
cmp #$AA
2019-04-10 23:43:19 +00:00
bne --
2021-05-20 15:46:48 +00:00
- lda $C0EC
bpl -
2024-02-23 19:00:08 +00:00
cmp #$AD
bne --
2021-05-20 15:46:48 +00:00
@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
2019-04-10 23:43:19 +00:00
dey
2021-05-20 15:46:48 +00:00
bpl -
@delay
-- ldx #$11
- dex
bne -
inc $46
2021-05-20 15:46:48 +00:00
bne +
inc $47
2021-05-20 15:46:48 +00:00
+ sec
sbc #1
bne --
2019-04-10 23:43:19 +00:00
@knownret
rts
2021-05-20 15:46:48 +00:00
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
2019-03-11 01:16:41 +00:00
jsr IDIDSI
bcc BeginTheBoot
2019-03-11 19:30:59 +00:00
jsr IDSirius
bcc BeginTheBoot
2019-03-18 02:20:12 +00:00
jsr IDProDOS
bcc BeginTheBoot
2019-05-24 18:42:18 +00:00
jsr IDProgame
bcc BeginTheBoot
2020-08-12 01:02:04 +00:00
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
2019-05-24 19:30:07 +00:00
lda #$11 ;Virtual II fix
2019-05-24 18:42:18 +00:00
pha
plp ;match boot-time flags and registers
lda $800 ;might not be 1
2019-03-10 02:30:04 +00:00
ldy #0
ldx #$60
2019-03-09 20:09:16 +00:00
jmp $0801
2019-11-05 04:49:32 +00:00
Tracer13
jsr PatchBoot13
jsr IDPersonal
bcc BeginTheBoot13
jsr IDBoot13
bcc BeginTheBoot13
2020-10-16 01:02:57 +00:00
jsr IDSensible
bcc BeginTheBoot13
2019-11-05 04:49:32 +00:00
; [execution falls through here]
; [and runs anyway]
BeginTheBoot13
lda #$CD ;Virtual II fixes
sta $9D
sta $A2
lda #4
sta $AC
2021-05-20 15:46:48 +00:00
ldx #$33 ;Sensible Software fix
2019-11-05 04:49:32 +00:00
ldy $0300
jmp $0301
2019-03-09 20:09:16 +00:00
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
2019-03-13 15:45:01 +00:00
cmp #$E1
bcc @noforce
and kForceLower
@noforce
2019-03-09 20:09:16 +00:00
jsr COUT
inc @print+1
bne @print
inc @print+2
bne @print
@done
clc
@exit
rts
2019-03-13 15:45:01 +00:00
kForceLower
!byte $FF ; AND mask for lowercase letters
2019-03-09 20:09:16 +00:00
;
; String IDs
; (pass in accumulator to PrintByID)
;
s_header = $00
s_mainmenu = $01
STRINGCOUNT = $02
2019-03-09 20:09:16 +00:00
StringTable
!word @header
!word @mainmenu
@header
2024-02-27 16:25:27 +00:00
!text "Anti-M v2.2 by 4am 2024-02-27"
2019-03-09 20:09:16 +00:00
!text "________________________________________",$8D
!text $8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D,$00
2019-03-12 01:04:37 +00:00
@mainmenu
2019-03-09 20:09:16 +00:00
!text " Insert original disk in slot 6 drive 1",$8D
!text $8D
!text " and press <RETURN> to boot",$8D,$00
2019-03-10 02:30:04 +00:00
2019-03-10 14:28:28 +00:00
!src "src/compare.a"
!src "src/idbroderbund.a"
2019-03-10 14:28:28 +00:00
!src "src/idspiradisc.a"
2019-03-11 01:16:41 +00:00
!src "src/ididsi.a"
2019-03-11 19:34:46 +00:00
!src "src/idsirius.a"
2019-03-12 20:35:43 +00:00
!src "src/idboot.a"
2019-03-18 02:20:12 +00:00
!src "src/idprodos.a"
2019-05-24 18:42:18 +00:00
!src "src/idprogame.a"
2019-11-05 04:49:32 +00:00
!src "src/idpersonal.a"
2020-08-12 01:02:04 +00:00
!src "src/idalphabeta.a"
2020-10-16 01:02:57 +00:00
!src "src/idsensible.a"