mirror of
https://github.com/a2-4am/passport.git
synced 2024-12-22 04:29:59 +00:00
Merge pull request #60 from peterferrie/master
convert RDOS13 to 16 sectors + support SSI protection
This commit is contained in:
commit
7b7a810bb0
2
Makefile
2
Makefile
@ -24,7 +24,7 @@ asm:
|
||||
cd src/mods && $(ACME) universalrwts.a
|
||||
$(EXOMIZER) raw -q build/universalrwts.bin -o build/universalrwts.tmp
|
||||
printf "\xB8\x00" | cat - build/universalrwts.tmp > build/universalrwts.pak
|
||||
cd src/mods && $(ACME) t00only.a
|
||||
cd src/mods && $(ACME) -r ../../build/t00only.lst t00only.a
|
||||
$(EXOMIZER) raw -q build/t00only.bin -o build/t00only.tmp
|
||||
printf "\x20\x00" | cat - build/t00only.tmp > build/t00only.pak
|
||||
cd src && $(ACME) -r ../build/passport.lst passport.a 2> ../build/relbase.log
|
||||
|
@ -54,6 +54,10 @@
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
|
||||
FIRSTFILTER
|
||||
;gIsRDOS
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
;gIsDavidson
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
|
@ -10,6 +10,7 @@ FALSE = $01
|
||||
ID_DOS33p = $00
|
||||
ID_DOS32 = $01
|
||||
ID_DOS32LO = $02
|
||||
ID_RDOS13 = $03
|
||||
|
||||
;-------------------------------
|
||||
;MECC fast-load variants
|
||||
@ -48,6 +49,7 @@ RELBASE = $2000 ; dummy assignment for first build
|
||||
; to allow calculation of proper value
|
||||
}
|
||||
LOWPOINT = $4300 ; lowest available address for code
|
||||
HIGHPOINT = $B200 ; highest available address+1 for code
|
||||
BASEPAGE = $10 ; Special Delivery tracer assumes
|
||||
; this is $10, so don't change it!
|
||||
|
||||
@ -57,7 +59,7 @@ BASEPAGE = $10 ; Special Delivery tracer assumes
|
||||
; compressed code to work
|
||||
;-------------------------------
|
||||
|
||||
APIEND = $B600
|
||||
APIEND = HIGHPOINT
|
||||
gMode = APIEND-$01 ; byte
|
||||
gPatchCount = gMode-$01 ; byte
|
||||
gTriedUniv = gPatchCount-$01 ; byte
|
||||
@ -95,9 +97,10 @@ gForceDiskVol = gPolarwareTamperCheck-$01 ; byte
|
||||
gIsAdvent = gForceDiskVol-$01 ; byte
|
||||
gIsPanglosDOS = gIsAdvent-$01 ; byte
|
||||
gIsDavidson = gIsPanglosDOS-$01 ; byte
|
||||
gIsRDOS13 = gIsDavidson-$01 ; byte
|
||||
;LASTFILTER ; add new gIs* above this line
|
||||
;gMECCFastloadType is a special case integer whose default value cannot be #FALSE
|
||||
gMECCFastloadType = gIsDavidson-$01 ; byte
|
||||
gMECCFastloadType = gIsRDOS13-$01 ; byte
|
||||
|
||||
gOnAClearDayYouCanReadForever = gMECCFastloadType-$01 ; byte
|
||||
gUsingRAMDisk = gOnAClearDayYouCanReadForever-$01 ; byte
|
||||
@ -164,6 +167,7 @@ ConstructStandardDelivery = jConstructStandardDelivery
|
||||
!warn "gIsAdvent=",gIsAdvent
|
||||
!warn "gIsPanglosDOS=",gIsPanglosDOS
|
||||
!warn "gIsDavidson=",gIsDavidson
|
||||
!warn "gIsRDOS13=",gIsRDOS13
|
||||
!warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever
|
||||
!warn "gUsingRAMDisk=",gUsingRAMDisk
|
||||
!warn "gRAMDiskRef=",gRAMDiskRef
|
||||
|
@ -143,8 +143,11 @@ TraceDOS32LO
|
||||
cmp #$B6
|
||||
beq +
|
||||
cmp #$36
|
||||
beq +
|
||||
cmp #$B2 ;RDOS
|
||||
bne .fail
|
||||
+
|
||||
clc
|
||||
+ php
|
||||
;
|
||||
; set up RWTS entry point and other self-modified vectors
|
||||
; that depend on where the RWTS is in memory
|
||||
@ -177,7 +180,32 @@ TraceDOS32LO
|
||||
|
||||
.fail jmp FatalError
|
||||
|
||||
.RDOSPatch
|
||||
lda #$B3
|
||||
ldx #$00 ; check for "JMP $B974;LDY #$00"
|
||||
ldy #$05 ; at RWTS entry point
|
||||
jsr CompareMemory ; (i.e. $B300)
|
||||
!byte $4C,$74,$B9,$A0,$00
|
||||
bcs .fail
|
||||
lda #TRUE
|
||||
sta gIsRDOS13
|
||||
lda #s_rdos13
|
||||
jsr PrintByID
|
||||
|
||||
lda #<.RDOS13Hook
|
||||
sta jCallRWTS+1
|
||||
lda #>.RDOS13Hook
|
||||
sta jCallRWTS+2
|
||||
|
||||
lda #$C9 ; override address prologue to avoid reliance on $48
|
||||
sta $BC75
|
||||
lda #$D4
|
||||
sta $BC76
|
||||
bne .patchmap
|
||||
|
||||
TraceDOS32d
|
||||
plp
|
||||
bcc .RDOSPatch
|
||||
lda jCallRWTS+2
|
||||
ldx #$00 ; check for "STY $48;STA $49"
|
||||
ldy #$04 ; at RWTS entry point
|
||||
@ -205,6 +233,8 @@ TraceDOS32d
|
||||
; if data prologue is not found
|
||||
sta (modsrc),y
|
||||
|
||||
.patchmap
|
||||
|
||||
; skip sectors $0D, $0E, and $0F on all tracks
|
||||
; since this is a 13-sector disk
|
||||
|
||||
@ -226,6 +256,16 @@ TraceDOS32d
|
||||
dex
|
||||
bpl .A
|
||||
|
||||
; set flag for patcher
|
||||
|
||||
lda #TRUE
|
||||
sta gIsDOS32
|
||||
|
||||
;retain track 00 for RDOS because we can
|
||||
|
||||
ldy gIsRDOS13
|
||||
beq +
|
||||
|
||||
; skip T00,S00-S0A
|
||||
; since we're going to construct our own bootloader later
|
||||
|
||||
@ -234,11 +274,6 @@ TraceDOS32d
|
||||
dey
|
||||
bpl -
|
||||
|
||||
; set flag for patcher
|
||||
|
||||
lda #TRUE
|
||||
sta gIsDOS32
|
||||
|
||||
; check for MUSE sector doubling RWTS
|
||||
lda jCallRWTS+2
|
||||
ldx #$09
|
||||
@ -279,8 +314,34 @@ FFer
|
||||
iny
|
||||
cpy #$9A
|
||||
bne .G
|
||||
clc
|
||||
- clc
|
||||
rts
|
||||
+ sec
|
||||
rts
|
||||
|
||||
.RDOS13Hook
|
||||
ldx _sector
|
||||
stx $BAF6
|
||||
lda _track
|
||||
sta $BAF5
|
||||
bne +
|
||||
cpx #$0C
|
||||
beq - ;lie that T00S0C exists
|
||||
|
||||
;standard 13-sector prologue on T00
|
||||
;because we can't decode the 16-sector version
|
||||
lda #$D5
|
||||
sta $BC76
|
||||
lda #$B5
|
||||
sta $BC8B
|
||||
|
||||
+ lda gAddress
|
||||
sta $BAF7
|
||||
lda gAddress+1
|
||||
sta $BAF8
|
||||
ldx #1
|
||||
stx $B718 ;count of sectors (low part)
|
||||
dex
|
||||
stx $B719 ;count of sectors (high part)
|
||||
jmp $BA00
|
||||
}
|
||||
|
@ -12,8 +12,8 @@
|
||||
; 2000..35FF - clobbered by Special Delivery tracer
|
||||
; 3600..3FFF - clobbered by lomem DOS 3.3 / Special Delivery tracers
|
||||
; 4000..42FF - backup of zero page, page 3, page $BF (SaveProDOS, SwapProDOS)
|
||||
; 4300..B5FF - program code
|
||||
; B600..BFFF - clobbered by DOS 3.3 boot tracer
|
||||
; 4300..B1FF - program code
|
||||
; B200..BFFF - clobbered by DOS boot tracer (RDOS is B200+, DOS 3.x is B600+)
|
||||
;-------------------------------
|
||||
|
||||
|
||||
|
@ -680,14 +680,16 @@ WriteRAMToDisk
|
||||
bne -
|
||||
|
||||
jsr IncProgress
|
||||
lda #TRUE
|
||||
sta gUsingRAMDisk
|
||||
clc
|
||||
|
||||
.exit
|
||||
lda #TRUE
|
||||
sta gUsingRAMDisk
|
||||
rts
|
||||
|
||||
.cancel
|
||||
lda #TRUE
|
||||
sta gUsingRAMDisk
|
||||
jmp Cancel
|
||||
|
||||
}
|
||||
|
@ -108,6 +108,7 @@ AnalyzeT00
|
||||
!source "../patchers/dos32dlm.a"
|
||||
!source "../patchers/microfun.a"
|
||||
!source "../patchers/panglosdos.a"
|
||||
!source "../patchers/rdos13.a"
|
||||
|
||||
;add only above this line
|
||||
rts
|
||||
|
@ -4,7 +4,7 @@
|
||||
;-------------------------------
|
||||
; Passport
|
||||
; a 4am hack
|
||||
; (c) 2016-7 by 4am
|
||||
; (c) 2016-8 by 4am
|
||||
;
|
||||
; Permission is hereby granted, free of charge, to any
|
||||
; person obtaining a copy of this software and associated
|
||||
@ -88,7 +88,7 @@ UNIV_D3 = $B8FC
|
||||
|
||||
ldx #$00
|
||||
FM lda LastMover - 256,x
|
||||
sta $B500,x
|
||||
sta HIGHPOINT-$100,x
|
||||
inx
|
||||
bne FM
|
||||
dec FM+2
|
||||
@ -375,6 +375,9 @@ ReadWithRWTS
|
||||
.read
|
||||
lda KEY
|
||||
bpl checksector
|
||||
bit STROBE
|
||||
cmp #$e0 ;ignore backtick (MAME debug break)
|
||||
beq checksector
|
||||
jmp Cancel
|
||||
checksector
|
||||
lda $FFFF ; status of current sector in sector map (modified above)
|
||||
@ -796,6 +799,7 @@ _applyToAll
|
||||
!source "patchers/advent.a" ; gIsAdvent only
|
||||
!source "patchers/davidsonforth.a" ; gIsDavidson only
|
||||
!source "patchers/davidsonasm.a" ; gIsDavidson only
|
||||
!source "patchers/ssi.a" ; gIsRDOS13 only
|
||||
|
||||
lda gPatchCount
|
||||
beq .nopatches
|
||||
@ -818,10 +822,10 @@ LastMover
|
||||
!ifdef PASS2 {
|
||||
} else { ;PASS2
|
||||
!set PASS2=1
|
||||
!warn "RELBASE = ", $B600 - (LastMover - FirstMover)
|
||||
!warn "RELBASE = ", HIGHPOINT - (LastMover - FirstMover)
|
||||
}
|
||||
} else {
|
||||
!if ($B600 - (LastMover - FirstMover)) < LOWPOINT {
|
||||
!if (HIGHPOINT - (LastMover - FirstMover)) < LOWPOINT {
|
||||
!serious "code is too large to fit in available space!"
|
||||
}
|
||||
}
|
||||
|
@ -7,8 +7,8 @@
|
||||
bpl .exit
|
||||
lda gIsDOS32
|
||||
bne .exit
|
||||
bit gMode ; nothing to do here in verify-only mode
|
||||
bpl .exit
|
||||
lda gIsRDOS13
|
||||
beq .exit
|
||||
|
||||
; sector 1
|
||||
|
||||
@ -54,21 +54,15 @@
|
||||
|
||||
; sector 0
|
||||
|
||||
ldx #ID_DOS32LO
|
||||
.cr lda #$d1 ; set at runtime
|
||||
cmp #$3D
|
||||
beq +
|
||||
ldx #ID_DOS32
|
||||
jsr ConstructStandardDelivery
|
||||
jmp ++
|
||||
|
||||
+ ldx #ID_DOS32LO
|
||||
jsr ConstructStandardDelivery
|
||||
|
||||
++ bit gMode ; do not print in verify mode
|
||||
bpl +++
|
||||
+ jsr ConstructStandardDelivery
|
||||
|
||||
lda #s_bootwrite
|
||||
jsr PrintByID
|
||||
+++ inc gPatchCount
|
||||
inc gPatchCount
|
||||
.exit
|
||||
}
|
||||
|
171
src/patchers/rdos13.a
Normal file
171
src/patchers/rdos13.a
Normal file
@ -0,0 +1,171 @@
|
||||
;-------------------------------
|
||||
; #RDOS13
|
||||
; patch RDOS to be 16-sector compatible
|
||||
;
|
||||
; module by qkumba
|
||||
;-------------------------------
|
||||
!zone {
|
||||
bit gMode ; nothing to do here in verify-only mode
|
||||
bpl .jmpexit
|
||||
lda gIsRDOS13
|
||||
beq .okay
|
||||
.jmpexit
|
||||
jmp .exit
|
||||
|
||||
.okay
|
||||
|
||||
lda #8
|
||||
ldx #$C9
|
||||
ldy #3
|
||||
jsr modify
|
||||
!byte $20,$2A,$BB ;JSR $BB2A
|
||||
|
||||
;adjust write-timing
|
||||
|
||||
lda #$9
|
||||
ldx #$89
|
||||
ldy #3
|
||||
jsr modify
|
||||
!byte $04 ;sync delay
|
||||
!byte $48 ;PHA
|
||||
!byte $68 ;PLA
|
||||
|
||||
lda #$0A
|
||||
ldx #$16
|
||||
ldy #1
|
||||
jsr modify
|
||||
!byte $56
|
||||
|
||||
lda #$0A
|
||||
ldx #$2B
|
||||
ldy #2
|
||||
jsr modify
|
||||
!byte $23,$B8
|
||||
|
||||
lda #$0A
|
||||
ldx #$3C
|
||||
ldy #2
|
||||
jsr modify
|
||||
!byte $23,$B8
|
||||
|
||||
lda #$0A
|
||||
ldx #$4C
|
||||
ldy #2
|
||||
jsr modify
|
||||
!byte $23,$B8
|
||||
|
||||
;enable 16-sector address prologue
|
||||
|
||||
lda #$0A
|
||||
ldx #$75
|
||||
ldy #2
|
||||
jsr modify
|
||||
!byte $C9,$D5 ;CMP #$D5
|
||||
|
||||
lda #$0A
|
||||
ldx #$8B
|
||||
ldy #1
|
||||
jsr modify
|
||||
!byte $96
|
||||
|
||||
lda #s_rwtswrite
|
||||
jsr PrintByID
|
||||
|
||||
;build 6-and-2 denibbilisation table for reading
|
||||
|
||||
ldx #$16
|
||||
ldy #0
|
||||
-- stx $48
|
||||
txa
|
||||
asl
|
||||
bit $48
|
||||
beq +
|
||||
ora $48
|
||||
eor #$ff
|
||||
and #$7e
|
||||
- bcs +
|
||||
lsr
|
||||
bne -
|
||||
tya
|
||||
sta (BASEPAGE * $100) + $6B9 - $16, x
|
||||
|
||||
;and 6-and-2 nibbilisation table for writing
|
||||
|
||||
txa
|
||||
ora #$80
|
||||
sta (BASEPAGE * $100) + $B70, y
|
||||
iny
|
||||
+ inx
|
||||
bpl --
|
||||
|
||||
;replace 6-and-2 encoder routine
|
||||
;and introduce DOS-order lookup
|
||||
|
||||
ldy #$41
|
||||
- lda .writemod - 1, y
|
||||
sta (BASEPAGE * $100) + $900 - 1, y
|
||||
dey
|
||||
bne -
|
||||
|
||||
;replace 6-and-2 decoder routine
|
||||
|
||||
ldy #$18
|
||||
- lda .readmod - 1, y
|
||||
sta (BASEPAGE * $100) + $AC1 - 1, y
|
||||
dey
|
||||
bne -
|
||||
|
||||
ldx #ID_RDOS13
|
||||
jsr ConstructStandardDelivery
|
||||
|
||||
lda #s_bootwrite
|
||||
jsr PrintByID
|
||||
|
||||
jmp .exit
|
||||
|
||||
.writemod
|
||||
!byte $A2,$00 ;LDX #$00
|
||||
!byte $A0,$02 ;LDY #$00
|
||||
!byte $88 ;DEY
|
||||
!byte $B1,$3E ;LDA ($3E),Y
|
||||
!byte $4A ;LSR
|
||||
!byte $3E,$00,$BF ;ROL $BF00,X
|
||||
!byte $4A ;LSR
|
||||
!byte $3E,$00,$BF ;ROL $BF00,X
|
||||
!byte $99,$00,$BE ;STA $BE00,Y
|
||||
!byte $E8 ;INX
|
||||
!byte $E0,$56 ;CPX #$56
|
||||
!byte $90,$ED ;BCC $BC04
|
||||
!byte $A2,$00 ;LDX #$00
|
||||
!byte $98 ;TYA
|
||||
!byte $D0,$E8 ;BNE $BC04
|
||||
!byte $A2,$55 ;LDX #$55
|
||||
!byte $BD,$00,$BF ;LDA $BF00,X
|
||||
!byte $29,$3F ;AND #$3F
|
||||
!byte $9D,$00,$BF ;STA $BF00,X
|
||||
!byte $CA ;DEX
|
||||
!byte $10,$F5 ;BPL $BC1E
|
||||
!byte $60 ;RTS
|
||||
!byte $AC,$F6,$BA ;LDY $BAF6
|
||||
!byte $B9,$31,$BB ;LDA $BB31,Y
|
||||
!byte $60 ;RTS
|
||||
!byte $00,$0D,$0B,$09,$07,$05,$03,$01
|
||||
!byte $0E,$0C,$0A,$08,$06,$04,$02,$0F
|
||||
|
||||
.readmod
|
||||
!byte $A0,$00 ;LDY #$00
|
||||
!byte $A2,$56 ;LDX #$56
|
||||
!byte $CA ;DEX
|
||||
!byte $30,$FB ;BMI $BCC3
|
||||
!byte $B9,$00,$BE ;LDA $BE00,Y
|
||||
!byte $5E,$00,$BF ;LSR $BF00,X
|
||||
!byte $2A ;ROL
|
||||
!byte $5E,$00,$BF ;LSR $BF00,X
|
||||
!byte $2A ;ROL
|
||||
!byte $91,$3E ;STA ($3E),Y
|
||||
!byte $C8 ;INY
|
||||
!byte $D0,$ED ;BNE $BCC5
|
||||
!byte $60 ;RTS
|
||||
|
||||
.exit
|
||||
}
|
33
src/patchers/ssi.a
Normal file
33
src/patchers/ssi.a
Normal file
@ -0,0 +1,33 @@
|
||||
;-------------------------------
|
||||
; #SSI Weak-bit protection
|
||||
;
|
||||
; module by qkumba
|
||||
;-------------------------------
|
||||
!zone {
|
||||
bit gMode ; nothing to do here in verify-only mode
|
||||
bpl .exit
|
||||
ldy gIsRDOS13
|
||||
bne .exit
|
||||
|
||||
ldy #$0D
|
||||
jsr SearchTrack
|
||||
!byte $F0,$17 ; BEQ *+$19
|
||||
!byte $20,$65,$BC; JSR $BC65
|
||||
!byte $B0,$F7 ; BCS *-7
|
||||
!byte $C1,$00 ; CMP ($00,X)
|
||||
!byte $C1,$00 ; CMP ($00,X)
|
||||
!byte $EA ; NOP
|
||||
!byte $EA ; NOP
|
||||
bcs .exit
|
||||
|
||||
sta gDisplayBytes
|
||||
pha
|
||||
lda #s_ssi
|
||||
jsr PrintByID
|
||||
pla
|
||||
ldy #$01
|
||||
jsr modify
|
||||
!byte $D0 ; BNE
|
||||
|
||||
.exit
|
||||
}
|
@ -17,6 +17,8 @@ ConstructStandardDelivery
|
||||
beq .construct32
|
||||
dex
|
||||
beq .construct32lo
|
||||
dex
|
||||
beq .constructrdos
|
||||
|
||||
.construct33p
|
||||
lda #<SD_DOS33p
|
||||
@ -31,6 +33,11 @@ ConstructStandardDelivery
|
||||
.construct32lo
|
||||
lda #<SD_DOS32LO
|
||||
ldx #>SD_DOS32LO
|
||||
bne +
|
||||
|
||||
.constructrdos
|
||||
lda #<SD_RDOS13
|
||||
ldx #>SD_RDOS13
|
||||
|
||||
+ sta .A+1
|
||||
stx .A+2
|
||||
@ -136,3 +143,11 @@ SD_DOS32LO
|
||||
; track 2
|
||||
!byte $2A,$00,$00,$00,$35,$34,$33,$32,$31,$30,$2F,$2E,$2D,$2C,$2B,$00
|
||||
!byte $C0
|
||||
|
||||
SD_RDOS13
|
||||
; exit via JMP $B300
|
||||
!byte $00,$B3
|
||||
; track 0
|
||||
!byte $00,$00,$00,$BD,$BC,$BB,$BA,$B9,$B8,$B7,$B6,$B5,$B4,$B3
|
||||
!byte $C0
|
||||
|
||||
|
@ -119,6 +119,8 @@ StringTable
|
||||
!word .advent
|
||||
!word .gathering
|
||||
!word .davidson
|
||||
!word .rdos13
|
||||
!word .ssi
|
||||
;
|
||||
; Text can contain substitution strings, which
|
||||
; are replaced by current values at runtime. Each
|
||||
@ -144,7 +146,7 @@ StringTable
|
||||
; can be set directly before calling PrintByID.
|
||||
;
|
||||
.header
|
||||
!text "Passport by 4am 2018-09-25",$00
|
||||
!text "Passport by 4am 2018-09-26",$00
|
||||
.mainmenu
|
||||
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
|
||||
!text " "
|
||||
@ -422,7 +424,7 @@ StringTable
|
||||
.rwtswrite
|
||||
!text "T00,S02 Writing built-in RWTS",$8D,$00
|
||||
.rdos
|
||||
!text "T00,S00 Found RDOS bootloader",$8D,$00
|
||||
!text "T00,S00 Found RDOS 16-sector bootloader",$8D,$00
|
||||
.sra
|
||||
!text "T%t,S%0 Found SRA protection check",$8D,$00
|
||||
.muse
|
||||
@ -446,4 +448,8 @@ StringTable
|
||||
!text "Gathering per-file encryption keys",$8D,$00
|
||||
.davidson
|
||||
!text "T%t Found Davidson & Associates disk",$8D,$00
|
||||
.rdos13
|
||||
!text "T00,S00 Found RDOS 13-sector bootloader",$8D,$00
|
||||
.ssi
|
||||
!text "T%t,S%0 Found SSI protection check",$8D,$00
|
||||
}
|
||||
|
@ -106,4 +106,6 @@ s_microfun = $64
|
||||
s_advent = $65
|
||||
s_gathering = $66
|
||||
s_davidson = $67
|
||||
STRINGCOUNT = $68
|
||||
s_rdos13 = $68
|
||||
s_ssi = $69
|
||||
STRINGCOUNT = $6A
|
||||
|
@ -15,7 +15,7 @@ cd ..\..\build
|
||||
cscript /nologo //e:jscript %~f0 "b8" "00"
|
||||
1>nul copy /b tmp+universalrwts.tmp universalrwts.pak
|
||||
cd ..\src\mods
|
||||
%ACME% t00only.a
|
||||
%ACME% -r ..\..\build\t00only.lst t00only.a
|
||||
cd ..\..\build
|
||||
%EXOMIZER% raw -q t00only.bin -o t00only.tmp
|
||||
cscript /nologo //e:jscript %~f0 "20" "00"
|
||||
|
Loading…
Reference in New Issue
Block a user