2018-08-23 20:02:48 +00:00
|
|
|
!cpu 6502
|
|
|
|
!to "build/LAUNCHER.SYSTEM",plain
|
|
|
|
*=$2000
|
|
|
|
|
2018-08-26 19:33:32 +00:00
|
|
|
!source "src/constants.a"
|
|
|
|
!source "src/macros.a"
|
2018-08-29 19:27:30 +00:00
|
|
|
|
2018-10-28 18:04:52 +00:00
|
|
|
sta $C00E
|
|
|
|
sta $C00C
|
|
|
|
sta $C004
|
|
|
|
sta $C002
|
|
|
|
sta $C000
|
|
|
|
jsr $FB2F
|
|
|
|
jsr $FC58
|
2018-08-30 17:07:21 +00:00
|
|
|
jsr Has64K ; check for 64K (required)
|
2018-08-31 04:31:54 +00:00
|
|
|
bcs @no64K
|
2018-08-29 19:27:30 +00:00
|
|
|
jsr DisableAccelerator ; set to 1 MHz
|
2018-08-30 17:07:21 +00:00
|
|
|
jsr Has128K ; check for 128K (absence is OK, we just filter out some games)
|
2018-08-29 19:27:30 +00:00
|
|
|
ror MachineStatus
|
2018-08-30 17:07:21 +00:00
|
|
|
jsr HasJoystick ; check for joystick (absence is OK, we just filter out some games)
|
2018-09-13 13:53:04 +00:00
|
|
|
ror MachineStatus ; now bit 6 = 1 if 128K
|
|
|
|
; bit 7 = 1 if joystick
|
2018-08-29 19:27:30 +00:00
|
|
|
|
2018-10-24 13:44:30 +00:00
|
|
|
jsr init ; initialize ProRWTS2 (bye bye ProDOS)
|
|
|
|
+READ_RAM1_WRITE_RAM1
|
2018-08-31 04:31:54 +00:00
|
|
|
ldx #$00 ; relocate rest of program to RAM bank 1 in language card
|
|
|
|
@FM lda FirstMover,x
|
2018-08-29 19:27:30 +00:00
|
|
|
sta $D000,x
|
|
|
|
inx
|
2018-08-31 04:31:54 +00:00
|
|
|
bne @FM
|
|
|
|
lda @FM+2
|
|
|
|
cmp #>LastMover
|
|
|
|
bcs +
|
|
|
|
inc @FM+2
|
|
|
|
inc @FM+5
|
|
|
|
bne @FM
|
|
|
|
+
|
2018-10-29 23:23:43 +00:00
|
|
|
jmp OneTimeSetup
|
2018-08-29 19:27:30 +00:00
|
|
|
|
2018-08-31 04:31:54 +00:00
|
|
|
@no64K
|
|
|
|
ldy #@no64Klen
|
|
|
|
- lda @s_no64K,y
|
|
|
|
sta $6B6,y
|
|
|
|
dey
|
|
|
|
bpl -
|
|
|
|
@hang bmi @hang
|
|
|
|
@s_no64K !raw "REQUIRES 64K"
|
|
|
|
@no64Klen=*-@s_no64K
|
|
|
|
|
2018-10-24 13:44:30 +00:00
|
|
|
; ProRWTS2 has its own function to relocate itself
|
|
|
|
!source "src/prorwts2.a"
|
2018-08-31 04:31:54 +00:00
|
|
|
; these routines will only be called once, from main memory, before relocating to language card
|
2018-10-24 13:44:30 +00:00
|
|
|
ProRWTSBuffer
|
2018-09-13 13:53:04 +00:00
|
|
|
!source "src/hw.memcheck.a"
|
|
|
|
!source "src/hw.joystick.a"
|
|
|
|
!source "src/hw.normfast.a"
|
2018-10-24 13:44:30 +00:00
|
|
|
*=ProRWTSBuffer+512 ; ProRWTS needs a 512-byte buffer for its init function
|
|
|
|
; so we reuse as much of the 1-time code as possible
|
|
|
|
; and fill the rest with zeros
|
2018-10-29 23:23:43 +00:00
|
|
|
OneTimeSetup
|
|
|
|
lda hddopendir+1 ; save current directory as 'root'
|
2018-10-28 15:44:26 +00:00
|
|
|
ldy hddopendir+3
|
2018-10-29 23:23:43 +00:00
|
|
|
+STAY gRootDirectory
|
|
|
|
jsr LoadFile ; load games list
|
2018-10-23 19:44:06 +00:00
|
|
|
!word kGameListConfFile
|
|
|
|
jsr ParseGamesList ; parse games list
|
2018-09-13 13:53:04 +00:00
|
|
|
!word gGamesListStore
|
2018-10-27 22:47:27 +00:00
|
|
|
!word ldrlo2 ; (ldrlo2) points to load address
|
2018-10-29 23:23:43 +00:00
|
|
|
+LDAY SRC
|
|
|
|
+STAY gFXStore ; save pointer to free space for next store
|
|
|
|
jsr LoadFile ; load transition effects list
|
|
|
|
!word kFXConfFile
|
|
|
|
jsr ParseKeyValueList ; parse transition effects list
|
|
|
|
!word gFXStore
|
|
|
|
!word ldrlo2 ; (ldrlo2) points to load address
|
2018-10-23 19:44:06 +00:00
|
|
|
+LDAY SRC
|
|
|
|
+STAY gAttractModeStore ; save pointer to free space for next store
|
2018-10-29 23:23:43 +00:00
|
|
|
jsr LoadFile ; load attract-mode configuration
|
2018-10-23 19:44:06 +00:00
|
|
|
!word kAttractModeConfFile
|
|
|
|
jsr ParseKeyValueList ; parse attract-mode configuration
|
|
|
|
!word gAttractModeStore
|
2018-10-27 22:47:27 +00:00
|
|
|
!word ldrlo2 ; (ldrlo2) points to load address
|
|
|
|
+LDAY SRC
|
|
|
|
+STAY gSlideshowStore ; save pointer to free space for next store
|
2018-10-29 23:23:43 +00:00
|
|
|
jmp Main
|
|
|
|
kGameListConfFile
|
|
|
|
!byte @kGameListConfFile_e-@kGameListConfFile_b
|
|
|
|
@kGameListConfFile_b
|
|
|
|
!text "GAMES.CONF"
|
|
|
|
@kGameListConfFile_e
|
|
|
|
kFXConfFile
|
|
|
|
!byte @kFXConfFile_e-@kFXConfFile_b
|
|
|
|
@kFXConfFile_b
|
|
|
|
!text "FX.CONF"
|
|
|
|
@kFXConfFile_e
|
|
|
|
kAttractModeConfFile
|
|
|
|
!byte @kAttractModeConfFile_e-@kAttractModeConfFile_b
|
|
|
|
@kAttractModeConfFile_b
|
|
|
|
!text "ATTRACT.CONF"
|
|
|
|
@kAttractModeConfFile_e
|
2018-10-23 19:44:06 +00:00
|
|
|
|
2018-10-29 23:23:43 +00:00
|
|
|
FirstMover
|
|
|
|
!pseudopc $D000 {
|
|
|
|
!zone
|
|
|
|
Reenter ; self-running demos should call this to exit back to 4cade
|
|
|
|
+READ_RAM1_WRITE_RAM1
|
2018-10-28 21:20:48 +00:00
|
|
|
Main
|
2018-10-29 23:23:43 +00:00
|
|
|
ldx #$FF
|
|
|
|
txs
|
2018-10-28 18:04:52 +00:00
|
|
|
jsr BlankHGR
|
2018-11-03 13:23:04 +00:00
|
|
|
- bit $C010
|
2018-10-27 22:47:27 +00:00
|
|
|
jsr AttractMode
|
2018-11-03 13:23:04 +00:00
|
|
|
jmp -
|
2018-10-27 22:47:27 +00:00
|
|
|
|
|
|
|
AttractMode
|
2018-10-29 00:05:59 +00:00
|
|
|
jsr okvs_nth ; get filename of next attract-mode module
|
2018-10-27 22:47:27 +00:00
|
|
|
!word gAttractModeStore
|
2018-10-28 18:05:54 +00:00
|
|
|
@index !byte 0
|
2018-10-28 18:04:52 +00:00
|
|
|
+STAY @key
|
|
|
|
|
|
|
|
inc @index ; increment module index for next time
|
|
|
|
jsr okvs_len
|
|
|
|
!word gAttractModeStore
|
|
|
|
cmp @index
|
|
|
|
bne +
|
|
|
|
lda #0
|
|
|
|
sta @index
|
|
|
|
+
|
|
|
|
jsr okvs_get
|
|
|
|
!word gAttractModeStore
|
|
|
|
@key !word $FDFD
|
2018-10-27 22:47:27 +00:00
|
|
|
+STAY PTR
|
2018-10-28 18:04:52 +00:00
|
|
|
|
|
|
|
jsr +
|
|
|
|
lda $C000
|
|
|
|
bpl AttractMode
|
|
|
|
rts
|
|
|
|
+
|
|
|
|
ldy #1
|
|
|
|
lda (PTR),y
|
|
|
|
and #$0F
|
|
|
|
cmp #$03
|
2018-10-29 23:23:43 +00:00
|
|
|
bne @Slideshow
|
2018-10-29 00:05:59 +00:00
|
|
|
|
2018-10-29 23:23:43 +00:00
|
|
|
+LOAD_FILE kDemoDirectory, @key
|
2018-10-28 15:44:26 +00:00
|
|
|
|
2018-10-29 23:23:43 +00:00
|
|
|
ldx #(@end_prelaunch-@prelaunch-1)
|
|
|
|
- lda @prelaunch,x ; copy pre-launch code to main memory
|
2018-10-28 21:20:48 +00:00
|
|
|
sta $100,x
|
|
|
|
dex
|
|
|
|
bpl -
|
2018-10-31 05:59:03 +00:00
|
|
|
ldx #(end_promote-promote-1)
|
|
|
|
- lda promote,x ; copy tiny ProDOS to main memory
|
|
|
|
sta $bf00,x
|
|
|
|
dex
|
|
|
|
bpl -
|
2018-11-02 00:06:32 +00:00
|
|
|
jmp $106 ; jump to pre-launch code
|
2018-10-29 23:23:43 +00:00
|
|
|
@prelaunch ; this runs from main memory
|
2018-11-02 00:06:32 +00:00
|
|
|
lda $C088 ; entry point used by some self-running demos
|
|
|
|
jmp Reenter
|
|
|
|
+READ_ROM_NO_WRITE ; entry point to launch game (called above)
|
2018-10-29 23:23:43 +00:00
|
|
|
jsr $FE89 ; initialize machine like a cold boot
|
|
|
|
jsr $FE93 ; (many games assume a 'clean slate')
|
2018-10-28 21:20:48 +00:00
|
|
|
sta $C000
|
|
|
|
sta $C002
|
|
|
|
sta $C004
|
|
|
|
sta $C00C
|
|
|
|
sta $C00E
|
|
|
|
jsr $FB2F
|
|
|
|
jsr $FC58
|
|
|
|
ldx #$FF
|
|
|
|
txs
|
2018-11-02 00:06:32 +00:00
|
|
|
jmp (ldrlo2) ; jump to game
|
2018-10-29 23:23:43 +00:00
|
|
|
@end_prelaunch
|
|
|
|
|
|
|
|
@Slideshow
|
|
|
|
pha ; save module type
|
|
|
|
|
|
|
|
+LOAD_FILE kAttractModeSlideshowDirectory, @key
|
|
|
|
|
|
|
|
jsr ParseKeyValueList ; parse slideshow configuration
|
|
|
|
!word gSlideshowStore
|
|
|
|
!word ldrlo2 ; (ldrlo2) points to load address
|
|
|
|
pla ; restore module type
|
|
|
|
cmp #$01
|
|
|
|
beq @HGRSlideshow
|
|
|
|
|
|
|
|
;@DHGRSlideshow
|
|
|
|
jsr BlankDHGR
|
|
|
|
jsr okvs_iter
|
|
|
|
!word gSlideshowStore
|
|
|
|
!word DHGRLoad
|
|
|
|
jmp BlankHGR
|
|
|
|
|
|
|
|
@HGRSlideshow
|
2018-10-31 14:38:09 +00:00
|
|
|
jsr LoadTransition
|
2018-10-29 23:23:43 +00:00
|
|
|
jsr okvs_iter
|
|
|
|
!word gSlideshowStore
|
|
|
|
!word HGRLoad
|
|
|
|
rts
|
2018-09-13 13:53:04 +00:00
|
|
|
|
|
|
|
HGRLoad
|
|
|
|
ldx $C000
|
2018-10-31 14:38:09 +00:00
|
|
|
bpl +
|
|
|
|
rts
|
|
|
|
+
|
2018-09-13 13:53:04 +00:00
|
|
|
+STAY PTR
|
2018-10-29 23:23:43 +00:00
|
|
|
|
|
|
|
; load HGR screenshot at $4000
|
|
|
|
+LOAD_FILE kHGRScreenshotDirectory, PTR
|
|
|
|
|
2018-11-03 13:23:04 +00:00
|
|
|
; jsr LoadTransition
|
2018-10-31 15:13:03 +00:00
|
|
|
jsr $6000 ; transition effect code was loaded here earlier
|
2018-10-28 18:04:52 +00:00
|
|
|
jmp WaitOnScreenshot
|
|
|
|
|
|
|
|
DHGRLoad
|
|
|
|
ldx $C000
|
2018-10-31 15:13:03 +00:00
|
|
|
bpl +
|
|
|
|
rts
|
|
|
|
+
|
2018-10-28 18:04:52 +00:00
|
|
|
+STAY PTR
|
|
|
|
jsr ResetPath
|
|
|
|
+LDADDR kDHGRScreenshotDirectory
|
|
|
|
jsr AddToPath
|
|
|
|
+LDADDR kPathSeparator
|
|
|
|
jsr AddToPath
|
|
|
|
+LDAY PTR
|
|
|
|
jsr AddToPath
|
|
|
|
jsr LoadDHRFile
|
|
|
|
!word gPathname
|
|
|
|
jsr FizzleDHGR
|
2018-10-31 15:13:03 +00:00
|
|
|
; note: execution falls through here
|
2018-10-28 18:04:52 +00:00
|
|
|
WaitOnScreenshot
|
2018-10-31 15:13:03 +00:00
|
|
|
ldx #$20
|
|
|
|
- lda #0
|
|
|
|
jsr WaitForKeyWithTimeout
|
|
|
|
bmi +
|
2018-10-28 15:44:26 +00:00
|
|
|
dex
|
2018-10-31 15:13:03 +00:00
|
|
|
bpl -
|
|
|
|
+ rts
|
2018-09-13 13:53:04 +00:00
|
|
|
|
2018-10-31 14:38:09 +00:00
|
|
|
LoadTransition
|
|
|
|
jsr okvs_nth ; get filename of transition effect code
|
|
|
|
!word gFXStore
|
|
|
|
@fxindex !byte 0
|
|
|
|
+STAY @fxkey
|
|
|
|
|
|
|
|
inc @fxindex ; increment transition effect index for next time
|
|
|
|
jsr okvs_len
|
|
|
|
!word gFXStore
|
|
|
|
cmp @fxindex
|
|
|
|
bne +
|
|
|
|
lda #0
|
|
|
|
sta @fxindex
|
|
|
|
+
|
|
|
|
; load transition effect code at $6000
|
|
|
|
+LOAD_FILE kFXDirectory, @fxkey
|
|
|
|
rts
|
|
|
|
@fxkey !word $FDFD
|
|
|
|
|
2018-10-31 05:59:03 +00:00
|
|
|
promote
|
|
|
|
!pseudopc $bf00 {
|
|
|
|
lda $c08b
|
|
|
|
clc
|
|
|
|
bcc @do_enter
|
|
|
|
;$bf06
|
|
|
|
rts ;clock interface, must be RTS on real ProDOS if program uses $20x
|
|
|
|
@do_enter
|
|
|
|
lda $c08b
|
|
|
|
jmp ProDOS_enter
|
|
|
|
!text "q4!"
|
|
|
|
;$bf10
|
|
|
|
!word $c1d1, $c2d1, $c3d1, $c4d1, $c5d1, $c6d1, $c7d1
|
|
|
|
ProDOS_exit
|
|
|
|
lda $c081
|
|
|
|
pla ;saved inside ProDOS_enter
|
|
|
|
tay
|
|
|
|
pla
|
|
|
|
tax
|
|
|
|
lda #0
|
|
|
|
rts
|
|
|
|
ProDOS_fatal ;only for debugging, will be removed
|
|
|
|
lda $c081
|
|
|
|
jsr $fe89
|
|
|
|
jsr $fe93
|
|
|
|
jmp $ff3a
|
|
|
|
}
|
|
|
|
end_promote
|
|
|
|
|
2018-10-28 15:44:26 +00:00
|
|
|
Reboot
|
|
|
|
ldx #(@end-@start-1)
|
|
|
|
- lda @start,x
|
2018-10-28 18:04:52 +00:00
|
|
|
sta $300,x
|
2018-10-28 15:44:26 +00:00
|
|
|
dex
|
|
|
|
bpl -
|
2018-10-28 18:04:52 +00:00
|
|
|
jmp $300
|
2018-10-28 15:44:26 +00:00
|
|
|
@start
|
|
|
|
+READ_ROM_NO_WRITE
|
2018-10-29 00:05:59 +00:00
|
|
|
jmp $FF59
|
2018-10-28 15:44:26 +00:00
|
|
|
@end
|
|
|
|
|
2018-10-28 18:04:52 +00:00
|
|
|
Home
|
|
|
|
ldx #(@end-@start-1)
|
|
|
|
- lda @start,x
|
|
|
|
sta $300,x
|
|
|
|
dex
|
|
|
|
bpl -
|
|
|
|
jmp $300
|
|
|
|
@start
|
|
|
|
; this will be run from main memory
|
|
|
|
+READ_ROM_NO_WRITE
|
|
|
|
sta $C00C ; get out of DHGR mode
|
2018-10-31 05:59:03 +00:00
|
|
|
sta $C05F ; get out of DHGR mode
|
2018-10-28 18:04:52 +00:00
|
|
|
jsr $FB2F ; TEXT
|
|
|
|
jsr $FC58 ; HOME
|
|
|
|
+READ_RAM1_WRITE_RAM1
|
|
|
|
rts
|
|
|
|
@end
|
|
|
|
|
|
|
|
BlankHGR
|
|
|
|
jsr Home
|
|
|
|
jsr ClearHGR1 ; clear hi-res screen 1
|
|
|
|
lda $c057 ; show hi-res screen 1 (now blank)
|
|
|
|
lda $c054
|
|
|
|
lda $c052
|
|
|
|
lda $c050
|
|
|
|
rts
|
|
|
|
BlankDHGR
|
|
|
|
jsr Home
|
|
|
|
jsr ClearHGR1 ; clear hi-res screen 1
|
|
|
|
sta $C005
|
|
|
|
jsr ClearHGR1 ; clear hi-res screen 1 in auxmem
|
|
|
|
sta $C004
|
|
|
|
sta $c00d
|
|
|
|
sta $c057
|
|
|
|
sta $c054
|
|
|
|
sta $c052
|
|
|
|
sta $c050
|
|
|
|
sta $c05e
|
|
|
|
rts
|
|
|
|
ClearHGR1
|
|
|
|
ldx #$20 ; clear hi-res screen 1
|
|
|
|
stx @a+2
|
|
|
|
lda #0
|
|
|
|
tay
|
|
|
|
@a sta $2000,y
|
|
|
|
iny
|
|
|
|
bne @a
|
|
|
|
inc @a+2
|
|
|
|
dex
|
|
|
|
bne @a
|
|
|
|
rts
|
|
|
|
|
2018-08-31 04:31:54 +00:00
|
|
|
; these routines will only be called after relocating to language card
|
2018-09-13 13:53:04 +00:00
|
|
|
!source "src/prodos.path.a"
|
2018-08-31 04:31:54 +00:00
|
|
|
!source "src/glue.prorwts2.a"
|
2018-08-30 20:30:58 +00:00
|
|
|
!source "src/okvs.a"
|
2018-10-29 23:23:43 +00:00
|
|
|
!source "src/wait.a"
|
2018-10-23 19:44:06 +00:00
|
|
|
!source "src/parse.common.a"
|
2018-08-31 04:31:54 +00:00
|
|
|
!source "src/parse.games.a"
|
2018-10-29 23:23:43 +00:00
|
|
|
!source "src/fx/fx.dhgr.fizzle.a"
|
2018-08-31 04:31:54 +00:00
|
|
|
gGamesListStore
|
|
|
|
!word *+2 ; address of first okvs store
|
2018-08-29 19:27:30 +00:00
|
|
|
}
|
|
|
|
LastMover
|