Basic main menu working!

This commit is contained in:
blondie7575 2023-07-24 20:29:11 -07:00
parent 1eb235fc4c
commit 5eb32268b9
7 changed files with 1459 additions and 1323 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 924 B

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

View File

@ -27,9 +27,7 @@
706DF1641F2D39F700AA6680 /* loader.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = loader.s; sourceTree = "<group>"; };
706DF1651F2D4A8100AA6680 /* terrain.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = terrain.s; sourceTree = "<group>"; };
7076E9222A57AED90006E295 /* CompileFont.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = CompileFont.py; sourceTree = "<group>"; };
7076E9232A59113F0006E295 /* font8x8.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = font8x8.s; sourceTree = "<group>"; };
7076E9242A5A4A8E0006E295 /* fontEngine.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = fontEngine.s; sourceTree = "<group>"; };
7076E9252A5F9F540006E295 /* font16x16.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = font16x16.s; sourceTree = "<group>"; };
7088096D1F2ECE8D00D4C950 /* GenerateRenderSpans.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateRenderSpans.py; sourceTree = "<group>"; };
708D1B1E27B9A1A600909AFC /* crosshair.s */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.asm; path = crosshair.s; sourceTree = "<group>"; };
709175C01F60D263008FAFAB /* GenerateCircles.py */ = {isa = PBXFileReference; lastKnownFileType = text.script.python; path = GenerateCircles.py; sourceTree = "<group>"; };
@ -92,8 +90,6 @@
70E9D8631F2BD95400555C19 /* Makefile */,
70BDCBC92006AD5F00CB51F1 /* linkerConfig */,
701E708A2A649A230030C35D /* tinyNumbers.s */,
7076E9232A59113F0006E295 /* font8x8.s */,
7076E9252A5F9F540006E295 /* font16x16.s */,
7076E9242A5A4A8E0006E295 /* fontEngine.s */,
7076E9222A57AED90006E295 /* CompileFont.py */,
70FE79D21F8814A600E0095C /* MerlinToCA65.sh */,

2588
fonts.s

File diff suppressed because it is too large Load Diff

29
input.s
View File

@ -20,8 +20,14 @@ kbdScanTitle:
bpl kbdScanTitleDone
sta KBDSTROBE
cmp #(8 + $80)
beq kbdScanLeftArrowTitle
cmp #(11 + $80)
beq kbdScanUpArrowTitle
cmp #(10 + $80)
beq kbdScanDownArrowTitle
cmp #(13 + $80)
beq kbdScanEnterTitle
cmp #(32 + $80)
beq kbdScanSpaceTitle
kbdScanTitleDone:
BITS16
@ -32,12 +38,29 @@ kbdScanTitleDone:
; Title Screen Key Handlers
;
kbdScanLeftArrowTitle:
kbdScanUpArrowTitle:
BITS16
lda #-1
sta menuActionRequested
rts
kbdScanDownArrowTitle:
BITS16
lda #1
sta menuActionRequested
rts
kbdScanEnterTitle:
BITS16
lda #2
sta menuActionRequested
rts
kbdScanSpaceTitle:
BITS16
lda #2
sta menuActionRequested
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

View File

@ -21,6 +21,7 @@ MAINENTRY = $020000
LOADSTEP = 3
.macro addProgress amount
jsr nextVBL
lda #amount
jsr advanceLoadingBar
jsr renderLoadingBar

View File

