| |
Sixgun Shootout Version 1.2 [2019] |
|
Released by : TNT
Release Date :
1 April 2019
Type : IDE64 Release
Videosystem: any Proper release: OK
|
Credits :
Download :
Look for downloads on external sites:
Pokefinder.org
Production Info Submitted by Grue on 2 April 2019
Anatomy of an IDE64 fix
Case: Sixgun Shooter / Strategic Simulations Inc
TL;DR; Patch KERNAL vectors to force device number.
Grue brought the game to my attention and did a quick IDE64 version which unfortunately needed CHANGE command. I decided to take a look myself.
BOOT is simply an autostarter which runs BOOT1.5. The latter sets the BASIC top pointer, loads FASTLOAD.O and GUNPRINT.O. Then it loads another booter, BOOT2.
BOOT2 is BASIC program compiled with DTL Compiler, so it first loads RTL-64. The compiled program itself does protection check to verify that Track 33 Sector 5 returns code 23, "READ ERROR". After that it resets the disk drive and checks if it's 1541 - if so the game initailizes the fastloader.
After that BOOT2 loads WESTSETS, INIT.GUN and DRAW.FO and moves WESTSETS contents to $E800. Then it boots LOADER
The problem with compiled BASIC is that there is no room to modify device number everywhere it's used, as it's stored as ASCII. Furthermore, changing it to another constant value would just change the problem instead of making the game device independent. That's when I got an idea to patch KERNAL vectors to make the game use the very device it was loaded from.
I wrote a booter which did the BASIC pointer initialization and linked in files WESTSETS, GUNPRINT.O, INIT.GUN, RTL-64 and DRAW.F.O. I also poked $64 into $02FF to tell the compiled BASIC parts thet RTL-64 was already in memory. Finally I patched OPEN, LOAD and SAVE vectors to force them to use the device number the booter was loaded from. After that the booter loads and runs LOADER program just like the original boot sequence.
This was already enough to fix the game, but closer examination showed that game maps and scenarios are always used in same combinations. Those two are stored in separate files, but in memory they are adjanced with just one extra byte between them. This lead me into patching LOADER to only load the MAP file, and then replacing each MAP file with combined MAP + SCEN file. Lo and behold, it actually worked :)
The last touch was compressing the booter with TinyCrunch to bring the size down without causing too much slowdown.
That's all folks!
boot.asm
- - - -
processor 6502
seg code
subroutine
* = $0801
dc.w .bend
dc.w 2019
dc.b $9e,"2061",0
.bend dc.w 0
START ldx #<$5600 ; basic top
ldy #>$5600
stx 51
sty 52
stx 55
sty 56
stx $d020
stx $d021
jsr 49242 ; move westsets
lda #$64 ; rtl-64 loaded
sta $02ff
ldy #30 ; move patch to high 03xx
.p lda patch,y
sta old_OPEN,y
dey
bpl .p
ldx $031a ; patch vectors
ldy $031a+1
stx old_OPEN
sty old_OPEN+1
ldx #<_OPEN
ldy #>_OPEN
stx $031a
sty $031a+1
ldx $0330
ldy $0330+1
stx old_LOAD
sty old_LOAD+1
ldx #<_LOAD
ldy #>_LOAD
stx $0330
sty $0330+1
ldx $0332
ldy $0332+1
stx old_SAVE
sty old_SAVE+1
ldx #<_SAVE
ldy #>_SAVE
stx $0332
sty $0332+1
lda $ba ; remember #device
sta _ba
ldy #0 ; print load command
beq .pr
.pr0 jsr $ffd2
iny
.pr lda txt,y
bne .pr0
ldy #4 ; prepare keyboard buffer with CR + rU + CR
sty $c6 ; to load and run the next part
.k lda keys,y
sta $0277,y
dey
bpl .k
jsr $a644 ; NEW
jmp $e37e ; BASIC warm start
patch
rorg $0400-31
old_OPEN
dc.w 0
old_LOAD
dc.w 0
old_SAVE
dc.w 0
_OPEN ldx _ba
stx $ba
jmp (old_OPEN)
_LOAD ldx _ba
stx $ba
jmp (old_LOAD)
_SAVE ldx _ba
stx $ba
jmp (old_SAVE)
_ba dc.b 0
rend
txt dc.b $90,$93,$11,$11 ; black: $90
dc.b "L",$cf,$22,"LOADER",$22,",8",$13,0
keys dc.b $0d,$52,$d5,13
* = $8900
incbin "westsets.prg",2
* = $9900
incbin "gunprint.o.prg",2
* = $9b80
incbin "init.gun.prg",2
* = $a000
incbin "rtl-64.prg",2
* = $c000
incbin "draw.f.o.prg",2
- - - - |
|
|
|
| Search CSDb |
| Navigate | |
|
| Detailed Info | |
|
| Fun Stuff | |
· Goofs · Hidden Parts · Trivia
|
|
| Forum | |
|
| Support CSDb | |
|
| |
|