Nand2Tetris Questions and Answers Forum
›
Architecture
›
Chapter 4
Search
everywhere
only in this topic
Advanced Search
Machine Language Keyboard Interface: Uppercase Only?
Classic
List
Threaded
♦
♦
Locked
3 messages
rleininger
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Machine Language Keyboard Interface: Uppercase Only?
The brief description of the keyboard interface accessed through the built-in keyboard register "chip" at RAM[24576] seems to indicate that the interface will provide the ASCII codes for both upper and lower case alphabetic characters. For example, pressing the
key would put the decimal value 97 ("A") in RAM[24576], while <Shift>-
would supply decimal 65 ("a").
This expectation is supported by the tables in the slide deck supplied for Chapter 4 at slide 58.
I have tried the CPU emulator (Version 2.5) on three different computers (all Windows 10) with different hardware keyboards. In every case, the code that appears at RAM[24576] for every alphabetic key is the ASCII code for the uppercase letter, even when the <Shift> key is NOT depressed. The keyboard echo panel in the interface correctly indicates the <Shift> key condition, but the code supplied to the keyboard register is not correct for unshifted alphabetic keys.
However, the keys which contain numbers and symbols, or symbol pairs, deliver the expected ASCII codes when the <Shift> key is pressed. Also, all the non-ASCII keys implemented in the book produce the expected codes; e.g., <Del> -> 139.
Is this correct behavior for alphabetic characters in the CPU emulator? Or am I missing something?
WBahn
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Machine Language Keyboard Interface: Uppercase Only?
Administrator
This is the behavior I would expect if the Caps Lock is on. Are you SURE that it is not on?
rleininger
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Machine Language Keyboard Interface: Uppercase Only?
Thanks, for your response.
Forgot to mention in my original post that I tested Caps Lock both On and Off. In either case, for example, the
key rendered the value in the keyboard register as 65 (A) whether the <Shift> key was pressed or not.
I have included a short video that shows the behavior I observe.
hack_keyboard_register_demo.mp4
Free forum by Nabble
Edit this page