Min h4 h8 which means. Minimum value excluding zeros. How to calculate the sum of minimum non-negative values \u200b\u200bin Excel

¨ Displaying text on the screen by direct programming of the video buffer.

¨ Development application programs using the BIOS service functions for working with the screen and keyboard.

¨ Introduce a delay for software operations.

In work No. 2, various DOS system functions for displaying symbolic information on the screen were considered. However, the capabilities of DOS are very limited: it does not have functions for changing the color of displayed characters and positioning the cursor. In addition, DOS lacks graphics rendering facilities.

All the capabilities of the computer's video system can be implemented using the video functions of the BIOS interrupt int 10h... Interrupt int 10h provides: change of video mode (text or graphic); character output and text information; changing fonts, adjusting the color palette, working with a graphic image. Programming the video system using the BIOS is more cumbersome, however great opportunities and the high output speed determine the widespread use of this method in application programs.

This paper discusses the BIOS functions for maintaining the computer's video system, as well as functions for working with the keyboard. Let's list the functions that are the subject of consideration in the laboratory.

Int 10h:

function 00h - video mode setting;

function 02h - setting the cursor position;

function 03h - reading the position and size of the cursor;

function 05h - setting the video page;

function 06h (07h) - initialization or window scrolling up (down);

function 08h - reading a character and an attribute at the cursor position;

function 09h - writing a symbol and attribute to the cursor position;

function 0Ah - writing a character to the cursor position with the current attribute;

function 0Eh - writing a character in teletype mode with the current attribute;

function 0Fh - get display mode;

function 1003h - switching the assignment of the most significant bit of the attribute byte: flicker / brightness,

function 13h - writing a string with a given attribute in teletype mode.

Int 16h:

function 00h (10h) - reading a character from the keyboard with waiting;

function 01h (11h) - checking the keyboard buffer for the presence of a character in it;

function 02h (12h) - receiving flags of the (extended) keyboard.

Int 15h,function 86h - delay.

Int 1Ah, function 00h - getting the system time.

8.2.2. DIRECT VIDEO BUFFER PROGRAMMING IN TEXT MODE

Modern video controllers support a variety of text and graphics modes. Text modes differ in resolution (number of characters displayed horizontally and vertically) and color palette (monochrome or 16-color mode). For graphics modes, the main classification feature is the number of simultaneously displayed colors and, accordingly, the number of video memory bits allocated to each point (pixel) of the image. The following types of graphics modes are distinguished:

Monochrome (1-bit encoding);

16-color EGA / VGA (4-bit encoding);

256-color SVGA (8-bit encoding);

- HiColor (16-bit encoding);

- TrueColor (24-bit / 32-bit encoding).

VGA (SVGA) graphic modes are outdated, and text modes continue to be used successfully (see Table 3.2, section 8.2.3).

Everything that is displayed on the monitor - graphics, text - is simultaneously present in the memory built into the video adapter. In order for the image to appear on the monitor, it must be written to the memory of the video adapter. In text mode, for VGA-compatible systems, video memory is allocated an address space (excluding the 7th video mode with a monochrome adapter), starting with the logical address B800h: 0000h and ending with the address BF00h: 0FFFh. This area is divided into 8 sectors according to the number of video pages (4 KB per page). Thus, the paging of the video memory address space in text mode is as follows:

B800h: 0000h - page 0, offset in the range 0000h - 0FFFh

B900h: 0000h - page 1, offset in the range 0000h - 0FFFh

- ...........

BF00h: 0000h - page 7, offset in the range 0000h - 0FFFh

The video buffer corresponding to the active page is displayed on the screen. In text modes, 2 bytes are allocated for the display of each character: byte with ASCII-character code and byte with its attribute. Moreover, at the address B800h: 0000h there is a byte with a character code (left top corner screen), and in B800h: 0001h - attribute of this symbol; B800h: 0002h - the code of the second character, and in B800h: 0003h - attribute of the second character, etc. In general, when forming an image directly in the video buffer, bypassing dOS programs and BIOS, all control codes ASCII lose their control functions and are displayed as corresponding symbols. The structure of the attribute byte is shown in Fig. 3.1.

Figure: 3.1. Attribute byte structure

Fig. 3.1 it follows that each symbol can take any of 16 possible colors, determined by the combination of the least significant 4 bits. Bits 4-6 of the attribute bytes set the background color under this symbol. The last bit 7, depending on the mode of the video adapter, determines either the brightness of the background under this symbol (then the background can also take 16 different colors), or the flickering of the symbol ( is establishedDOS by default).

When loading the machine, a standard palette is installed, the color codes of which are given in table. 3.1. Let's look at some examples. So, in the blinking mode, the value of the high nibble of the attribute 8hdenotes not a gray background, but black with a flickering character, the color of which is still determined by the low nibble; high nibble value 0Ch- red background with a flickering symbol. Bit 7 assignment is switched by subfunction 03hfunctions 10h interruptions int 10h.

Table 3.1

Standard palette color codes

Light green

Turquoise

Light turquoise

Violet

Light purple

Brown

Bright white

Double-byte character codes are written to the video buffer in the order in which they should appear on the screen: the first 80 * 2 bytes correspond to the first line of the screen, the second 80 * 2 bytes correspond to the second, etc. In this case, the transition to the next line of the screen is determined not by the control codes of carriage return and line feed, but by the placement of the code in another place of the video buffer. In order to get access to the video buffer from the program, it is necessary to enter the segment address of the video buffer into one of the segment data registers. After that, by specifying these or those offsets, you can record to any places (cells) of the video buffer. Calculate cell offset in row-column coordinates (row,clm) you can do this:

