add support for MUSE RWTS [fixes The Function Game, The Caverns of Freitag, others]

This commit is contained in:
4am 2019-02-04 17:20:29 -05:00
parent 0618041e91
commit 831441425d
9 changed files with 97 additions and 11 deletions

View File

@ -64,7 +64,11 @@
; set in IDBootloader() after reading T00,S00 ; set in IDBootloader() after reading T00,S00
FIRSTFILTER FIRSTFILTER
;gIsRDOS ;gIsMUSERWTS
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gIsRDOS13
!byte FALSE ; 0=true, 1=false !byte FALSE ; 0=true, 1=false
; reset before each operation ; reset before each operation
; set in IDBootloader() after reading T00,S00 ; set in IDBootloader() after reading T00,S00

View File

@ -98,9 +98,10 @@ gIsAdvent = gForceDiskVol-$01 ; byte
gIsPanglosDOS = gIsAdvent-$01 ; byte gIsPanglosDOS = gIsAdvent-$01 ; byte
gIsDavidson = gIsPanglosDOS-$01 ; byte gIsDavidson = gIsPanglosDOS-$01 ; byte
gIsRDOS13 = gIsDavidson-$01 ; byte gIsRDOS13 = gIsDavidson-$01 ; byte
gIsMUSERWTS = gIsRDOS13-$01 ; byte
;LASTFILTER ; add new gIs* above this line ;LASTFILTER ; add new gIs* above this line
;gIsInfocom18 is a special case whose ID is not in the regular inspection path ;gIsInfocom18 is a special case whose ID is not in the regular inspection path
gIsInfocom18 = gIsRDOS13-$01 ; byte gIsInfocom18 = gIsMUSERWTS-$01 ; byte
;gIs13Sector is a special case whose ID is not in the regular inspection path ;gIs13Sector is a special case whose ID is not in the regular inspection path
gIs13Sector = gIsInfocom18-$01 ; byte gIs13Sector = gIsInfocom18-$01 ; byte
;gMECCFastloadType is a special case integer whose default value cannot be #FALSE ;gMECCFastloadType is a special case integer whose default value cannot be #FALSE
@ -171,6 +172,7 @@ ConstructStandardDelivery = jConstructStandardDelivery
!warn "gIsAdvent=",gIsAdvent !warn "gIsAdvent=",gIsAdvent
!warn "gIsPanglosDOS=",gIsPanglosDOS !warn "gIsPanglosDOS=",gIsPanglosDOS
!warn "gIsDavidson=",gIsDavidson !warn "gIsDavidson=",gIsDavidson
!warn "gIsMUSERWTS=",gIsMUSERWTS
!warn "gIsRDOS13=",gIsRDOS13 !warn "gIsRDOS13=",gIsRDOS13
!warn "gIsInfocom18=",gIsInfocom18 !warn "gIsInfocom18=",gIsInfocom18
!warn "gIs13Sector=",gIs13Sector !warn "gIs13Sector=",gIs13Sector

View File

@ -66,7 +66,9 @@ IDDOS33
!byte $6C,$3E,$00 !byte $6C,$3E,$00
!byte $EE,$FE,$08 !byte $EE,$FE,$08
!byte $EE,$FE,$08 !byte $EE,$FE,$08
bcs .exit bcc +
jmp .exit
+
; ;
; DOS 3.3 has JSR $FE89 / JSR $FE93 / JSR $FB2F ; DOS 3.3 has JSR $FE89 / JSR $FE93 / JSR $FB2F
; some Sierra have STA $C050 / STA $C057 / STA $C055 instead ; some Sierra have STA $C050 / STA $C057 / STA $C055 instead
@ -93,16 +95,33 @@ IDDOS33
+ +
; ;
; Sector order map must be standard (no exceptions) ; Check sector order map
; ;
lda #$00 lda #$00
ldx #$4D ldx #$4D
ldy #$10 ldy #$10
jsr compare ; if T00,S00,$4D == jsr compare ; if T00,S00,$4D ==
!byte $00,$0D,$0B,$09,$07,$05,$03,$01 !byte $00,$0D,$0B,$09,$07,$05,$03,$01
!byte $0E,$0C,$0A,$08,$06,$04,$02,$0F !byte WILDCARD,$0C,$0A,$08,$06,$04,$02,$0F
bcs .exit bcs .exit
; ;
; Check for MUSE sector order map
;
lda #$00
ldx #$55
ldy #$01
jsr compare ; if T00,S00,$55 ==
!byte $02
bcs +
lda #TRUE
sta gIsMUSERWTS
lda #$0E
sta precheck_sectors+1
lda #kSectorIgnore
sta T00S08
sta T00S0F
+
;
; Minor variant (e.g. Terrapin Logo 3.0) jumps to $08F0 and back ; Minor variant (e.g. Terrapin Logo 3.0) jumps to $08F0 and back
; but is still safe to trace. Check for this jump and match ; but is still safe to trace. Check for this jump and match
; the code at $08F0 exactly. ; the code at $08F0 exactly.
@ -126,6 +145,9 @@ IDDOS33
ldy #$09 ldy #$09
jsr compare ; if T00,S00,$F0 == jsr compare ; if T00,S00,$F0 ==
!byte $8D,$FE,$08 !byte $8D,$FE,$08
!byte $EE,$F3,$03 !byte $EE,$F3,$03
!byte $4C,$1F,$08 !byte $4C,$1F,$08
; bcs .exit ; unknown code at $08F0 -> failure ; bcs .exit ; unknown code at $08F0 -> failure

