If the flag is
false, check it again, and again, and again, until it becomes true.
When the flag becomes ???true,??? a character will have arrived at the keyboard interface from the
keyboard. However, the character will arrive as the ASCII encoding of the character we know, not as
a binary numeric value.
You can see the encodings of various characters by looking at a table of ASCII encodings. One
reference is this: http://www.lookuptables.com/. If you consult the table, you will see that the character 0
is encoded as the bit pattern equivalent to the decimal number 48. The character 1 is encoded as 49; the
number 2 as 50; and so on, up to character 9, which is encoded as 57. Likewise, the equal sign is
encoded as 61, the plus sign as 43, etc.
If the user types a 3, it will arrive as the decimal value 51.
95
3 When the user types a character, the signal flag on the keyboard interface becomes true, and our program
exits its endless loop testing the signal flag. Now the program can use another I/O instruction to read the
character on the keyboard interface into a register of the central processing unit (CPU).
4 Check to see if the character now in the register is one of the characters we??™re interested in, i.
Pages:
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256