Misc fixes

Misc fixes and cleanup
This commit is contained in:
StewBC 2020-01-16 14:10:14 -08:00
parent a1a6ce8919
commit 1307c2ae66
5 changed files with 21 additions and 19 deletions

View File

@ -39,15 +39,14 @@ explosion:
tax tax
ldy #$6 ldy #$6
jsr playNote jsr playNote
inc audioExplFrame
inc audioExplFrame ; make sure off-screen ticks to end
lda audioExplFrame lda audioExplFrame
cmp #%00000011 cmp #%00000011
bcc :+ bcc :+
stx audioFrame ; turn off the explosion lda #AUDIO_MOTOR_PLAY
rts sta audioFrame ; turn off the explosion
: :
lda #AUDIO_EXPLOSION
sta audioFrame
rts rts
bombDrop: bombDrop:
@ -106,7 +105,9 @@ loop:
lda #AUDIO_EXPLOSION ; reset the audio frame (serviced) lda #AUDIO_EXPLOSION ; reset the audio frame (serviced)
and audioFrame ; but keep explosion if it was set and audioFrame ; but keep explosion if it was set
ora #AUDIO_MOTOR_PLAY ; and always add the MOTOR
sta audioFrame sta audioFrame
rts rts
.endproc .endproc

View File

@ -41,18 +41,15 @@ preamble: ; bring terrain on-screen with n
wait #$40 ; give the user a moment to get ready wait #$40 ; give the user a moment to get ready
loop: loop:
lda runAudio lda runAudio ; alternate between game and audio
eor #1 eor #1
sta runAudio sta runAudio
bne :+ beq :+ ; run the game when runAudio eq 0
jsr serviceAudio jsr serviceAudio ; run the audio
lda audioFrame jmp loop ; go back and flip to the game
ora #AUDIO_MOTOR_PLAY
sta audioFrame
beq loop
: :
lda playerDead lda playerDead ; check if the input should run
bne skip bne skip ; and skip if not
jsr inputGame ; read joystick and move player, check for pause key jsr inputGame ; read joystick and move player, check for pause key
cmp #$9b ; check for ESC cmp #$9b ; check for ESC
@ -60,7 +57,7 @@ loop:
rts ; on ESC, just quit rts ; on ESC, just quit
skip: skip:
lda playerDead ; even on every second frame if the player is dead the world doesn't move lda playerDead ; if the player is dead the world doesn't move
bne :+ bne :+
jsr gameWorldMove ; scroll the world jsr gameWorldMove ; scroll the world
inc bufferDraw ; and move the draw start also inc bufferDraw ; and move the draw start also
@ -74,7 +71,7 @@ skip:
next: next:
dec bulletIndex ; Bullets move every frame (2x for 1 world move) dec bulletIndex ; Bullets move every frame (2x for 1 world move)
dec bulletIndex ; Bullets move every frame (2x for 1 world move) dec bulletIndex
draw: draw:
jsr terrainShow ; show terrain 1st because it collides with nothing jsr terrainShow ; show terrain 1st because it collides with nothing
@ -156,10 +153,10 @@ win:
sta dangerTickIdx sta dangerTickIdx
sta moveHorz sta moveHorz
sta moveVert sta moveVert
sta runAudio
sta flipFlop sta flipFlop
sta pause sta pause
sta fireCoolDown sta fireCoolDown
sta audioFrame
tax ; clear the buffers for tracking objects tax ; clear the buffers for tracking objects
: :
@ -181,6 +178,9 @@ win:
lda #XSIZE-1 ; place where terrain will start drawing (right hand) lda #XSIZE-1 ; place where terrain will start drawing (right hand)
sta terrainOrigin sta terrainOrigin
lda #AUDIO_MOTOR_PLAY ; Init th eaudio-frame with the engine
sta audioFrame
lda #$ff lda #$ff
sta lastInput ; set no keys down all 1's sta lastInput ; set no keys down all 1's
sta nextStage sta nextStage

View File

@ -70,6 +70,7 @@ store:
lda #$0 lda #$0
sta backLayer ; set back layer to 0 sta backLayer ; set back layer to 0
sta audioFrame ; set all audio channels to off (0) sta audioFrame ; set all audio channels to off (0)
sta numPlayers ; Init initially to 0 (not set for training)
: :
sta highScores, x sta highScores, x
dex dex

View File

@ -26,7 +26,7 @@ textStefan: .asciiz " Stefan Wessels, Dec 2019 "
textSupport: .asciiz " Lots of great Apple II " textSupport: .asciiz " Lots of great Apple II "
textOliver: .asciiz " Support from Oliver Schmidt " textOliver: .asciiz " Support from Oliver Schmidt "
textSource: .asciiz " Source on GitHub: " textSource: .asciiz " Source on GitHub: "
textGitHub: .asciiz " github.com/StewBC/penetrator " textGitHub: .asciiz " StewBC/penetrator-apple2 "
textGameOver: .asciiz "********** GAME OVER **********" textGameOver: .asciiz "********** GAME OVER **********"
; main menu ; main menu

View File

@ -34,7 +34,7 @@ loopo:
sta zaState sta zaState
loop: loop:
lda #$10 lda #$08
sta zaCounterH sta zaCounterH
lda zaState lda zaState