mirror of
https://github.com/a2-4am/4cade.git
synced 2024-09-27 12:57:21 +00:00
121 lines
3.9 KiB
Plaintext
121 lines
3.9 KiB
Plaintext
;license:MIT
|
|
;(c) 2018-9 by 4am
|
|
;
|
|
!cpu 6502
|
|
!to "build/LAUNCHER.SYSTEM",plain
|
|
*=$2000
|
|
|
|
!ifndef RELBASE {
|
|
RELBASE=$2000
|
|
}
|
|
|
|
!source "src/constants.a" ; no code in these
|
|
!source "src/macros.a"
|
|
|
|
; first-run initialization, relocates code to language card and jumps
|
|
; to |Reenter|
|
|
!source "src/4cade.init.a"
|
|
|
|
FirstMover
|
|
!pseudopc RELBASE {
|
|
;------------------------------------------------------------------------------
|
|
; 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: none
|
|
; out: see above
|
|
;------------------------------------------------------------------------------
|
|
Reenter
|
|
cld
|
|
cli
|
|
+READ_RAM2_WRITE_RAM2
|
|
jsr CloseHandles ; close any open handles to restore ProRWTS
|
|
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
|
|
sta $100,x
|
|
inx
|
|
bne -
|
|
ldx $DF00 ; restore stack pointer
|
|
txs
|
|
+READ_RAM1_WRITE_RAM1
|
|
rts ; and return to caller
|
|
|
|
; these routines will only be called after relocating to language card
|
|
!source "src/ui.search.mode.a"
|
|
!source "src/ui.browse.mode.a"
|
|
!source "src/ui.credits.a"
|
|
!source "src/ui.attract.mode.a"
|
|
!source "src/ui.attract.hgr.a"
|
|
!source "src/ui.attract.dhgr.a"
|
|
!source "src/ui.attract.shr.a"
|
|
!source "src/ui.attract.gr.a"
|
|
!source "src/prodos.path.a"
|
|
!source "src/glue.launch.a"
|
|
!source "src/glue.prorwts2.a"
|
|
!source "src/okvs.a"
|
|
!source "src/wait.a"
|
|
!source "src/textrank.a"
|
|
!source "src/parse.common.a"
|
|
!source "src/parse.prefs.a"
|
|
!source "src/ui.font.a"
|
|
; add new files above here so ui.common stays last
|
|
!source "src/ui.common.a"
|
|
MachineStatus
|
|
!byte 0
|
|
GameCount
|
|
!byte 0
|
|
gAttractModeStore
|
|
gFXStore
|
|
gDFXStore
|
|
!word $6000
|
|
gSlideshowStore
|
|
!word $0800
|
|
gGlobalPrefsStore
|
|
!word $D000
|
|
gGamesListStore
|
|
!word $FDFD ; SMC
|
|
!word Reenter ; NMI vector ($FFFA-B)
|
|
!word Reenter ; reset vector ($FFFC-D)
|
|
!word Reenter ; IRQ vector ($FFFE-F)
|
|
}
|
|
LastMover
|
|
!pseudopc $D600 {
|
|
!source "src/ui.font.data.a"
|
|
!source "src/prodos.impl.a"
|
|
!warn *
|
|
!if * > $DEFF {
|
|
!error "code is too large: ends at ", *
|
|
}
|
|
}
|
|
EvenLasterMover
|
|
!if RELBASE = $2000 {
|
|
!ifdef PASS2 {
|
|
} else { ;PASS2
|
|
!set PASS2=1
|
|
!warn "RELBASE = ", $10000 - (LastMover - FirstMover)
|
|
}
|
|
}
|