VidAddr \u003d (row * 160) + (clm * 2)

With a large amount of output data, the information frame is formed in advance in the user buffer located in the program data segment.

Listing 3.1.Writing a string to a video buffer 0- pages .

; Screen cleaning

; Set the ES segment register to page 0 of the video buffer, and ds to the data segment

; Let's send a string of characters to the video buffer, adjusting accordingly

; registers si, di and cx

cld; Look Forward

rep movsb;) *; Send a character string with attributes to the video buffer

; Stop the program to observe the result (otherwise, after the end of the program

; a DOS prompt for a command may overwrite the output)

; Data fields in the program data segment. Symbols and attributes: 0B0h - light

; turquoise on black, 0E4h - red on yellow

msg db ‘*’, 0B0h, ’T’, 0E4h, ’E’, 0E4, ’S’, 0E4, ’T’, 0E4, ’*’, 0B0h

In this program fragment character codes displayed messages are interspersed with their attributes. This method of generating data fields intended for direct recording into video memory becomes cumbersome, but it can be significantly simplified if the displayed characters have the same attributes. So, if we want to carry out the output of text characters from a data segment with a single attribute 0E4h, then we just need to replace one command linemarked in the above fragment with the symbol "*)" , on three. In this case, specifying a data line will take on the form we are used to.

mov si, offset msg; Source offset

mov di, 160 * 12 + 36 * 2; Receiver offset (36 column of 13th row),

mov cx, msglen; Number of bytes transferred

cld; Look Forward

mov ah, 0E4h; Attribute of the output characters 0E4h - red on yellow

stosw; Upload “character + attribute” from ax to video buffer (ax → es: di)

loop cycle; Repeat msglen times

; Data fields in the program data segment.

msg db '* TEST *'

The above method of text output is formatted with the length of the video line without taking into account hyphenation characters or indents from the left border. Introduction of elementary rules text editor into the output procedure will greatly complicate the program. In this case, it is advisable to use BIOS functions to display messages.

It is convenient to develop the structure of programs that view arbitrary video pages on which information is previously recorded by direct programming of the video buffer, it is convenient to use the function 05 hint 10hBIOS (p. 8.2.3.2).

8.2.3. BIOS FUNCTIONS REFERENCE

8.2.3.1. Interrupt int 10h. BIOS video functions

¨ Function 00h. Setting the video mode (table 3.2) of the current video page with screen clearing (quick screen cleaning is performed by function 06h and 07h).

Call: AH \u003d 00h,

Al \u003d video mode (the mode code is set in the lower 7 bits, setting the most significant bit to 1 disables screen clearing).

The call destroys registers AX,BP,SI, andDI.

Table 3.2

Text video modes and pages in standard VGAsupported by
modern video controllers

Mode

Resolution

Colour

Sign size

Address

Pages

semitones

semitones

3 (Mono )

By default, DOS uses mode 3 (however, a well-formed program should check or set the required text mode and then restore the previous one).

¨ Function 02h. Setting the cursor position.

Sets the position of the cursor on the screen in text coordinates, from which the text will be displayed later. The row and column numbers are counted from the upper left corner. The cursor can be positioned in both text and graphics mode, however, in graphics mode, the cursor is not visible. The BIOS supports up to eight independent cursors, one for each page (see Table 3.2), regardless of which page is active. Function 02 h

Call: AH \u003d 02h; BH\u003d page number (0,1, ... 7), usually 0;

DH \u003d line; DL\u003d column.

The call destroys registers AX,BP,SIand DI.

¨ Function 03h. Reading the position and size of the cursor.

Returns the current coordinates of the cursor state on the selected page. This makes it possible to temporarily move to another place on the screen to work, and then return to the old place. Function 03 hBIOS can be used in combination with DOS functions to organize screen output.

Call: AH \u003d 03h, BH \u003d page number (0,1, ... 7), usually 0.

Return: DH, DL \u003d the row and column of the current cursor position,

CH, CL\u003d the first and last lines of the cursor expansion.

The call destroys registers AX, BP, SI, and DI.

¨ Function 05h. Installing a video page.

Sets the active video page (both text and graphic).

Call: AH \u003d 05h, AL \u003d page number (0, ..., 7).

The call destroys registers AX,BP,SIand DI.

A program that installs a page different from the current one is obliged to restore the original one at the end of the work.

¨ Function 06h (07h). Initializing or scrolling the window up (down).

Initializes the window with the specified coordinates, spaces ASCIIwith the given attribute (AL \u003d 0), or scrolls the contents of the window up (down) the specified number of lines ( AL\u003d number of lines). When scrolling, lines appearing at the bottom (top) are filled with spaces ASCII with the given attribute. The function is convenient to use for quick cleaning of the screen or some rectangular window.

Call: AH \u003d 06h (07h);

AL \u003d 0 - cleaning, AL \u003d N (N\u003e 0) - scroll on N lines;

BH \u003d attribute of symbols in the window;

CH, CL \u003d row and column coordinates (Y, X)upper left corner;

DH, DL \u003d row and column coordinates (Y, X) lower right corner.

The call destroys registers AX,BP,SI,and DI.

¨ Function 08h. Reads the character and attribute at the current cursor position on the selected page.

Call: AH \u003d 08h, BH \u003d page number (0, ..., 7), usually 0.

Return: AH \u003d character attribute, AL \u003d ASCII-character code.

The call destroys registers BP,SI and DI.

¨ 09h function... Writing a character with the specified attribute to the screen at the cursor position. Works in both graphic and text modes. In graphics mode, characters should not continue to the next line. All codes in AL are treated as character codes and do not control the cursor position. After the character is displayed, the cursor is shifted to the next position by function 02h. The repetition factor allows you to output strings of identical characters. In text mode, the character is displayed with the specified in BL attribute. Graphically - content BL affects only the color of the symbol, not the background below it. Graphic image under familiarity is overwritten.

Call: AH \u003d 09h, AL \u003d ASCII- character code,

BL\u003d symbol attribute (text mode) or symbol color only (graphics mode),

BH \u003dpage number (0,1, ... 7), CX\u003d repetition rate.

The call destroys registers AX,BP,SI and DI.

¨ Function 0Ah. Writing a character with the current attribute to the screen at the cursor position. The function works in both graphic and text modes. The symbol takes on the attribute previously set for this position. All ASCII codes in AL are treated as character codes and do not control cursor position (as in function 09h). After the character is displayed, the cursor moves to the next positionfunction 02h.

Call: AH \u003d 0Ah, AL \u003d ASCII- character code,

BH \u003d page number (0,1, ... 7), CX \u003d repetition rate.

The call destroys registers AX,BP,SI and DI.

¨ Function 0Eh. Writing a character with the current attribute in TTY mode.

Writes a character ASCII at the cursor position (previously set by function 02h) on the active page and moves the cursor to the next position. Codes ASCII: 07h - call (BEL), 08h - step back (BS), 0Dh - carriage return (CR), 0Ah - line translation (LF), treated as managers and the corresponding actions are performed. The rest of the control codes are treated as characters and are displayed on the screen. The cursor is automatically moved to the next line after the previous one is completed, as well as scrolling up the screen by 1 line after filling the bottom one.

Call: AH \u003d 0Eh, AL \u003d ASCII- character code,

BL\u003d symbol color (only for graphics mode),

BH \u003d page number (0,1, ... 7), the default is the active page.

¨ Function 0Fh. Get display mode and current page number .

Call: AH \u003d 0Fh.

Return: AL = display mode, AH\u003d screen width in text format

BH \u003dactive page number.

The call destroys registers BP,SI and DI.

Example. Procedure for setting the cursor position on the current page.

input : dh \u003d string (0 - 25), dl\u003d column (0 - 79)

.......... ; Restore registers

¨ Function 10h. Subfunction 03h... Toggle the flicker / brightness bit.

Determines the purpose of the most significant bit 7 of the symbol attribute: flickering of the symbol or increased background brightness.

Call: AX\u003d 1003h, BL\u003d assignment of the 7th bit of the attribute:

0 - increased brightness, 1 - flicker (installed by default).

The function immediately affects all screen characters that have the most significant bit of the background attribute set.

¨ Function 13h. Writing a character string with the specified attributes.

Writes a string to the current videobuffer page, starting at the specified position. Codes ASCII: 07h- call, 08h- step back, 0Ah - line translation,
0Dh - carriage returns are treated as control, the rest as character.

Call: AH \u003d 13h, AL \u003d recording mode:

0 - character attribute in BL, the line contains only character codes, after writing, the cursor takes its original position (i.e., the output of the next line, if you do not change the cursor position, starts from the originally set position);

1 - differs from mode 0 in that after writing the cursor remains at the end of the line;

2 - the line contains alternately the codes of characters and attributes (i.e. each character is described by 2 bytes - ASCII-code and attribute), after recording the cursor takes its original position;

3 - differs from mode 2 in that at the end of the output, the cursor remains at the end of the line.

BH\u003d page number (0,1, ... 7), BL\u003d attribute for modes 0 and 1,

CX\u003d length of a character string (length includes only character codes, not attribute bytes),

DX \u003d DH.DL\u003d the coordinates of the cursor (row, column) at the origin of the display of the row on the screen,

ES: BP\u003d the address of the beginning of the line in memory.

Pay attention to the peculiarity of setting the address !

1. Programs (training workshop) performed in the operating room dOS environmentuse the default text mode 3, page 0.

2. Programs of more general purpose should request the current video mode and page (function 0Fh, int 10h) with their subsequent application in the used BIOS functions.

.......

Mov v_mode, al; Save mode

Mov current_page, bh; Save the line

3. If the program displays the image on different pages, then the sequence of actions with each page can be as follows (the default mode with "0" - page is assumed):

Setting a page by function 05h;

Setting the cursor position by function 02h;

BIOS or DOS text formatting line by line.

In the future, a cyclic viewing of the content of pages can be organized by switching them with the function 05 h,int 10h... When exiting the program, be sure to restore the required "0" -page. For example, you can do it like this.

..........

..........

; Analysis of the keyboard buffer by the DOS function 06h int 21h in order to terminate it by pressing; an arbitrary key

mov ah, 06h; No wait input function

mov dl, 0FFh; Input

out_program:; Restore the page with function 05h, int 10h

..........

