2018-12-29 18:38:18 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018 by 4am
|
|
|
|
;
|
2018-08-23 20:02:48 +00:00
|
|
|
!cpu 6502
|
|
|
|
!to "build/LAUNCHER.SYSTEM",plain
|
|
|
|
*=$2000
|
|
|
|
|
2019-06-19 04:49:12 +00:00
|
|
|
!ifndef RELBASE {
|
|
|
|
RELBASE=$2000
|
|
|
|
}
|
|
|
|
|
2018-08-26 19:33:32 +00:00
|
|
|
!source "src/constants.a"
|
|
|
|
!source "src/macros.a"
|
2018-11-10 13:36:36 +00:00
|
|
|
|
2019-06-23 18:24:09 +00:00
|
|
|
; first-run initialization, relocates code to language card and jumps
|
|
|
|
; to |Reenter|
|
2018-11-07 23:56:39 +00:00
|
|
|
!source "src/4cade.init.a"
|
2018-10-23 19:44:06 +00:00
|
|
|
|
2018-10-29 23:23:43 +00:00
|
|
|
FirstMover
|
2019-06-19 04:49:12 +00:00
|
|
|
!pseudopc RELBASE {
|
2019-06-23 18:24:09 +00:00
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
; Reenter
|
|
|
|
; This is the primary entry point for returning to the launcher from anywhere.
|
|
|
|
; - Self-running demos call this when the user presses a key or when the demo
|
|
|
|
; cycles ends naturally.
|
|
|
|
; - It is set as the reset vector, so the user can play a game then press
|
|
|
|
; Ctrl-Reset to return to the launcher and choose another.
|
|
|
|
; - It also functions as a reset vector while the launcher is running.
|
|
|
|
; - It is also called on program startup, after the first-run initialization.
|
|
|
|
;
|
|
|
|
; When execution reaches this point, we may have previously backed up the stack
|
|
|
|
; and stack pointer, in which case it is now our job to restore it and return
|
|
|
|
; to the caller. This allows magic like 'JSR PlayGame' then continuing once the
|
|
|
|
; JSR returns.
|
|
|
|
;
|
|
|
|
; If there is no stack to restore, this exits via SearchMode.
|
|
|
|
;
|
|
|
|
; in: no parameters
|
|
|
|
; out: see above
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
Reenter
|
2018-12-10 00:04:36 +00:00
|
|
|
cld
|
|
|
|
cli
|
2019-06-22 20:16:16 +00:00
|
|
|
+READ_RAM2_WRITE_RAM2
|
2019-06-23 18:24:09 +00:00
|
|
|
jsr CloseHandles ; close any open handles to restore ProRWTS
|
2019-06-22 20:16:16 +00:00
|
|
|
; (also switches to LC RAM bank 1)
|
2019-06-23 18:24:09 +00:00
|
|
|
jsr SaveOrRestoreScreenHoles ; restore original screen hole contents
|
|
|
|
RestoreStackNextTime
|
|
|
|
clc ; SMC
|
|
|
|
bcc SearchMode ; not an unconditional branch because code
|
|
|
|
; might change the 'clc' just before it
|
|
|
|
; If we fall through to here, it's because we backed up the stack and
|
|
|
|
; stack pointer and wanted this routine to restore it and return to
|
|
|
|
; caller.
|
|
|
|
lda #$18 ; reset to 'clc' opcode so we don't try to
|
|
|
|
sta RestoreStackNextTime ; restore the same stack twice
|
|
|
|
ldx #1
|
|
|
|
- lda $DF00,x ; restore stack
|
2019-01-08 19:10:26 +00:00
|
|
|
sta $100,x
|
|
|
|
inx
|
2019-06-23 18:24:09 +00:00
|
|
|
bne -
|
|
|
|
ldx $DF00 ; restore stack pointer
|
|
|
|
txs
|
|
|
|
rts
|
2018-10-27 22:47:27 +00:00
|
|
|
|
2018-08-31 04:31:54 +00:00
|
|
|
; these routines will only be called after relocating to language card
|
2018-12-28 20:11:38 +00:00
|
|
|
!source "src/ui.search.mode.a"
|
2018-11-07 23:56:39 +00:00
|
|
|
!source "src/ui.attract.mode.a"
|
2019-01-15 00:06:58 +00:00
|
|
|
!source "src/ui.attract.hgr.a"
|
|
|
|
!source "src/ui.attract.dhgr.a"
|
|
|
|
!source "src/ui.attract.shr.a"
|
2018-09-13 13:53:04 +00:00
|
|
|
!source "src/prodos.path.a"
|
2019-01-15 00:06:58 +00:00
|
|
|
!source "src/glue.launch.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"
|
2019-06-18 18:56:05 +00:00
|
|
|
!source "src/textrank.a"
|
2018-10-23 19:44:06 +00:00
|
|
|
!source "src/parse.common.a"
|
2018-11-11 13:42:53 +00:00
|
|
|
!source "src/parse.prefs.a"
|
2018-08-31 04:31:54 +00:00
|
|
|
!source "src/parse.games.a"
|
2019-06-18 20:54:15 +00:00
|
|
|
!source "src/ui.sound.a"
|
2018-12-28 20:11:38 +00:00
|
|
|
!source "src/ui.font.a"
|
2018-11-10 15:08:14 +00:00
|
|
|
gGlobalPrefsStore
|
2019-06-19 04:49:12 +00:00
|
|
|
!word $D000 ; address of first okvs store
|
2019-06-21 16:43:43 +00:00
|
|
|
!word Reenter ; NMI vector ($FFFA-B)
|
|
|
|
!word Reenter ; reset vector ($FFFC-D)
|
|
|
|
!word Reenter ; IRQ vector ($FFFE-F)
|
2018-08-29 19:27:30 +00:00
|
|
|
}
|
|
|
|
LastMover
|
2019-06-20 01:50:48 +00:00
|
|
|
!source "src/ui.font.data.a"
|
2019-06-19 04:49:12 +00:00
|
|
|
!if RELBASE = $2000 {
|
|
|
|
!ifdef PASS2 {
|
|
|
|
} else { ;PASS2
|
|
|
|
!set PASS2=1
|
2019-06-21 16:43:43 +00:00
|
|
|
!warn "RELBASE = ", $10000 - (LastMover - FirstMover)
|
2019-06-19 04:49:12 +00:00
|
|
|
}
|
|
|
|
}
|