From 0e4574663fe55c41cae666950a23bdbc067e1e46 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Wed, 18 Mar 2020 10:31:12 -1000 Subject: [PATCH] twoplayer: Allow both players to pause --- twoplayer-tetris-PRG.s.diff | 35 +++++++++++++++++++++++++++++++++++ twoplayer.s | 12 ++++++++++-- 2 files changed, 45 insertions(+), 2 deletions(-) diff --git a/twoplayer-tetris-PRG.s.diff b/twoplayer-tetris-PRG.s.diff index a73e499..7f69de0 100644 --- a/twoplayer-tetris-PRG.s.diff +++ b/twoplayer-tetris-PRG.s.diff @@ -1216,6 +1216,41 @@ lda frameCounter and #$07 bne @waitForVBlank +@@ -4296,15 +4479,15 @@ gameModeState_startButtonHandling: + + @checkIfInGame: + lda renderMode + cmp #$03 + bne @ret +- lda newlyPressedButtons_player1 +- and #$10 +- bne @startPressed ++ .import isStartNewlyPressed ++ nop ;lda newlyPressedButtons_player1 ++ jsr isStartNewlyPressed ;and #$10 ++ beq @startPressed ;bne @startPressed + jmp @ret +- + ; Do nothing if curtain is being lowered + @startPressed: + lda player1_playState + cmp #$0A + bne @pause +@@ -4327,12 +4510,12 @@ @pauseLoop: + lda #$77 + sta spriteYOffset + lda #$05 + sta spriteIndexInOamContentLookup + jsr loadSpriteIntoOamStaging +- lda newlyPressedButtons_player1 +- cmp #$10 ++ nop ;lda newlyPressedButtons_player1 ++ jsr isStartNewlyPressed ;cmp #$10 + beq @resume + jsr updateAudioWaitForNmiAndResetOamStaging + jmp @pauseLoop + + @resume:lda #$1E @@ -6209,17 +6392,17 @@ dmc1: .byte $6D,$6E,$6F,$5F,$3C,$33, .byte $87,$78,$84,$7A,$77,$87,$78,$84 .byte $7A,$67,$87,$77,$87,$77,$72,$83 diff --git a/twoplayer.s b/twoplayer.s index 9f4743a..8c2d6a7 100644 --- a/twoplayer.s +++ b/twoplayer.s @@ -7,7 +7,6 @@ ; "current player" as the palette value. ; TODO: -; Allow player 2 to pause ; Save another RNG to let the behind player catch up. ; Fix background tetrimino pattern ; Demo can be two-player if second player presses start and then the system goes idle. But demo playing is broken in 2 player @@ -15,7 +14,6 @@ ; Allow second player to disable next piece display (minor) ; Integrations: -; Have handicap support 2 players ; Any way to fit stats on screen? Seems like there's no room. ; No room for A/B-Type, high score @@ -519,6 +517,16 @@ pickRandomTetrimino_mod: jsr generateNextPseudorandomNumber rts + +isStartNewlyPressed: + .export isStartNewlyPressed + lda newlyPressedButtons_player1 + ora newlyPressedButtons_player2 + and #$10 + cmp #$10 + rts + + gameMode_levelMenu_nametable_mod: .export gameMode_levelMenu_nametable_mod jsr bulkCopyToPpu