2017-01-08 03:35:35 +00:00
|
|
|
;-------------------------------
|
|
|
|
; ProtectedDOS
|
|
|
|
; in: $0800..$08FF contains boot0
|
|
|
|
; $B600..$BFFF contains boot1
|
|
|
|
; out: C clear if "Protected DOS" was found
|
|
|
|
; C set if "Protected DOS" was not found
|
2017-06-19 18:04:33 +00:00
|
|
|
; gIsProtDOS is set to TRUE or FALSE
|
2017-01-08 03:35:35 +00:00
|
|
|
;-------------------------------
|
2017-01-24 00:57:43 +00:00
|
|
|
!zone {
|
2017-01-08 03:35:35 +00:00
|
|
|
ProtectedDOS
|
|
|
|
lda #$B7
|
|
|
|
ldx #$00
|
|
|
|
ldy #$1A
|
|
|
|
jsr CompareMemory
|
2017-01-24 00:57:43 +00:00
|
|
|
!byte $A0,$1A,$B9,$00,$B7,$49,$97,$99
|
|
|
|
!byte $00,$B7,$C8,$D0,$F5,$EE,$04,$B7
|
|
|
|
!byte $EE,$09,$B7,$AD,$09,$B7,$C9,$C0
|
2017-01-08 03:35:35 +00:00
|
|
|
!byte $D0,$E8
|
2019-05-07 01:24:29 +00:00
|
|
|
bcs .exit ; passport-test-suite/Ultima IV.woz [C=0] matches
|
2017-01-08 03:35:35 +00:00
|
|
|
|
2021-06-14 15:20:59 +00:00
|
|
|
stx gDisplayBytes
|
2017-01-08 03:35:35 +00:00
|
|
|
lda $B706 ; decryption key
|
2017-01-24 00:57:43 +00:00
|
|
|
sta .key+1
|
2021-04-08 20:11:00 +00:00
|
|
|
sta gDisplayBytes+1
|
2017-01-08 03:35:35 +00:00
|
|
|
jsr PrintByID
|
2021-06-13 02:07:26 +00:00
|
|
|
!byte s_protdos
|
2017-01-08 03:35:35 +00:00
|
|
|
|
|
|
|
;
|
|
|
|
; decrypt RWTS in memory
|
|
|
|
;
|
|
|
|
lda #$B7
|
2017-01-24 00:57:43 +00:00
|
|
|
sta .decrypt+2
|
|
|
|
sta .store+2
|
2017-01-08 03:35:35 +00:00
|
|
|
ldy #$1A
|
2017-01-24 00:57:43 +00:00
|
|
|
.decrypt lda $B700,y
|
|
|
|
.key eor #$FF ; set at runtime
|
|
|
|
.store sta $B700,y
|
2017-01-08 03:35:35 +00:00
|
|
|
iny
|
2017-01-24 00:57:43 +00:00
|
|
|
bne .decrypt
|
|
|
|
inc .decrypt+2
|
|
|
|
inc .store+2
|
|
|
|
lda .store+2
|
2017-01-08 03:35:35 +00:00
|
|
|
cmp #$C0
|
2017-01-24 00:57:43 +00:00
|
|
|
bne .decrypt
|
2017-01-08 03:35:35 +00:00
|
|
|
|
|
|
|
;
|
|
|
|
; this RWTS swaps the A/Y hi/lo parameter table address
|
|
|
|
; when calling the RWTS entry point, so we need to
|
|
|
|
; set a flag so we can call it properly later
|
|
|
|
; (in ReadSector)
|
|
|
|
;
|
|
|
|
lda #TRUE
|
|
|
|
sta gIsProtDOS
|
|
|
|
clc
|
2017-01-24 00:57:43 +00:00
|
|
|
.exit
|
2017-01-08 03:35:35 +00:00
|
|
|
rts
|
2017-01-24 00:57:43 +00:00
|
|
|
}
|