Video buffer pages can be sequentially formatted using direct memory programming. In this case, the selection of pages is carried out by the corresponding initialization of the segment register ES (see clause 8.2.2). Viewing the content of pages can also be performed by switching them sequentially using the function 05h, int 10h.

4. The structure of the demo program examining the "flicker - background brightness" function (function 10h, subfunction 03h, int 10h).

; Screen cleaning

..........

; Initialization of 2 local windows, each with its own attribute and text. When assigning

; color attributes the most significant (7th by number) bit is set equal to "1".

.........

continue:; Turn on blinking

mov bl, 1; Blink

; Introduce a delay of 3 seconds

.........

; Turn on increased brightness

.........

; Introduce a delay of 3 seconds

.........

; Analysis of the keyboard buffer by the DOS function 06h int 21h in order to terminate it by pressing

; arbitrary key

.........

jnz out_program; zf \u003d 0, there is a symbol, to exit

jmp continue; zf \u003d 1, no symbol, continue working

out_program:; Restore blinking (default)

..........

exit: mov ax, 4C00h; Call the exit function

.........

5. If the program organizes an endless cycle of data output to the screen by BIOS functions (09 h, 0Ah, 0Eh, 13h), then it cannot be aborted by pressing the keys Ctrl + C (i.e. exit the program, as can be done using the appropriate DOS functions). To do this, include the function in the body of the loop 0Bh interruptions Int 21h.

8.2.3.3. Interrupt int 16h

¨ Function 00h (10h). Reading a keyboard character with wait.

Reads a character and scan code from the circular input buffer. Once read, they are removed from the buffer and returned in the register AX. If the buffer is empty, waits for input.Each key on the keyboard corresponds to the so-called scan code, which corresponds only to this key. This code is sent by the keyboard each time a key is pressed and released and processed in the BIOS by an interrupt handler. Int 09h... Function 00h makes it possible to get the push code without intercepting this handler. If the pressed key corresponds to ASCII-symbol, then:

AL - ASCII- character code, AH - key scan code.

If the pressed key corresponds to an extended ASCII-code, then:

AL - 00h, AH -extended ASCII-the code.

Call: AH \u003d 00h (83/84-key).

Return: AL \u003d ASCII-code of the character shown on the key / 00h,

AH\u003d scan code / extended ASCII-key code.

