8BIT OPERATING SYSTEM FOR ZX-SPECTRUM
DOORS 2000 (a part 1)
(Year 2000, the wind of the changes which have broken a roof, at all..)
What is D2K or in what differences DOORS 2000 from DOORS ' 96,97,98,99
So, the most important difference D2K from the previous versions in the idea of work with kernalem. Earlier (as you could will familiarize above) the reference to kernalju was through separate points of an input, type has caused procedure to draw the button, it is drawn and for system has no value, i.e. it was necessary to process independently coordinates of an arrow, event when it have pressed (have released) and so on ?
Now the ideology of a writing of the program has changed. Kernal and the program an integral part each other also work together instead of as earlier one caused another. The program represents a certain script of actions and conditions - what to do and how to behave kernalju in this or that situation. For a basis kernalja it is possible to take the interface of work with an arrow (running forward, I shall tell that without the mouse of work with d2k it is impossible to consider high-grade). It sets event'u (events). " That in the given situation occurs? " - have pressed the right button of the mouse or have guided the cursor at object of all this it is displayed in event'ao. The window interface Further follows. Though, to tell the truth, it even should be carried to a priority component as construction of any program should be begun with creation of a window:), and then only already to place scenery, frames, buttons and so on.
So such d2k? OS or a set of commands? To tell the truth, the question rhetorical enough ? As before on it to answer, costs will be defined that for you OS? If first of all cleanly disk functions the answer but unequivocal - is not present: (For me the main thing the convenient and practical interface for the user, I pursued this purpose, creating system. With change of ideology of a writing of programs under d2k (thanks KVA) the interface became not only convenient for users, but also for coders which will write own programs under d2k (at least, I so I hope ?).
D2K / 2 (IN THE CUT)
(DOORS 2000 - so with what you is?:)
Here I have decided to finish already with transfusion from empty in empty and to pass directly to consideration of the system as a whole.
So, we shall begin with work with memory. By default d2k understands any machine as zx-spectrum 128 as it is not regrettable, but about 48 KB the system will not work. What to work with the expanded memory, it is necessary proinstallirovat the driver of the expanded memory. And it is absolutely not important, what machine at you pentagon, kay or profi. If the driver correct and the program works only through it, instead of breaks directly rulit banks the success is guaranteed:) what to write the driver of memory it would be necessary to adhere to the certain points of an input. And if to be more exact, it is necessary to have following heading:
| ORG *C000 |
; The size of the driver in bajtah
; Initialization of the driver
; Work with the expanded memory (physical)
; Work with the expanded memory (indirect)
; A call of the basic screen (*4000)
; A call of the additional screen (*N000)
Further, I think, it is necessary to pay attention to structure of the basic memory (i.e. 128 KB). It consists from: the basic screen, the buffer of the printer, area of system variables and area accessible to use:
The area accessible to use can be broken in turn on:
| *4000 - *5AFF || Area of the basic screen |
| *5B00 - *5BFF || Area for the driver of the printer |
| *5A00 - *5FFF || Area of system variables BASIC and TR-DOS |
| *6000 - *FFFF || Area accessible to use. |
It is not obligatory, that a font 5x5 and a proportional font should it is loaded in the area allocated above, simply variable pFONT5 and pFONT by default specify values *F100 and *F700. At their initial initialization in system it is enough to specify the address and bank of memory where they will be stored! However it is necessary to pay your attention to that that, it is possible to do these manipulations during a writing and debuggings of your program. When you awake to start your program from system the driver of memory, accommodation of fonts and other elements will settle down in memory as they have been adjusted in system!!! On it also it is not necessary to become attached to rigid addressing! But about it we shall talk little bit later, in the chapter about creation of the finished appendix under d2k.
Well now, I think the general idea of work with memory is clear and it is a high time to pass to the keyboard and a mousy. Repeating, I shall tell once again that without kempston mouse management very much and very much it is not convenient, therefore very urgently I recommend to connect this device! But if at you it is absent, it is not fatal. At work with the keyboard the idea by principle EMS (E-mage Modem Station) i.e. if it is necessary to operate an arrow you easy use keys Q, A, O, P, SPACE, M - upwards, downwards, to the left, to the right and an active is taken. If it is necessary to enter the text we are switched to this mode by pressing CS+SPACE as and back. At input of the text for switching various modes following combinations are used: CAPS LOCK - lower case/capital, EDIT (CS+1) - a ?on/armour. Well and accordingly SHIFT, SPACE and ENTER - on their direct purpose. As if to other devices, such as, AY-mouse, kempston joystick they are not supported yet kernalem (versions 3), b
| *6000 - *97FF || Area - the bottom memory (LowMem) |
| *9800 - *BFFF || Itself kernal d2k |
| *C000 - *F0FF || Area - the top memory (HighMem) Bank *10 |
| *F100 - *F6FF || Area - a font 5X5 |
| *F700 - *FFFF || Area - a proportional font |
ut the future they are planned will be taken by means of special drivers.
Well here when it is finished with memory and devices, it is a high time to talk about a highlight of system - the script! We shall consider the elementary example opening of a window:
| The Code of the Script || IX |
| DW 0,0 ||-7,6-9,8 |
| DW RET_I ||-5,4 |
| DB 4 ||-3 |
| DW DAT2 ||-2,1 |
| DAT1 DB 0 || 0 |
| DB 0,0 || +1, +2 |
| DB 32,24*8 || +3, +4 |
| DB *28, *0E || +5, +6 |
| DB 0,0,0 || +7,8,9 |
| DB " D2K window ", 0 || +10 |
At first sight a heap of figures and nothing is clear, except for probably phrase " D2K window ":) But as they say, the first impressions are deceptive. Running forward, I shall tell, that for work with elements of the script again register pair IX is required to us, therefore displacement concerning it and are resulted in the right column, here only values have exchanged (rather Doors ' 96-99).
So about all under the order:
| IX displacement || Given || Comments |
| Attention! Data only at work with a component window (to create a window) |
|-9,8 || 0,0 || (0-standard) Synchronization we shall consider the Address of procedure of synchronization little bit later. |
|-7,6 || 0,0 || The Address of procedure of processing of the keyboard (0-standard) About it too little bit later. |
| The standard heading for each element (-5,-4,-3,-2,-1,0) Further follows|
|-5,-4 || RET_I || The Address of processing of events (event). In our case it specifies on RET. That is that would not occur in any way to a window to not react. |
|-3 || 4 || The Mask of events (event) on what to react. In our case 4 - have just pressed left knopu mice. Basically it would be possible to put and 0 as all of us exactly were not going to undertake what actions. (the table of events (event'ia) below) |
|-2,-1 || DAT2 || The Address of a following element if *0000 it is last element and means the end of the script! The following element of the script is not so obligatory for placing at once for previous, it is possible to scatter them though in general on all memory:) |
| +00 || 0 || The command kernalju Here is underlined what to do. In this case 0 - specifies, that the window will be created. |
| The description characteristic only for a component window Further follows: |
| +01 || 0 || Initial coordinate X (a). Initial as at the further moving a window it will be will change together with its position concerning all screen. (a) - means that coordinates are set in attribute units (cursors) and can accept value from 1 up to 32. |
| +02 || 0 || Initial coordinate Y (p). All above told as concerns also to coordinate Y, at the further moving a window it will be will change together with its position concerning all screen. (p) - means that coordinates should be set in pix and can accept value from 1 up to 192, but in this case it is recommended to set values multiple 8 (0,8,16,24,32 ?). For what? Business all in that that at a conclusion of a window, kernal certainly itself will approximate values up to multiple 8, but here at the further conclusion of the text and scenery, glitches will begin:) as data it will use, which distances to it you ? |
| +03 || 32 || Size X (a) - the size of a window across (1-32) |
| +04 || 24*8 || Size Y (p) - the size of a window on a vertical (1-192) As is recommended to set values multiple 8! |
| +05 || *28 || Attributes of the window |
| +06 || *0E || Attributes of heading of a window |
| +7,8,9 || 0,0,0 || The Given cells are reserved under needs kernalja! It is recommended to leave them alone!:) |
| +10 || " D2K window ", 0 || The Text in heading of the window, necessarily terminating a code *00! |
Here so, basically the script also is under construction. It can consist both of standard components, and from your own. As work with bibliotechkami (LIBS), but as they say to all the time is possible.
Finishing conversation on "cut":) Doors up and down, it would be desirable to direct your attention to one highlight of system, variable - pTEKID. Than it so is remarkable? And here than ? it is an element of one interesting branch kernalja. Unique number of the appendix I it am stored In it ? feel to what drive? YESSSSSSS!!!!! mnogozadachnost on a spectrum! If in the beginning to one program to appropriate pTEKID=1, and the second pTEKID=2 then changing value of this variable it is possible to jump that in one appendix in another! At you the question certainly arises: And who will appropriate these numbers and will be switched between appendices? The natural question, will be engaged in it File manager - but its creation in the project and consequently to speak about it early: (However! Other variable pTEKSD - stores unique number of a window that the enclosed windows allow to not get confused when many, yes they still all and compete ?
(Work with a mousy of coz ?)
| The left button of the mouse (the analogue of the keyboard is not present) Is pressed|
| The left button of the mouse (the analogue of the keyboard is not present) Is wrung out|
| Have just pressed the left button of the mouse (the analogue of the keyboard is not present) |
| Have just wrung out the left button of the mouse (the analogue of the keyboard is not present) |
| The right button of the mouse (analogue of the keyboard - SPACE, M) Is pressed|
| The right button of the mouse (analogue of the keyboard - SPACE, M) Is wrung out|
| Have just pressed the right button of the mouse (analogue of the keyboard - SPACE, M) |
| Have just wrung out the right button of the mouse (analogue of the keyboard - SPACE, M) |
| Pressed Nothing, but the cursor is above object, it is convenient at change of appearance of the cursor, depending on the induced object. |
X - means that here can be as 0, and 1-oa. That is if we wish to receive a combination of events, type: the left button of the mouse have pressed and hold already long time, and right have just pressed, we shall receive a code: BIN %00000101, HEX *05. I.e. as a matter of fact they simply develop. In more detail about events we still shall talk.
THE PROGRAM UNDER D2K
(With what to begin? ?)
Here we we shall consider initial lines of any program under d2k and we shall smoothly pass to components of the system. (the small remark: examples of initial texts written under ALASM 4.2 are hereinafter resulted, but them will not make the big work to export to other assemblers, such as TASM, STORM, XAS, ZXASM and others ?)
So, with what to begin? ? first of all it will be defined, what we write? If it will be the small program within the limits of 8 - 10 KB, or the resident (and about residents we still shall talk separately), quite to it a place in LowMem (*6000 - *9800 will suffice). Well and even if will not suffice:) always it is possible kick'ioou workbench aka file explorer (from it we actually only to start the program and we shall be). If at us more global project, for example the text editor, then business are a little bit more difficultly, as before the beginning of a writing of the project it is necessary to paint all nuances and necessary memory, as it () to us simply should be elicited memory at kernalja:) as to make it we shall consider further under the text, and now we shall go further. After we were defined and have understood with memory, we shall pass directly to codes:
First podgruzhaem the block of fonts 5x5 and proportional.
Then we load itself kernal.
Well and now labels kernalja, without them to one procedure kernalja will not really address. In the given file "MDOOR2K" labels for kernalja versions 2 as it has a little changed in difference from version 0 and 1. The description of labels and addresses can be found in the appendix.
Here so, the initial heading of any appendix actually looks, you can use this or write the, in any case it is not so important. Where it is more important, as it will look finally when the program is written, debugged and ready to the use. How to make of it the high-grade module? So it would be started from system (WB)? Here about it we shall talk in the chapter about compilation of the final module, and now it is a high time to consider components d2k.
LD A, (rPAGES)
LD HL, FONTP
LD D, 0
LD HL, FONT5
LD D, 0
LD A, 1
LD (pTEKID), A
LD HL, *2758
LD IY, *5C3A
|; the MAIN PROCEDURE (BASIS CYCLE) |
; In total it is accessible pages of memory
; Initialization kernalja
; We choose initial page of memory
; We establish proportsialnyj
; A font in system
; We establish a font 5X5
; In system
; indetefikator appendices
; We cause your program
; End of work