Skip to content

Instantly share code, notes, and snippets.

@RenatoExpert
Created April 16, 2023 18:25
Show Gist options
  • Save RenatoExpert/5ab1577a5279a9a6f8f083042cfa2eec to your computer and use it in GitHub Desktop.
Save RenatoExpert/5ab1577a5279a9a6f8f083042cfa2eec to your computer and use it in GitHub Desktop.
; Made by Renato Araujo, 2023
; renatorraraujo@gmail.com
; gh: renatoexpert
JSR init
JSR loop
init:
LDA #$11
STA $00
LDA #$02
STA $01
RTS
loop:
JSR clear
JSR getkey
JSR draw
JSR sleep
JMP loop
clear: ; clear current position
LDY #$00
LDA #$00
STA ($00),y
RTS
getkey:
CLC
LDA $ff
CMP #$77
BEQ upkey
CMP #$64
BEQ rightkey
CMP #$73
BEQ downkey
CMP #$61
BEQ leftkey
RTS
rightkey:
INC $00
RTS
leftkey:
DEC $00
RTS
upkey:
LDA $00
SBC #$20
STA $00
RTS
downkey:
LDA $00
ADC #$1F
STA $00
RTS
draw:
LDY #$00
LDA $01
STA ($00),y
RTS
sleep:
LDX #$00
LDY #$00
JSR sleepcycle
RTS
sleepcycle:
NOP
NOP
DEX
BNE sleepcycle
DEY
BNE sleepcycle
RTS
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment