Skip to content
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
22 changes: 22 additions & 0 deletions cpctelera/src/keyboard/cpct_getKeypressedAsASCII.asm
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,28 @@
;; (end code)
;; *Note*: Non-standar ASCII characters (>127) in this table will not match Amstrad CPC's characters.
;;
;; Next code example shows how to use this function in conjunction with <cpct_scanKeyboard>.
;; Read the keyboard, get the key pressed and return the ASCII value.
;; (start code)
;; u8 key_pressed () {
;; u8 key; // declares symbol key
;; cpct_scanKeyboard(); // read keyboard
;; key = cpct_getKeypressedAsASCII (); // returns the ASCII value associated to the pressed key
;; return key;
;; }
;; (end code)
;;
;; Next code example shows how to use this function in conjunction with <cpct_scanKeyboard>,<cpct_drawCharM1>
;; This code scans the keyboard and displays the pressed key in the upper left of the screen.
;; (start code)
;; void print_key(){
;; u8 key; // declares symbol key
;; cpct_scanKeyboard(); // read keyboard
;; key = cpct_getKeypressedAsASCII(); // returns ASCII value to key symbol
;; cpct_drawCharM1 ((u8*)0xc000, key); // prints on the screen the pressed key
;; }
;; (end code)
;;
;; Destroyed Register values:
;; AF, BC, DE, HL
;;
Expand Down