@ -13,6 +13,8 @@ titlePalette:
TITLE_ANIMATION_FRAMES = 5
CAT_DELAY = 300
CAT0_VRAM = $5d79
CAT1_VRAM = $5da0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@ -31,7 +33,7 @@ titleScreen:
titleScreenCopyLoop:
lda $060000,x
sta VRAM,x
sta SHADOWVRAM,x
inx
inx
cpx #$7d00
@ -46,11 +48,17 @@ titleScreenCopyLoop:
; Set up audio
jsr initSoundSystem
; Render menu text
jsr titleScreenRenderMenu
; Fade in
lda #titlePalette
sta PARAML2
jsr paletteFade
ldy #CAT0_VRAM ; Save a generic background to erase cats
jsr protectAnimation16x16
titleScreenMainLoop:
; Track animations
@ -67,6 +75,9 @@ titleScreenMainLoop:
lda #CAT_DELAY
sta animationDelay0
ldy #CAT0_VRAM
jsr unrenderAnimation16x16
; Render next frame of cats
lda #titleAnimationPos0
sta PARAML0
@ -78,7 +89,7 @@ titleScreenMainLoop:
titleScreenStillCat:
sta animationDelay0
ldy #$5d79
ldy #CAT0_VRAM
lda #29
jsr drawSpriteBankSafe
@ -89,6 +100,9 @@ titleScreenNextCat:
lda #CAT_DELAY
sta animationDelay1
ldy #CAT1_VRAM
jsr unrenderAnimation16x16
lda #titleAnimationPos1
sta PARAML0
ldx #TITLE_ANIMATION_FRAMES
@ -99,7 +113,7 @@ titleScreenNextCat:
titleScreenStillCat2:
sta animationDelay1
ldy #$5da0
ldy #CAT1_VRAM
lda #20
jsr drawSpriteBankSafe
@ -107,14 +121,53 @@ titleScreenKeyboard:
; Check for selection
jsr kbdScanTitle
lda menuActionRequested
beq titleScreenMainLoop
beq titleScreenMainLoopEndFrame
jmp beginGameplay
cmp #-1
beq titleScreenKeyboardMenuUp
cmp #1
beq titleScreenKeyboardMenuDown
cmp #2
beq titleScreenKeyboardMenuGo
bra titleScreenMainLoopEndFrame
titleScreenResetAnimation:
stz titleAnimationCounter
rts
titleScreenKeyboardMenuUp:
lda menuSelection
beq titleScreenMainLoopEndFrame
dec
sta menuSelection
jsr titleScreenRenderMenu
bra titleScreenMainLoopEndFrame
titleScreenKeyboardMenuDown:
lda menuSelection
cmp #2
beq titleScreenMainLoopEndFrame
inc
sta menuSelection
jsr titleScreenRenderMenu
bra titleScreenMainLoopEndFrame
titleScreenKeyboardMenuGo:
lda menuSelection
beq titleScreenBeginGame
cmp #2
beq titleScreenQuit
titleScreenMainLoopEndFrame:
stz menuActionRequested
jmp titleScreenMainLoop
titleScreenBeginGame:
jmp beginGameplay
titleScreenQuit:
jmp quitGame
titleAnimationCounter:
.word 0
titleAnimationPos0:
@ -127,3 +180,100 @@ animationDelay1:
.word CAT_DELAY
menuActionRequested:
.word 0
selectionString:
pstring "[[[[[[[[[[[[[[[["
unselectionString:
pstring "\\\\\\\\\\\\\\\\"
startString:
pstring "BEGIN GAME"
helpString:
pstring "HOW TO PLAY"
quitString:
pstring "QUIT"
menuSelection:
.word 0
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; titleScreenRenderMenu
;
; Render the game menu
;
; Trashes A
;
titleScreenRenderMenu:
ldy #$78f0
jsr titleScreenUnRenderSelection
lda menuSelection
bne titleScreenRenderMenuItem0
ldy #$78f0
jsr titleScreenRenderSelection
titleScreenRenderMenuItem0:
lda #startString
sta PARAML0
lda #1
ldy #$78fc
jsl renderStringFar
ldy #$7f30
jsr titleScreenUnRenderSelection
lda menuSelection
cmp #1
bne titleScreenRenderMenuItem1
ldy #$7f30
jsr titleScreenRenderSelection
titleScreenRenderMenuItem1:
lda #helpString
sta PARAML0
lda #1
ldy #$7f39
jsl renderStringFar
ldy #$8570
jsr titleScreenUnRenderSelection
lda menuSelection
cmp #2
bne titleScreenRenderMenuItem2
ldy #$8570
jsr titleScreenRenderSelection
titleScreenRenderMenuItem2:
lda #quitString
sta PARAML0
lda #1
ldy #$8588
jsl renderStringFar
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; titleScreenRenderSelection
;
; Render the menu selection bar
;
; Y = VRAM position of bar
;
titleScreenRenderSelection:
lda #selectionString
sta PARAML0
lda #1
jsl renderStringFar
rts
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; titleScreenUnRenderSelection
;
; Unrender the menu selection bar
;
; Y = VRAM position of bar
;
titleScreenUnRenderSelection:
lda #unselectionString
sta PARAML0
lda #1
jsl renderStringFar
rts