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