Work with the keyboard. The data buffer BIOS. Using MS DOS function.
Keyboard - this is one of the main links of human-computer interaction.
Microprocessor 8048 also allows you to buffer up to 20 keystrokes, if the CPU can not accept them at once. Typically, this buffer is completely empty, as a situation where the CPU does not have time to respond to a request key.
To use a keyboard ports and interrupts. When any action is performed with a key (press or release), the processor detects the keyboard and stores it in a buffer. Then, the keyboard processor generates an interrupt with the number 9. In response to the interrupt service routine in the system BIOS ROM code reads the scan button of the keyboard port (port number 96) and then sends a command to the keyboard port to clear the keyboard buffer of the CPU. If the system does not respond to block the keyboard interrupt, then the scan codes accumulated in the buffer keypad processor, though in normal operation it should not happen. Special scan code 255, the hexadecimal value FF, is used by the keyboard, for a message that its buffer is full.
To enter data from the keyboard, you can use two kinds of functions: universal function 3fh (input file) and a group of specialized functions MS DOS keyboard input.
second group, which includes seven features that differ from each other by the following characteristics:
• the expectation of entering the absence of a character in the keyboard buffer, or just check for the presence of a buffer for input characters;
• the number of input characters;
• the presence of an echo when you type, that is, doubling the input from the keyboard symbols on the screen;
• sensitivity to the key combination Ctrl + C (code 03h).
Reading a character from the keyboard echo (10h int 21h)
01h function allows you to enter a single character from the keyboard. If the symbol is not present, then the function expects its input. Input symbol is displayed on the screen (echo).
Login: AH = 01h - read character with an echo. Output: AL = ASCII-character code, or 0.
At the output of the function puts the register AL ASCII-character code, or 0. The presence of zero in register AL indicates that the keyboard buffer is extended ASCII-code, and must repeat the same function call to read the second byte. Also, the function checks for 01h in a buffer of characters the key combination Ctrl + C (Ctrl + Break), which is produced when an interrupt calls int 23h.
To enter more characters to use this function in a loop.
Date: 2015-01-29; view: 247