mirror of
https://github.com/a2-4am/4cade.git
synced 2025-01-19 01:31:36 +00:00
more in LC RAM2
This commit is contained in:
parent
ec637fe9ba
commit
11fb880be9
@ -83,10 +83,6 @@ RestoreStackNextTime
|
||||
!source "src/glue.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
|
||||
|
@ -241,6 +241,7 @@ OneTimeSetup
|
||||
cpy #$03
|
||||
bcc @outer
|
||||
|
||||
+READ_RAM2_WRITE_RAM2
|
||||
ldx #5
|
||||
- lda Prelaunch,x ; copy reentry wrapper to bottom of stack
|
||||
sta $100,x ; (used as reset vector because ][+ always
|
||||
|
@ -194,65 +194,4 @@ Launch
|
||||
dex
|
||||
bpl -
|
||||
jmp $106 ; jump to pre-launch code
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Prelaunch
|
||||
; code to set up and launch third-party code (either a self-running demo or
|
||||
; an actual game)
|
||||
; THIS IS NOT A FUNCTION. DO NOT CALL THIS DIRECTLY.
|
||||
; must be run from main memory
|
||||
; contains multiple entry points
|
||||
;
|
||||
; in: for first entry point, none
|
||||
; for second entry point, the game must already be loaded in memory
|
||||
; and ldrlo2/ldrhi2 must be the game entry point
|
||||
; out: exits via JMP (ldrlo2), which is expected to exit via JMP |Prelaunch|
|
||||
; (not here, but wherever it was copied to in main memory) or by
|
||||
; manually enabling LC RAM then JMP |Reenter|
|
||||
;------------------------------------------------------------------------------
|
||||
Prelaunch
|
||||
; copied to $0100 in main memory
|
||||
; main entry point to return to launcher (used by self-running demos, vectors)
|
||||
+READ_RAM1_NO_WRITE
|
||||
jmp Reenter
|
||||
|
||||
!if * != Prelaunch+6 {
|
||||
!error "Prelaunch entry points are messed up"
|
||||
}
|
||||
; copied to $0106 in main memory
|
||||
; main entry point to launch game
|
||||
+READ_ROM_NO_WRITE
|
||||
lda ldrlo2 ; set up game entry point in stack page
|
||||
ldy ldrhi2 ; (last load address - 1)
|
||||
sec
|
||||
sbc #$01
|
||||
bcs +
|
||||
dey
|
||||
+
|
||||
+STAY $1FE
|
||||
ldx #0 ; wipe zero page
|
||||
txa
|
||||
- sta $00,x
|
||||
inx
|
||||
bne -
|
||||
lda #$65 ; Initialize 'random' seed. These are
|
||||
sta RNDSEED ; arbitrary values. Some games like Pooyan
|
||||
lda #$02 ; require these to be non-zero. Ask me
|
||||
sta RNDSEED+1 ; how long that one took to debug.
|
||||
jsr ROM_IN0 ; Initialize machine like a cold boot.
|
||||
jsr ROM_PR0 ; Many games assume a 'clean slate' and
|
||||
jsr ROM_NORMAL ; rely on zero page values set by these
|
||||
sta STOREOFF ; ROM routines,
|
||||
sta READMAINMEM ; e.g. Wavy Navy just prints out text via
|
||||
sta WRITEMAINMEM ; $FDED and expects it to work. Having it
|
||||
sta CLR80VID ; print all null characters is amusing, in
|
||||
sta PRIMARYCHARSET ; a quiet way, but not really helpful.
|
||||
jsr ROM_TEXT
|
||||
jsr ROM_HOME
|
||||
bit CLEARKBD
|
||||
ldx #$FD ; Jump to game entry point via stack pop.
|
||||
txs
|
||||
rts
|
||||
End_Prelaunch
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2019 by qkumba
|
||||
;(c) 2019 by 4am & qkumba
|
||||
;
|
||||
; Pseudo-ProDOS environment
|
||||
;
|
||||
@ -647,3 +647,63 @@ SaveSmallFileInternal
|
||||
sta reqcmd
|
||||
sta sizelo ; non-zero
|
||||
jmp hddopendir ; exit via ProRWTS2 (must re-open the file after query)
|
||||
|
||||
;------------------------------------------------------------------------------
|
||||
; Prelaunch
|
||||
; code to set up and launch third-party code (either a self-running demo or
|
||||
; an actual game)
|
||||
; THIS IS NOT A FUNCTION. DO NOT CALL THIS DIRECTLY.
|
||||
; must be run from main memory
|
||||
; contains multiple entry points
|
||||
;
|
||||
; in: for first entry point, none
|
||||
; for second entry point, the game must already be loaded in memory
|
||||
; and ldrlo2/ldrhi2 must be the game entry point
|
||||
; out: exits via JMP (ldrlo2), which is expected to exit via JMP |Prelaunch|
|
||||
; (not here, but wherever it was copied to in main memory) or by
|
||||
; manually enabling LC RAM then JMP |Reenter|
|
||||
;------------------------------------------------------------------------------
|
||||
Prelaunch
|
||||
; copied to $0100 in main memory
|
||||
; main entry point to return to launcher (used by self-running demos, vectors)
|
||||
+READ_RAM1_NO_WRITE
|
||||
jmp Reenter
|
||||
|
||||
!if * != Prelaunch+6 {
|
||||
!error "Prelaunch entry points are messed up"
|
||||
}
|
||||
; copied to $0106 in main memory
|
||||
; main entry point to launch game
|
||||
+READ_ROM_NO_WRITE
|
||||
lda ldrlo2 ; set up game entry point in stack page
|
||||
ldy ldrhi2 ; (last load address - 1)
|
||||
sec
|
||||
sbc #$01
|
||||
bcs +
|
||||
dey
|
||||
+
|
||||
+STAY $1FE
|
||||
ldx #0 ; wipe zero page
|
||||
txa
|
||||
- sta $00,x
|
||||
inx
|
||||
bne -
|
||||
lda #$65 ; Initialize 'random' seed. These are
|
||||
sta RNDSEED ; arbitrary values. Some games like Pooyan
|
||||
lda #$02 ; require these to be non-zero. Ask me
|
||||
sta RNDSEED+1 ; how long that one took to debug.
|
||||
jsr ROM_IN0 ; Initialize machine like a cold boot.
|
||||
jsr ROM_PR0 ; Many games assume a 'clean slate' and
|
||||
jsr ROM_NORMAL ; rely on zero page values set by these
|
||||
sta STOREOFF ; ROM routines,
|
||||
sta READMAINMEM ; e.g. Wavy Navy just prints out text via
|
||||
sta WRITEMAINMEM ; $FDED and expects it to work. Having it
|
||||
sta CLR80VID ; print all null characters is amusing, in
|
||||
sta PRIMARYCHARSET ; a quiet way, but not really helpful.
|
||||
jsr ROM_TEXT
|
||||
jsr ROM_HOME
|
||||
bit CLEARKBD
|
||||
ldx #$FD ; Jump to game entry point via stack pop.
|
||||
txs
|
||||
rts
|
||||
End_Prelaunch
|
||||
|
@ -219,32 +219,42 @@ RunAttractModule
|
||||
pla ; restore module type
|
||||
|
||||
- and #$0F ; convert ASCII digit to int
|
||||
asl
|
||||
tax
|
||||
lda @slideshows-2,x
|
||||
lda @slideshowslo-1,x
|
||||
sta @jmp+1
|
||||
lda @slideshows-1,x
|
||||
lda @slideshowshi-1,x
|
||||
sta @jmp+2
|
||||
+LDAY @key ; pass in module name
|
||||
@jmp jmp $FDFD ; SMC
|
||||
|
||||
@dispatchSingle
|
||||
clc
|
||||
adc #$06
|
||||
adc #(@singleslo-@slideshowslo)-1
|
||||
bne - ; always branches
|
||||
|
||||
@slideshows
|
||||
!word HGRTitleSlideshow
|
||||
!word HGRActionSlideshow
|
||||
!word DHGRTitleSlideshow
|
||||
!word DHGRActionSlideshow
|
||||
!word SHRSlideshow
|
||||
!word GRActionSlideshow
|
||||
@singles
|
||||
!word HGRSingle
|
||||
!word DHGRSingle
|
||||
!word SHRSingle
|
||||
!word GRSingle
|
||||
@slideshowslo
|
||||
!byte <HGRTitleSlideshow
|
||||
!byte <HGRActionSlideshow
|
||||
!byte <DHGRTitleSlideshow
|
||||
!byte <DHGRActionSlideshow
|
||||
!byte <SHRSlideshow
|
||||
!byte <GRActionSlideshow
|
||||
@singleslo
|
||||
!byte <HGRSingle
|
||||
!byte <DHGRSingle
|
||||
!byte <SHRSingle
|
||||
!byte <GRSingle
|
||||
@slideshowshi
|
||||
!byte >HGRTitleSlideshow
|
||||
!byte >HGRActionSlideshow
|
||||
!byte >DHGRTitleSlideshow
|
||||
!byte >DHGRActionSlideshow
|
||||
!byte >SHRSlideshow
|
||||
!byte >GRActionSlideshow
|
||||
@singleshi
|
||||
!byte >HGRSingle
|
||||
!byte >DHGRSingle
|
||||
!byte >SHRSingle
|
||||
!byte >GRSingle
|
||||
|
||||
LoadAndParseAttractModeConf
|
||||
; TODO refactor launch code then make this private
|
||||
|
@ -66,7 +66,8 @@ BrowseMode
|
||||
ldx BrowseSelectedIndex
|
||||
cpx #$FF
|
||||
bne @notTooSmall
|
||||
ldx GameCount
|
||||
GameCount = *+1
|
||||
ldx #$D1 ; SMC
|
||||
dex
|
||||
bne @done ; always branches
|
||||
@notTooSmall
|
||||
|
@ -259,7 +259,8 @@ SoftBell
|
||||
; out: $0106..$011F clobbered
|
||||
;------------------------------------------------------------------------------
|
||||
Home
|
||||
lda MachineStatus
|
||||
MachineStatus = *+1
|
||||
lda #$D1 ; SMC
|
||||
and #SUPPORTS_SHR
|
||||
beq @noSHR
|
||||
lda NEWVIDEO
|
||||
|
Loading…
x
Reference in New Issue
Block a user