ZX Review #7-8-9-10
08 ноября 1997 |
|
page iS-DOS - Description of system restarts IS DOS.
PAGE iS-DOS Music by MITCHELL (C) Sergey Astrov, Cheboksary DESCRIPTION OF THE RESTART THE SYSTEM IS DOS Ca. Ed.: This work was done long ago. In the ranks of experts ZX REVIEW she called positive feedback but, unfortunately, has not been completed by the author. We hope that someone from our readers to finish this work. According to S. Astrov ... # 00 = 0 DOS.create - Initializing ramdisk Ramdisk (not to be confused with "Fast", or virtual RAM-, or quasidisc) - this is an internal cache of disk space He needed to increase the speed disk access. When the first reading of an block its contents are stored in memory. If then there will be another call to this the same block, the information will already been read from the RAM. Title "Electronic" is not quite comfortable in this edition it replaced by a "disk cache" or just a "cache." When this restart battery must contain the size of the cache in blocks. For each Block is reserved to 260 bytes of data: 256 - for the contents of the block, on one byte for status register block and counter appeals to the block, and 2 bytes - number block on the device. The cache size can be anything depending on user needs. In describing the firm ISDOS optimal cache size passed for 29 blocks, I use cache size to 32 blocks. Not is to use small or large cache sizes. In the first the case of disk accesses will be slower in the second case, many programs will not fit in memory, and therefore can not work. So, register A must contain the cache size. To avoid freezing should not be loaded into battery is 0. If a given cache size is huge, more than possible to create, then restart nothing will, when the output is enabled flag Carry - error. It is not recommended to ask value of the cache is less than nine blocks, since then lost the possibility of widespread use of "fast" disk. In other words, in this case, all program will be searched for "System" drive, not addressing first to the "fast". Example ; The above program creates a cache size of 25 blocks. 140. LD A, 25; cache of 325 blocks LD C, 0; create RST # 10 XOR A LD A, # F4 RET 2 # 07 = 7 DOS.ttyin - entered via the keyboard Example ; Program typed keystrokes and depicts his ; In the upper left corner of the screen. To exit, press <ENTER>. 140. LOOP LD HL, 0, (0,0) LD C, # 0C; prapd - setting the printing position RST # 10 LD C, # 07; ttyin - input symbol RST # 10 CP 1913 JR Z, EXIT LD C, # 0A; ttyout - output symbol RST # 10 JR LOOP EXIT XOR A LD A, # F4 RET2 # 08 = 8 DOS.kwait - Waiting for the state of the keyboard with of rest keys. 2 During operation of the restart will be constantly polled keyboard and while pressing one key, exit restart will not occur. Once all keys are released, or pressed two or more keys then immediately exits. If in the example below will pressed, for example, key "A" and not will be dispensed, the program will not go into the shell. If you press another key andor (not releasing the "A"!), then exit all will not happen. If all Keys will be released, either by pressing "A" and "B" together, it will exit the shell. Application of this restart is needed in some menus having a "hot button" when can occur by chance recall for the same hot button. In other words, applies when you want to be sure that any key is pressed. Example ; Program clears the screen, waiting for the keys, and "hanging" ; Until this key is pressed. 140. XOR A LD C, # 73; cls - clear screen RST # 10 LD C, # 07; ttyin - waiting for keypress RST # 10 LD C, # 08; kwait - waiting for "squeezing" the keys RST # 10 XOR A LD A, # F4 RET 2 # 0A = 10 DOS.ttyout - character output to the screen This restart is used system itself, in most when you want to display on screen (or on another character output device) of any text. In most cases, This restart is not used in application programs, program printing the symbol is highlighted in separate restart to make it easier recourse to the system itself. If you use a print driver ty42.typ, when you print control characters (chr 0 .. chr 31) are not recognized and instead will be withdrawn from the chaotic character outlines. When using the driver ty42-f.typ control characters are displayed in accordance with the coding IBM. In general, the restart only transmits without changing the character codes print driver. That will be displayed on the screen (printed on printer) - depends only on driver. Not recommended for printing the screen is off-screen, although freezing is usually not the case. Example ; Program clears the screen and displays a complete set of characters, , Which allows you to print this output driver. ; To exit press <ENTER>. 140. LD C, # 73; cls - clear screen XOR A RST # 10 LD D, 8, 8 lines LD H, -1; initial value of the coordinates XOR A; character typed LOOP LD B, 32 2, 32 characters per line INC H; newline LD L, 0; coordinate (H, 0) LD C, # 0C; prapd - setting the printing position PUSH AF RST # 10 POP AF L1 LD C, # 0A; ttyout - output symbol PUSH AF RST # 10 POP AF INC A; next character DJNZ L1 DEC D JR NZ, LOOP LD C, # 07; ttyin - waiting RST # 10 EXIT XOR A LD A, # F4 RET 2 # 0B = 11 DOS.prcpl - Select print mode Restart allows you to select one of two modes of printing: direct or inverted. Inverse output is often used to highlight a section of text. Set the print mode register A. Establish direct (Normal) print mode if the battery contains 0, otherwise it will set the inverse mode. Example ; Program clears the screen and displays a complete set of characters, , Which allows you to print this output driver. Print ; Going in reverse mode. To exit, press <ENTER>. 140. LD A, 1 LD C, # 0B RST # 10 LD C, # 73; cls - clear screen XOR A RST # 10 LD D, 8, 8 lines LD H, -1; initial value of the coordinates XOR A; printable character LOOP LD B, 32, 32 characters per line INC H; newline LD L, 0; coordinate (H, 0) LD C, # 0C; prapd - setting the printing position PUSH AF RST # 10 POP AF L1 LD C, # 0A; ttyout - output symbol PUSH AF RST # 10 POP AF INC A; next character DJNZ L1 DEC D JR NZ, LOOP LD C, # 07; ttyin - waiting RST # 10 EXIT XOR A LD A, # F4 RET 2 .................................................. ............ # 15 = 21 DOS.empty - Restart is not used. .................................................. ............ # 22 = 34 DUD.empty - Restart is not used DUD.mkdir Old restart DUD.mkdir - create the directory. More later versions of IS-DOS was deleted as unnecessary. .................................................. ............ # 24 = 36 DUD.erfil - Deleting a file named To delete a file, you must specify its name. Address of the descriptor file name must be in register HL. The file name must be specified accurately, without global symbols "*" And "?". Immediately after the file name extension must be specified. For example, the file unicolor.com must have a descriptor: "unicolorcom" (without separating the point!) If you specify a file name, and file does not exist, then the call erfil errors will not. .................................................. ............ # 3A = 58 DUD.empty - Restart is not used DUD.paste Old restart DUD.paste. In later versions of IS-DOS was deleted as unnecessary. .................................................. ............ # 60 = 96 WIND.empty - Not used # 61 = 97 WIND.wt - Output window Restart is used to display the window. To set the configuration window, use register A and the vector window, the address which specifies the index register IX. Contents of register A (for output window): (These values clears) A = 0 # 00 window with single frame A = 1 # 01 window without frames A = 2 # 02 double window frame A = 3 .. 127 # 03 .. # 7F window without frames When you use the following values of the window is not cleared, and only podkrashivayutsya and drawn frame. Keep in mind that the frame is drawn lines (probably using subroutine PLOT in the Spectrum ROM). For any value of register A frame will be superimposed on the image, and place under the frame will not be cleared. Showing the example shows the effect. Should Note that the restart can be used effectively if must simultaneously touch up or repaint the existing window and replace the literal single frame to a double, and skirt the window frame with the tint or color changes. Contents of register A: (Box only podkrashivayutsya) A = 128 # 80 box with single frame A = 129 # 81 window without frames A = 130 # 1982 box with dual frame A = 131 .. 255 # 83 .. # FF window without frames Vector window offset length name comments 0 X_COOR an X coordinate of the window for printing 1 Y_COOR a Y coordinate for the print window 2 Y_SIZE a window height 3 X_SIZE a window width 4 ATTR a window attributes SHADE 5 1 attribute shadow 6 X_coor an X coordinate for printing text 7 X_size a window width for printing text All coordinates are deposited from the upper left corner. X_COOR, Y_COOR, Y_SIZE and familiarity X_SIZE counted in 8 * 8 pixels. The first two quantities can take values from 0 to 31 and from 0 to 23, respectively. Y_SIZE X_SIZE and should not take zero values. X_coor and X_size determine the location of the text in the box relative to the boundaries Screen rather than the current window! These values measured in the familiarity of printable characters, with using normal driver printing (42 characters per line) options can be selected from range 0 .. 41. WARNING! Always make sure not to go beyond the boundaries physical screen. The system does not monitor such violations, and, at best, the screen will look sloppy. Attributes shade (SHADE) determine the color of the shadow and its availability. The shadow color is set as standard: bits of value 7 6 5 4 3 2 1 0 ink color Paper Color brightness 0 = presence of shadows 1 = absence of shade Example 140. ; The program opens and prints the text in it LD A, # 82; double frame without treatment, but with a tint LD C, # 61; wt - the output window LD IX, WIND1; vector window RST # 10 LD C, # 66; adrwt - print text in the window LD IX, WIND1 RST # 10 LD C, # 2007 RST # 10 XOR A LD A, # F4 RET WIND1 DEFB 1,5,8,10,71,4,2,8 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize DEFM "So what?" DEFB 13 DEFM "So what?" DEFB 13,32 If you start this file screen will contain any image, the box was superimposed on the screen content. Place will be cleared only by printed symbols. # 62 = 98 WIND.box - Drawing / Erasing framework Restart is used to draw or remove the window frame. When you call the register pair IX must contain the address of the vector window, register D holds the indentation on Y from the edge of the window, and register E - by axis X. Accumulator (register A) indicates the configuration of the frame. Should pay attention to that draws a box restart single lines. To to skirt the window double lines should cause a restart twice or use the call wt (# 61). When you call in the battery might include the following bits: bits of value 7 6 5 4 3 2 1 0 left if 1 - side right-hand drawn / removed if the upper 0 - lower ignored not used 0 = draw 1 = erase Registers D and E contain padding in pixels from the borders of the window to the center. Note that indentation on the left and right are determined by register E modulo 8 (Top and bottom - Register D), In other words, a space defined by three lower bits of registers (and, in fact, can take values from 0 to 7). The second example shows this feature. Vector window offset length name comments 0 X_COOR an X coordinate of the window for printing 1 Y_COOR a Y coordinate for the print window 2 Y_SIZE a window height 3 X_SIZE a window width 4 ATTR a window attributes SHADE 5 1 attribute shadow 6 X_coor an X coordinate for printing text 7 X_size a window width for printing text Example ; Program opens a window with no frame, it prints text, , And then waits for a keypress. After you draw a ; Single frame and is waiting again. Then the side ; Side of the frame are removed and the program waits for keypress ; To exit the shell. 140. LD A, # 01; without frame, with the cleaning LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD C, # 66; adrwt - print text LD IX, WIND1 RST # 10 LD C, # 07; ttyin - waiting for the keys RST # 10 LD IX, WIND1 LD DE, # 0001; indentation in pixels LD A,% 00011111 LD C, # 62; box - frame RST # 10 LD C, # 07; ttyin - waiting for the keys RST # 10 LD IX, WIND1 LD DE, # 0101; indentation in pixels LD A,% 10000011 LD C, # 62; box - wipe the sides of the RST # 10 LD C, # 07; ttyin - waiting RST # 10 XOR A LD A, # F4; output in SHELL RET WIND1 DEFB 0,18,5,19,71,4,1,25 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize DEFM "Hello, people!" DEFB 13 DEFM "You can't put your arms" DEFB 13 DEFM "around a memory" DEFB 13,3 Example , Opens a window without a frame on the screen. The window is not cleared. ; Expected keystroke. ; (1) Draw a frame. ; Increasing margins from the edge by one. ; Expected keystroke. ; Running with paragraph (1) nine times. ; The same way, all erased. , Exits the shell. LD A, # 01; unframed LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD C, # 07; ttyin - waiting for the keys RST # 10 LD B, 10 LOOP LD IX, WIND1 LD D, B LD E, B; indentation in pixels LD A,% 00001111; draw from all sides LD C, # 62; box RST # 10 LD C, # 07; ttyin - waiting RST # 10 DJNZ LOOP LD B, 10 LOOP1 LD IX, WIND1 LD D, B LD E, B; indentation in pixels LD A,% 10001111, remove from all sides LD C, # 62; box RST # 10 LD C, # 07; ttyin - waiting RST # 10 DJNZ LOOP1 XOR A LD A, # F4; output in SHELL RET WIND1 DEFB 0,0,24,32,71,128,1,25 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize 2 # 63 = 99 WIND.awt - Tint lines in a window with a frame This restart is useful for create a menu that makes IS-DOS (see Restart SHELL. menu # 91 = 145). When you call must register IX contain the address of the vector window, Register B - Color and the battery - A string that you want to highlight. Row number is counted from the top of the window. If in the battery string is specified with number 0, will be highlighted top row, which contains a frame. It should be noted that the number of lines can be negative. If you want to tint the line above the window should be loaded into the accumulator -1 (255). Of course, line will have a size equal to the length of the window. When leaving for the boundaries of the physical screen, nothing happens, the call is ignored. Line number for the system is remainder of the division of content on the battery 32, in other words, the values of k and k +32 * n for this restart are equivalent to (n - integer, 0 <= k <= 31). Example ; The program opens a window and wears a second line. 140. LD A, 0; single frame LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD C, # 66; adrwt - print text LD IX, WIND1 RST # 10 LD C, # 63; awt - touch-up lines LD A, 2, No. 2 LD B, 15, white on blue RST # 10 LD C, # 07; ttyin - wait for keystroke RST # 10 XOR A LD A, # F4 RET WIND1 DEFB 0,0,6,9,71,4,2,8 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize DEFM "Line 1" DEFB 13 DEFM "Line 2" DEFB 13 DEFM "Line 3" DEFB 13 DEFM "Line 4" DEFB 13,3 2 # 64 = 100 WIND.awtc - Tint lines in a window without a frame This restart is virtually no different from the previous one, with the only difference being that podkrashivayutsya line window not including borders. If the window size horizontally less than three, when you call restart can be unpleasant consequences. In favorable circumstances and peculiar arrangement of stars, the screen will look ugly, but in general, you can and hang system - will have to reboot. The following example demonstrates this. Example ; The program opens a window and wears a second line. 140. LD A, 0; single frame LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD C, # 64; awtc - tint LD A, 2 second row LD B, 15 RST # 10 LD C, # 07; ttyin - waiting RST # 10 XOR A LD A, # F4 RET WIND1 DEFB 0,0,5,2,71,4,2,8; the size of the horizontal - two ; Xc, yc, ys, xs, attr, shade, xcoor, xsize 2 # 65 = 101 WIND.lwt - print this many lines in window Restart suitable for printing text window, as when specifying correct parameters text always issued in a limited areas that go beyond text can not. To call the restart register IX must contain the address of the vector window, the battery - the number of line window from which you will print text, case B - the number of rows that will be displayed. Text can contain any characters at the end of each line must be symbol CR (chr (13)). If, press meet EOF character (Chr (3)), no further printing terminated, there is a return the main program. Vector window Dimensions name offset the length of comments in pixels 0 X_COOR an X coordinate for printing window (8 * 8) 1 Y_COOR a Y coordinate for the print window (8 * 8) 2 Y_SIZE a window height (8 * 8) 3 X_SIZE a window width (8 * 8) 4 ATTR a window attributes SHADE 5 1 attribute shadow 6 X_coor an X coordinate for printing text (8 * 6) 7 X_size a window width for printing text (8 * 6) Here, as in the previous two restarts, the values of k and k +32 * n for this restart are equivalent to (n - integer, 0 <= k <= 31), the battery can take negative values with The only difference is that the yield for beyond the physical screen is dangerous - the system may hang. Printing is as follows: cleared rectangle with a width and height X_size contained in the register B, upper left corner has coordinates (X_coor; Y_COOR + contents battery). (The lengths of the sides of the rectangle - in familiarity). Then there is a seal with line Y_COOR + contents battery. If the length of the printed line will be more X_size, there will be a automatic transfer lines. In the window will be printed as many rows as contained in the register B, regardless of the transfer. Example ; Prints three lines in the window. 140. LD A, 0 LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD C, # 65; lwt - print LD B, 3, three rows LD A, 2, starting from the second row of windows, LD IX, WIND1; print window WIND1 LD HL, TEXT; text contained at TEXT RST # 10 LD C, # 07; ttyin - waiting for keypress RST # 10 XOR A LD A, # F4 RET TEXT DEFM "1. One" DEFB 13 DEFM "2. Two" DEFB 13 DEFM "3. Three" DEFB 13 DEFM "4. Four" DEFB 13 WIND1 DEFB 1,10,6,8,71,4,2,9 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize 2 # 66 = 102 WIND.adrwt - Print the text in the box Text - after vector window Restart is used very frequently if necessary many times get a window with one and the same text. When you call a restart is necessary to define only one register IX, which shall contain the address of the vector window. Immediately after the vector of the window should be placed in the message. The text will be printed until until it encounters the EOF character (Chr (3)). Printing may be interrupted in the event that will be reached the lower boundary of the window. Example ; Example is taken from the program mkdir.com ; Printout of the text in the box. 140. LD A, 2, double frame LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD C, # 66; adrwt - print text RST # 10 LD C, # 07; ttyin - waiting for keypress RST # 10 XOR A LD A, # F4 RET WIND1 DEFB 17,8,5,11,56,1,25,10 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize DEFM "Create" DEFB 13 DEFM "Directory:" DEFB 3 2 # 67 = 103 WIND.lenwt - Print the text in the box text - the register HL Unlike Lenwt (# 67) of adrwt (# 66) lies in the fact that the address of the beginning of the text contained in register HL. Example ; Example is taken from the program calculat.com (iS-EDIT Calculator 1993) Print the text in the window. 140. LD IX, WIND1 XOR A; single frame LD C, # 61; wt - the output window RST # 10 LD HL, TEXT LD C, # 67; lenwt - print text RST # 10 LD C, # 07; ttyin - waiting for keypress RST # 10 XOR A LD A, # F4 RET TEXT DEFM "Add +" DEFM "Sub -" DEFM "Mul *" DEFM "Div:" DEFM "Input" DEFM "Exit!" WIND1 DEFB 23,9,8,6,56,1,32,5 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize2 .................................................. ............ # 69 = 105 WIND.empty - Restart is not used. WIND.iniwt Former restart IND.iniwt, in later versions of IS-DOS is not used. .................................................. ............ # 6B = 107 WIND.wtpos - Set the cursor relative to window borders Restart is invoked in cases where it is necessary to position the cursor at the position, located in a window. When you exit this restart set system variable xypos, responsible for the location of the cursor on the screen. Positions k and k +32 * n equivalent (As in the X, and axis Y). X coordinate to be contained in the register L, and Y - in the register H. Coordinates are measured relative to the window bounds, rather than the screen. If H = YY, L = XX, then cursor position will be set (X_coor + XX; Y_COOR + YY). Vector window offset length name comments 0 X_COOR an X coordinate of the window for printing 1 Y_COOR a Y coordinate for the print window 2 Y_SIZE a window height 3 X_SIZE a window width 4 ATTR a window attributes SHADE 5 1 attribute shadow 6 X_coor an X coordinate for printing text 7 X_size a window width for printing text To avoid misunderstanding, especially want to note that POSITION the cursor is placed, BUT this cursor stays in the same The state in which it was before the call to restart. If the cursor was enabled before calling the restart, then he will remain so. NOTE: Restart only sets a variable xypos, and not the cursor. Cursor sets restart y___ (# 76 = 118). Example ; Window opens, it installed a blinking cursor. ; After pressing the cursor is extinguished and exits ; To the shell. 140. LD A, 0; single frame LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD H, -1-32; equivalent -1 LD L, -1 LD C, # 6B; wtpos - cursor RST # 10 LD C, # 76; y___ RST # 10 LD C, # 07; waiting for keypress RST # 10 LD C, # 77; n___ RST # 10 XOR A LD A, # F4 RET WIND1 DEFB 1,10,8,14,71,4,2,17 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize2 # 6C = 108 WIND.str - Print lines ending on CR (chr 13) Restart is used for printing lines, ending the symbol CR (chr 13). The procedure is very fast, but does not check critical situations. Going bottom of the screen is dangerous. Output is in the right border is not terrible, but when using the print driver 42 characters per line spoils the look of the screen is distorted because the 43rd character (printed not completely). Printing occurs with the current position xypos, to call to determine only the register HL, which must contain the address of the text string. Example ; Example is taken is not very aesthetic, but it shows but ; Particularly restart. Opens a window, set ; Cursor, printed a long string (with access abroad ; Screen). The yield on the key is pressed. 140. LD A, 0 LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD H, June 32, equivalent to 3 LD L, 5 LD C, # 6B; wtpos - cursor RST # 10 LD C, # 6C; str - print line LD HL, TEXT RST # 10 LD C, # 07; ttyin - waiting for keypress 140. RST # 10 XOR A LD A, # F4 RET TEXT DEFM "IS-DOS - Disk Operating System DEFM "for the ZX-Spectrum" DEFB 13 WIND1 DEFB 1,10,8,14,71,4,2,17 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize 2 # 6D = 109 WIND.lnstr - Print lines of a certain length When you call this a restart Prints a specified number of characters in the string. The procedure does not check out of the screen. Going beyond the lower limit is undesirable, when the output of the left border of the most distorted Right 43rd character. Printing occurs with the current position xypos. When you call the HL register contains the address text line, and register B - number of characters to print. While listing the system makes no difference which character is printed. Occurs if a character CR (chr 13) or a symbol EOF (chr 3) - they still will be represented as characters, not control codes. From here you can draw only one conclusion: no use when calling this restart the line with symbols (chr 0 .. chr 31). Example 140. ; The program opens a window, set the cursor and prints ; "IS-DOS" - the first six characters of the string. LD A, 0 LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD H, 1 LD L, 5 LD C, # 6B; wtpos - cursor RST # 10 LD B, 6 LD C, # 6D; lnstr - print deadlines length B = 6 characters LD HL, TEXT RST # 10 LD C, # 07; ttyin - waiting for keypress RST # 10 XOR A LD A, # F4 RET TEXT DEFM "IS-DOS - Disk Operating System DEFM "for the ZX-Spectrum" DEFB 13 WIND1 DEFB 1,10,8,14,71,4,2,17 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize 2 # 6E = 110 WIND.smbgt - String mobile Editor This restart is often used in cases where the need is put into the program data from the keyboard. The main convenience is its editor mobility (mobility). You can enter data in any place screen. At the entrance to the editor printed contents of the buffer whose address is contained in the register HL. The battery contains the width of the window, input field (X). Bits 0 .. 4 registers contain B the height of the input window (Y). When the input window for the edge of the screen may fail system. Contents of the buffer is full all the input box thus, it is necessary to allocate the input buffer X * Y bytes. Register B performs another role - it determines the initial position of the cursor in the window input. Appointment bit register B is shown in the following diagram. 7 6 5 4 3 2 1 0 - bits of register B Window height 0: mode "overtype" - print some characters over others 1: Mode "ME" - clearing the buffer when attempting to enter the correction tivy 00: at the end of the line (the last blank) 01: at the beginning of the buffer 10: The cursor is positioned on the first space from the beginning 11: at the beginning of the buffer If the fifth bit set to 1 (Included), then bits 6 and 7 are ignored, the cursor is placed at the beginning of the buffer. The cursor can be keys to move "up" "Down", "right" and "left", at enter any character buffer contents to the left of the cursor purified and added to the resulting character. If the fifth bit is cleared (set to 0) and the sixth bit is enabled, the cursor is positioned at the beginning of the buffer. The location of the upper-left corner of the window input the current value of system variable xypos, containing the coordinates of the cursor. Before calling a restart to initialize the cursor position (see example). E register contains the status byte the keyboard, the format of its as follows: 7 6 5 4 3 2 1 0 - bit register E 0: lower-case 1: upper 0: Latin 1: Cyrillic 0: Text 1: pseudographics 0: 1: not used Register D is a mask switch between the keyboard, the appointment of bits is similar to Register E. If you make a change provided for the register then the appropriate bits must be set to 1. The following example is a change of name of the file (directory) - so switching register uppercase / lowercase is not happening. If the exit from the editor Carry flag is enabled, an error occurred (for example, no print driver). If the Carry flag off, there are two possibilities: Zero flag is included - was pressed ENTER, the battery contains the string length without symbol CR (chr 13); Zero flag reset - keys are pressed SS / CS, CS / 9, SS / A, SS / ENTER or SS / SPACE, battery contains key code (c # 0E to # 12, respectively). Example , Is taken from the renam.com. In the original printed name ; File in a separate window is editing the file name. 140. LD IX, WIND1; window 1 LD C, # 61; wt - the output window LD A, # 02, double frame RST # 10 LD IX, WIND2; window 2 LD A, # 02, double frame RST # 10, the output window - register C is changed LD IX, WIND1; print in window 2 LD HL, TEXT; text "RENAME" LD C, # 65; lwt - LD B, # 01; print 1 line LD A, # 01; with 1 line of the window RST # 10 LD IX, WIND1 LD HL, # 0302; X = 2, Y = 3 (box 1) LD C, # 6B; wtpos - setting the cursor position RST # 10 LD HL, FILE1; print line - the old file name LD C, # 6D; lnstr LD B, # 0C; 3 12 characters RST # 10 LD IX, WIND1; setting the cursor position (2, 6) LD HL, # 0602; (need to specify the coordinates LD C, # 6B; editing window) RST # 10 LD HL, FILE1; contents of the buffer - the file name LD A, 12, the buffer length LD B,% 10000000 +1; buffer height: one line. ; Positioning on the first space from the beginning. ; Mode "overtype". LD DE, # 0200, you can only change the alphabet, ; Case (upper / lower case) - you can not LD C, # 6E; smbgt RST # 10 JR NZ, EXIT; NZ - output without changing the name ; ; Here writing a new subroutine name in the directory ; EXIT XOR A LD A, # F4 RET WIND1 DEFB 9,8,9,14,40,255,13,14 WIND2 DEFB 10,13,3,12,79,255,17,14 TEXT DEFM "RENAME" DEFB 13 FILE1 DEFM "unicolor com"; name example 2 # 6F = 111 WIND.empty - Not used WIND.beep Old restart WIND.beep - sound, in new versions of the system is not used. # 70 = 112 WIND.scrol - Scrolling Restart is used in those when there is a need for vertical scrolling. For normal operation procedure scrolling, you must first configure it. During setup of IS-DOS stores in their inner cell box options for which will be scrolling. Configuring the procedure on one window once you can then call a procedure many times scrolling virtually no passing procedure parameters. This, of course, was done to provide speed and low volume procedure scrolling. Customize scrolling is performed if the battery contains 0. In the register IX must contain the address of the extended vector window, the register H stores bits of filling the right window borders, and register L - left border. When there is scrolling, it shifts the entire window, including side borders containing the frame. HL register contains a bit map that provides information about what will be filled in the side of the border. For a double frame L = % 10100000, H =% 00000101. For a single frame is recommended to register to write HL the # 0180, for a double frame - # 05A0, and windows without a frame register must contain # 0000. Procedure scroll contains a small spelling, which was not corrected in later versions of IS-DOS, to maintain compatibility below up. Omission is that the vector of the window procedure is handled correctly. When scrolling the window is shifted to the area marked by arrows. Give me something for the pain Will be shifted to these columns (and should be shifted more and boundaries) And after scrolling for one line up (HL register contains a # 05A0) window will appear as follows: for the pain ^ ^ "Unnecessary" boundary Procedure as it narrowed the window left and right by one column. For normal operation, when calling the program should be inserted following commands: (see also example) DEC (IX); X_COOR INC (IX +3); X_SIZE INC (IX +3); X_SIZE This sequence extends the window by one position right and left. To return vector of the window to its original state, do the following commands: INC (IX); X_COOR DEC (IX +3); X_SIZE DEC (IX +3); X_SIZE Advanced vector window offset length name comments -2 S_DLAY a pause -1 S_STEP a discrete scrolling 0 X_COOR an X coordinate of the window for printing 1 Y_COOR a Y coordinate for the print window 2 Y_SIZE a window height 3 X_SIZE a window width 4 ATTR a window attributes SHADE 5 1 attribute shadow 6 X_coor an X coordinate for printing text 7 X_size a window width for printing text (Names S_DLAY and S_STEP given me, because I have not seen notation of these quantities in any one that I know of publications on IS-DOS). S_STEP contains important step for scrolling, in pixels, recommended value of 1, 2, 4 and 8. Do not use the value 0 since in this case the system hang. Not recommended to use other values, although the system does not hang, but the resulting effect will be unaesthetic - too much discretion, scrolling will be rough. S_DLAY - a pause between two intermediate shifts image with a given increment. A value of 0 means that pauses do not happen at all. Range of values: 0 .. 255. After initialization, you can call the procedure for scrolling, not loading especially in the registers HL and IX of the values of the template filling the borders and extended the vector window, respectively. It is only important content battery, which sets the direction scrolling. WARNING! In the scrolling involved attributes! If A = 1, it will scroll up one line, attributes of the window will shift to one line up, and attributes the lower line will not change. Bottom line will be cleared. If A = 2, then down one line will be shifted attributes and image the top row will be cleared. Attributes of the top line will not change. Example 140. LD A, 2 LD C, # 61; wt - the output window LD IX, WIND1 RST # 10 LD C, # 66; adrwt - print text in the window RST # 10 LD A, 0; A = 0 - setting DEC (IX); INC (IX +3); "moving apart Window INC (IX +3); LD HL, # 05A0; bitmap LD C, # 70; scrol - scrolling RST # 10 INC (IX) DEC (IX +3) DEC (IX +3) LD B, March 24, repeat 24 times LOOP LD A, 2; scroll down LD C, # 70; scrol - scrolling RST # 10 DJNZ LOOP LD C, # 07; ttyin - waiting for keypress RST # 10 XOR A LD A, # F4 RET DEFB 20,1; S_DLAY, S_STEP WIND1 DEFB 1,0,24,16,71,255,3,18 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize DEFM "Give me something" DEFB 13 DEFM "for the pain" DEFB 13,32 .................................................. ............ # 72 = 114 WIND.g_scr - Return of the vector of the third level "WIND" After emerging from the restart in register HL 'return address vector of the third level: mixed-length name comments generalization -2 2 address table features user panel (# 6A) 0 PAPER 1 attribute screen 1 BORD 1 attribute border 9 February reserved 11 SMDRV a logical number keyboard driver 12 SMKCS * 1 byte of state driver keyboard (K_CSR) 13 SMMCS * a mask permission bits change (M_CSR) 14 SMXS * 1 coordinates of upper left corner of the editable 15 SMYS * 1 line on the screen in familiarity 16 SMLN * 1 length an editable screen area 17 SMHT * a height of the editable screen area 18 SMCSR a status register line editor. Bits 0 / 1: * 6 - s_e - smbgt / edstr - mode (0) 1 - c_i - change / insert 19 SMDBF * 2 address line 21 SMXC * 1 Current coordinate X cursor in the text 22 SMXMX * a maximum length of string-2 23 SMLM * 1 left logical boundaries (0) 1924 SMRM 1 right logical boundary 25 SMXO * 1, the number of characters to skip (0) 26 SMSZ a field width requirements scrolling 27 SMCOD a code returned by the editor 28 SMLNS a length of string with the code CR (chr 13) 29 SMCOM 1 team, kotoruyu must complete an editor input 30 SMTYP 2 address routines to display the current status (If 0, it is not called) Values of all the boundaries can vary from 0 to 253. * All options marked asterisks, smbgt initializes itself. Example 140. LD C, # 72; g_scr - a return address the third level RST # 10 EXX; put HL 'in the IX PUSH HL POP IX EXX LD (IX +0),% 00001111; PAPER = White on blue LD (IX +1),% 00000010; BORDER = red LD A, 0, clear screen and color PAPER BORDER LD C, # 73; cls RST # 10 LD C, # 07; ttyin - waiting for keypress RST # 10 XOR A LD A, # F4 RET2 # 73 = 115 WIND.cls - Cleaning / tint screen Restart is used to clear the screen or touch-up (fill attributes). If Register A = 0, then the image on the screen is erased, then there is tint attributes PAPER, the curb is painted the color BORDER. PAPER BORDER values and are taken from the vector-level WIND (See previous restart). If the battery is not zero, then the screen is filled with color A, and cleaning the images are not occurs. Border color remains unchanged. Example 140. LD C, # 72; g_scr - a return address the third level RST # 10 EXX; put HL 'in the IX PUSH HL POP IX EXX LD (IX +0),% 00001111; PAPER = White on blue LD (IX +1),% 00000010; BORDER = red LD A, 0, clear screen and color PAPER BORDER LD C, # 73; cls RST # 10 LD C, # 07; ttyin - waiting for keypress RST # 10 XOR A LD A, # F4 RET2 # 74 = 116 WIND.empty - Not used # 75 = 117 WIND.empty - Not used # 76 = 118 WIND.y___ - Including the blinking cursor Find the application restarts cursor control rather difficult, practically it is rarely used, unless the user will not create your text editor. How to enable / disable selected as a restart for the simple to the her handling of the system. The flashing cursor is included in the interrupt, it The following example shows. After starting the program control is passed to the file wrapper and on the screen will see a blinking cursor. If we now produce some action (for example, view any file on disk) at which interrupts are disabled, the cursor stops flashing. Flicker will be resumed when you turn on interrupts. When you call a restart is not necessary worry about possible errors: when the cursor is outside the physical screen, not a failure occurs, the cursor on the screen not included. Example 140. LD C, # 76; y___ RST # 10 LD C, # 7; ttyin RST # 10, is used here as the expectation of keystrokes XOR A LD A, # F4 RET2 After running this program on-screen cursor will remain, which may be a bit annoying. You can turn the cursor by loading any program in which you must enter some text (the cursor control take on this program, when you exit a cursor will be disabled). Load Monitor command line and exit out of it! # 77 = 119 WIND.n___ - Turning off the blinking cursor If the previous restart includes a cursor, then this makes a just the opposite. When you turn on the cursor screen contents under the cursor is stored in specially allocated buffer. When you disable the cursor to the buffer restored. Thus, after clearing the contents of the screen cursor will be presented in its original form. Example 140. LD C, # 76; y____ RST # 10 LD C, # 7; ttyin RST # 10 LD C, # 77; n____ RST # 10 LD C, # 7; ttyin RST # 10 XOR A LD A, # F4 RET2 # 78 = 120 WIND.empty - Restart is not used. WIND.cr ^ on Restart is not used. In earlier versions of IS-DOS, apparently, used to activate the cursor. # 78 = 120 WIND.empty - Restart is not used. WIND.cr ^ of Restart is not used. Earlier, probably used for turn off the cursor. .................................................. ............ # 7A = 122 WIND.empty - Restart is not used # 7B = 123 WIND.empty - Restart is not used # 7C = 124 WIND.d_a - Convert number to string Restart is used to display numbers in different systems notation. When you call registers restart should contain the following values: HL - address of string buffer, in which will be formed number of ASCII characters A - buffer length in bytes B - radix DE - two-byte number (a flag Carry off), and the address will Schrieffer, which contains A four-number (a flag Carry On) When the Carry flag is enabled, if there was a buffer overflow. When choosing the number system should be noted that virtually useless to use a base of more than 16 - the value will be issued is not the same Kimi, what you would expect. Useless also use such an exotic radix as 1 - any number will buffer overflow. If chosen base 0, then the system understand that the chosen base 10. Example 140. LD IX, WIND1; vector window XOR A; A = 0 - single frame LD C, # 61; wt - the output window RST # 10 LD HL, BUFF; HL - buffer for XOR A; reset flag Carry - two-byte number LD A, March 15, a buffer of 15 bytes LD DE, 682; the number itself LD B, 2; radix LD C, # 7C; d_a RST # 10 JR C, ERROR; if Carry flag is enabled, it would overflow ; An immediate exit to the shell LD C, # 66; ADRwt - print text RST # 10 LD C, # 07; waiting for keypress RST # 10 ERROR XOR A LD A, # F4 RET WIND1 DEFB 1,10,8,14,71,4,2,15 ; Xc, yc, ys, xs, attr, shade, xcoor, xsize BUFF DEFS 15 DEFB 13 DEFB 3 2 # 7D = 125 WIND.a_d - Convert string to a number Restart is used to enter numbers in different systems notation. Introduce the four-byte numbers, so that may be imposed range from 0 to 4294967295. Leading spaces are ignored. When you call registers restart should contain the following values: HL - address of string buffer, in which contains a number of ASCII characters A - buffer length in bytes B - base system schisle of default If register A is zero, then buffer size is not specified, the number will be read to the code CR (Chr 13). Not recommended to use the base system more 16. Radix 0, equivalent to the base 10. If the base is equal to 1, then any number except 0, will buffer overflow. Radix You can specify the force directly when entering numbers. Before the number in this case, you must supply the appropriate prefix: "#", "H", "h" - for radix 16; ".", "D" - for decimal values; "o", "O" - for octal, "%", "b", "B" - for binary numbers. WARNING! Letters in typing in the hexadecimal system must be uppercase! In Otherwise, an error - non-digit character. When the 32-x bit number contained in the registers DE'HL '. Number # 12345678 will be presented as: DE '= # 1234 HL '= # 5678. Register BC 'contains address extension buffer. If the exit flag Carry enabled, there are two possible mistakes: non-digit character or overflows, the register contains A then 0 and 1, respectively. Example 140. ; This example is a primitive program, print a dump ; Memory. To print you must enter the address from which , And then will return 128 bytes in hexadecimal. ; The default address is entered in hexadecimal. ; After printing program expects to enter a new value ; Address. To exit the program you must enter an incorrect , The number of (non-numeric character), or click ss / A. XOR A LD C, # 73; cls - clear screen RST # 10 START LD HL, # 0000 LD C, # 0C; prapd - setting the cursor position RST # 10 LD B, 1; window height = 1, overtype, at the end of the buffer LD E,% 00000001; uppercase LD D,% 00000001; register CAPS can be controlled LD HL, BUFF LD A, 173, 17 bytes in the buffer (you can enter binary numbers) LD C, # 6E; sbmbgt - Mobile Editor RST # 10 JR NZ, EXIT; if the yield on the ss / A - out in the SHELL LD HL, BUFF LD C, # 7D; a_d - ASCII -> number LD A, March 17, 17 bytes in the buffer LD B, March 16, 16, a hexadecimal system default RST # 10 JR C, EXIT; if the error, then exit EXX PUSH HL 3; HL '- lower 16 bytes of POP IX; IX - the current cell LD HL, # 0200; the cursor to position (2,0) LD B, March 16, 16 lines LOOP PUSH BC; --- (1) - the levels of nesting stack PUSH HL; --- (2) LD C, # 0C; prapd - cursor RST # 10 LD HL, STRING OR A 3; Carry RES: DE = 16-bit number LD A, 4; Buffer - 4 bytes LD B, March 16, 16, a hexadecimal system (default) PUSH IX POP DE; DE = IX = current address LD C, # 7C; d_a - number -> ASCII RST # 10 LD D, 0; DE = 00XX - current byte (8-bit number) LD B, 8, 8 bytes per line LD HL, STRING +4 L1 LD E, (IX); DE = current byte OR A 3; Carry RES: DE = 16-bit number LD A, 3, buffer = 3 bytes PUSH BC; --- (3) LD B, March 16, 16, a hexadecimal system LD C, # 7C; d_a - number -> ASCII RST # 10 POP BC; === (3) INC IX; next byte INC HL INC HL INC HL; 3 characters per byte DJNZ L1 LD HL, STRING LD C, # 6C; str - print lines ending in CR RST # 10 POP HL; === (2) INC H; the next line POP BC; === (1) DJNZ LOOP LD HL, BUFF; the formation of the next address OR A 3; Carry RES: DE = 16-bit number LD A, 4; buffer of 4 characters LD B, March 16, 16, a hexadecimal system PUSH IX; POP DE; DE = IX = current address LD C, # 7C; d_a - number -> ASCII RST # 10 LD HL, BUFF +4 LD B, 13; Purification Buffer L2 LD (HL), 32 INC HL DJNZ L2 JR START EXIT XOR A LD A, # F4 RET BUFF DEFM ".32768" 3, 17 spaces - the input buffer address STRING DEFS 28; buffer forming line dump DEFB 132 # 7E = 126 WIND.analys - Transmission Control subroutine This allows the flexibility to restart subroutine call to the number in the table (the code team). Restart can be effectively used in databases and programs that require complex interactive interface. The table has the following format (for each record for three bytes): First entry: 1 byte: number of teams 2 bytes: address routines Second entry: 1 byte: number of teams 2 bytes: address routines ... N-th entry: 1 byte: number of teams 2 bytes: address routines OTHERWISE: (handling the case, as shown in the table there) 1 B: Number of teams = # FF 2 byte: the address of the subroutine processing OTHERWISE Thus, the command is the last OTHERWISE, she completes the table. Non teams table can go out of order, but randomly. If the table Two identical facilities team this will result in a subroutine, as defined earlier, there is a record which is closer to the top of the table. If the the following example to install all the numbers in the sub-2, this will result in routine PRINT. When you call the restart register A should contain code routines, and A can take any value (0 .. # FF). The Register of HL should be the address table analyzer. Example 140. ; Program demonstrates how to use the restart analys. In ; Register A (label REG_A) contains the command code. If A = 1, , Then the routine is called CLRSCR;, if A = 2, then called ; PRINT. In any other case, called NOTFND. LD HL, # 0000 coordinates of the cursor (0,0) LD C, # 0C; prapd - cursor RST # 10 REG_A LD A, 2; command code = 2 LD HL, TABL; table parser LD C, # 7E; analys - transfer of control RST # 10 LD C, # 07; ttyin - waiting RST # 10 XOR A LD A, # F4 RET PRINT LD HL, TEXT; address line LD C, # 6C; str - print line RST # 10 RET CLRSCR LD A,% 00010111; color: white on red LD C, # 73; cls - tint screen color RST # 10 RET NOTFND LD HL, NOTHIN; text: "Nothing" LD C, # 6C; str - print line RST # 10 RET TEXT DEFM "Team 2 - Printing this line" DEFB 13 NOTHIN DEFM "Nothing" DEFB 13 TABL DEFB 2, Team 2 DEFW PRINT DEFB 1; Team 1 DEFW CLRSCR DEFB # FF; otherwise DEFW NOTFND ; Dumper.com - displays a dump XOR A LD C, # 73; cls RST # 10 START LD HL, # 0000 LD C, # 0C; prapd RST # 10 LD B,% 00000000 1 LD E,% 00000001 LD D,% 00000001 LD HL, BUFF LD A, 17 LD C, # 6E; sbmbgt RST # 10 JR NZ, EXIT LD HL, BUFF LD C, # 7D; a_d LD A, 17 LD B, 16 RST # 10 JR C, EXIT EXX PUSH HL POP IX LD HL, # 0200 LD B, 16 LOOP PUSH BC PUSH HL LD C, # 0C RST # 10 LD HL, STRING OR A; Carry RES LD A, 4 LD B, 16 PUSH IX POP DE LD C, # 7C; d_a RST # 10 LD D, 0 LD B, 8 LD HL, STRING +4 L1 LD E, (IX) OR A; Carry RES LD A, 3 PUSH BC LD B, 16 LD C, # 7C; d_a RST # 10 POP BC INC IX INC HL INC HL INC HL DJNZ L1 LD HL, STRING LD C, # 6C RST # 10 POP HL INC H POP BC DJNZ LOOP LD HL, BUFF OR A; Carry RES LD A, 4 LD B, 16 PUSH IX POP DE LD C, # 7C; d_a RST # 10 LD HL, BUFF +4 LD B, 13 L2 LD (HL), 32 INC HL DJNZ L2 JR START EXIT XOR A LD A, # F4 RET BUFF DEFM ".32768"; March 17 spaces STRING DEFS 28 DEFB 13 ; Chgwait.com - Translated messages Please wait for the Russian language LD HL, # FFFF LD BC, # 8000 LOOP LD A, (HL) CP "<" JR Z, FIND L1 DEC HL DEC BC LD A, B OR C JR NZ, LOOP EXIT LD C, # 8B; mwait - print "<.. Please Wait ..>" RST # 10 LD C, # 07; ttyin - waiting for keypress RST # 10 XOR A LD A, # F4 RET FIND PUSH HL PUSH BC LD DE, PLEASE LD B, 17 L2 LD A, (DE) CP (HL) JR NZ, NOTFND INC HL INC DE DJNZ L2 POP BC POP DE LD HL, RUS LD BC, 17 LDIR JR EXIT NOTFND POP BC POP HL JR L1 PLEASE DEFM "<.. Please Wait ..>" RUS DEFM "<Wait> 3; Coming from gmen.res (C) 1993, IskraSOFT corp. St. Petersburg, Russia 3; modified Sergei Astrov, 1996 ; ; Gmen - routine appointment system, ; Fast and the current device ENTCUR EQU # 60 CURSOR EQU # 06 ATTR EQU # 70 SHADE EQU # 41 DEFW 0,0 XOR A MEM1 EQU $ +1 LD IX, WIND LD C, # 1961 RST # 10 LD C, # 1991 RST # 10 XOR A LD A, # F2 RET ; Routine initialization menu INIT LD C, # 1910 RST # 10 EXX LD C, # 41; = "A" Latin DEC HL LD A, (HL) ADD A, C MEM2 LD (S_DEV), A DEC HL LD A, (HL) ADD A, C MEM3 LD (Q_DEV), A DEC HL LD A, (HL) ADD A, C MEM4 LD (T_DEV), A EXX RET ; Routine processing keystrokes <ENTER> KEYS LD C, # 1910 RST # 10 EXX LD E, (IX-# 09); CURPOS XOR A LD D, A SBC HL, DE PUSH HL LD A, (HL) LD H, (IX-# 09) LD L, # 08 SCF LD C, # 8C RST # 10 POP HL JR NZ, NOPUT LD (HL), A NOPUT LD C, # 2008 RST # 10 XOR A INC A RET DEFB ENTCUR, 0, CURSOR, a MEM5 EQU $ -1 DEFW INIT, 0,0 MEM6 EQU $ -1 DEFW ENTER WIND DEFB 21,3,5,8, ATTR, SHADE, 29,9 DEFB 1,1,1 DEFM "System A" S_DEV EQU $ -1 DEFM "Quick A" Q_DEV EQU $ -1 DEFM "Current A" T_DEV EQU $ -1 MEM7 EQU $ -1 ENTER DEFW KEYS MEM8 EQU $ -1 DEFW KEYS MEM9 EQU $ -1 DEFW KEYS DEFW # FFFF, MEM1, MEM2, MEM3, MEM4 DEFW MEM5, MEM6, MEM7, MEM8, MEM9
Other articles:
Similar articles:
В этот день... 21 November