Created
May 30, 2011 09:37
-
-
Save biomood/998657 to your computer and use it in GitHub Desktop.
C64 - Move the cursor using the arrow keys
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;********************************************* | |
;* Arrow Cursor, W,S,A,D * | |
;********************************************* | |
processor 6502 | |
org $1000 | |
;setup helpful labels | |
CLEAR = $E544 | |
CHROUT = $FFD2 | |
GETIN = $FFE4 | |
SCNKEY = $FF9F | |
ENTER = $C202 | |
INVERSE = $C204 | |
NORMAL = $C206 | |
MARK = $C208 | |
JSR CLEAR | |
LDA #13 | |
STA $C202 | |
LDA #32 | |
STA MARK | |
LDA #18 | |
STA INVERSE | |
LDA #146 | |
STA NORMAL | |
LDA #0 | |
SCAN JSR SCNKEY ;get key | |
JSR GETIN ;put key in A | |
START CMP #87 ;W - up | |
BEQ UP | |
CMP #83 ;S - down | |
BEQ DOWN | |
CMP #65 ;A - left | |
BEQ LEFT | |
CMP #68 ;D - right | |
BEQ RIGHT | |
CMP ENTER ;end if enter clicked | |
BEQ END | |
CURSOR LDA MARK | |
JSR CHROUT | |
LDA #157 | |
JSR CHROUT | |
LDA NORMAL | |
JSR CHROUT | |
LDA MARK | |
JSR CHROUT | |
LDA #157 | |
JSR CHROUT | |
LDA INVERSE | |
JSR CHROUT | |
JMP SCAN | |
UP LDA #145 | |
JMP PRINT | |
DOWN LDA #17 | |
JMP PRINT | |
LEFT LDA #157 | |
JMP PRINT | |
RIGHT LDA #29 | |
JMP PRINT | |
PRINT JSR CHROUT | |
JMP CURSOR | |
END RTS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment