diff --git a/src/apple2/audio.inc b/src/apple2/audio.inc index 3a8349b..079831e 100644 --- a/src/apple2/audio.inc +++ b/src/apple2/audio.inc @@ -39,15 +39,14 @@ explosion: tax ldy #$6 jsr playNote - inc audioExplFrame + + inc audioExplFrame ; make sure off-screen ticks to end lda audioExplFrame cmp #%00000011 bcc :+ - stx audioFrame ; turn off the explosion - rts + lda #AUDIO_MOTOR_PLAY + sta audioFrame ; turn off the explosion : - lda #AUDIO_EXPLOSION - sta audioFrame rts bombDrop: @@ -106,7 +105,9 @@ loop: lda #AUDIO_EXPLOSION ; reset the audio frame (serviced) and audioFrame ; but keep explosion if it was set + ora #AUDIO_MOTOR_PLAY ; and always add the MOTOR sta audioFrame + rts .endproc diff --git a/src/apple2/game.inc b/src/apple2/game.inc index af4f17a..f3cea96 100644 --- a/src/apple2/game.inc +++ b/src/apple2/game.inc @@ -41,18 +41,15 @@ preamble: ; bring terrain on-screen with n wait #$40 ; give the user a moment to get ready loop: - lda runAudio + lda runAudio ; alternate between game and audio eor #1 sta runAudio - bne :+ - jsr serviceAudio - lda audioFrame - ora #AUDIO_MOTOR_PLAY - sta audioFrame - beq loop + beq :+ ; run the game when runAudio eq 0 + jsr serviceAudio ; run the audio + jmp loop ; go back and flip to the game : - lda playerDead - bne skip + lda playerDead ; check if the input should run + bne skip ; and skip if not jsr inputGame ; read joystick and move player, check for pause key cmp #$9b ; check for ESC @@ -60,7 +57,7 @@ loop: rts ; on ESC, just quit 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 :+ jsr gameWorldMove ; scroll the world inc bufferDraw ; and move the draw start also @@ -74,7 +71,7 @@ skip: 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 draw: jsr terrainShow ; show terrain 1st because it collides with nothing @@ -156,10 +153,10 @@ win: sta dangerTickIdx sta moveHorz sta moveVert + sta runAudio sta flipFlop sta pause sta fireCoolDown - sta audioFrame tax ; clear the buffers for tracking objects : @@ -181,6 +178,9 @@ win: lda #XSIZE-1 ; place where terrain will start drawing (right hand) sta terrainOrigin + lda #AUDIO_MOTOR_PLAY ; Init th eaudio-frame with the engine + sta audioFrame + lda #$ff sta lastInput ; set no keys down all 1's sta nextStage diff --git a/src/apple2/penetrator.asm b/src/apple2/penetrator.asm index 503769a..236d645 100644 --- a/src/apple2/penetrator.asm +++ b/src/apple2/penetrator.asm @@ -70,6 +70,7 @@ store: lda #$0 sta backLayer ; set back layer to 0 sta audioFrame ; set all audio channels to off (0) + sta numPlayers ; Init initially to 0 (not set for training) : sta highScores, x dex diff --git a/src/apple2/text.inc b/src/apple2/text.inc index b7227d3..7a22198 100644 --- a/src/apple2/text.inc +++ b/src/apple2/text.inc @@ -26,7 +26,7 @@ textStefan: .asciiz " Stefan Wessels, Dec 2019 " textSupport: .asciiz " Lots of great Apple II " textOliver: .asciiz " Support from Oliver Schmidt " textSource: .asciiz " Source on GitHub: " -textGitHub: .asciiz " github.com/StewBC/penetrator " +textGitHub: .asciiz " StewBC/penetrator-apple2 " textGameOver: .asciiz "********** GAME OVER **********" ; main menu diff --git a/src/apple2/ui.inc b/src/apple2/ui.inc index 360de47..db00229 100644 --- a/src/apple2/ui.inc +++ b/src/apple2/ui.inc @@ -34,7 +34,7 @@ loopo: sta zaState loop: - lda #$10 + lda #$08 sta zaCounterH lda zaState