This is not a question, but observations made while making Memory.hdl.
Figure 5.5 “Keyboard interface” is on page 90. What’s new about this chip?
I’m pretty sure it’s the first chip we’ve used with no Input.
Figure 5.7 “Data memory” shows a Keyboard on the right side, with a cable pointing left to “Keyboard memory map”.
(If I was drawing this picture, I’d put the keyboard on the left side, where other Input appears. The default position of Input is on the left side, as seen in chip diagrams in prior chapters. In Logisim, this default position is called “Facing East”; you can change it to other - W, N, or S.)
So then, how can we understand this chip with no “input”?
Page 71 explains: “The Hack computer interfaces with the physical keyboard… Whenever a key is pressed on the physical keyboard, its 16-bit ASCII code appears in RAM.”
So although the chip specification has no “Input”, it really does have input. Imagine invisible wires from the chip, connected to your physical keyboard. When a key is pressed, its ASCII code is automatically input into the chip. This arrangement has been provided as a “black box” for us.
All we need to do is connect the Keyboard “out” to something else in the Memory chip.
When you run the Memory.tst script, you must select the “Screen” option. When you do this, the Keyboard icon appears. Although a larger window could appear in which you could mouse-select a key from a simulated keyboard, clicking the icon enables something better – a connection from the actual keyboard into our chip!
And in chapter 4, we learned how to access that input:
@KBD // 24576
An observation about Screen chip. If you run these lines in CPU Emulator:
You see two things that happen:
/1. RAM display shows the value “-1”.
/2. Screen shows the two horizontal lines (16 binary 1s) seen in Memory.tst.
Therefore, there are additional “invisible wires” that enable Screen chip “out” to affect the computer screen.
So we’re borrowing actual hardware of our computer to build another computer!