2018-12-29 18:38:18 +00:00
|
|
|
;license:MIT
|
2020-03-17 01:58:05 +00:00
|
|
|
;(c) 2018-2020 by 4am
|
2018-12-29 18:38:18 +00:00
|
|
|
;
|
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
|
|
|
|
}
|
|
|
|
|
2019-06-24 02:32:18 +00:00
|
|
|
!source "src/constants.a" ; no code in these
|
2018-08-26 19:33:32 +00:00
|
|
|
!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"
|
2020-08-12 15:35:21 +00:00
|
|
|
!source "src/4cade.init.cffa.a"
|
2020-08-13 23:12:57 +00:00
|
|
|
!source "src/4cade.init.gs.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.
|
|
|
|
;
|
2019-06-24 02:32:18 +00:00
|
|
|
; in: none
|
2019-06-23 18:24:09 +00:00
|
|
|
; out: see above
|
|
|
|
;------------------------------------------------------------------------------
|
|
|
|
Reenter
|
2018-12-10 00:04:36 +00:00
|
|
|
cld
|
2019-11-27 21:51:43 +00:00
|
|
|
ldx #$ff
|
|
|
|
txs ; so that we never trash the reset vector
|
2019-09-26 03:01:59 +00:00
|
|
|
jsr SwitchToBank2
|
2019-10-08 17:19:20 +00:00
|
|
|
jsr DisableAccelerator ; back to 1 MHz (especially important on IIgs
|
|
|
|
; which restores default speed on Ctrl-Reset)
|
2019-06-23 18:24:09 +00:00
|
|
|
jsr CloseHandles ; close any open handles to restore ProRWTS
|
2020-07-30 17:21:42 +00:00
|
|
|
ldx #(end_promote-promote-1)
|
|
|
|
- lda promote,x ; copy ProDOS shim to main memory for GS/OS exit
|
|
|
|
sta $bf00,x
|
|
|
|
dex
|
|
|
|
bpl -
|
2019-09-16 01:00:38 +00:00
|
|
|
ldx #5
|
|
|
|
- lda ResetVector,x ; copy reentry wrapper to bottom of stack
|
2020-02-28 23:33:10 +00:00
|
|
|
sta $100,x ; (used as reset vector because //e always
|
2019-09-16 01:00:38 +00:00
|
|
|
dex ; switches to ROM on Ctrl-Reset)
|
|
|
|
bpl -
|
|
|
|
inx
|
|
|
|
stx $3F2 ; page 3 reset vector to ($100)
|
2020-02-28 23:33:10 +00:00
|
|
|
sei
|
2019-12-12 03:21:14 +00:00
|
|
|
stx $3FE ; page 3 IRQ vector to ($100)
|
2019-09-16 01:00:38 +00:00
|
|
|
inx
|
2019-12-12 03:21:14 +00:00
|
|
|
stx $3FF
|
2020-02-28 23:33:10 +00:00
|
|
|
cli
|
|
|
|
stx $3F3
|
2019-09-16 01:00:38 +00:00
|
|
|
ldx #$A4
|
|
|
|
stx $3F4
|
2019-06-23 18:24:09 +00:00
|
|
|
RestoreStackNextTime
|
2019-09-30 18:18:57 +00:00
|
|
|
bne SearchMode ; (SMC) not an unconditional branch because code
|
|
|
|
; might change the branch target to the next opcode
|
2019-06-23 18:24:09 +00:00
|
|
|
; 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.
|
2019-09-30 18:18:57 +00:00
|
|
|
lda #(SearchMode - RestoreStackNextTime) - 2
|
|
|
|
; reset to branch so we don't try to
|
|
|
|
sta RestoreStackNextTime + 1
|
|
|
|
; restore the same stack twice
|
2019-09-10 17:50:36 +00:00
|
|
|
ldx #$F1
|
2019-11-27 21:51:43 +00:00
|
|
|
- lda STACKBASE - $EF,x ; restore stack
|
2019-01-08 19:10:26 +00:00
|
|
|
sta $100,x
|
|
|
|
inx
|
2019-06-23 18:24:09 +00:00
|
|
|
bne -
|
2019-11-27 21:51:43 +00:00
|
|
|
STACKPTR
|
|
|
|
ldx #$D1 ; SMC, restore stack pointer
|
2019-06-23 18:24:09 +00:00
|
|
|
txs
|
2020-03-14 00:11:59 +00:00
|
|
|
SwitchToBank1
|
|
|
|
+READ_RAM1_WRITE_RAM1
|
|
|
|
rts
|
2019-09-16 01:00:38 +00:00
|
|
|
ResetVector ; 6 bytes, copied to $100
|
|
|
|
+READ_RAM1_NO_WRITE
|
|
|
|
jmp Reenter
|
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
|
2019-10-08 17:19:20 +00:00
|
|
|
!source "src/ui.search.mode.a" ; \__ execution falls through
|
|
|
|
!source "src/ui.animation.a" ; /
|
|
|
|
|
2020-03-25 20:56:35 +00:00
|
|
|
!source "src/ui.browse.mode.a"
|
2018-11-07 23:56:39 +00:00
|
|
|
!source "src/ui.attract.mode.a"
|
2020-03-25 20:56:35 +00:00
|
|
|
!source "src/ui.attract.hgr.a"
|
|
|
|
!source "src/ui.attract.dhgr.a"
|
2019-01-15 00:06:58 +00:00
|
|
|
!source "src/ui.attract.shr.a"
|
2019-07-15 15:42:05 +00:00
|
|
|
!source "src/ui.attract.gr.a"
|
2020-03-25 20:56:35 +00:00
|
|
|
!source "src/ui.offscreen.a"
|
2019-09-15 21:55:16 +00:00
|
|
|
!source "src/ui.cheats.a"
|
2020-03-25 20:56:35 +00:00
|
|
|
!source "src/ui.credits.a"
|
2020-07-29 01:06:36 +00:00
|
|
|
!source "src/ui.reboot.a"
|
2020-03-25 20:56:35 +00:00
|
|
|
!source "src/ui.common.a"
|
|
|
|
!source "src/ui.font.a"
|
|
|
|
!source "src/ui.overlay.a"
|
2019-10-08 18:47:47 +00:00
|
|
|
!source "src/parse.prefs.a"
|
2020-03-25 20:56:35 +00:00
|
|
|
!source "src/glue.launch.a"
|
2019-10-08 18:47:47 +00:00
|
|
|
!source "src/glue.prorwts2.a"
|
2020-03-15 15:23:56 +00:00
|
|
|
!source "src/glue.decompress.a"
|
2020-03-25 20:56:35 +00:00
|
|
|
!source "src/textrank.a"
|
|
|
|
!source "src/okvs.a"
|
|
|
|
!source "src/wait.a"
|
2019-10-08 17:31:41 +00:00
|
|
|
|
2020-03-25 20:56:35 +00:00
|
|
|
; add new files above here
|
2020-03-17 22:30:20 +00:00
|
|
|
!source "src/hw.vbl.a"
|
2020-03-25 20:56:35 +00:00
|
|
|
!source "src/ui.wait.a"
|
2020-03-18 16:08:39 +00:00
|
|
|
gSearchStore
|
2020-03-23 16:38:27 +00:00
|
|
|
!word $8200
|
2019-06-30 19:10:09 +00:00
|
|
|
gSlideshowStore
|
|
|
|
!word $0800
|
2018-11-10 15:08:14 +00:00
|
|
|
gGlobalPrefsStore
|
2020-03-29 23:52:35 +00:00
|
|
|
!word $D001 ; leave $D000 alone because FastChip accelerator
|
|
|
|
; flips out if it has certain values (it will
|
|
|
|
; be set to $55 as part of the 64K memory test,
|
|
|
|
; which is apparently one of the acceptable values)
|
2019-06-24 02:32:18 +00:00
|
|
|
gGamesListStore
|
|
|
|
!word $FDFD ; SMC
|
2021-10-18 05:04:55 +00:00
|
|
|
StoreAYAndSwitchToBank2
|
|
|
|
+ST16 PTR
|
2019-09-20 13:33:23 +00:00
|
|
|
SwitchToBank2
|
|
|
|
+READ_RAM2_WRITE_RAM2
|
|
|
|
rts
|
2019-10-10 04:26:18 +00:00
|
|
|
!source "src/prodos.path.a" ; paths end up on the same page
|
|
|
|
|
2021-10-15 20:00:40 +00:00
|
|
|
; iLoadFileDirect (label is in constants.a)
|
|
|
|
jmp LoadFileDirect ; no direct calling - target can move
|
|
|
|
|
2020-03-25 20:56:35 +00:00
|
|
|
; WaitForVBL (label is in constants.a)
|
2020-03-19 02:53:50 +00:00
|
|
|
jmp WaitForVBL_iie ; SMC to RTS on a II+
|
|
|
|
|
2020-03-25 20:56:35 +00:00
|
|
|
; UnwaitForVBL (label is in constants.a)
|
2020-03-19 02:53:50 +00:00
|
|
|
rts ; SMC to JMP on a IIc
|
|
|
|
!word iUnwaitForVBL
|
|
|
|
|
2020-03-25 20:56:35 +00:00
|
|
|
; MockingboardStuff (label is in constants.a)
|
2020-02-28 23:33:10 +00:00
|
|
|
; slot number where Mockingboard was detected and type of board
|
2020-01-29 23:52:33 +00:00
|
|
|
; #$00 if no Mockingboard detected
|
2020-02-28 23:33:10 +00:00
|
|
|
!byte $FD ; MockingboardStuff ($FFF8)
|
2019-10-05 01:34:49 +00:00
|
|
|
; MachineStatus (label is in constants.a so prelaunchers can use it)
|
|
|
|
; 7 6 5 4 3 2 1 0
|
|
|
|
; | | | | | | | +- bit 0 reserved
|
|
|
|
; | | | | | | +--- bit 1 reserved
|
2019-11-21 04:05:35 +00:00
|
|
|
; | | | | | +----- bit 2 reserved
|
2020-03-05 17:38:53 +00:00
|
|
|
; | | | | +------- bit 3 = 1 if cheats are enabled
|
|
|
|
; | | | +--------- bit 4 = 1 if VidHD
|
|
|
|
; | | +----------- bit 5 = 1 if IIgs
|
2019-10-05 01:34:49 +00:00
|
|
|
; | +------------- bit 6 = 1 if 128K
|
|
|
|
; +--------------- bit 7 = 1 if joystick
|
|
|
|
; Use the bit masks defined in constants.a
|
|
|
|
!byte $FD ; MachineStatus ($FFF9)
|
2019-06-21 16:43:43 +00:00
|
|
|
!word Reenter ; NMI vector ($FFFA-B)
|
|
|
|
!word Reenter ; reset vector ($FFFC-D)
|
2019-11-20 05:55:33 +00:00
|
|
|
!word Ignore ; IRQ vector ($FFFE-F)
|
2018-08-29 19:27:30 +00:00
|
|
|
}
|
|
|
|
LastMover
|
2020-01-28 19:19:10 +00:00
|
|
|
COPYSRC = *
|
|
|
|
!pseudopc hdddataend {
|
|
|
|
COPYDST = *
|
2019-10-09 17:04:39 +00:00
|
|
|
!source "src/prodos.impl.lc2.a"
|
|
|
|
!source "src/ui.font.lc2.a"
|
|
|
|
!source "src/glue.prorwts2.lc2.a"
|
|
|
|
!source "src/glue.launch.lc2.a"
|
2019-10-09 17:15:33 +00:00
|
|
|
!source "src/hw.accel.lc2.a"
|
2020-01-28 19:19:10 +00:00
|
|
|
STACKBASE = *
|
|
|
|
LCRAM2_END = STACKBASE + 15
|
2020-05-23 22:47:16 +00:00
|
|
|
!if LCRAM2_END >= DisableAccelerator {
|
2020-01-28 19:19:10 +00:00
|
|
|
!error "code is too large: ends at ", LCRAM2_END
|
2019-09-10 01:40:59 +00:00
|
|
|
}
|
2020-01-28 19:19:10 +00:00
|
|
|
FONTDST = (LCRAM2_END + 255) and -256
|
|
|
|
}
|
2019-09-06 22:12:17 +00:00
|
|
|
EvenLasterMover
|
2019-09-30 18:18:57 +00:00
|
|
|
FONTSRC = *
|
2020-01-28 19:19:10 +00:00
|
|
|
!pseudopc FONTDST {
|
2019-10-09 17:04:39 +00:00
|
|
|
!source "src/ui.font.data.lc2.a"
|
2020-01-28 19:19:10 +00:00
|
|
|
!if * > $E000 {
|
2019-09-30 18:18:57 +00:00
|
|
|
!error "code is too large: ends at ", *
|
|
|
|
}
|
|
|
|
}
|
2019-06-19 04:49:12 +00:00
|
|
|
!if RELBASE = $2000 {
|
|
|
|
!ifdef PASS2 {
|
|
|
|
} else { ;PASS2
|
|
|
|
!set PASS2=1
|
2019-11-21 04:05:35 +00:00
|
|
|
!warn "ProRWTS ends at ", hdddataend - 1
|
2019-09-30 18:18:57 +00:00
|
|
|
!warn "STACK at ", STACKBASE
|
2020-05-23 22:47:16 +00:00
|
|
|
!warn "LCRAM2 ends at ", LCRAM2_END
|
2019-06-21 16:43:43 +00:00
|
|
|
!warn "RELBASE = ", $10000 - (LastMover - FirstMover)
|
2019-06-19 04:49:12 +00:00
|
|
|
}
|
|
|
|
}
|