tests - finish WIP - Make a 'move a pixel with the keypad' program

This commit is contained in:
n loewen 2023-08-26 14:56:01 +01:00
parent 86d0b57c7a
commit ac0fccf2e9
1 changed files with 40 additions and 19 deletions

View File

@ -1,18 +1,13 @@
; Draw a pixel, and move it when a key is pressed
; 2023-08-26
;; WIP - up and right should be working,
;; but currently they're being tested with a
;; faked keyboard input at the end of @xy2id
;; (and down and left are still TODO)
#flagZ 1
#flagN 2
#keypad $1B ; contains latest key pressed
; Starting (x, y) coordinates
#input_x 1
#input_y 2
#input_x 0
#input_y 0
; Some handy shortcuts
#x $FA
@ -59,6 +54,13 @@
fhp #flagZ
jmp @up
; test left
lda (#keypad)
sub #left
ftg #flagZ
fhp #flagZ
jmp @left
; test right
lda (#keypad)
sub #right
@ -66,8 +68,16 @@
fhp #flagZ
jmp @right
; TODO: down, left
end
; test down
lda (#keypad)
sub #down
ftg #flagZ
fhp #flagZ
jmp @down
;; no key pressed...
jmp @stay_put
@up
lda (#y)
@ -76,9 +86,15 @@
fhp #flagN
jmp @stay_put
sto #y
; redundant - it's already in there:
lda @update
sto #return_addr_ptr
jmp @xy2id
@left
lda (#x)
sub 1
ftg #flagN
fhp #flagN
jmp @stay_put
sto #x
jmp @xy2id
@right
@ -90,9 +106,17 @@
lda (#x)
add 1
sto #x
; redundant - it's already in there:
lda @update
sto #return_addr_ptr
jmp @xy2id
@down
lda (#y)
sub 4
ftg #flagZ
fhp #flagZ
jmp @stay_put
lda (#y)
add 1
sto #y
jmp @xy2id
@stay_put
@ -100,7 +124,7 @@
LDA $FF
STO (#px_addr)
; TODO
END
; END
;; Convert a pair of (x, y) coords
@ -138,7 +162,4 @@
STO #xy2id_y
FHP #flagZ
JMP @xy2id_loop
;; JUST TO TEST: LOAD #up INTO KEYPAD MEM:
lda #right
sto #keypad
JMP (#return_addr_ptr)