ZX Format #03
29 февраля 1996 |
|
IS-DOS - "Window System IS-DOS".
Category "IS-DOS - the programmers." No 3 Eliseev VA "The window system IS-DOS" (Journal version) (C) PENCRAFT 1995 (C) IskraSoft 1995 End, beginning at No 1 and 2. Auxiliary restarts. _________________________________________ wtpos (# 6B) For the last two restarts printing directly adjacent restart wtpos (# 6B), allowing to modify the current position to restart the print lnstr and str. Restart wtpos calculates the absolute logical coordinates print the values of the Y-coord and Print pos. vector of the window, which indicates the contents of register IX, taking into account the displacement of Y, defined in the register H and X, defined by in register L, and puts them into the system variable XYPOS, located in the vector character of the output device. This system variable is actively used restart ttyout (# 0A), on the basis of which many of the restarts Print Level WIND.SYS. It is worth mentioning that for the coordinates of a print, you can also use restart prapd (# 0C) of Level DOS.SYS, which puts a system variable XYPOS register values H (Y-coord lines) and L (X-coord in familiarity 6 * 8). Example using prapd: ;**************************************** ; Listing 13 Setting the origin ; For lnstr (# 6D) ORG # 5D64 CALL CLS; clear screen LD H, 5; Y-coord LD L, 2; X-coord LD C, # 0C; code restart # 0C ; The level DOS.SYS RST # 10 LD HL, TEXT; address text LD C, # 6D; code restart lnstr LD B, 37; the number of characters RST # 10; print line CALL WAIT JP EXIT ; Text buffer TEXT DEFM "Printing line" DEFM "coordinates" DEFM "X = 2, Y = 5" ; Additional procedures CLS LD C, # 73; restart cls RST # 10; to clear the screen RET WAIT LD C, # 07; restart ttyin RST # 10; to wait for the clicking RET; Tia Keys EXIT XOR A; standard output LD A, # F4; in the IS-DOS RET ;**************************************** Same with wtpos: ;**************************************** ; Listing 14 Setting the coordinates wtpos ; For lnstr (# 6D) ORG # 5D64 ; Raw data: ; Y-coord window = 3 ; X-coord window = 0 ; Print pos = 1 ; Required coordinates printing: ; X = 2 ; Y = 5 And hence: ; H = 2 (displacement along the Y) ; L = 1 (offset X) CALL CLS; clear screen LD IX, WIND; vector window LD A, 2 opening windows LD C, # 1961 RST # 10 LD H, 2; Y-offset LD L, 1; X-offset LD C, # 6B; code restart wtpos RST # 10 LD HL, TEXT; address text LD C, # 6D; code restart lnstr LD B, 37; the number of characters RST # 10; print line CALL WAIT JP EXIT And the vector window WIND DEFB 0 DEFB 3 DEFB 7 DEFB 30 DEFB% 00001111 DEFB% 00000001 DEFB 1 DEFB 40 ; Text buffer TEXT DEFM "Printing line" DEFM "coordinates" DEFM "X = 2, Y = 5" ; Additional procedures CLS LD C, # 73; restart cls RST # 10; to clear the screen RET WAIT LD C, # 07; restart ttyin RST # 10; to wait for the clicking RET; Tia Keys EXIT XOR A; standard output LD A, # F4; in the IS-DOS RET ;**************************************** scrol (# 70) Another extremely useful when working with texts restart - scrol (# 70). He allows you to remove the contents of the window to line up or down. When working restart required Programming filling the extreme left and extreme right in the familiarity freed string (bottom motion up and vice versa). Input parameters: IX - the vector of window HL - extreme value fill byte freed string (image coding induces a binary representation, For example: a single-line on the edge coded as 10000000 00000001 and etc.) A - operating mode: A = 0 - Set the restart of the vector windows - called once before starting work in the window. Setting is retained for all time work until the next call scrol c zero value in register A. A = 1 - scroll to line up A = 2 - scrolling by one line For normal operation scrol need two more parameters are added to the standard vector and windows located directly in front of him: IX-1-speed scrolling - possible values - 1, 2, 4, 8 defines time during which the line moves to 8 pixels along the vertical ticked IX-2 delay of scrolling - possible values from 0 to 255 - regulates time interval between consecutive mi call restarting By choosing these two parameters is achieved in the most fluid motion required rate of scrolling. Example: ;**************************************** ; Listing 15 Application scrol (# 70) ORG # 5D64 , Opening a window CALL CLS LD IX, WIND LD C, # 1961 LD A, 2 RST # 10 ; Setting procedures scroll , The vector window: LD IX, WIND; vector window LD C, # 70; code restart LD HL, # 0000 completion XOR A; in Reg. A - 0 RST # 10 ; Print line prstr subfunction 3 LD IX, WIND LD HL, TEXT LD C, # 1968 LD E, 3 LD A,% 00001010 LD B, 1 RST # 10 ; Scrolling the window up in the cycle in 5 rows LD B, 5 M1 PUSH BC LD C, # 70; code restart LD A, 1; scrolling up LD IX, WIND; vector window LD HL, # 0000 completion RST # 10 POP BC DJNZ M1 CALL WAIT JP EXIT And the vector box + 2 bytes for restart ; Scrol (# 70) DEFB 25; delay DEFB 01; rate WIND DEFB 0 DEFB 5 DEFB 12 DEFB 25 DEFB% 00000111 DEFB% 00000001 DEFB 2 DEFB 25 The text for printing TEXT DEFM "It works scrol (# 70)" DEFB # 0D DEFB # 03 ; Additional procedures: CLS LD C, # 73; restart cls RST # 10; to clear the screen RET WAIT LD C, # 07; waiting for the keys RST # 10 RET EXIT XOR A; output in the IS-DOS LD A, # F4 RET ;**************************************** Application restart scrol with restarts printing (eg prstr) allows you to organize the on-screen mode "running text". Consider another example: ;**************************************** ; Listing 16 The "running text" ORG # 5D64 , The procedure for opening the window CALL CLS LD IX, WIND LD C, # 1961 LD A, 2 RST # 10 ; Setting procedures scrol , The vector window: LD IX, WIND LD C, # 1970 LD HL, 0 XOR A RST # 10 ; Input parameters for the routine LD A,% 00001010 , In ref. A - bits 7 and 6 determine the mode ; Alignment ; Bits 5 ... 0 determine the indentation ; From the top The windows LD B, 1; line number in The text (lines , Separated ; From other characters ; ID # 0D) M1 PUSH AF; save Reg. A PUSH BC; save BC ; Print line on the number of the text LD IX, WIND; address vector window LD HL, TEXT; address early. Text LD C, # 68; code prstr LD E, 3; subfunction code RST # 10 CALL SCROLL; call scrol POP BC; restore BC INC B; increase the number ; Line in the text LD A, B; check on the number of CP 9; lines printed JP Z, END; output if all ; Line printed POP AF; recover A JR M1; go to print ; The next line And the vector box + 2 bytes for restart ; Scrol (# 70) DEFB 25; delay DEFB 01; rate WIND DEFB 1 DEFB 1 DEFB 12 DEFB 28 DEFB% 00000111 DEFB% 00000001 DEFB 4 DEFB 35 The text for printing TEXT DEFM "This program DEFB 13 DEFM "is an example" DEFB 13 DEFM "organization in the system" DEFB 13 DEFM "IS-DOS to the screen" DEFB 13 DEFM "in 'running text'" DEFB 13 DEFM "Text output is organized" DEFB 13 DEFM "with restarts" DEFB 13 DEFM "scrol (# 70) and prstr (# 68)" DEFB 13 ; Additional procedures: CLS LD C, # 73; restart cls RST # 10; to clear the screen RET SCROLL LD C, # 70; procedure to scroll LD A, 1; linga window LD IX, WIND; line up LD HL, # 0000 RST # 10 RET END POP AF; shutdown CALL WAIT JR EXIT WAIT LD C, # 07; waiting for the keys RST # 10 RET EXIT XOR A; output in the IS-DOS LD A, # F4 RET ;**************************************** ...
Other articles:
Similar articles:
В этот день... 23 November