Programmers - Mini Windows`98

Black Crow #02
  WINDOWS`98 PROGRAM SHELL.     
                                          
------------------------------------------ Suckers breed every day. I did not choose this epigraph by chance. Review of new software products, and especially the media, among of all other pathology revealed another in- interesting point: how many soft makers, so many attempts to do more or less similar to Windows on PC. Everyone considers himself an academic, so he spends a lot of time and effort to imitate. In some In some cases this is possible, but in Most imitation turns into into a parody. There was no time (desire) yet look at all these perversions from the inside, but outwardly - nonsense. In some cases, that especially noteworthy, it immediately arises question - which Kempston mouse controller? the guys who wrote this or that have arrow driver? The point is that the software quite interestingly supports this do- weight - the arrow moves only when when you hold down the spacebar. Fire buttonsdo not work at all or only They play again with the spacebar pressed. Insanity is getting stronger... Especially when for pe- moving the arrow across the screen from one edge to another using the mouse (!) you need 83 (!!!!!!) centimeter! The next perversion - window interface. Actually, the window and Africa window, but not everyone uses it logical and beautiful. Sometimes opening the window, you're wondering how to cancel it, yes so that without selecting anything and launching kaya. Some programmers have tried more e-less breathing pathology to offer for widespread use by all others, with this tying up a whole stack of inalienable requirements and working conditions, etc. Me too I walked this path at one time, but constantly new improvement has not yet led to great demands on the programmer, and at the same time Borot - freed his hands. Now I've decided give everyone your own MiniWindows. This version does not have physical addresses subroutines Single point access entrance. So, dedicated to all the morons... 1.INTRODUCTION This software product represents is a complete object module for or- organization of a convenient interface.Shell consists of a set of functions, a set which allows you to obtain a modern design Zain programs. Functions should be tied according to this programming manual Vania. For convenience of work, we carried out Function numbering code after the command to call it call From now on the user has no idea about the location of all shell routines ki. Access to them only through a single point login: CALL #6000;call the shell. DEFB #41 ;window printing. or: RST #10 DEFB #41 In the first case, all registers are saved - xia, and in the second due to the nature of the work RST 16 in the ROM of the 48th BASIC is killed alternative DE. Contact via RST 16 possible if after installation (#40) "bind" procedure SUPERVISOR, going to complete with the shell and its co- the main part. To link you need to register my pairBC enter at address #5С51. Function numbers do not start from zero, but from #40. This is done so that you can was to use commands like CALL NZ,OS without risk of going into meditation if there is a discrepancy conditions, because the next byte is no- function measure. If the call condition does not match fell, then the function number turns into bo- a more or less harmless squad... Taking into account the wishes of the programmers, we have I'm already dealing with my version of Windows, I after installation in register pair HL I give the address of the beginning of the function table, i.e. two-byte physical addresses of functions. This is done so that you can become attached to some (or all) functions shell pits and do not waste extra cycles for their number-by-number call. To bind: let's take the sequence number of the function, then make a correction to zero, and then calculating walk the address in the table take it and substitute under JP adr. In a register pair DE is the address of the beginning of the second font or, if not present, the address of the end of the shell. Firstfont for 42 character printing, the second - whatever you want, tie it like that - those But the height is EIGHT bits! Third "you" input" parameter - address for RST binding 16. Just enter the register value pairs BC at #5С51 and that's it. Natural but, if necessary, then first save Thread the old value of this system. 2.TECHNICAL FEATURES The shell is compiled to address #6000 (24576) and is designed to operate at 48 kilo- byte and more computers. Nice to have minimum 128 KB. RAM, because for saving the screen under the windows must be allocated which is the amount of computer memory that in 48 KB. problematic. Printing subroutine windows provides for the preservation of fragments screens under the windows to the allotted area programmer RAM page. The shell size is 8 kilobytes. If there is no second font, then 6 kilobytes. B this file contains everything for the interface user: printing and deleting windows, re- a number of menu texts, menu selection arrow- cursor, print standardsize (3 by 3) pictograms, simultaneous procedure new survey of Kempston mice and keyboards + joysticks, full-fledged 256-character font fishing, programmable letter size from 32 to 64 characters per line and small functions for different cases of using the shell. The shell kit includes 4 types of fonts ta (32,42,51,64 characters per line), file icons, utility file for assembler "ALASM", intended for installation function numbers and shell, screen splash file (wallpaper), program listing creating pictograms. The shell uses the current one when running. set of processor registers plus register new pair IX. The alternative set does not touch included, including AF`. Interrupt mode can be can be anything, even prohibited. But next you should follow him, because for braking cursor, the command HALT is used. Shell monitors permission or prohibition interrupts except for disk functions operations (setting DI) and input(setting new EI). For inputit is necessary to have knowledge reading IY,23610. This is to save memory and ease of retrieving keystroke code at IY-50. ATTENTION! Functions of disk operations and character input uses system re- exchangeable BASIC and TR-Dos! Be careful useful when writing programs. If such restrictions do not suit you, then write themselves disk operations, line inputs and so on... The programmer is invited to install the add page to save screen areas under the windows. I'm on the same page I recommend adding a file with icons. Naturally, one should not get carried away too much windows in a large number of simultaneous but on the screen, because memory limitations will arise immediately. Window printing program in order to save memory and machine time does not check whether the end of the pa- crumple when saving the screen. By the way, about ek- wound: the shell uses the main screen computer from address #4000 (16384), second the screen is given to the programmer on hisgoals. The PAGE function will turn on any screen! The principle of screen saving is similar working with the processor stack: the last one walked, came out first. Saving information yah screen is automatically laid in a special buffer whose size is equal to number of simultaneously open windows. On one save must be allocated six bytes, where information about the window size is stored, its place on the screen, color aspects and address in the save buffer. Also available system variable about the number of stored of screens, which is installed also automatically. If it is zero, then The window removal program is ignored. 3. PRINCIPLE OF WORKING WITH THE SHELL System installation is described below, and here briefly about the technology of writing in- interface. First of all, you need to order a century- window torus (see below), open the window, print create menus, create system options, activate the cursor option selector, delete cursor, window, navigate to the created table of addresses further according to the algorithm rhythm. It doesn’t sound definite... But in reality In fact, everything is very simple and accessible. 4.WINDOW VECTOR PROGRAMMING To set window parameters: create a special set of bytes called We then use the window vector. To this vector always indicates register pair IX. Almost all shell routines are nerd with vector, so the programmer must monitor its safety and timeliness of substitution, if necessary need to use IX register. Vector window includes the following values: +0 window print column in familiar places. +1 Window print line in familiar places. +2 window length in familiar locations. +3 height of the window in familiar locations. +4 window color. +5 flagnumber one. +6 current. column for printing text in pixels. +7 current. line of printed text in a sign. +8 current text printing color. +9 flag number two. +10 address of the mother window vector. +11 +12 address of system parameters on the menu. +13 +14 transition address table address +15 according to the selected menu. +16 indicator of the presence of a window title (zero - no header). Parameters with offset 6,7,8,10,11 us- are adjusted by the shell automatically. By offset +16 setting zero means from - the absence of a window title, but if the title needed, then this byte is the first in title. And now about each displacement in window vector in order. Printing program windows does not monitor the correctness of entered parameters, so you shouldn’t set bullshit blowing By offset plus four indicated the color of the window and the text that will be there printed. Bits of values ink, paper, bright and flash are similar to BASIC. Bytes with offset 6,7,8 set- with the window print program automatically and mean the current column values in pixels lyakh from the edge of the TV screen, the value of the line is chat in familiar places from the top of the TV screen, the value of the current text printing color is responsibly.By offset plus 10 printing program window sets the address of the vector pre- the main (mother) window from which the call was made. A new window appeared. Current window value stored in a special system variable noah(REGWIN). To arrange a return to to the mother window, the function RESTOR takes hence the address of the previous window, makes it current and deletes the last window. So Thus, using the window vector, you can ver- go to the previous branch of the algorithm ma user soft. By offset plus 12 the programmer is obliged indicate the beginning of system parameters for selection of menu options. For one menu you need specify four coordinates: column position from the edge of the screen, stock position from the top of the screen wound, size in length and height measure strips nude All values ​​are specified in familiar places. End of system variables code #FF. Quantity The quality of four-digit system ones depends on number of menu options in the window. If in pro- During the program operation it is necessary to exclude you need to read some mode from the survey "zero" the strip length parameter. Then choice is impossible, but when calculating the order number of the selected menu is excluded - ny also counts! To carry out transitions according to the subroutine For frames outside the shell, I suggest using use a tabular method of movement, because he's on- most convenient when working with my "WINDOWS". The address of the beginning of the address table must be placed by offset +14.Transition principle JP (HL). By offset plus 16: zero - no offset dexterity. End of title, like others texts in the shell, always zero. Print The title is highlighted by inversion. Now about the offset flags 5 and 9. Sohow they are used together is discussed here written together. So, a list of bit numbers and shell reaction to their values: BIT 0,(IX+5) - window border indicator at text printing. 0 -printing on the borders. 1 -printing with a retreat of one character BIT 1,(IX+5) - screen copy pointer on under the window. 0 -make a copy of the screen. 1 -do not make a copy. BIT 2,(IX+5) - print resolution indicator window shadows. 0 -do not create a shadow.1 -make a shadow. BIT 3,(IX+5) - permission to invert the menu volumes. 0 -the strip is inverted. 1 -prohibition of menu bar inversion. BIT 4,(IX+5) - reaction of the menu bar to boron options. Works in pairs with the value BIT 3,(IX+5). 00 -band present: delete. 01 -no strip: leave as is. 10 -band present: leave as is. 11 -no strip: set. BIT 5,(IX+5) - letter size indicator in pixels. 0 -the letter size is arbitrary. 1 -letter size is eight pixels. BIT 6,(IX+5) - print inversion indicator text. 0 -inversion is disabled. 1 -inversion is enabled. BIT 7,(IX+5) - feed resolution indicator chi sound click. 0 -clicking is enabled. 1 -clicking is disabled. BIT 0,(IX+9) - action with leading zeros when printing numbers. 0 -skip leading zero. 1 -print a space instead of a leading zero. BIT 1,(IX+9) - icon color correction 0 -do not change the color of the icon. 1 -color the icon with a color from (IX+8). BIT 2,(IX+9) - permission to draw a frame ictogram. 0 -do not draw a frame. 1 -enclose the icon with a frame. BIT 3,(IX+9) - icon printing resolution close and dismiss the window in the header. 0 -do not print icons. 1 -print icons. BIT 4,(IX+9) - method of printing pictograms. 0 -print using the OR overlay principle. 1 -regular printing. BIT 5,(IX+9) - anti-bounce action ha when you press "fire". 0 -bounce protection is enabled. 1 -protection is removed (you can draw with the cursor). BIT 6,(IX+9) - reserve for the programmer. BIT 7,(IX+9) - input enable/disable non-Russian letters in INPUT. 0 -prohibited. 1 -allowed. 5.INSTALLATION OF THE SHELL. The user program must do setting up system and some functions shells for further collaboration. To do this, you need to create a special sequence of bytes that are used This function is INSTALL. Your actions: 1. Load the file into the computer memory pictograms and indicate in the installation block of variables its beginning and country number face where he is. 2. Reserve the save buffer wound area covered by printed windows. The buffer size can be calculated using walking from the maximum number of windows, open at the same time. Formula for determining lensionsamount of RAM for one window: a=window length, b=window height, c=length c shadow, d=height with shadow, r=(a*b)*8+(c*d). To correctly find information in save buffer should be reserved a kind of descriptor of six bytes per every window. The easiest way to do this is one- new page: first the descriptor 6*nn, and then the save buffer. nn is equal to max- small number of simultaneously open windows in the program, for example, five. The beginning of that and indicate another in the installation block. 3. Upload the screen background file (wallpaper). 4. The mouse polling program is assembled for a three-button mouse. If the controller mouse missing (from port #FADF (64223) zero is read), then the poll is ignored, and during installation the mouse driver is cut off and is no longer available. First button pressed (left or right) is considered fire, the central button cannot be "fire" and there is no access to it until the driver is detected poured with a fire button. During installation checks for the presence of a Kempston joystick (reading from port #1F the first five bits) and when in its absence, he is excluded from the survey.5. To work on computers with a capacity RAM more than 48 KB becomes necessary indicate the current page number. These us- adjustments must be done every time yes, for example, it works IM 2 with playback I eat music on another page. System STRAN indicates the last value transferred to the port #7FFD by the function PAGE. Vector windows can be anywhere in memory: the window opener automatically resets it into a special buffer and works with it from - efficient. After opening the window it returns- put in place with corrected data by color, print, etc. The page is also for- remembered and restored. Appearance of the installation block: +O DEFB O ;BORDER color of the border when aiming on the beeper. +1 DEFB O ;PICPAG page number where the icons are located. +2 DEFB O ;COXPnumber of the save page under the windows. DEFW O ;TABSOHR the beginning of the system storage table. +5 DEFW About ;TABSPR directly save buffer. +7 DEFW O ;TABPIC address of where the icon file is located. +9 DEFW O ;P_KUR1 cursor position on the screen in pixels. +11 DEFB O ;DRIVE number of the current drive O,1,2,Z. +12 DEFB O ;LD_MIU number of the first physical sector of the disk +1З DEFB O ;LD_MAX number of the last physical number. +14 DEFB O ;SV_MIU is an analogue of the two previous ones, but for the function +15 DEFB About ;SV_MAX sector group records. +16 DEFW O ;STACK standard stack position (reg. SP). +18 DEFB O ;AND_KURS shell cursor number O,1,2. Values +12/+15 indicate to the shell the first and last numbers of sectors that some are physically present on the disk. Per- The first two values for loading are: for recording to disk. Gaps in numbering it shouldn't be! Sector size does not have values - so many bytes will be read, how much is there according to the sector size on disk. The driver is written in such a way that It monitors download addresses itself. The cursor position is indicated in pixels from the top and left edge of the TV screen and presentation order: lowest value is equal to the column, the highest value is line. As befits a shell "WINDOWS", the appearance can be replaced with your own. In this case, one should take into account Note that the cursor is only four in size acquaintances. When writing, the author manually was guided by common sense, so did not provided for the size of the cursor in half fault of the screen... System variable indicated - calling to the address of the cursor that is activated is currently set to FORMA.B The shell has three types of cursor: ma- small arrow like in Art-Studio, big arrow and finger. The cursor hasapprox. This is exactly what it looks like in a bit layout: CURSOR MASK 00000000 00000000 00011111 11111111 01100000 00000000 00001111 11111111 01010000 00000000 00000111 11111111 01001000 00000000 00000011 11111111 01000100 00000000 00000001 11111111 01010010 00000000 00000000 11111111 01011001 00000000 00000000 01111111 01011100 10000000 00000000 00111111 01011110 01000000 00000000 00011111 01010000 00100000 00000000 00001111 01000111 11110000 00000000 00000111 01001000 00000000 00000000 00000111 01010000 00000000 00000111 11111111 01100000 00000000 00001111 11111111 01000000 00000000 00011111 11111111 00000000 00000000 00111111 11111111 The cursor shape is bookmarked as follows - first two columns "cursor" in order from left to right, and then "mask" in the same way. Total 64 bytes for one type. 5. PRINT txt Positionwindow printing is indicated in the sign from the top and left edge of the screen and presented in the order described in the century- window tore. The text printing position is indicated on rotation from the window print position: low-order sign value - row, highest - column. A little it turned out to be a mess, but “we have what we have" (L.M. Kravchuk). Same standard positions and for printing pictograms. The shell is initially assembled with 42-character font. ATTENTION! IN VIEW THE APPEARING MEMORY LIMITATIONS MAINLY SHELL FONT FIRST 256 BYTES USED THEY ARE FOR OTHER PURPOSES, SO THE FIRST 32 IT IS NOT RECOMMENDED TO PRINT THE CHARACTER FROM ZERO TO #1F POUTING, T.K. THERE WILL BE "TRASH" ON THE SCREEN, BUT THE ADDRESS OF THE FONT IS INDICATED WITH ACCOUNT VOLUME OF THESE SYMBOLS! Please remember this! After installation in the variable SHRIFT le- its beginning lives on. Font length 2048 bytes. On the output after INSTALL in registers DE will be address for the second font, no larger size more than 2048 bytes. Used for printing a mask that hasdouble-byte view: 32 #0800 42 #0603 51 #0507 64 #040F where the high byte means the letter size in pixels, and the least significant one in mask bits when re- chat. If an alternative (additional) nitive) font, then to switch to it need to reorder system dimensions PIKSEL (if it is different from the main one) and addresses of the beginning of the font in the system SHRIFT. Naturally, you need to make settings from separately fromINSTALL,if this is not the first time. 7.DESCRIPTION OF SHELL FUNCTIONS When writing the shell, the author did not adhere to lived syntax in English, therefore the names of labels and subroutines can sound absurd. Sorry... For reasons I left no understanding of what you are writing about everything is as in the original program listing we. The function number comes first, and then it name. #40 _INSTAL - shell installation. in -HL, installation block. ### -HL,DE,BC,AF out -HL,address of the function table. DE, the beginning of the second font or the end shells. BC, for connecting RST 16. push-no. #41 _RAMKA - window opening function. in -IX,window vector. ### -IX,HL,DE,BC,AF. out -*** push-no. The function opens a window according to the parameters meters indicated by the window vector. Written algorithm so that the print and save cycle work synchronously, so if there is no co- commands to save the screen area, the address #0000 is substituted. This follows take into account those who have in the address space The ROM may not even be there... #42 _RESTOR -closes the current window. in - no. ### -all out -IX, mother window. push-DE,BC,AF. sys -(REGWIN)-set. The address is taken from the current window vector mother window, entered into the system REGWIN and register IX. Then goes to removing a window. #43 _KURSOR - print the cursor. in -VS, cursor position in pixels. ### -IX,HL,DE,BC,AF. out -*** push-no. sys -(IX+12) -sp. (P_KUR1) -set. (FORMA) - Spanish (REGWIN) - Spanish 5,(IX+9) -sp. for "REPER" op/off. A very important and serious program in shell. It sets the course position ra in pixels, reads mouse ports (channel A and B) and sets the initial value for amendmentsmovements. From the window vector is taken address where the system chain is located and by it determines the “impact” on the op- tion. #44 _DELKUR - delete the cursor. in - no. ### -IX,HL,DE,BC,AF. out -*** push-HL,DE,BC,AF,(IX+5). sys -(REGWIN)-sp. 3+4,7,(IX+5)-sp. Normal cursor removal with reaction, according to the value of bits 3+4,7,(IX+5). #45 _SELECT - menu selection. in - no. ### -IX,HL,DE,BC,AF. out -C, (RESPONSE) - menu polling result B,(KOMAND) - key polling result and mice. AF,(RESPONSE) - menu polling result. CF reaction to user action. push-no. sys -(KOMAND)-use+set.(AT_KUR)-set + use (ADRKUR)-install + use (P_KUR1)-set+use The coolest shell program ever. After polling the keyboard she looks at the type of valid interface and if it was mouse, then the position is corrected cursor without braking If not the mouse, then the cursor acceleration cycle from 1 to 4 pixels. If bit 5,(IX+9) is set, then the offset will always be 1and you can poke without pausing to release the keys. On the output in A will be the menu selection response. But the answer depends on the state of the flag CF. If the flag is reset, which means pressing the fire keys Vish did not happen or happened inside windows, but not on the menu! In this case, register A is not equal to #FF - fire is not pressed, normal movement Cursor movement or silence. If the flag is set updated - pressed "fire". Register A is equal to #FF - the click occurred outside the window; not equals #FF - number of the selected menu! Numbers- tion starts from scratch. It should be remembered that pressing the middle or non-fire button on the mouse is reflected in the response, as if nothing happens, so it is necessary view the contents of the cell KOMAND,a specifically - the bits responsible for the buttons. See the function description for the bit layout. INKEY. #46 _REPER - bounce protection. in - no. ### -HL,DE,BC,AF. out -in push-all sys - see "INKEY". The program checks all buttons (mouse and "fire") when pressed and the algorithm will not release as long as something is pressed. #47 _SOUND- click on the #FE port. in - no. ### -HL,BC,AF. out -*** push-all sys -(BORDER)-sp. #48 _STOP_M - check for pressing "cancel" buttons on the mouse. in - no. ### -IX,HL,DE,BC,AF out -AF,result push-IX,HL,DE,VS sys - see "K_MOUSE". Checksbit 5button ports on the mouse and if there is no click, then the flag will be Z.B registerAF the result of this survey. #49 _PRI_SP- print icons. in -E, line D, column in familiar places A, pictogram number. ### -IX,HL,DE,BC,AF. out -DE, column +3 (picture size) push-no. sys -(PICPAG)-sp. (IX+8,9)-sp. Prints an icon at the specified number measure and position in familiar places. Color beret from the window vector (IX+8). Icon numbering - ramm starts from scratch. Icon size standard: 72 bytes, i.e. three by three acquaintances. It's easier that way... #4A _PRHEX - hexadecimal printing of numbers. in -HL, a number from 0 to #FFFF. ### -HL,DE,BC,AF. out -*** push-HL,DE,BC. sys -see. "PRINT". Prints in the specified format. Before The number is marked with "#".#4B _PRDES - 10-digit printing of numbers. analogue of "PRHEX". #4С _PRINT - print one character. in -A, character from #00 to #FF. ### -IX,HL,DE,BC,AF. out -*** push-HL,DE,BC. sys -(IX+5,6,7,8)-sp. (SHRIFT) - Spanish (PIKSEL)-Spanish The main procedure for printing characters in text tabernacle window. Printing outside is not possible. on (if you don’t distort the position tions of printing...). Upon reaching the right the edge of the window is automatically translated to the next one, but if this is the last line ka, then to its beginning. Letter color from window vector (IX+8). Letter size and mask are taken from the system pair PIKSEL. This the only subroutine that prints no character codes less than #20 (32). #4D _ENTER - translate the print line in the window in -no. ### -HL,AF. out -HL push-no. sys -(IX+6,7). #4E _PRI_C - text printing cycle. in -HL, beginning of the text. ### -cm. "PRINT". out -HL,end of text+1 push-no. sys - see "PRINT". Cycle for printing menu texts. End of text always zero. A number of options are provided for the service tokens that can be inserted into text. The end of the text is zero, all codes are less than #14 - line feed....,#14,... - turns on the inverse printing bit ty in the window vector. ...,#15,... - turns off the print inversion bit tee. ...,#16,... - switch to free mode letter sizes. However, there is no specific system corrections! Only bit 5,(IX+5) is reset. ...,#17,n1,n2,n3,n4,... - switch to alternative user font with cor- rectification of the dimension of letters, where n1 junior, n2 high byte of the physical start address font; n3 mask for printing a symbol, n4 - character size in pixels. ...,#18,... - letter size is 8 bits....,#19,... - sets in the system SHRIFT address of the standard shell font. ...,#1A,n1,n2,... print the number in hexadecimal system. ...,#1B,... - auto-tabulation of relative text exactly the window boundaries. When working, any byte except for the color replacement token text less than the space code is considered the end of the letter counting operation. Output corrects the values of the current position of the chat text. ...,#1С,n1,n2,... - text decompression. Byte n1 contains the value of the number of torenium,n2 - character code. ...,#1D,n1,n2,... - 10-point printing, where n1, n2 -number to print....,#1E,n1,n2,... - new print position text. Byten1indicates the print line in pixels, n2 - column in familiarity. All parameters from the edge of the current window! ...,#1F,n1,... - replacing the current color with valuen1. #4F _NEW_AT - new text printing position in -E, line in familiar places. D,column in pixels. ### -DE,AF. out -DE push-no. sys -(IX+6,7). #50 _TABUL - centering the text in the window. in -HL, beginning of the text. ### -HL,BC,AF. out -HL-1.push-no. sys -(PIKSEL+1)-sp. (IX+6) -set. #51 _CHWIND - connection of the main font that shell. in - no. ### -HL out - no. push-all sys -(SHRIFT)-set (PIKSEL)-set #52 _PAGE - switching RAM pages. in -A,page number. ### -SUN,AF. out -AF, what is sent to the port #7FFD. push-sun. sys -(STRAN)-installs. Switches RAM pages. In the room there is bit ROM 48 BASIC and full port addressing #7FFD. #53 _SCRADR - getting the screen address. in -E, line D, column in familiar places. ### -HL,DE,AF. out -HL,screen address. push-no. sys - no. #54 _ATRADR - obtaining the attribute address ... - similar to the previous procedure. #55 _INKEY - poll of mouse, keys and joystick. in -no. ### -HL,DE,BC,AF. out -C,A - result. -HL -if the mouse worked, then but- cursor position. push-no. sys - no. The main procedure for polling external factors ditchimpact on the cursor or shell. Priority is given to the mouse, as the most “nimble” in the system. The button port is checked and if there is zero, go further to polling others devices. The first pressed (except central) the button is considered "fire". Yes- Next, the ports of the travel directions are checked and are compared with the value of the system ones, added by the KURSOR function. If there are differences chiya (the mouse moved), then it is adjusted value from the system P_KUR1, but not stored is given, but goes out toHL.Directions to motion bits are not indicated, but7bit set as a sign of mouse operation. Answer located in registers A and C. mouse bots is setting CF. Os- Talent devices are not checked! If not the mouse is touched, then the keyboard is polled tour and joysticks (Sinclair right & Kempston) plus cursors and ENTER. For times dividing the "sphere of influence" of the cursor keys and The Sinclair joystick is first polled for pressingCAPS SHIFT and if not pressed, then This is Sinclair. Keys used: O-left P-right Q-ir A-down SPACE/ENTER-fire. For determining the direction of cursor movement The following bits are used: BIT COMMAND BIT COMMAND 0 - fire 4 - left 1 - down 5 - 2 key mouse 2 - ir 6 - 3 key mouse 3 - right 7 - mouse 1-op 0-off #56 _K_MOUSE - quempston mouse survey. in - no ### -HL,BC,AF out -HL,new cursor position. -C,A—survey result. push-sun sys -(KOMAND)-set, if there is work. Poll of self-configuring mouse driver. If there is no mouse controller, then the output is Z. Only press buttons and install the seventh bit as a sign of operation on the mouse. #57 _LOADER - loading a group of sectors. in:HL,download address. D, track E, sector B,number of sectors. ### -IX,IY,HL,DE,BC,AF out - see explanation. push-IX,IY sys -DRIVE,L23796,ADR_LD. The function reads sectors by the specified address. Forcibly prohibits interrupts and DOES NOT RESTORE! На выходе флаг ZF имеет результат работы с диском: Z - ок, NZ - еггог. При ошибке в AF будет ее код: 0 - ок. 1 - disk еггог. 2 - read only. 3 - disk пот present. 4 - track пот formatted. 5 - break in program. Значения HL,DE при "ok" have the following parameters, at "eggog" - where the ob- scrap In registerBthere will be the remainder of the unfinished tanny sectors. Functions don't care set sector sizes on the disk. The main thing is not break the numbering sequence. #58 _SAVER - record a group of sectors. see LOADER #59 _MOTOR - stop the drive motor. saves everything, modeINTdoes not touch. #5A _INPUT - input a character string. in -DE, input buffer address. C,maximum string length. (IX+6),(IX+7)-should already be there. IY,23610 ### -allout -AF, exit key code. push-HL,DE,SUN sys -(INP_KOD)-set. Sets EI. In the system INP_KOD will be the code of the last pressed (not to be confused with entered) the key by which the exit the function. Exit is possible only by codes less than 32, namely: enter (13), cursor down (10), break (5), extend, etc. The function looks like a semi-finished product. From the outside initially compiled under the Russian register and capital letters. #5B _STAND1 - standard menu polling. There are no inputs. Works in current vector rum windows. Performs a transition according to the algorithm according to the transition address table. When from- less (outside the window press "fire"or button "cancel"on the mouse) deletes the current window and sets the main font for the wallpaper boxes. When you select a menu option, the current window is not deleted.#5С _STAND2 - standard menu polling. Complete analogue of the previous function for except that the current window when you bore option is removed. #5D _SETKUR - select the shell cursor. in -A, cursor number The system FORMA enters the address of the form cursor. The shell has three types of cursor, distinguished by numbers - 0,1,2. To specify of its species, located outside the shell- ki, you need to substitute your own in the system FORMA meaning. #5E _BREAK - poll of this key. in - no. ### -AF push-no. out -AF,result.If there is a key press break, then in AF there will be #05 and NZ. Otherwise zero and Z. #5F _IN_1F - poll of register #1F on VG-93. Sets DI. Saves all settings hystra. The output in AF has the value of VeGashki register. Use in case of mistaken in situations with disk functions, boxes are meaningless due to the peculiarities of the writings of these very functions. #60 _SBIT - active bit calculation. The function is made to determine the bit, which at the moment of pressing "fire" is indicated - shaft cursor.It’s useful to know if you suddenly re- you want to extinguish the anti-bounce protection in the flag and draw with the cursor. The answer is in AF. 8. EXAMPLE OF WORKING WITH THE SHELL ╔══════════ ═════════════════════════╗ I N S T A L L W I N D O W S ║# ╚═════════════════ ══════════════════╝# ######################################## ORG #6000 INCBIN "WINDOWS8";object code OS EQU #6000;entry point STRAN EQU OS+3 ;current page number REGWIN EQU OS+4 ;current window vector STACK EQU OS+6 ;standard position SP SHRIFT EQU OS+8 ;address of the current font PIKSEL EQU OS+10;letter size in pixels. FORMA EQU OS+12;cursor shape address K_SPR EQU OS+14;number of saves ADRKUR EQU OS+15;scr. address course. AT_KUR EQU OS+17;AT cursor in familiar places P_KUR1 EQU OS+19;^ column in pixels. P_KUR2 EQU OS+20;^ line in pixels. SETBIT EQU OS+21;active bit BORDER EQU OS+22;color INP_KOD EQU OS+23;INPUT exit code RESPONSE EQU OS+24;select menu number KOMAND EQU OS+25;key polling result DRIVE EQU OS+27;drive 0,1,2,3 L23796 EQU OS+28;analog 23796 ADR_LD EQU OS+30;next adr. if OK operat. B32 EQU #0800;mask for 8 bits letter B42 EQU #0603;6 bit letter B52 EQU #0507;5 bit letter B64 EQU #040F;4-bit letter List of function numbers windows`98 _INSTAL EQU #40;installation _RAMKA EQU #41;window printing _RESTOR EQU #42;deleting a window _KURSOR EQU #43;print cursor _DELKUR EQU #44;deleting the cursor _SELECT EQU #45;menu option selector _REPER EQU #46;anti-bounce _SOUND EQU #47;click _STOP_M EQU #48;checking cancellation with the mouse _PRI_SP EQU #49;icon printing _PRHEX EQU #4A;hex print HL _PRDES EQU #4B;dec print HL _PRINT EQU #4С;print one character _ENTER EQU #4D;print line feed _PRI_C EQU #4E;print a line of text _NEW_AT EQU #4F;new print position _TABUL EQU #50;centering a line of text _CHWIND EQU #51;windows main font _PAGE EQU #52;switching RAM pages _SCRADR EQU #53;screen address _ATRADR EQU #54;attributeaddress _INKEY EQU #55;full control poll _K_MOUSE EQU #56;quempston mouse survey _LOADER EQU #57;loading a group of sectors _SAVER EQU #58;sector group entry _MOTOR EQU #59;disable motor _INPUT EQU #5A;enter a character string _STAND1 EQU #5B;selector. The window remains _STAND2 EQU #5С;selector. The window is deleted _SETKUR EQU #5D;set cursor (0,1,2) _BREAK EQU #5E;break click poll _IN_1F EQU #5F;poll of port #1F on VG93 _SBIT EQU #60;active bit after SELECT ╔══════════ ═════════════════════════╗ D E M O V I S I O N║# ╚═══════════════════════════════════╝# ##################################### ORG #8000 ;user soft LD HL,(#5С51) ;сохранить теку- LD (L5C51),HL ;щий поток rst LD HL,TABINST ;блок install LD (TABINST+16),SP;стандарт CALL OS ;вызов оболочки DEFB _INSTAL ;номер функции ;out:HL,начало таблицы адресов функций ; DE,начало альтернативного шрифта ; ВС,адрес подключения RST 16 LD (#5С51),ВС ;подключ. rst 16 JR CONTI ;и так далее...;````````````````````````````````````````` ;------ ИНСТАЛЛЯЦИОННЫЙ БЛОК WINDOWS ----- TABINST DEFB 0 ;BORDER 0 DEFB 0 ;PICPAG 1 DEFB 0 ;page сохранений 2 DEFW TABSOHR ;сист. сохранений 3 DEFW TABSPR ;буфер сохранений 5 DEFW TABPIC ;где пиктограммы 7 DEFW #1010 ;P_KUR1 9 DEFB 0 ;DRIVE 11 DEFB #01 ;LD_MIN 12 DEFB #10 ;LD_MAX TR-DOS 13 DEFB #01 ;SV_MIN 14 DEFB #10 ;SV_MAX TR-DOS 15 DEFW 0 ;STACK 16 DEFB 1 ;N_KURS 0,1,2 18 L5C51 DEFS 2 ;сохранение потока RST 16 ;------ Буфер и системные сохранений ----- ;Предполагаемые размеры: ;TABSOHR:30 байт для 5 окон. 5*6=30 ;TABPIC :1440 байт для 20 пикт. 72*20=1440 ;TABSPR :вся оставшаяся память страницыTABSOHR EQU #С000 ;5 окон 30 TABPIC EQU TABSOHR+30 ;20 pick 1440 TABSPR EQU TABPIC+1440 ;сюда сохранять... ;````````````````````````````````````````` CONTI LD IX,R_DEMO;вектор окна LD (REGWIN),IX;заносить толь- CALL OS ;ко первый раз!!! DEFB _RAMKA ;open window LD HL,Т_DEMO;текст в окне RST 16 ;после install DEFB _PRI_С ;можно rst 16 CONTI1 LD ВС,(P_KUR1);позиция курс. CALL OS ;print cursorDEFB _KURSOR DEMKA1 CALL OS ;вызов селектора DEFB _SELECT ;меню JR NC,DEMKA1;нет выбора OR A ;за пределами JP M,OTMENA ;окна? CALL OS ;удалить курсор DEFB _DELKUR CALL OS ;защита от дре- DEFB _REPER ;безга LD L,(IX+14);адрес таблицы LD Н,(IX+15);переходов по JP ADD A,A ;из номера меню LD Е,A LDD,0 ADD HL,DE LD Е,(HL) ;адрес перехода INC HL ;на user подпрог- LD D,(HL) ;рамму PUSH DE ;run program RET OTMENA CALL OS ;защита дребезга DEFB _REPER CALL OS ;удалить курсор DEFB _DELKUR CALL OS ;удалить окно DEFB _RESTOR LD SP,(STACK);станд. значение ;здесь надо возврат вselection cycle for ;normal running around the windows... ; JR CONTI1 _RET LD HL,(L5C51);restore LD (#5С51),HL;flow rst 16 EI ;and exit from RET ;programs ;example of entering a line of text INP_TXT LD DE,#0006;print position RST 16 ;input string DEFB _NEW_AT RST 16 ;triggering protection DEFB _REPER ;output RST 16 ;by enter, because DEFB _REPER ;он есть "fife"! LD DE,BUFTXT;буфер ввода LD С,22 ;макс.размер line RST 16 ;вызов input`а DEFB _INPUT RST 16 ;возврат в селек- DEFB _REPER ;тор текущего ок- JR CONTI1 ;на ;------ Пример окна ------- R_DEMO DEFB 6,8,20,9,114,1,0,0,0,#9С DEFW R_DEMO,S_UPR,J_UPR DEFB #1B,"Управление",0 Т_DEMO DEFB 13,#1B,"Kempston mouse",13 DEFB #1B,"Kempston joy",13 DEFB #1B,"Sinclair joy II",13 DEFB #1B,"Cursor key",13 DEFB #1B,"QAOP Space, Enter",13,0 S_UPR DEFB 6,10,20,1,6,15,20,1,#FF J_UPR DEFW _RET,INP_TXT BUFTXT DEFS 41 ;for input buffer NOTES. Based on how constant early programmers tried to work with shell, I decided to comment separately some nuances. For menu selection you don't have to type it every time sequence of functions _KURSOR,_SELECT and so on. The beauty of the shell is that the branching of the algorithm for each the open window is bound to the window vector. This way you can dial the above- the specified sequence (in the example this is from the mark CONTI1 to OTMENA enable strictly) and then carry out selectionname- but with this fragment! Look carefully Here is an example of working with the shell and you will understand no problem! THE COMPANY GUARANTEES. Another important nuance for lovers tel to intercept the output in 48Kb ROM via RET at 23746. Disco functions output operations and register reading #1F also make such an interception that they score three bytes at the above address. Therefore ensure their timely installation, if necessary. 9. CONCLUSION This is how it turned out. How are you already guessed it - the origin of the shell is from the beloved program was once beloved by many well-known Spectrum hacker Nikolai Rodionova "DCU 2.xx". This version is is the eighth alteration of that wind. At this stage, work to improve development has been curtailed, as further bells and whistles require additional resources memory, which in this case is no longer acceptablemo. Who wants to develop further in this direction - STS into your hands...

Share your thoughts about the article