2019-10-09 17:15:33 +00:00
|
|
|
;license:MIT
|
|
|
|
;(c) 2018-9 by 4am & qkumba
|
|
|
|
;
|
2019-10-09 17:16:29 +00:00
|
|
|
; Functions to launch games and self-running demos
|
2019-10-09 17:15:33 +00:00
|
|
|
;
|
|
|
|
; /!\ These live in LC RAM 2 and rely on the ProRWTS code which is also in LC RAM 2. /!\
|
|
|
|
; Code in LC RAM 1 (which is most program code) should call the functions in glue.launch
|
|
|
|
; which handle bank switching for you.
|
|
|
|
|
2019-10-09 17:04:39 +00:00
|
|
|
LaunchInternal
|
|
|
|
ldy #$F1
|
|
|
|
- lda $100,y
|
2019-11-27 21:51:43 +00:00
|
|
|
sta STACKBASE - $EF,y ; back up stack
|
2019-10-09 17:04:39 +00:00
|
|
|
iny
|
|
|
|
bne -
|
|
|
|
tsx ; back up stack pointer
|
2019-11-27 21:51:43 +00:00
|
|
|
stx STACKPTR + 1
|
2019-10-09 17:04:39 +00:00
|
|
|
sty RestoreStackNextTime + 1
|
|
|
|
; tell |Reenter| to restore the stack and stack pointer
|
|
|
|
|
|
|
|
tya
|
|
|
|
ldy #$18
|
|
|
|
- sta $bf57,y
|
|
|
|
dey
|
|
|
|
bne -
|
|
|
|
jmp $106 ; jump to pre-launch code
|