Function 10h (AH \u003d 10) - 00h for extended keyboard (101 / 102- key
ASCII-codes for keys F11,F12as well as for a number of other combinations.
As a sign of control keys or their combinations, in addition to the value 00 h, are used 0Ah, 0Dh and E0h.

¨ Function 01h (11h). Checking the keyboard buffer for the presence of a character in it.

Determines if there are any pending characters in the circular buffer; returns the wait flag and the symbol itself, if any. However, the symbol and its scan code are not retrieved from the buffer and can be retrieved again when the function is called again 00 h Int 16h... This function is one of the asynchronous functions: after determining the state of the input buffer, it returns control to the
gram.

Call: AH \u003d 01h (83/84-key), 11h(101/102-key).

Return: ZF \u003d1 if the buffer is empty and ZF\u003d 0 if there is a character pending in the buffer. In this case:

AL \u003d ASCII- character code / 00h, AH\u003d key scan code / extended ASCII-the code.

Function 11h (AH \u003d 11h) -improved version of the function 01 h for extended keyboard (101/102 -key). Allows you to get extended ASCII-codes for keys F11,F12as well as for a number of other combinations. As a sign of control keys or their combinations, in addition to the value 00 h, are used 0Ah, 0Dh and E0h.

¨ Function 02h (12h). Get keyboard flags.

Returns a byte of keyboard flags describing the state of the control keys written in a byte (word) of the BIOS data area at the address 0000 h: 0417h.

Call: AH \u003d 02h

Return: A L\u003d 1st byte of keyboard flags.

The byte bits have the following meanings:

0: 1 - right Shift pressed

1: 1 - left Shift pressed

2: 1 - Ctrl (any) pressed

3: 1 - Alt (any) pressed

4: 1 - mode Scroll Lock

5: 1 - mode Num lock

6: 1 - mode Caps lock

7: 1 - mode Insert active

Function 12h (AH \u003d 12h) -improved version of the function 02 hfor extended keyboard (101 / 102- key). Outputs the same byte value as the function 02 h, by the address 0000 h: 0417h, and, optionally, the second keypad status byte (address 0000h: 0418h) with the following values:

0: 1 - left Ctrl pressed 4: 1 - pressed Scroll Lock

1: 1 - left Alt pressed 5: 1 - pressed Num lock

2: 1 - right Ctrl pressed 6: 1 - pressed Caps lock

3: 1 - right Alt pressed 7: 1 - pressed SysReg

8.2.3.4. Delay of software operations

Program delays are used in cases when at any point in the program it is necessary to suspend its execution for a while. By the type of execution, software delays are divided into two types: delays implemented based on the execution of "empty" nested loops by the program, and delays implemented based on the computer's system timer. Listing 3.2 shows an example implementation of the first type of delay.

Listing 3.2. Software delay based on nested loops execution with command Loop.

Proc delay; Delay routine

Mov cx, N; N - outer loop counter

Outer: push cx; Store the contents of the outer loop counter

Mov cx, 0; We will provide the maximum number of repetitions (64K times)

; inner loop

Inner: loop Inner; Inner loop

Pop cx; Restore the contents of the outer loop counter

Loop Outer; Repeat the outer loop N times

In Listing 3.2, the parameter N acts as a scale factor for the delay time

t ass \u003dN *t inner loop execution.

In this case, the smallest unit of time (ie, "tick") is the execution time of the internal loop, which, in turn, consists of the execution time 65535 times of the command Loop... Parameter Nis selected experimentally to obtain t backside (in msec or sec), taking into account the speed of a particular computer.

Considering this example, the disadvantages of this approach are obvious when it is necessary to ensure that the time delay is executed in the program, regardless of the type of computer used. Therefore, it is reasonable to determine the software delay time directly from the timer. The output signals of the timer with a frequency of 18.2 times per second do not depend on the computer's performance and play the role of a daily time counter. The implementation of this method uses the function 00 h BIOS interrupts Int 1Ah.

Int 1A h, function 00 h. Reading the timer cycle counter.

BIOS interrupt handler from system timer ( Int 8) counts the number of interrupts (every 55ms or 18.2 times per second) in a double word of memory with the address 0040h: 006Сh... This function returns the accumulated value (binary code) and resets it to 0 ... In the register AL returns 0 , if the content of the counter has not exceeded the value corresponding to 24 hours (when this value is reached, the counter is reset), otherwise it returns AL \u003d1.

Call: AH \u003d 00h.

Return: CX: DX - the number of ticks of system time from midnight,

AL - flag of transition in a day.

Examples of return values \u200b\u200bin CX: DX:

1 sec 12 h or 18,

1 minute 04 44 h or 1092,

1 hour 1 00 07 h or 65543,

24 hours 18 00 B0 h or 1 573 040.

For delays less than 14 seconds, only the low byte of the register can be used DX

Listing 3.3. B this example a delay of 5 seconds is set, which corresponds to 91 counts of the timer

..........

mov ah, 0; Function of "reading" timer cycles

int 1Ah; Get the value of the cycle counter in cx: dx

add dx, 91; Add 5 sec. to the least significant word in dx

mov bx, dx; We store the required value in bx and execute

; continuous check of the time of day counter values

repeat: int 1Ah; Get the counter value again

cmp dx, bx; Compare with the desired one

jne repeat; If not equal, then repeat again,

; otherwise the delay is over

If you need to introduce a delay with high precision, you must use the function 86h BIOS interrupts Int 15h. It allows you to define the delay time in microseconds. Interrupts are enabled while the delay is in progress. Control returns to the program after the specified time has elapsed.

Int 15h Function 86h

Call: AH \u003d 86h, СX : DX \u003d delay time in microseconds.

Return: CF \u003d 0 - normal execution, CF \u003d 1 - the function is not supported.

Example: CX:DX \u003d0098h:9680h \u003d 10,000,000 μs \u003d 10 sec.

8.3. INDIVIDUAL JOB OPTIONS

1. Initialize the screen with a specific attribute. Overlay it with a smaller local window with a different color attribute. In the central part of the window, display the text (several lines) from memory with a cyclic implementation of window scrolling in several lines up and down. Changing the type of scrolling is set by a software delay (2 ... 3 sec.). Provide an exit from the program.

2. Initialize two video pages, each with its own attribute and recorded text (some characters of the text must have a different color from others). Organize a cyclic change of video pages with a period of 2 ... 3 seconds. Provide an exit from the program with the restoration of the current page.

3. Initialize 2 local windows on the screen. Each window with its own attribute and text with several lines. Organize cyclic switching of the attributes of the first window to the second and back. The switching cycle is set by a time delay of 2 ... 3 sec. Provide an exit from the program.

4. Initialize 2 local windows on the screen. Each window with its own attribute and text in several lines. Organize cyclic switching of text from one window to another with a time delay of 2 ... 3 seconds. Provide an exit from the program.

5. On the screen, initialize window_1 with the attribute and text in several lines. After a delay time of 2 ... 3 seconds, partially overlay window_2 with another attribute and text on it. Loop process. Provide an exit from the program.

6. On the screen, initialize a local window with an attribute (and text), tell it drift in the horizontal (vertical) direction. When the border of the screen is reached, the window changes its drift in the opposite direction. The step of movement of the local window in the screen space should be many times smaller than the size of the screen itself.

7. On the screen, initialize the local window with the attribute (and text). After pressing the command key, the window begins to change its size (pulsate), increasing and decreasing with a certain period. The time step for resizing the window should be much less than the period
ripple.

8. Initialize the screen and the local window in it with their attributes. Organize the mode of text output to the local window from the keyboard. Provide for the possibility of editing text, as well as scrolling the window when it is filled.

9. Initialize the screen and two small local windows in it. With the key<Tab\u003e arrange cursor switching from one window to another. Selected by key<Tab\u003e the window becomes brighter. Provide an exit from the program.

10. Initialize the screen and two local windows in it. Display the first half of the table in the left window ASCII, and to the right - the second half. Provide for cleaning windows and exiting the program.

11. Initialize the screen and two local windows in it (each with its own attribute and text). Arrange the cyclic switching of the "background brightness / flicker" bit. Exiting the program should restore the default bit value.

12. Initialize the screen and two local windows in it. Display the second half of the table in the left window ASCII with pseudo-graphic symbols. Using the cursor navigation, use the keys (¬, -, ®, ¯) to organize the possibility of continuous playback of straight lines in the second window.

13. Develop a program for displaying text on the screen by directly programming the video buffer using formatting elements (indentation from the left border, text wrapping to the next line after a word crosses the right border).

Input: DS:SI - the address ASCI-strings, AH- attributes;

CX- the number of displayed characters;

DH /DL - line ( row) / column ( clm);

Indent_L,Indent_R - padding margins (in columns) on the left and right.

It is necessary to optimize the calculation of the video buffer address ES:DI... The procedure must return the original register value ES.

14. Using direct video memory programming, fill several video buffer pages and then view them (display) in a cyclic mode. When exiting the program, ensure the restoration of the current page.

15. Develop a program for drawing a rectangle using graphic characters in ASCII encoding. The coordinates of the upper left corner (row, column) and lower right should be entered from the keyboard after the appropriate prompt.

8.4. CONTROL QUESTIONS

1. a brief description of capabilities provided to the programmer by the basic BIOS input / output system in comparison with the DOS service functions.

2. What is the amount of video memory for the image of one character and, accordingly, one video page of the monitor in text mode?

3. Give a description of the symbol attribute in the video buffer.

4. Develop macros for:

¨ clearing the screen by placing the cursor in the upper left corner of the screen;

¨ positioning the cursor to an arbitrary point on the screen memorizing its coordinates in memory using variables row and clm;

¨ message display mes the length leng and the color attribute attrib from a position defined by variables row and clm.

5. What BIOS function provides the user with comprehensive information about the pressed key on the keyboard.

The MIN function is used to find the minimum number in the range under study and returns the corresponding number.

MINA function is designed to find the minimum value in the examined data range and return the corresponding result.

Examples of using the MIN and MINA functions in Excel

AT excel spreadsheet contains data on the date of birth of office workers. Determine the minimum age for the employee.

Data table:

For calculations, we use the array formula (the correct result is only when pressing the combination Ctrl + Shift + Enter):


The only argument is the expression YEAR (TODAY ()) - YEAR (B3: B10), which returns an array of numeric values \u200b\u200bequal to the difference between the current year and the year of birth of each employee. As a result of calculations, we get:


The formula automatically calculated that the youngest employee was 27 years old.



How to calculate the sum of minimum non-negative values \u200b\u200bin Excel

An Excel spreadsheet contains multiple columns of numeric data. Find the sum of the minimum non-negative values \u200b\u200bcontained in these columns. Additionally find the smallest number available in the table.

Source table:


To determine the minimum non-negative numbers, use the array formula:

!}

