From a5d8084260628e979dd845a6814a4aa4f6bf3982 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Thu, 16 Jun 2022 13:40:58 -0700 Subject: [PATCH] Constants for controller input --- homebrew-tutorial/keys.inc | 17 +++++++++++++++++ homebrew-tutorial/main.asm | 5 +++-- 2 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 homebrew-tutorial/keys.inc diff --git a/homebrew-tutorial/keys.inc b/homebrew-tutorial/keys.inc new file mode 100644 index 0000000..c18b23b --- /dev/null +++ b/homebrew-tutorial/keys.inc @@ -0,0 +1,17 @@ + +; Joypad bitmaps + + +JOYH_B = %10000000 +JOYH_Y = %01000000 +JOYH_SEL = %00100000 +JOYH_START = %00010000 +JOYH_UP = %00001000 +JOYH_DOWN = %00000100 +JOYH_LEFT = %00000010 +JOYH_RIGHT = %00000001 + +JOYL_A = %10000000 +JOYL_X = %01000000 +JOYL_L = %00100000 +JOYL_R = %00010000 diff --git a/homebrew-tutorial/main.asm b/homebrew-tutorial/main.asm index 9276ebd..dd6d71e 100644 --- a/homebrew-tutorial/main.asm +++ b/homebrew-tutorial/main.asm @@ -3,6 +3,7 @@ .include "macros.inc" .include "registers.inc" +.include "keys.inc" .include "header.asm" @@ -96,8 +97,8 @@ start: sta NMITIMEN mainloop: - lda JOY1H - bit #%00000100 ; Down button + lda JOY1L + bit #JOYL_L beq down_not_pressed ; write tile 2 to position (4, 8) TILE_X2= 4