anti-m/src/anti-m.a
2019-03-10 10:28:28 -04:00

157 lines
4.0 KiB
Plaintext

!cpu 6502
!ct "src/lcase.ct"
!to "build/ANTI.M.SYSTEM",plain
*=$2000
;-------------------------------
; Anti-M
; a 4am hack
; (c) 2019 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
KEY = $C000
STROBE = $C010
REBOOT = $FAA6
TEXT = $FB2F
HOME = $FC58
COUT = $FDED
cmp1 = $F8 ; word
cmp2 = $FA ; word
tmp = $FC ; byte
jsr TEXT
jsr HOME
MainMenu
ldx #$FF
txs
jsr HOME
lda #s_header
jsr PrintByID
lda #s_mainmenu
jsr PrintByID
@loop
bit STROBE
- lda KEY
bpl -
bit STROBE
cmp #$8D ; return
beq Boot
jsr MLI
!byte $65
!word .quitparm
.quitparm
!byte $04,$00,$00,$00,$00,$00,$00
Boot
ldx #$00
- lda $C600,x
sta $1600,x
inx
bne -
lda #<Tracer
ldx #>Tracer
ldy $16F8
cpy #$4C
bne @iigs
; entry point for Disk II controller
sta $16F9 ; lo byte of callback
stx $16FA ; hi byte of callback
jmp $1600
@iigs
ldy $16FB
cpy #$4C
bne @unknowncontroller
; entry point for IIgs smart controller
sta $16FC ; lo byte of callback
stx $16FD ; hi byte of callback
jmp $1600
@unknowncontroller
jmp REBOOT
Tracer
jsr IDChoplifter
bcc @jmpboot
jsr IDSpiraDisc
bcc @jmpboot
;... others ...
@jmpboot
sec ;match boot-time flags and registers
lda #1
ldy #0
ldx #$60
jmp $0801
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
jsr COUT
inc @print+1
bne @print
inc @print+2
bne @print
@done
clc
@exit
rts
;
; String IDs
; (pass in accumulator to PrintByID)
;
s_header = $00
s_mainmenu = $01
STRINGCOUNT = $02
StringTable
!word @header
!word @mainmenu
@header
!text "Anti-M by 4am 2019-03-10",$00
@mainmenu
!text "________________________________________",$8D
!text $8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D
!text " Insert original disk in slot 6 drive 1",$8D
!text $8D
!text " and press <RETURN> to boot",$00
!src "src/compare.a"
!src "src/idchoplifter.a"
!src "src/idspiradisc.a"