The only argument is the IF function, which checks the data array for occurrences of positive numbers. If the condition is met, the MIN function takes an array containing only positive numbers as an argument. Similarly, we will find the minimum values \u200b\u200bfor the remaining columns. Received result (Ctrl + Shift + Enter):


Find the smallest number in the table using the formula:

The function arguments are the values \u200b\u200breturned by each MIN function for the specified data vector. Use as array formula. Result (Ctrl + Shift + Enter):


Find multiple smallest values \u200b\u200bunder conditions in Excel

Some company previously worked with one product supplier. However, it has become known that several other suppliers are offering better prices. The Excel spreadsheet contains product codes and discounts offered by other suppliers. If there is no discount, the logical value is FALSE; if the number is positive, the product costs more. Find the biggest discount for the same products only at different prices from different suppliers.

Source table:

Calculation formula (array formula):

\u003d 0; "No discount"; MINA (IF (A3: A15 \u003d D1; B3: B15; ""))) "class \u003d" formula "/\u003e

Calculation algorithm:

  1. The IF function tests the MINA condition (IF (A3: A15 \u003d D1; B3: B15; ""))\u003e \u003d 0, where MINA returns the minimum discount value for the item whose code is specified in cell D1.
  2. The MINA function takes logical values \u200b\u200binto account. It is possible that there is no discount for some product (all values \u200b\u200bare FALSE), and the result 0 (zero) will be returned. In this case, the text string "No discount" will be returned. A similar event will happen if all discounts are only positive numbers.
  3. If the condition is not met, the maximum discount (the largest negative value) for the specified item code will be returned.

Let's calculate the largest discounts for other products. As a result, we get (Ctrl + Shift + Enter):


Features of using the MIN and MINA functions in Excel

The MIN function has the following syntax:

MIN (number1; [number2] ...)

Description of arguments:

  • number1 is a required argument characterizing the first number from the range in which you want to find the minimum value;
  • [number2] ... - the second and subsequent optional arguments characterizing the second and subsequent numbers from the range under study.

The MINA function has the following syntax:

MINA (value1; [value2] ...)

Description of arguments:

  • value1 is a required argument characterizing the first occurrence in the range in which you want to find the minimum value;
  • [value2] ... are the second and subsequent optional arguments characterizing the second and subsequent occurrences of the data range under study.

Notes 1:

  1. The difference in syntax emphasizes the semantic difference between the two functions: MIN works only with numeric values, MINA additionally takes into account the logical data type.
  2. If only the MIN and MINA functions were passed as arguments text stringsfunctions that are not textual representations of numbers will return 0.
  3. The MIN function, which takes a reference to a data range as an argument, ignores not only logical TRUE and FALSE, but also text strings and empty cells.
  4. If MIN or MINA is a formula that returns an error, these functions will also return an error code. It is recommended to check the data using the IFERROR function.
  5. The MIN and MINA functions do not have logical functions analogous to, as is implemented, for example, in the COUNT (COUNTIF) function, therefore, data verification should be performed when MIN and MINA are executed, passing them logical functions (IF, IFERROR, and others) as an argument.

