From f1d3f2f6b64f34528f5e158e795c8fb83d7a7c40 Mon Sep 17 00:00:00 2001 From: Greg Shuflin Date: Wed, 15 Jun 2022 11:30:27 -0700 Subject: [PATCH] Read from joypad --- homebrew-tutorial/main.asm | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/homebrew-tutorial/main.asm b/homebrew-tutorial/main.asm index 6e78625..9276ebd 100644 --- a/homebrew-tutorial/main.asm +++ b/homebrew-tutorial/main.asm @@ -85,23 +85,32 @@ start: sta VMDATAL stz VMDATAH - ; write tile 2 to position (4, 8) - TILE_X2= 4 - TILE_Y2= 8 - ldx #(VRAM_BG1 + (TILE_Y2* 32) + TILE_X2) - stx VMADDL - lda #$02 - sta VMDATAL - stz VMDATAH - ; Show bg1 lda #%00000001 sta TM - lda #$0f sta INIDISP + lda #$01 + sta NMITIMEN + +mainloop: + lda JOY1H + bit #%00000100 ; Down button + beq down_not_pressed + ; write tile 2 to position (4, 8) + TILE_X2= 4 + TILE_Y2= 8 + ldx #(VRAM_BG1 + (TILE_Y2* 32) + TILE_X2) + stx VMADDL + lda #$02 + sta VMDATAL + stz VMDATAH + down_not_pressed: + + bra mainloop + busywait: bra busywait