View File

@ -18,6 +18,13 @@ IDBootloader
bne - bne -
stx gMECCFastloadType stx gMECCFastloadType
stx gLastTrack stx gLastTrack
ldx #$0F
ldy #$F8
- tya
sta precheck_sectors,x
iny
dex
bpl -
lda gIsInfocom18 lda gIsInfocom18
bne .check13 bne .check13

View File

@ -13,16 +13,23 @@ TraceDOS33
; ;
lda #$00 lda #$00
sta gTrack sta gTrack
lda #$09 ldy #$00
@precheck_loop
lda precheck_sectors,y
bmi +
sta gSector sta gSector
jsr IgnoreAddressChecksum jsr IgnoreAddressChecksum
precheck tya
pha
jsr ReadSector jsr ReadSector
pla
tay
bcc + bcc +
jmp FatalError jmp FatalError
+ +
dec gSector iny
bne precheck cpy #$10
bne @precheck_loop
; ;
; pre-check passed, do the trace ; pre-check passed, do the trace
; ;
@ -30,6 +37,18 @@ precheck
ldx #>TraceDOS33b ldx #>TraceDOS33b
jmp Trace jmp Trace
precheck_sectors
; This list is (re)initialized in IDBootloader,
; then potentially altered in IDDOS33.
; Values are logical sector numbers.
; There are always 16 (0x10) values in this list.
; Negative values are ignored.
; Positive values are treated as logical
; sector numbers and read from track $00.
; Sectors are read in the order listed here.
!byte $09,$08,$07,$06,$05,$04,$03,$02,$01
!byte $00,$FF,$FE,$FD,$FC,$FB,$FA,$F9,$F8
;------------------------------- ;-------------------------------
; TraceDOS33b ; TraceDOS33b
; set up 2nd boot trace at $084A ; set up 2nd boot trace at $084A

View File

@ -112,6 +112,7 @@ AnalyzeT00
!source "../patchers/rdos13.a" !source "../patchers/rdos13.a"
!source "../patchers/swordthrust.a" !source "../patchers/swordthrust.a"
!source "../patchers/dakin5.a" !source "../patchers/dakin5.a"
!source "../patchers/muserwts.a"
;add only above this line ;add only above this line
rts rts

30
src/patchers/muserwts.a Normal file
View File

@ -0,0 +1,30 @@
;-------------------------------
; #MUSERWTS
; RWTS changes based on track
;
; tested on
; - The Caverns of Freitag (MUSE)
; - The Function Game (MUSE)
;-------------------------------
!zone {
bit gMode ; nothing to do here in verify-only mode
bpl .exit
lda gIsMUSERWTS
bne .exit
lda #$06
ldx #$F2
ldy #$03
jsr compare ; if T00,S06,$F2 ==
!byte $20,$B6,$B6
bcs .exit
pha
lda #6
sta gDisplayBytes
lda #s_bytrack
jsr PrintByID
pla
ldy #$01
jsr modify ; then set T00,S06,$F2 =
!byte $2C
.exit
}

View File

@ -60,7 +60,8 @@ InitSectorMap
sectormap sectormap
T00S00 T00S00
T00 !byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF T00 !byte $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF
T00S08 !byte $FF
T00S09 !byte $FF T00S09 !byte $FF
T00S0A !byte $FF T00S0A !byte $FF
T00S0B !byte $FF T00S0B !byte $FF

View File

@ -152,7 +152,7 @@ StringTable
; can be set directly before calling PrintByID. ; can be set directly before calling PrintByID.
; ;
.header .header
!text "Passport by 4am 2019-02-03",$00 !text "Passport by 4am 2019-02-04",$00
.mainmenu .mainmenu
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
!text " " !text " "