Let's Code MS DOS 0x02: The Keyboard

Channel:
Subscribers:
7,950
Published on ● Video Link: https://www.youtube.com/watch?v=Y0nT_6RF4NI



Duration: 16:08
7,088 views
209


In this second episode of "Let's Code: MS-DOS" we take a look at keyboard handling. To meaningfully control a player character we need to be at least able to query keypresses of the arrow keys, plus any other keys we deem worthwhile. I will talk you through the process on how you can do this using Turbo C, using builtin functions, and how to figure out which keys produce which scancodes using the kbhit() and getch() functions.

A more detailed keyboard input is possible by reading from the hardware directly, allowing you to detect even keypresses of the shift, alt and ctrl keys. But that is for another time...

Source code: https://gist.github.com/root42/8e147c5ec2427f42f2ac50a5aba52317/44e5a0068392208528388be98b6e5fd0f0987b91

Long Stroll von Kevin MacLeod ist unter der Lizenz "Creative Commons Attribution" (https://creativecommons.org/licenses/by/4.0/) lizenziert.
Quelle: http://incompetech.com/music/royalty-free/index.html?isrc=USUAN1100174
Künstler: http://incompetech.com/







Tags:
retro-gaming
ms-dos
coding
lets-code
turboc