Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
system prog new.docx
Скачиваний:
1
Добавлен:
01.05.2025
Размер:
275.7 Кб
Скачать

8) Numbers with a floating comma. Data types of fpu.

To improve the accuracy and as compact as possible arrange a real number in the computer memory were invented by a floating point number. In the high-order bits are written order. Size of the order number is known in advance (depending on the type of data) and takes up much less space than it would take the integer part.In the low-order bits are written mantissa - normalized exponential form of a number without a comma. Thus, within the point mantissa can be as "float", i.e. its location depends on the order number.But how to make that point to swim? This deals with the processor, that is the hardware. In many modern processors even have special instructions for operations on floating point numbers (but more on that later). Most computers are used is a floating point number (not fixed), because it allows you to save memory and get better accuracy.

Recall the algorithm for representing a real number in the computer's memory:

1. Transfer the number of P-ary to binary

2. Submit a binary number to a normalized exponential form

3. Order to calculate the offset number

4. Place a sign the order and the corresponding bits in the mantissa

In the representation of real numbers in the computer's memory a first step we did and got the binary representation of the integer and fractional part of the number 3.14:

3 = 11b

0,14 = 0,00100011 b

That is the number 3.14 to binary is:

3,14 = 11,00100011 b

Now convert this number to a normalized exponential form:

11,00100011 b = 1,100100011 b * 21

Now calculate the offset procedure (assuming storage order, we use 5 bits). Then the raw data:

PI = 1 (we have 2 to the power 1)

k = 5

SP = SP + 2k-1 - 1 + 1 25-1 = - 1 + 1 = 16 - 1 = 16

Write the sign of the number, order, and the corresponding bits in the mantissa:

Sign | order |Mantissa

0 |10000 |0010001100

As you can see in the mantissa we have two junior category - it's zero. These bits are not used by us, but if you wish we could use them and thus improve accuracy.

9) 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.

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]