Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example is_key_pressed #185

Open
wants to merge 1 commit into
base: development
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions cpctelera/src/keyboard/cpct_isKeyPressed.s
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,29 @@
;; -------------------------------------------
;; Any | 17 | 68
;; -------------------------------------------
;;
;; Example of use of cpct_isKeyPressed_asm
;;
;; We want that the player pushes the [Space Key]. So,
;; let's make a routine that waits until this key is pressed
;;wait_until_space_key_is_pressed::
;; scan all the keyboard reading every key and notates
;; call cpct_scanKeyboard_asm
;; load the desired key in the register HL
;; ld hl,#Key_Space
;; call the routine to check if the key is pressed
;;
;; return in flag Z the result of the check.
;; 1 if key is NOT pressed, 0 if pressed
;; call cpct_isKeyPressed_asm
;;
;; check against Zero in flag Z
;;
;; flag is 1, so key is not pressed
;; jr nz,wait_until_space_key_is_pressed
;; key was pressed, flag was 0.end of routine
;; ret
;;
;; (end code)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Expand Down