Notes 2:

  1. MINA function returns 0 (zero) if the range referenced as an argument contains text values \u200b\u200bor textual representations of numbers.
  2. Both functions are used to find the minimum values \u200b\u200bin a range of values \u200b\u200bpassed as an argument, however there are several differences between them:
  • If one of the arguments to the MIN function is a Boolean value (TRUE or FALSE, which can be converted to numeric values \u200b\u200b1 and 0, respectively), that value will be included in the calculation. For example, the function \u003d MIN (100; TRUE; FALSE; 10) will return 0.
  • If a reference to a range containing data was passed as an argument to the MIN function logical type, the latter will not be counted. For example, \u003d MIN (A1: A4) will return 10 if the cell range A1: A4 contains the following data: 100, TRUE, FALSE, and 10, respectively.
  • To include logical data in the calculations, use the MINA function. For example, writing \u003d MINA (A1: A4) will return the value 0 (logical FALSE is equivalent to numeric 0) if cells A1: A4 contain data as in the previous paragraph.
14. Question. Which command will you choose to quickly convert the bottom paragraph to the same format as the top one?

Answer options:

4) 3.
15. Question. Which tab should you go to to change the fields of the edited document?


Answer options:

4) 4.
16. Question. Which button must be pressed to get this text?


Answer options:

4) 2.
17. Question. Which tab do you need to navigate to to add pagination in a document?


Answer options:

4) 4.
18. Question. The text contains a link to an external source. What to do to navigate through it?


Answer options:

5) hold down the SHIFT key and left-click on the link.
19. Question. What happens if you click on the indicated button?

Answer options:

1) will be created empty page in this document;

2) there will be a transition to the "Preview" mode;

3) a new one will be created microsoft document Word;

4) the current page will be printed.
20. Question. You want the bottom paragraph to look like the top one. Which button should you press?


Answer options:

4) 1.
21. Question. In which part of the screen should I double-click the left mouse button to enter a header and footer?


Answer options:

4) 3.
22. Question. How do I select a range of cells marked in yellow on a worksheet?


Answer options:

1) select a range of cells E2: E8, then hold aLT key, highlight the range H2: H8;

2) select a range of cells E2: E8, then holding cTRL key, highlight the range H2: H8;

3) select the range of cells E2: E8, then hold down the SHIFT key and select the range H2: H8;

4) use conditional formatting.
23. Question. You decided to calculate the number of persons who filled government positions and positions of the civil service in the executive and legislative bodies in 2013. Which of the options solves this problem?


Answer options:

1) \u003d SUM (H4: H8);

2) \u003d SUM (H4: H5);

3) \u003d SUM (B4: B5);

4) \u003d SUM ($ 4: $ 5).
24. Question. Do you want to insert into the book in one click Microsoft Excel new sheet, which button should I click on?

Answer options:

4) 3.
25. Question. Do you want to select an entire sheet of a Microsoft Excel workbook, which button should you click on?

Answer options:

4) 4.
26. Question. Do you want to select a range of columns B: H for this is necessary?


Answer options:

1) while holding down the Ctrl key, click on the header of column B (area 1), and then click on the header of column H (area 2);

2) click on the header of column B (area 1), press and hold the Ctrl key and click on the header of column H (area 2);

3) click on the heading of column B (area 1), press and hold the Shift key and click on the heading of column H (area 2);

4) hold down the Shift key and click on the heading of column B (area 1) then click on the heading of column H (area 2).
27. Question. Do you want to highlight unrelated lines 10 and 20 for this necessary?


Answer options:

1) click on the heading for row 10 (area 1), and then click on the heading for row 20 (area 2);

2) click on the heading of line 10 (area 1), press and hold the Ctrl key and click on the heading of line 20 (area 2);

3) click on the title of row 10 (area 1), press and hold the Shift key and click on the title of row 20 (area 2);

4) Shift-click the heading of row 10 (area 1), and then click the heading of row 20 (area 2).
28. Question. In cell I7, you need to get the average value of the range of cells B7: H7?

Answer options:

1) click cell I7, then go to tab 1, use the Average command and press Enter;

2) click cell I7, then go to tab 2, use the Average command and press Enter;

3) click cell I7, then go to tab 3, use the Average command and press Enter;

4) click cell I7, then go to tab 4, use the Average command and press Enter.
29. Question. Do you want to arrange the values \u200b\u200bof the cell range H7: H21 in descending order?


Answer options:

1) click button 1;

2) click cell H6 and then click button 1;

3) click cell H6 and then click button 2;

4) click button 3.

30. Question. Do you need to format the cell range J8-J22 like cell J7?


Answer options:

1) click cell J7 then click button 1 and select the range of cells J8: J22 with the corresponding cursor;

2) click the column header J (button 2) then go to tab 4 and use the command format by example;

3) select a range of cells J8: J22 then go to tab 3 and use the command format by example;

4) click cell J7 then go to tab 4 and select the range of cells J8: J22 with the appropriate cursor.
31. Question. In the diagram shown below, you have decided to change the scale of the vertical axis for greater clarity, setting the maximum value of 5. Which menu item do you need to go to?


Answer options:

