|
8BIT OPERATING SYSTEM FOR ZX-SPECTRUM
\history \doors2000
DOORS 2000 (a part 3)
(Year 2000, the wind of the changes which have broken a roof, at all..)
API FUNCTION
(The basic functions kernalja DOORS 2000)
Here we shall consider the basic functions (read commands) kernalja. Why the cores? Because is still Memory Function (functions of work with memory) and Left Function (additional functions or as it was expressed KVA - levovatye:) but anyhow useful). And besides it is still Vectors (a vector of devices) and Variables (variables), but we shall return to API to functions ?
mINIT
Full initialization kernalja Doors. It is caused once before start of system (OS) or own program. Has no parameters and does not demand entering data. On an output as does not give out any variables.
mCHECKON
The given function, at the reference to it, returns in A (accumulator) a code of an element above which now there is an arrow. The code specifies a serial number of an element in the script. On an example: *00 - always will be a window (if the arrow is abroad windows the code is equal *FF), further *01 - can be appropriated to the button of closing of a window (if it is certainly used in the given type of a window) *02 ? and so on all elements of the script. Dannoju it is convenient to take advantage of function when it is necessary to trace an element above which the arrow, on an example hangs now at work with the text.
IN: it is not required.
OUT: in A the code of an element above which now is an arrow.
mCHECKONITEM
As well as above described design, the given function, at the reference to it, returns a flag With - if the arrow is on an element of the script, flag NC - if is not. The address of an element of the script for check is set in register pair IX. It is convenient to take advantage of the given function when it is necessary to trace a concrete element, for example it would be possible to make that at prompting on the button click was distributed or it changed color.
IN: IX - the address of an element of the script for check
OUT: the flag With - belongs, NC - is not present.
mREDRAW
The given command compulsorily forces kernat to draw again all elements of the script since an element specified in IX. The given function is convenient for using at switching between several windows.
IN: IX - the address of an initial element of the script for copying
OUT: target data are not present.
mREDRAWITEM
The given command compulsorily forces kernal to draw again only one element of the script specified in IX. The given function is convenient for using at frequent change and a conclusion of the information, for example as that at a conclusion of hours.
IN: IX - the address of an element of the script for copying
OUT: target data are not present.
mPRMENU
The given command compulsorily forces kernat vyrisovat all elements of the script since an element specified in IX. It is necessary to take advantage of the given function at creation of a new window with elements.
IN: IX - the address of an initial element of the script for vyrisovki
OUT: target data are not present
mPRITEM
The given command compulsorily forces kernal vyrisovat only one element of the script specified in IX. The given function is convenient for using when all is necessary vyrisovat only one changed element, instead of components; it considerably raises speed.
IN: IX - the address of an element of the script for vyrisovki
OUT: target data are not present.
mSYNC
The address of standard synchronization kernalja. To the given address there is a value 201 (*C9) - komadna RET and corresponds to the beginning of a portrayal of the screen.
IN: entrance data are not required
OUT: target data are not present
mSTY and mSTN
The given two commands resolve or forbid display of an arrow. Thus their processing does not stop. It is convenient to take advantage at copying a background or other objects on new. And happens and so if to not disconnect an arrow and to deduce new object on the same place where an arrow at following updating the screen, the arrow will restore under itself the previous background and the glitch will turn out!
IN: entrance data are not required
OUT: target data are not present
mWAIT
This command starts on execution the script. The window (a command mWINMEMCR), and all elements of the script vyrisovany (a command mPRMENU) should be preliminary created in memory. In HL the address of synchronization is underlined, it is desirable mSYNC.
IN: in HL the address of synchronization
OUT: under the standard of target data is not present
mPRFIZ
The given function allows to carry out a press a proportional font on physical coordinates of one symbol is not dependent on borders and a site of a parent window, i.e. the coordinate (0,0) will be always the left top corner of the screen. In A (accumulator) the code of a symbol, in register pair BC - coordinates in pixels is set. And that is remarkable if to organize a press of the whole line kernal itself watches change of coordinate Y! That relieves of superfluous efforts in occasion of the account of displacement at a proportional press. As well as at a press from the script, here if in And ' =0 that a normal press, and if A ' =1, a negative. We shall consider an example of the script:
WA022
PE4AT
LOOP
RETA | DW RETA
DB 0
DW 0
DB 9
DW PE4AT
DW RETA
DW RETA
DW RETA
LD BC, *0000
LD HL, TEXT
LD A, (HL)
CP *00
JR Z, RETA
CALL mPRFIZ
INC HL
JR LOOP
SCF
RET
|
; A following element of the script
; Own element
; Procedure of a press
; Coordinates of a press
; A line of the text
; We take a trace. An element
; The end of the text?
; That on an output
; If is not present - it is printed
; CARRY ON (flag)
; We leave |
IN: in A - a code of a symbol, BC - coordinates
OUT: under the standard of target data is not present
mPRFIZ5
The given function allows to carry out a press a font 5x5 on physical coordinates of one symbol. All above described for mPRFIZ primenitelno and for work with this function.
IN: in A - a code of a symbol, BC - coordinates
OUT: under the standard of target data is not present
mCURSOR
IN: in A - type of the cursor, if *FF, in HL - the address, With - quantity of phases, in B - bank
OUT: under the standard of target data is not present
mCURITEM
As well as the previous command, mCURITEM allows to alter the cursor but if mCURSOR sets appearance for all system mCURITEM becomes attached to concrete object, and changes the cursor in that only a case if have guided at this object. mCURITEM it is caused from the script, therefore we shall consider an example:
MENEX2 | DW BEEP
DB 1
DB 0
DW CURSOR
DB 0
DB 2
DW mCURITEM
DB *FF
DW 0
DB 5
DB 8,21,0
DB "TOOLS", 0
| ; the Address of caused procedure
; Event (if the button have pressed)
; Quantity of phases
; The address of the cursor
; Bank of memory
; Type of the cursor
; Installation of the cursor
; The cursor have guided at object
; A following element of the script
; A press a font 5x5
; Coordinates
; The text |
Now, what we have? At prompting the cursor on word TOOLS, it will turn to the image hands (type 2). If we use standard cursors values above the two (type of the cursor) it is necessary to hammer in all in zero; if you wish to use the type of the cursor then it is necessary to specify all parameters as in case of with a command mCURSOR. If we shall press the left button of the mouse (event 1) that will be caused procedure BEEP.
IN: it is set as an element of the script
OUT: under the standard of target data is not present
mIFITEMOFF
It is convenient to take advantage of this function, when it is necessary to execute, any action after from an element it is shown the arrow (is cleaned). In register pair HL the address of caused procedure is set, all can be up to 16! Procedures. We shall consider work of the given command on an example:
On an example it would be necessary for us that at prompting on an inscription " Grodno Rulez! " The cursor changed the kind for a hand and when it have cleaned, back in a normal arrow ?
It is possible to take advantage, certainly, of a command mCURITEM, but other variant of the decision of the given problem, by means of a command mITEMOFF. Is possible also
WA03 | DW NEW_CURSOR
DB *FF
DW WA03_
DB 5
DB 16,20,0
DB " Grodno Rulez! ", 0 | ; Our subroutine
; If have simply guided an arrow
; A following element of the script
; A press 5x5 |
Here so the part in the script, and here so the subroutine ? Looks
NEW_CURSOR
NORMAL | LD A, 2
CALL mCURSOR
LD HL, NORMAL
CALL mIFITEMOFF
RET
LD A, 0
CALL mCURSOR
RET
| ; To establish the cursor
; In the form of a hand (a code 2)
; To cause procedure NORMAL
; As soon as the cursor have reduced with
; Object
; To establish standard
; A kind of the cursor (a code 0) |
Apparently from an example, anything complex in use mITEMOFF is not present, it is possible to find various application of the given function. On an example it would be possible to make that at prompting on object click or any sound signal was distributed, and at prompting on a picture animation ? Joined
IN: HL - the address of procedure
OUT: under the standard of target data is not present
mIFITEMOFFDEL
As it is clear from the name mIFITEMOFFDEL it kills installations made in mIFITEMOFF. In register pair HL the address of the established procedure is set.
IN: HL - the address of procedure
OUT: under the standard of target data is not present
mRUNOFFITEM
Function mRUNOFFITEM with make related above described mIFITEMOFF. As it is noticed above in base mIFITEMOFF it was possible to bring about 16 elements so the question arises: " And who will delete them therefrom? ":) and so the problem mRUNOFFITEM is reduced just to that that:
- Function scans the base (16 elements) for the addresses brought by means of mIFITEMOFF, and having found the first got carries out it.
- All base (16 elements) is cleared and is ready to further use.
If base to not clean that data will hang before restart of system: (it should be considered at creation of the final module of the program.
mPROCSTRON / mPROCINTERON
Commands mPROCSTRON and mPROCINTERON give an opportunity to hang up on interruptions own procedures, with that only a difference that: mPROCSTRON - the hung up procedure will be will be executed between vyrisovkoj arrows, and mPROCINTERON - the hung up procedure will be will be executed on INT'a. What is better for using? It is necessary to define most as will depend only on, whether the arrow will catch updating or not. And if the arrow catches updating, means or it is necessary to hang up procedure on mPROCSTRON, or on mPROCINTERON already is hung up procedures (is available in view of on steps) too much! It is necessary to notice what not on all models of computers of ~71000 steps (as for example "PENTAGON"), it is possible to consider as the standard ~69000. As there are machines with a separate field of memory (on an example "BYTE") and on such models in addresses with *6000 till *8000 speed of performance of the program falls on 25 %!!! Too it is necessary to consider and do It with a small stock. Though certainly you anybody, does not limit and it is possible though turbo-mode to use. Only will not forget about it to inform the user - type of a window with minimal requirements. As if to opportunities most kernalja they are limited only mPROCSTRON. On it probably to hang up only 16! Procedures. So for that what to hang up procedure on interruption, it is enough to specify the address in register pair HL and to cause mPROCSTRON or mPROCINTERON. On an example I when wrote plejer AY-modules (AMP) under D2K has distributed resources as follows: I have hung up copying of the indicator of levels and a player on mPROCINTERON, and copying chasikov on mPROCSTRON. It has allowed will get rid of updating (blinking) of an arrow. These components it is better to do a call (installation of procedures) in the beginning of the program after the window is already set also all elements of the script vyrisovany, on an example so:
| LD IX, WA
CALL mWINMEMCR
CALL mPRMENU
LD HL,
| ; the Beginning of the script
; Creation of a window
; Vyrisovka elements of the script |
IN: HL - the address of procedure
OUT: under the standard of target data is not present
mPROCSTROFF / mPROCINTEROFF
If commands mPROCSTRON and mPROCINTERON give an opportunity to hang up on interruptions own procedures would be probably law that mPROCSTROFF and mPROCINTEROFF remove earlier the established procedures. As enough to specify in register pair HL the address and to cause mPROCSTROFF or mPROCINTEROFF.
IN: HL - the address of procedure
OUT: under the standard of target data is not present
mSETFNTP
mSETFNTP establishes a current proportional font. In register pair HL the address of a font is set, and L should be always equal *00 (*F100 address is for example possible). In accumulator A the bank of memory where the font is located is set.
IN: HL - the address of a font (L = * 00), A - bank of memory
OUT: under the standard of target data is not present
mSETFNTPS
mSETFNTPS establishes the main proportional font current i.e. the font which has been certain in the beginning of loading of system. On an output from procedure in register pair HL the address of the previous font, in A - bank of memory.
IN: under the standard of entrance data is not present
OUT: HL - the address of the previous font, A - bank of memory
mSETFNT5X5
mSETFNT5X5 Establishes a current font 5X5. In register pair HL the address of a font is set, and L should be always equal *00 (on an example *F700 address is possible). In accumulator A the bank of memory where the font is located is set.
IN: HL - the address of a font (L = * 00), A - bank of memory
OUT: under the standard of target data is not present
mSETFNT5X5S
mSETFNTPS establishes the main font 5X5 current i.e. the font which has been certain in the beginning of loading of system. On an output from procedure in register pair HL the address of the previous font, in A - bank of memory.
IN: under the standard of entrance data is not present
OUT: HL - the address of the previous font, A - bank of memory
mMAKEFNTPS / mMAKEFNT5X5S
The given two commands (mMAKEFNTPS / mMAKEFNT5X5S) establish fonts (proportional and 5x5 accordingly) in system as the standard. In register pair HL the address of a font is set, and L should be always equal *00 (on an example *F100 address is possible). In accumulator A the bank of memory where the font is located is set.
IN: HL - the address of a font (L = * 00), A - bank of memory
OUT: under the standard of target data is not present
mEXITW
mEXITW is an output from a window if to be little bit more exact, it is even not simple from a window and from the given script. Usually mEXITW it is hung up on the button of closing of a window, as that on an example:
WA01 | DW mEXITW
DB 4
DW WA02
DB 12
DB 0, *00, *38
| ; we Leave
; If have pressed the left button
; A following element of the script
; The button of closing of a window |
IN: under the standard of entrance data is not present
OUT: under the standard of target data is not present
mITEMFUNCTION
Performance of functions of components of the script. About it already it was spoken above, but I shall repeat the basic moments. We shall recollect that part where we cause function (the example is taken from the program of work with a roller):
MDSK1D |
XOR A
LD BC, *3003
JP mITEMFUNCTION | ; CLEARING OF AREA AT VYPECHATKE
; Number of caused function (*00)
; An operating code
; The command kernalju to execute function |
The Operating code in the given situation matters: reg. With / bit0 =1 clearing pikselnaja, bit1=1 clearing of attributes; If attribute clearing, in reg is included. B there will be a code of attributes (*30 in our case) what to decorate cleared area.
IN: in A (accumulator) number of caused function (from 0 ?) Is set
OUT: under the standard of target data is not present
mSETTIMECUR
The given command establishes the temporary cursor above current object, and is reserved for the further expansion of functions kernalja and here will not be described.
mWINMEMCR
The given function is caused before performance of elements of the script. mWINMEMCR reserves in memory area and keeps there a background under a window. In register pair IX the address of a window (an initial element of the script) is set.
IN: in IX address of a window
OUT: under the standard of target data is not present
mWINMEMDEL
Function mWINMEMDEL return mWINMEMCR. It is caused after closing a window (a command mEXITW). mWINMEMDEL deletes from memory area where the background under a window has been kept. In register pair IX the address of a window (an initial element of the script) is set. The note: If there is a background under a window, kill a window and vypechatat a background; if the window is not present - that simply kill mem.
IN: in IX address of a window
OUT: under the standard of target data is not present
mWINMOVE
Function mWINMOVE is intended that would be possible tjagat a window. It has no entering parameters and is used directly in a body of the script, on an example:
WA | DW 0,0
DW mWINMOVE
DB 4
DW WA01
DB 0
DB 1,8
DB 18,10*8
DB *28, *0F
DB 0,0,0
DB " Window *01 ", 0 | |
If it is necessary before tjaganiem to execute windows still any actions (as that to disconnect animation sprajtov) it is enough instead of mWINMOVE to insert the reference to the procedure to example MOVIE, and there already to specify on mWINMOVE:
MOVIE | LD HL, DISCOV
CALL mPROCINTEROFF
CALL mWINMOVE
CALL INIT
LD HL, DISCOV
CALL mPROCINTERON
RET
| ; we Remove from interruption
; vyrisovku the indicator
; Tjagaem a window
; Initialization of the indicator
; We establish on interruption
; vyrisovku the indicator |
Here so it is for example realized in AMP'a (AY-Modyle Player)
IN: under the standard of entrance data is not present
OUT: under the standard of target data is not present
mWINMEMEX
The given command changes a window and a background kept in memory, places.
IN: under the standard of entrance data is not present
OUT: under the standard of target data is not present
mCOPYTOEXT
The given command copies the basic screen (*4000) in 7-th bank (*C000.)
IN: under the standard of entrance data is not present
OUT: under the standard of target data is not present
mCOPYTOMAIN
The given command copies to 7-th bank (*C000) in the basic screen (*4000.)
IN: under the standard of entrance data is not present
OUT: under the standard of target data is not present
mGETFNTADRP
The given function returns the address in register pair HL and to bank in A (accumulator) of a site in memory of a proportional font.
IN: under the standard of entrance data is not present
OUT: HL - the address, A - bank.
mGETFNTADR5X5
The given function returns the address in register pair HL and to bank in A (accumulator) of a site in memory of a font 5x5.
IN: under the standard of entrance data is not present
OUT: HL - the address, A - bank.
mKEY
The given function returns a code of the pressed key. In A and E - a code in format Doors, in D - in format ASCII. (the Table of codes in the appendix)
IN: under the standard of entrance data is not present
OUT: A, E - a code in format Doors, D - in format ASCII.
mWINMOVEH
The given function moves a window, it is reserved for the further expansion of functions kernalja and here will not be described. Well and if briefly generally mWINMOVEH is a minorant function mWINMOVE, in A (accumulator) the type of moving *FF - standard is set, *00 - borders of the screen are not checked.
IN: And - type of moving
OUT: under the standard of target data is not present
mKEYCLR
The given command clears the buffer of the keyboard. As well as in any normal operational system, in D2k input from the keyboard keshiruetsja and if it is necessary to clear urgently a cache is used the given command.
IN: under the standard of entrance data is not present
OUT: under the standard of target data is not present.
|
|