Table 5.6 I O instructions for the CPU
Read information from the I
O and store it in the cell at address
Read information from the cell at address and send it to I
Open a file whose name is found in the cell at address
Read information from the currently open file into the cell at address
Close the previously opened file
The new devices are represented by three classes: Display , Keyboard and
HardDisk . They have characteristics similar to the other components of the
system (i.e. CPU and RAM). The structure of the HDL package with the
addition of the new classes is shown in Figure 5.9.
The main issue that we need to address in the development of the three
new components concerns the level of abstraction of their functionalities.
How do the keyboard and the display simulate the interaction with the user?
The keyboard and the display are complex devices. We adopt a simplified
model of them: we assume that all the information read from the keyboard
and written on the display is represented by strings. The information goes
directly from the keyboard to the RAM and from the RAM to the display.
When the instruction INPUT is executed the CPU asks the keyboard to
read a line of input from the user. Then, the CPU waits for the user to insert
0 data : String
0 command : String
0 address : int
Figure 5.9 Complete computer classes