4) 3.
32. Question. You want the Pivot Data label in the left table to be centered in the selection, as in the right table. Which button should I press?

Answer options:

4) 3.
33. Question. You want the "Summary Data" label in the right table to appear as it does in the left table. Which button should I press?


Answer options:

4) 3.
34. Question. What value will appear in the selected cell if the function \u003d MIN (H4: H8) is entered there?

Answer options:

4) 11479.
35. Question. You want the number in the right cell to appear the same as the number in the left. Which menu item should you choose?


Answer options:

4) 3.
36. Question. You want the highlighted cell C19 to be the difference of cells A19 - B19. Where do you start entering a formula?

Answer options:

1) with a space;

2) with a minus sign;

3) with an equal sign;

4) with the cell name.
37. Question. If you stretch the selection with numbers 1, 2, 3 by the lower right corner while holding left button mouse, then the result will be as in the fragment?

Answer options:

1) ; 2) ;
3) ; 4) .

38. Question. Which tab should you go to to add slides to your presentation?


Answer options:

4) 3.
39. Question. Which button should be pressed to convert the selected text of Fragment 1 into bulleted listlike Fragment 2?


Answer options:

4) 4.
40. Question. What button should I press to convert the selected text in Fragment 1 to the same view as in Fragment 2?

Answer options:

4) 3.
41. Question. Which button should you press so that the word "Cell" in the upper table looks like it does in the lower one?


Answer options:

42. Question. How do I switch to slideshow mode?

Answer options:

4) 3.
43. Question. Which menu item should you choose to get the result as in the picture on the right?


Answer options:

4) 3.
44. Question. What shortcut should I use to launch the browser to view WEB-pages?

Answer options:

4) 4.
45. Question. You need to go directly to the website www.kremlin.ru directly. In which field should you enter the address you are looking for?


Answer options:

4) 4.
46. \u200b\u200bQuestion. Without closing the tabs of the kremlin.ru site, you want to go to the gov.ru portal by opening it in a new tab. Which option should you take?

Answer options:

4) 4.
47. Question. What happens if you click on the specified icon?

Answer options:

1) stop loading the page;

2) closing the Microsoft Internet Explorer browser;

3) go to the previous page;

4) page refresh.
48. Question. You received email, where the copy contains several addressees. If you press the "Reply" button, what addresses will appear in the "To" field of your letter?

Answer options:

1) Igor Zhuravlev;

2) Igor Zhuravlev, Andrey Kurosh, Alexey Chumachenko, Polina Vafina;

3) Igor Zhuravlev, Polina Vafina;

4) A letter will be created with an empty "To" field.
49. Question. You have received an email with several recipients in the copy. What happens if you click the Reply All button?


Answer options:

1) a letter will be created, where the address from which you received the original letter will be indicated in the "To" field;

2) a letter will be created, where all recipients listed in the original letter will be indicated in the "To" and "Cc" fields, respectively;

3) a letter will be created with an empty "To" field;

4) a letter will be created, where the recipients listed in the original letter will be indicated in the "Copy" field.
50. Question. You received an email with specific address... There are several more addresses in the "Cc" field. You want to reply only to the person from whose address the letter came. Which button should you press?

Answer options:

1) answer;

2) answer everyone;

3) create a message;

4) forward.
51. Question. What is the Follow Up button used for?


Answer options:

1) to create a task;

2) to prepare a response on behalf of the manager;

3) so that the letter is always marked as unread;

4) to forward a letter to a subordinate.
52. Question. What is the definition below?

Answer options:

1) open data;

2) open government data;

3) passport of open data.

Select the range of cells E2: E8, then hold down the ALT key and select the range H2: H8

Select the range of cells E2: E8, then hold down the CTRL key and select the range H2: H8

Select the range of cells E2: E8, then hold down the SHIFT key and select the range H2: H8

Use conditional formatting

\u003d SUM (H4: H8)

\u003d SUM (H4: H5)

\u003d SUM (B4: B5)

\u003d SUM ($ 4: $ 5)

In the diagram below, you have decided to change the scale of the vertical axis for greater clarity, setting the maximum value to 5. Which menu item do you need to go to?

· 4

You want the Pivot Data label in the left table to be centered in the selection, as in the right table. Which button should I press?

· 3

You want the "Summary Data" label in the right table to appear as it does in the left table. Which button should I press?

· 3

32. What value will appear in the highlighted cell if the function \u003d MIN (H4: H8) is entered there?

You want the number in the right cell to appear the same as the number in the left. Which menu item should you choose?

This article describes the formula syntax and usage of the function MIN in Microsoft Excel.

Description

Returns the smallest value in the argument list.

Syntax

MIN (number1; [number2]; ...)

The MIN function arguments are described below.

    Number1, number2, ... Number1 is required, subsequent numbers are optional. From 1 to 255 numbers, among which you want to find the smallest.

Remarks

    Arguments can be either numbers, or numbers containing names, arrays, or references.

    Boolean values \u200b\u200band textual representations of numbers that are directly entered in the argument list are considered.

    If the arguments do not contain numbers, the MIN function returns 0.

    Arguments that are error values \u200b\u200bor text that cannot be converted to numbers result in errors.

Example

Copy the sample data from the following table and paste it into cell A1 of the new excel worksheet... To display the results of formulas, select them and press F2, and then press Enter. Change the width of the columns as needed to see all the data.