diff options
| author | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-03-11 17:00:47 +0100 |
|---|---|---|
| committer | Miquel Sabaté Solà <mikisabate@gmail.com> | 2025-03-11 17:00:47 +0100 |
| commit | 428c301a80641361f51af8102628b545cf9ae63e (patch) | |
| tree | e8888ec3a369bb617e892ff783334ae4f46ce355 /scroll | |
| parent | eb9544cb3df7158f7fba5ed346997989102d0155 (diff) | |
| download | code.nes-428c301a80641361f51af8102628b545cf9ae63e.tar.gz code.nes-428c301a80641361f51af8102628b545cf9ae63e.zip | |
shared: Bring joypad into a proper style
Put functions inside of the scope, avoid useless fallthroughs and be
more realistic on what is needed from elsewhere.
Signed-off-by: Miquel Sabaté Solà <mikisabate@gmail.com>
Diffstat (limited to 'scroll')
| -rw-r--r-- | scroll/include/driver.s | 2 | ||||
| -rw-r--r-- | scroll/include/player.s | 8 | ||||
| -rw-r--r-- | scroll/level.s | 2 | ||||
| -rw-r--r-- | scroll/sprite0.s | 2 | ||||
| -rw-r--r-- | scroll/toggle.s | 8 |
5 files changed, 11 insertions, 11 deletions
diff --git a/scroll/include/driver.s b/scroll/include/driver.s index abb3f5e..acf5a11 100644 --- a/scroll/include/driver.s +++ b/scroll/include/driver.s @@ -50,7 +50,7 @@ ;; If `select` is pressed, then go for a new level. Otherwise check ;; whether there is a pending column to be loaded. lda #Joypad::BUTTON_SELECT - and Joypad::m_buttons1 + and Joypad::zp_buttons1 beq @check_column ;; Set the counter. diff --git a/scroll/include/player.s b/scroll/include/player.s index 239cec6..a4f750c 100644 --- a/scroll/include/player.s +++ b/scroll/include/player.s @@ -76,7 +76,7 @@ .proc update ;; Is the player requesting to go up? lda #Joypad::BUTTON_UP - and Joypad::m_buttons1 + and Joypad::zp_buttons1 beq @check_down ;; If we are already at the top disregard this button press and check @@ -108,7 +108,7 @@ @check_down: ;; Is the player requesting to go down? lda #Joypad::BUTTON_DOWN - and Joypad::m_buttons1 + and Joypad::zp_buttons1 beq @check_left ;; We have to move down unless we are already at the very bottom. @@ -135,7 +135,7 @@ @check_left: ;; Is the player requesting to go left? lda #Joypad::BUTTON_LEFT - and Joypad::m_buttons1 + and Joypad::zp_buttons1 beq @check_right ;; We have to move left unless we are already at the leftmost edge. @@ -160,7 +160,7 @@ @check_right: ;; Last check! Is the player requesting to go right? lda #Joypad::BUTTON_RIGHT - and Joypad::m_buttons1 + and Joypad::zp_buttons1 bne @check_level_end rts diff --git a/scroll/level.s b/scroll/level.s index de386db..28de7f0 100644 --- a/scroll/level.s +++ b/scroll/level.s @@ -57,7 +57,7 @@ sta PPU::CONTROL @main_game_loop: - jsr joypad_read + READ_JOYPAD1 jsr Player::update jsr Driver::update diff --git a/scroll/sprite0.s b/scroll/sprite0.s index 4bd940d..a1944e6 100644 --- a/scroll/sprite0.s +++ b/scroll/sprite0.s @@ -142,7 +142,7 @@ BACKGROUND_ROW_OFFSET = 1 sta PPU::CONTROL @main_game_loop: - jsr joypad_read + READ_JOYPAD1 jsr Player::update jsr Driver::update diff --git a/scroll/toggle.s b/scroll/toggle.s index b9214b4..32fc39f 100644 --- a/scroll/toggle.s +++ b/scroll/toggle.s @@ -70,11 +70,11 @@ bne @end ;; Read the joypad. - jsr joypad_read + READ_JOYPAD1 ;; Is the player pressing left? If so then the direction is to the left. lda #Joypad::BUTTON_LEFT - and Joypad::m_buttons1 + and Joypad::zp_buttons1 beq @check_right inc Vars::zp_scrolling lda #0 @@ -84,7 +84,7 @@ @check_right: ;; Is the player pressing right? If so then the direction is to the right. lda #Joypad::BUTTON_RIGHT - and Joypad::m_buttons1 + and Joypad::zp_buttons1 beq @check_select inc Vars::zp_scrolling lda #1 @@ -95,7 +95,7 @@ ;; Is the player pressing Select? Then the direction depends on the current ;; nametable. lda #Joypad::BUTTON_SELECT - and Joypad::m_buttons1 + and Joypad::zp_buttons1 beq @end inc Vars::zp_scrolling ldx #0 |
