4cade/src/4cade.a

189 lines
5.4 KiB
Plaintext
Raw Normal View History

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-08-30 17:07:21 +00:00
jsr Has64K ; check for 64K (required)
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
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
bne @FM
lda @FM+2
cmp #>LastMover
bcs +
inc @FM+2
inc @FM+5
bne @FM
+
2018-08-29 19:27:30 +00:00
jmp Start
@no64K
jsr $FB2F
jsr $FC58
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"
; 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-08-23 20:02:48 +00:00
2018-08-29 19:27:30 +00:00
FirstMover
!pseudopc $D000 {
!zone
2018-10-23 19:44:06 +00:00
Reenter ; self-running demos should call this to exit back to 4cade
; TODO
2018-08-27 19:39:08 +00:00
Start
2018-10-28 15:44:26 +00:00
lda hddopendir+1
ldy hddopendir+3
+STAY gRootDirectory ; save current directory as 'root'
2018-10-23 19:44:06 +00:00
jsr LoadFile ; load games list from file
!word kGameListConfFile
2018-09-13 13:53:04 +00:00
2018-10-23 19:44:06 +00:00
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-23 19:44:06 +00:00
+LDAY SRC
+STAY gAttractModeStore ; save pointer to free space for next store
jsr LoadFile ; load attract-mode configuration from file
!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
2018-10-23 19:44:06 +00:00
2018-10-27 22:47:27 +00:00
+LDAY SRC
+STAY gSlideshowStore ; save pointer to free space for next store
2018-10-23 19:44:06 +00:00
2018-10-28 15:44:26 +00:00
bit $C010
2018-10-27 22:47:27 +00:00
jsr AttractMode
2018-10-28 15:44:26 +00:00
jmp Reboot
2018-10-27 22:47:27 +00:00
AttractMode
jsr okvs_nth ; get filename of next attract module
!word gAttractModeStore
2018-10-28 15:44:26 +00:00
@index !byte 0
2018-10-27 22:47:27 +00:00
+STAY PTR
jsr ResetPath
+LDADDR kAttractModeSlideshowDirectory
jsr AddToPath
+LDADDR kPathSeparator
jsr AddToPath
+LDAY PTR
jsr AddToPath
jsr LoadFile ; load attract module configuration file
!word gPathname
2018-10-28 15:44:26 +00:00
inc @index ; increment module index for next time
jsr okvs_len
!word gAttractModeStore
cmp @index
bne +
lda #0
sta @index
+
2018-10-27 22:47:27 +00:00
jsr ParseKeyValueList ; parse slideshow configuration
!word gSlideshowStore
!word ldrlo2 ; (ldrlo2) points to load address
jsr okvs_iter
!word gSlideshowStore
2018-09-13 13:53:04 +00:00
!word HGRLoad
2018-10-28 15:44:26 +00:00
lda $C000
bpl AttractMode
2018-10-27 22:47:27 +00:00
rts
2018-09-13 13:53:04 +00:00
HGRLoad
ldx $C000
bmi @exit
+STAY PTR
jsr ResetPath
+LDADDR kHGRScreenshotDirectory
jsr AddToPath
+LDADDR kPathSeparator
jsr AddToPath
+LDAY PTR
jsr AddToPath
jsr LoadFile
!word gPathname
jsr FizzleHGR
2018-10-28 15:44:26 +00:00
ldx #0
ldy #0
@wait lda $C000
bmi @exit
jsr @burn
dey
bne @wait
dex
bne @wait
rts
@burn jsr @burn2
@burn2 jsr @burn3
@burn3 jsr @exit
2018-09-13 13:53:04 +00:00
@exit rts
2018-10-28 15:44:26 +00:00
Reboot
ldx #(@end-@start-1)
- lda @start,x
sta $100,x
dex
bpl -
jmp $100
@start
+READ_ROM_NO_WRITE
jmp $FAA6
@end
2018-10-23 19:44:06 +00:00
kGameListConfFile
!byte @kGameListConfFile_e-@kGameListConfFile_b
@kGameListConfFile_b
!text "GAMES.CONF"
2018-10-23 19:44:06 +00:00
@kGameListConfFile_e
kAttractModeConfFile
!byte @kAttractModeConfFile_e-@kAttractModeConfFile_b
@kAttractModeConfFile_b
!text "ATTRACT.CONF"
@kAttractModeConfFile_e
; these routines will only be called after relocating to language card
2018-09-13 13:53:04 +00:00
!source "src/prodos.path.a"
!source "src/glue.prorwts2.a"
!source "src/okvs.a"
2018-10-23 19:44:06 +00:00
!source "src/parse.common.a"
!source "src/parse.games.a"
2018-09-13 13:53:04 +00:00
!source "src/fx.hgr.fizzle.a"
!source "src/fx.dhgr.fizzle.a"
gGamesListStore
!word *+2 ; address of first okvs store
2018-08-29 19:27:30 +00:00
}
LastMover