diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9955f60 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.DS_Store +/build/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..4d5bb68 --- /dev/null +++ b/Makefile @@ -0,0 +1,35 @@ +# +# Anti-M Makefile +# assembles source code, optionally builds a disk image and mounts it +# +# original by Quinn Dunki on 2014-08-15 +# One Girl, One Laptop Productions +# http://www.quinndunki.com/blondihacks +# +# adapted by 4am on 2019-03-09 +# + +# third-party tools required to build +# https://sourceforge.net/projects/acme-crossass/ +ACME=acme +# https://www.brutaldeluxe.fr/products/crossdevtools/cadius/ +# https://github.com/mach-kernel/cadius +CADIUS=cadius + +BUILDDISK=build/anti-m.po +VOLUME=ANTI.M + +asm: + mkdir -p build + $(ACME) -r build/anti-m.lst src/anti-m.a + cp res/work.po $(BUILDDISK) + cp res/_FileInformation.txt build/ >>build/log + $(CADIUS) ADDFILE "$(BUILDDISK)" "/${VOLUME}/" "build/ANTI.M.SYSTEM" >>build/log + +clean: + rm -rf build/ + +mount: + open "$(BUILDDISK)" + +all: clean asm mount diff --git a/res/_FileInformation.txt b/res/_FileInformation.txt new file mode 100644 index 0000000..fdd4d7e --- /dev/null +++ b/res/_FileInformation.txt @@ -0,0 +1,2 @@ +PRODOS=Type(FF),AuxType(0000),Access(C3) +ANTI.M.SYSTEM=Type(FF),AuxType(2000),Access(C3) diff --git a/res/notes.txt b/res/notes.txt new file mode 100644 index 0000000..d446d68 --- /dev/null +++ b/res/notes.txt @@ -0,0 +1,19 @@ +Tested (Broderbund): +- Choplifter +- Dueling Digits +- Labyrinth +- Seafox +- Serpentine +- Star Blazer + +Tested (Gebelli): +- Eggs-It +- Horizon V +- High Orbit +- Neptune +- Phaser Fire +- Russki Duck +- Zenith + +Untested (Gebelli): +- Lazer Silk diff --git a/res/work.po b/res/work.po new file mode 100644 index 0000000..0dc910a Binary files /dev/null and b/res/work.po differ diff --git a/src/anti-m.a b/src/anti-m.a new file mode 100644 index 0000000..ded118d --- /dev/null +++ b/src/anti-m.a @@ -0,0 +1,204 @@ +!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 + + 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 #0 +- lda Tracer,x + sta $1700,x + inx + bne - + ldx #$00 +- lda $C600,x + sta $1600,x + inx + bne - + lda #$00 + ldx #$17 + ldy $16F8 + cpy #$4C + bne @iigs + sty $16F8 ; JMP 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 + sty $16FB ; JMP for IIgs smart controller + sta $16FC ; lo byte of callback + stx $16FD ; hi byte of callback + jmp $1600 +@unknowncontroller + jmp REBOOT + +Tracer +!pseudopc $1700 { +; patch code to regain control after it loads 1 sector into $0300 + lda #<@callback1 + sta $0838 + lda #>@callback1 + sta $0839 + jmp $0801 +@callback1 +; duplicate bootloader from $0300 to $2300 + ldx #$00 +- lda $0300,x + sta $2300,x + inx + bne - +; patch bootloader so it reads the pristine copy at $2300 + lda #$23 + sta $030A + sta $0310 + sta $0316 + sta $031C +; patch bootloader to regain control after it decrypts itself into $0100 + lda #$4C + sta $0325 + lda #<@callback2 + sta $0326 + lda #>@callback2 + sta $0327 + jmp $0301 +@callback2 +; patch bootloader to regain control after it loads 4 sectors into $0400 + lda #$4C + sta $01FB + lda #<@callback3 + sta $01FC + lda #>@callback3 + sta $01FD + rts +@callback3 +; patch bootloader so it doesn't wipe main memory + lda #$60 + sta $04E2 +; patch bootloader to regain control after it loads title screen and code into $2000+ + lda #$4C + sta $0498 + lda #<@callback4 + sta $0499 + lda #>@callback4 + sta $049A +; restore bytes on stack page that we patched earlier because they're checksummed soon + lda #$AE + sta $01FB + lda #$65 + sta $01FC + lda #$05 + sta $01FD + jmp $01FB +@callback4 +; patch bootloader to bypass ROM check at $6300 + lda #$60 + sta $0421 + jmp $0400 +} +EndTracer=* + +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-09",$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 to boot",$00 diff --git a/src/lcase.ct b/src/lcase.ct new file mode 100755 index 0000000..38dee39 --- /dev/null +++ b/src/lcase.ct @@ -0,0 +1 @@ + \ No newline at end of file