From 3601c5be62282d78ffa60100ae069571704eeb25 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Mon, 15 Apr 2019 17:15:36 -0700 Subject: [PATCH] auto-crack Choplifter (read-only) also make one-time procs discardable and double stringtable capacity --- src/initscan.a | 205 ++++++++++++++++++++++ src/mli.a | 100 +---------- src/passport.a | 41 ++--- src/patchers/choplifter.a | 225 +++++++++++++++++++++--- src/prefs.a | 16 -- src/print.a | 10 +- src/slots.a | 111 ------------ src/strings/en.a | 361 +++++++++++++++++++++++++------------- 8 files changed, 682 insertions(+), 387 deletions(-) create mode 100644 src/initscan.a diff --git a/src/initscan.a b/src/initscan.a new file mode 100644 index 0000000..34cebc8 --- /dev/null +++ b/src/initscan.a @@ -0,0 +1,205 @@ +;------------------------------- +; ScanForDiskII +; scan all slots for things that +; look like Disk II cards +; +; out: all registers clobbered +; all flags clobbered +; DiskIIArray filled with 00 or FF +;------------------------------- +!zone { +ScanForDiskII + lda #$00 + sta cmp1 + ldx #$07 +.fingerprint + txa + ora #$C0 + sta cmp1+1 + ldy #$01 + lda (cmp1),y + cmp #$20 + bne .next + ldy #$03 + lda (cmp1),y + bne .next + ldy #$05 + lda (cmp1),y + cmp #$03 + bne .next + ldy #$FF + lda (cmp1),y + bne .next + tya + sta DiskIIArray-1,x +.next + dex + bne .fingerprint + rts +} + +!zone { +ScanForRAMDisk + lda #$00 + sta iunit +- lda iunit + clc + adc #$10 + sta iunit + beq .done + cmp #$80 + beq - + pha + and #$70 + lsr + lsr + lsr + lsr + tay + pla + ldx DiskIIArray-1,y + bne - + jsr GetVolumeName + bcs - + lda OnlineReturn + beq - + jsr GetVolumeInfo + + ;watch for RAM disk type + + lda filetype + and #$0F + cmp #$0F + bne - + + ;check for RAM[x] by name + + ldy OnlineReturn + cpy #4 + beq + + cpy #5 + bne - + dey ++ +-- lda SlashRAM-1,y + cmp VolumeName-1,y + bne - + dey + bne -- + + ;check free space + ;need at least $118 blocks + + sec + lda auxtype + sbc blocks + tax + lda auxtype+1 + sbc blocks+1 + cmp #1 + bcc - + bne + + cpx #$18 + bcc - ++ lda #TRUE + sta gUsingRAMDisk +.done + rts + +SlashRAM !byte $2F, $52, $41, $4D +} + +;------------------------------- +; LoadPrefs +; load preferences from file +; +; in: ProDOS must be in memory +;------------------------------- +LoadPrefs + lda #$FF + sta PREFSVER + jsr LoadFile1Shot + !word PREFSFILE + !word PREFSVER + !word PREFSREADLEN + !word PREFSBUFFER + jsr ValidatePrefs + bcc .goodprefs + jmp SavePrefs + +.goodprefs + rts + +;------------------------------- +; LoadFile1Shot +; load a file into memory all at once, +; using ProDOS MLI calls +; +; in: stack contains 8 bytes of parameters: +; +1 address of pathname +; +3 address of data buffer (to receive file contents) +; +5 [word] maximum length of data to read +; +7 address of ProDOS file buffer +; out: if C set, load failed and A contains error code +; from open or read +; if C clear, load succeeded and ($02) contains +; data loaded from file +; all other flags clobbered +; all registers clobbered +; stack set to next instruction after parameters +;------------------------------- +!zone { +LoadFile1Shot + clc + pla + adc #$08 + sta $00 + tax + pla + adc #$00 + sta $01 + pha + txa + pha + + ldy #$01 + lda ($00),y ; lo byte of pathname + sta mliparam+1 + iny + lda ($00),y ; hi byte of pathname + sta mliparam+2 + ldy #$07 + lda ($00),y ; lo byte of ProDOS file buffer + sta mliparam+3 + iny + lda ($00),y ; hi byte of ProDOS file buffer + sta mliparam+4 + + jsr OpenFile + bcs .loadfile1s ; C set on error + + pha ; push file reference number + ldy #$03 + lda ($00),y ; lo address of data buffer + sta mliparam+2 + iny + lda ($00),y ; hi address of data buffer + sta mliparam+3 + iny + lda ($00),y ; lo data length + sta mliparam+4 + iny + lda ($00),y ; hi data length + sta mliparam+5 + pla ; pull file reference number + jsr ReadFile + php ; save flags from readfile + pha + jsr CloseFile ; always close whether read worked or not + pla + plp ; restore flags from readfile + ; (so caller gets codes from read attempt, + ; not close) +.loadfile1s + rts +} diff --git a/src/mli.a b/src/mli.a index fba5f1a..c8bd48a 100755 --- a/src/mli.a +++ b/src/mli.a @@ -139,21 +139,16 @@ WriteTrackMLI ;------------------------------- !zone { SaveFile1Shot - pla - sta $00 - pla - sta $01 - tax - lda #$0B clc - adc $00 - bcc .noinc - inx -.noinc - tay - txa + pla + adc #$0B + sta $00 + tax + pla + adc #$00 + sta $01 pha - tya + txa pha ldy #$01 @@ -211,85 +206,6 @@ SaveFile1Shot rts } -;------------------------------- -; LoadFile1Shot -; load a file into memory all at once, -; using ProDOS MLI calls -; -; in: stack contains 8 bytes of parameters: -; +1 address of pathname -; +3 address of data buffer (to receive file contents) -; +5 [word] maximum length of data to read -; +7 address of ProDOS file buffer -; out: if C set, load failed and A contains error code -; from open or read -; if C clear, load succeeded and ($02) contains -; data loaded from file -; all other flags clobbered -; all registers clobbered -; stack set to next instruction after parameters -;------------------------------- -!zone { -LoadFile1Shot - pla - sta $00 - pla - sta $01 - tax - lda #$08 - clc - adc $00 - bcc .noinc - inx -.noinc - tay - txa - pha - tya - pha - - ldy #$01 - lda ($00),y ; lo byte of pathname - sta mliparam+1 - iny - lda ($00),y ; hi byte of pathname - sta mliparam+2 - ldy #$07 - lda ($00),y ; lo byte of ProDOS file buffer - sta mliparam+3 - iny - lda ($00),y ; hi byte of ProDOS file buffer - sta mliparam+4 - - jsr OpenFile - bcs .loadfile1s ; C set on error - - pha ; push file reference number - ldy #$03 - lda ($00),y ; lo address of data buffer - sta mliparam+2 - iny - lda ($00),y ; hi address of data buffer - sta mliparam+3 - iny - lda ($00),y ; lo data length - sta mliparam+4 - iny - lda ($00),y ; hi data length - sta mliparam+5 - pla ; pull file reference number - jsr ReadFile - php ; save flags from readfile - pha - jsr CloseFile ; always close whether read worked or not - pla - plp ; restore flags from readfile - ; (so caller gets codes from read attempt, - ; not close) -.loadfile1s - rts -} - ;------------------------------- ; open file via ProDOS MLI ; diff --git a/src/passport.a b/src/passport.a index 489508e..848a708 100755 --- a/src/passport.a +++ b/src/passport.a @@ -96,7 +96,26 @@ FM lda LastMover - 256,x lda FM+5 cmp #(>RELBASE)-((>(RELBASE+255))->RELBASE)-1 bne FM - jmp OneTimeSetup + +OneTimeSetup + lda $C0E8 + jsr SaveProDOS + ldx MACHINEID + cpx #$EA + bne .slotscan + lda #$DF + sta kForceLower +.slotscan + jsr ScanForDiskII + lda DiskIIArray+5 + bne .founds6 + jmp FatalNoSlot6 +.founds6 + jsr ScanForRAMDisk + jsr LoadPrefs ; load preferences (if available) + jmp ResetVector + + !source "initscan.a" FirstMover !pseudopc RELBASE { @@ -165,24 +184,6 @@ FirstMover !source "rwts.a" !source "standarddelivery.a" -OneTimeSetup - lda $C0E8 - jsr SaveProDOS - ldx MACHINEID - cpx #$EA - bne .slotscan - lda #$DF - sta kForceLower -.slotscan - jsr ScanForDiskII - lda DiskIIArray+5 - bne .founds6 - jmp FatalNoSlot6 -.founds6 - jsr ScanForRAMDisk - jsr LoadPrefs ; load preferences (if available) - bcc ResetVector - jsr SavePrefs ; save preferences (if possible) ResetVector lda # !source "strings/enid.a" !zone { -StringTable - !word .header - !word .mainmenu - !word .progbar - !word .reading - !word .diskrwts - !word .bb00 - !word .sunburst - !word .optimum - !word .builtin - !word .switch - !word .writing - !word .unformat - !word .f7 - !word .sync - !word .optbad - !word .passver - !word .passdemuf - !word .passcrack - !word .passcrack0 - !word .fail - !word .fatal0000 - !word .fatal220f - !word .done - !word .noslot6 - !word .writeerr - !word .writeioerr - !word .writenodev - !word .writeprot - !word .othermli - !word .canttrace - !word .canceled - !word .bademu - !word .reset - !word .modify - !word .modifyto - !word .dos33boot0 - !word .prodosboot0 - !word .pascalboot0 - !word .mecc - !word .sierra - !word .a6bc95 - !word .jmpbcf0 - !word .rol1e - !word .runhello - !word .e7 - !word .jmpb4bb - !word .jmpb400 - !word .jmpbeca - !word .bb03 - !word .thunder - !word .jmpae8e - !word .diskvol - !word .d5d5f7 - !word .construct - !word .datasoftb0 - !word .datasoft - !word .lsr6a - !word .bcs08 - !word .jmpb660 - !word .protdos - !word .decryptrwts - !word .protserial - !word .fbff - !word .encoded44 - !word .encoded53 - !word .specdel - !word .bytrack - !word .a5count - !word .restart - !word .corrupter - !word .eaboot0 - !word .eatrk6 - !word .eeef - !word .poke - !word .bootcounter - !word .milliken - !word .jsr8b3 - !word .daviddos - !word .quickdos - !word .diversidos - !word .prontodos - !word .jmpb412 - !word .laureate - !word .bbf9 - !word .micrograms - !word .cmpbne0 - !word .writeram - !word .d5timing - !word .advint - !word .dos32boot0 - !word .bootwrite - !word .rwtswrite - !word .rdos - !word .sra - !word .muse - !word .origin - !word .volumename - !word .dinkeydos - !word .trillium - !word .tamper - !word .microfun - !word .advent - !word .gathering - !word .davidson - !word .rdos13 - !word .ssi - !word .aacount - !word .infocom18 - !word .toverify - !word .sector13 - !word .dakin5 - !word .springboard - !word .hallabs - !word .holle - !word .hoffman - !word .diskvol0 - !word .e7everywhere - !word .choplifter +StringTableLow + !byte <.header + !byte <.mainmenu + !byte <.progbar + !byte <.reading + !byte <.diskrwts + !byte <.bb00 + !byte <.sunburst + !byte <.optimum + !byte <.builtin + !byte <.switch + !byte <.writing + !byte <.unformat + !byte <.f7 + !byte <.sync + !byte <.optbad + !byte <.passver + !byte <.passdemuf + !byte <.passcrack + !byte <.passcrack0 + !byte <.fail + !byte <.fatal0000 + !byte <.fatal220f + !byte <.done + !byte <.noslot6 + !byte <.writeerr + !byte <.writeioerr + !byte <.writenodev + !byte <.writeprot + !byte <.othermli + !byte <.canttrace + !byte <.canceled + !byte <.bademu + !byte <.reset + !byte <.modify + !byte <.modifyto + !byte <.dos33boot0 + !byte <.prodosboot0 + !byte <.pascalboot0 + !byte <.mecc + !byte <.sierra + !byte <.a6bc95 + !byte <.jmpbcf0 + !byte <.rol1e + !byte <.runhello + !byte <.e7 + !byte <.jmpb4bb + !byte <.jmpb400 + !byte <.jmpbeca + !byte <.bb03 + !byte <.thunder + !byte <.jmpae8e + !byte <.diskvol + !byte <.d5d5f7 + !byte <.construct + !byte <.datasoftb0 + !byte <.datasoft + !byte <.lsr6a + !byte <.bcs08 + !byte <.jmpb660 + !byte <.protdos + !byte <.decryptrwts + !byte <.protserial + !byte <.fbff + !byte <.encoded44 + !byte <.encoded53 + !byte <.specdel + !byte <.bytrack + !byte <.a5count + !byte <.restart + !byte <.corrupter + !byte <.eaboot0 + !byte <.eatrk6 + !byte <.eeef + !byte <.poke + !byte <.bootcounter + !byte <.milliken + !byte <.jsr8b3 + !byte <.daviddos + !byte <.quickdos + !byte <.diversidos + !byte <.prontodos + !byte <.jmpb412 + !byte <.laureate + !byte <.bbf9 + !byte <.micrograms + !byte <.cmpbne0 + !byte <.writeram + !byte <.d5timing + !byte <.advint + !byte <.dos32boot0 + !byte <.bootwrite + !byte <.rwtswrite + !byte <.rdos + !byte <.sra + !byte <.muse + !byte <.origin + !byte <.volumename + !byte <.dinkeydos + !byte <.trillium + !byte <.tamper + !byte <.microfun + !byte <.advent + !byte <.gathering + !byte <.davidson + !byte <.rdos13 + !byte <.ssi + !byte <.aacount + !byte <.infocom18 + !byte <.toverify + !byte <.sector13 + !byte <.dakin5 + !byte <.springboard + !byte <.hallabs + !byte <.holle + !byte <.hoffman + !byte <.diskvol0 + !byte <.e7everywhere + !byte <.choplifter + +StringTableHigh + !byte >.header + !byte >.mainmenu + !byte >.progbar + !byte >.reading + !byte >.diskrwts + !byte >.bb00 + !byte >.sunburst + !byte >.optimum + !byte >.builtin + !byte >.switch + !byte >.writing + !byte >.unformat + !byte >.f7 + !byte >.sync + !byte >.optbad + !byte >.passver + !byte >.passdemuf + !byte >.passcrack + !byte >.passcrack0 + !byte >.fail + !byte >.fatal0000 + !byte >.fatal220f + !byte >.done + !byte >.noslot6 + !byte >.writeerr + !byte >.writeioerr + !byte >.writenodev + !byte >.writeprot + !byte >.othermli + !byte >.canttrace + !byte >.canceled + !byte >.bademu + !byte >.reset + !byte >.modify + !byte >.modifyto + !byte >.dos33boot0 + !byte >.prodosboot0 + !byte >.pascalboot0 + !byte >.mecc + !byte >.sierra + !byte >.a6bc95 + !byte >.jmpbcf0 + !byte >.rol1e + !byte >.runhello + !byte >.e7 + !byte >.jmpb4bb + !byte >.jmpb400 + !byte >.jmpbeca + !byte >.bb03 + !byte >.thunder + !byte >.jmpae8e + !byte >.diskvol + !byte >.d5d5f7 + !byte >.construct + !byte >.datasoftb0 + !byte >.datasoft + !byte >.lsr6a + !byte >.bcs08 + !byte >.jmpb660 + !byte >.protdos + !byte >.decryptrwts + !byte >.protserial + !byte >.fbff + !byte >.encoded44 + !byte >.encoded53 + !byte >.specdel + !byte >.bytrack + !byte >.a5count + !byte >.restart + !byte >.corrupter + !byte >.eaboot0 + !byte >.eatrk6 + !byte >.eeef + !byte >.poke + !byte >.bootcounter + !byte >.milliken + !byte >.jsr8b3 + !byte >.daviddos + !byte >.quickdos + !byte >.diversidos + !byte >.prontodos + !byte >.jmpb412 + !byte >.laureate + !byte >.bbf9 + !byte >.micrograms + !byte >.cmpbne0 + !byte >.writeram + !byte >.d5timing + !byte >.advint + !byte >.dos32boot0 + !byte >.bootwrite + !byte >.rwtswrite + !byte >.rdos + !byte >.sra + !byte >.muse + !byte >.origin + !byte >.volumename + !byte >.dinkeydos + !byte >.trillium + !byte >.tamper + !byte >.microfun + !byte >.advent + !byte >.gathering + !byte >.davidson + !byte >.rdos13 + !byte >.ssi + !byte >.aacount + !byte >.infocom18 + !byte >.toverify + !byte >.sector13 + !byte >.dakin5 + !byte >.springboard + !byte >.hallabs + !byte >.holle + !byte >.hoffman + !byte >.diskvol0 + !byte >.e7everywhere + !byte >.choplifter + ; ; Text can contain substitution strings, which ; are replaced by current values at runtime. Each @@ -159,7 +280,7 @@ StringTable ; can be set directly before calling PrintByID. ; .header - !text "Passport by 4am 2019-04-13",$00 + !text "Passport by 4am 2019-04-15",$00 .mainmenu !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D !text " "