Doors AQUA OS



ATM Turbo
Spectrum 128
Scenergy







8BIT OPERATING SYSTEM FOR ZX-SPECTRUM

\history \doors2000

DOORS 2000 (a part 5)
(Year 2000, the wind of the changes which have broken a roof, at all..)
A part 1, 2, 3, 4, 5, 6

Memory Function
(Functions of work with memory)

Here we also have approached to functions of work with memory. As it was already written above by default d2k understands any machine as zx-spectrum 128 as it is not regrettable, but about 48 KB the system will not work. So all under the order.

mINITMEM
mINITMEM is a procedure of initialization standard 128e memories. It is caused once before start of system. As it it is possible to use at a writing and debuggings of own programs.

IN: under the standard of entrance data is not present
OUT: under the standard of target data is not present

mINITMEMDRV
If your computer of memory has more than 128Ea by means of mINITMEMDRV it is possible to initialize the driver of the expanded memory (Exchange memory). For this purpose it is necessary in HL - to specify the address of the driver and to cause function mINITMEMDRV. It is necessary to remember that the given function can use only during a writing and debuggings of own program as in system there can be an own driver and change of the address can it is fatal it will be reflected in the further work of system after an output (closing) from your program. In more detail about creation actually the driver of memory we shall talk a little bit later in the chapter about creation of own components under D2k.

IN: HL the-address of the driver
OUT: under the standard of target data is not present

mALLOC
As already it was spoken earlier, for that what to begin work with the expanded memory, it is necessary to find it and zaallotsirovat (to borrow). Function mALLOC just also gives such opportunity. On an input: in register pair HL we specify the address interesting us, in E - quantity of sectors which we want zaallotsirovat, in A - we specify bank of memory, in D - unique number of the appendix from a system variable. On an output we have result: flag C - it is impossible, NC - memory is successfully reserved. In general the given procedure is expedient for using when it is necessary for us podgruzit any volumetric block or we wish to place any table from the concrete address, for example at a writing skrollingov.

IN: HL the-address, E - sectors, A - bank, D - unique number
OUT: N? - memory is reserved, With - is not present.

mALLOCH
mALLOCH - carries out the same function as mALLOC, with that difference that not looking at flags - memory rigidly is engaged also all! I.e. even if the given site of memory has been borrowed by someone ?.

ATTENTION!

Consequences of the given command can be the most sad: (Therefore it should use extremely seldom and when you are assured on 100 % that except for your program in memory nothing is!!

IN: HL the-address, E - sectors, A - bank, D - unique number
OUT: memory in any case Is reserved

mFINDL / mFINDH
The guarantee of that that required memory will appear accessible is not great, therefore the given commands will help to find an interested site. mFINDL - prospects in LOWmem, and mFINDH in HIGHmem. For search it is necessary to set in E - required length. On an output we have: flag C - if was not possible to find required memory if all is successful in register pair HL - we have the address. If search occurs in HIGHmem in A (accumulator) comes back also number banks.

IN: E - required length
OUT: With - it was not possible to find, otherwise HL - the address, A - bank

mFINDALLOCL / mFINDALLOCH
If it is just necessary to know about presence of free memory it is more expedient to use mFINDL or mFINDH. If memory at once is necessary for work functions mFINDALLOCL and mFINDALLOCH allow not only to find free memory, but also at once it zaallotsirovat (to borrow). Entrance and target parameters same as well as in case of with mFINDL / mFINDH. We shall consider on an example:

LD E, 9
LD A, (pTEKID

LD D, A
CALL mFINDALLOCH
LD (PAGEOF), A
LD (ADROF), HL
; Required length in sectors
; Unique number of the appendix
; We copy in D
; Search...
; Number free banks
; The address in bank

mFINDLHP
In difference from all above described functions, mFINDLHP allows to find a free site of memory in HIGHmem in particularly set bank. On an input: in And (accumulator) number concrete banks, in E - length. As a result we have: if there is no empty seat in the given area, flag C. If all normally that on an output in register pair HL - the address, in A - bank.

IN: E - required length, A - concrete bank.
OUT: With - it was not possible to find, otherwise HL - the address, A - bank

mDEALLOC
When your program finishes work and the output from it is carried out, it is necessary to release memory, and that which was used during work, and that which was borrowed with the program. For these purposes the command mDEALLOC also is used. On an input it is specified in register pair HL - the address, in E - length, in A - bank of memory.

ATTENTION! Not when not deallotsirujte memory borrowed kernalem! It can lead to irreversible consequences!

IN: HL - the address, E - length, A - bank.
OUT: by default there are no target data

mFCALL
mFCALL is a function of the removed call (FARCALL). It allows to cause what or procedure from concrete bank of memory. For example it is convenient, when causing procedure itself is in other bank of memory. A format of a call such:

mFCALLB
mFCALLB carries out the same functions as mFCALL, but spoils thus registers HL and A. It is reserved for further use here again it will not be described.

ATTENTION! It is recommended to use only mFCALL.

LEFT Function
(Additional functions)

The basic purpose additional or as it was expressed KVA - levovatyh functions this performance of various mathematical calculations, translation of data from one format in another and so forth. Therefore they have no own names and differ on figures. (one time of function UP/DOWN too to them concerned ?)

mFUN00
It is convenient to take advantage of this function at a conclusion ottsetrovannogo the text. In register pair HL we specify the address of the test which we are going to print the proportional font, terminating a code *00. On an output we have in And (accumulator) length in pix lines of the text.

IN: In HL - a line of the text, terminating a code *00
OUT: In And - length in pix

mFUN01
The given function carries out following recalculation: the Register pair IX should specify a site in the script where data X are used, Y, SizeX, SizeY, for example it can be a site of the script - window. After a call of the given function a condition of registers: HL - contains data L = X, H = Y, DE - contains given E = SizeX, D = SizeY.

IN: In IX - the script
OUT: In HL - X, Y in DE - SizeX, SizeY

mFUN02
The given function carries out following recalculation: As well as in a command mFUN01 - IX specifies X, Y, SizeX, SizeY and as data in HL and DE undertake, to that difference that thus there is a translation of data: contents L are transformed by a principle: from Xa in Xp, and contents E are transformed by a principle: from SizeXa in SizeXp. I.e. differently there is a translation of values from a format a (attribute) in a format p (pikselnyj) and already these changed data come back in HL and DE.

IN: In IX - the script
OUT: In HL - X, Y in DE - SizeX, SizeY (Xa in Xp, SizeXa in SizeXp)

mFUN03
The given function carries out following recalculation: As well as in a command mFUN01 - IX specifies X, Y, SizeX, SizeY and as data in HL and DE undertake, to that difference that thus there is a translation of data: contents H are transformed by a principle: from Ya in Yp, and contents D are transformed by a principle: from SizeYa in SizeYp and already these changed data come back in HL and DE.

IN: In IX - the script
OUT: In HL - X, Y in DE - SizeX, SizeY (Ya in Yp, SizeYa in SizeYp)

mFUN04
The given function carries out following recalculation: As well as in a command mFUN02 and mFUN03-IX specifies X, Y, SizeX, SizeY and as data in HL and DE undertake, to that difference that thus there is a translation of data at once in both register pairs, the command mFUN04 as though combines in itself at once mFUN02 and mFUN03:

Contents L are transformed by a principle: from Xa in Xp, contents E are transformed by a principle: from SizeXa in SizeXp, and contents H are transformed by a principle: from Ya in Yp, contents D are transformed by a principle: from SizeYa in SizeYp and already these changed data come back in HL and DE.

IN: In IX - the script
OUT: In HL - X, Y in DE - SizeX, SizeY (Xa in Xp, SizeXa in SizeXp, Ya in Yp, SizeYa in SizeYp)

mFUN05
Function mFUN05 checks an accessory of an arrow on the set area. On an input in register pair HL we set X, Y, and in register pair DE we set SizeX, SizeY. On an output we have result: C - if has not got, NC - if has got.

IN: In HL - X, Y in DE - SizeX, SizeY
OUT: C - does not belong, NC - belongs

mFUN06
Function mFUN06 carries out a press a proportional font on physical coordinates. In register pair HL the address of the text on the screen (not in a current window is set! Namely concerning all screen!) coming to an end the code *00, in register pair BC sets coordinates X, Y in pix.

IN: In HL - the address of the text, in BC - Xp, Yp
OUT: by default there are no target data

mFUN07
Function mFUN07 carries out a press a font 5X5 on physical coordinates. In register pair HL the address of the text on the screen (not in a current window is set! Namely concerning all screen!) coming to an end the code *00, in register pair BC sets coordinates X, Y in pix.

IN: In HL - the address of the text, in BC - Xp, Yp
OUT: by default there are no target data

mFUN08
Function mFUN08 - initialization of a delay. It is reserved for the further expansion of functions kernalja and here it will not be described.

mFUN09
Function mFUN09 - a delay (Z - to do, NZ - is not present). It is reserved for the further expansion of functions kernalja and here it will not be described. mFUN10 function mFUN10 returns current coordinates of a window in register pair DE. In E = Xp, D = Yp.

IN: by default there are no entrance data
OUT: In DE - coordinates of a window

mFUN11
Function mFUN11 returns current coordinates of a window in register pair DE. In E = Xa, D = Yp.

IN: by default there are no entrance data
OUT: In DE - coordinates of a window

mFUN12
Function mFUN12 puts entering coordinates in register pair HL with current coordinates of a window and returns the received value in register pair DE. In E = Xp, D = Yp.

IN: In HL - coordinates
OUT: In DE - total coordinates

mFUN13
Function mFUN13 puts entering coordinates in register pair HL with current coordinates of a window and returns the received value in register pair DE. In E = Xa, D = Yp.

IN: In HL - coordinates
OUT: In DE - total coordinates

mFUN14
Function mFUN14 returns in register pair HL the standard address of processing of events (event) for a current element of the script, i.e. what at present specifies IX. In H = (IX - 4), L = (IX - 5).

IN: by default there are no entrance data
OUT: In HL - the standard address of processing of events (event)

mFUN15
Function mFUN15 - additional check of an element, in register pair HL - the address of the script for this element. It is reserved for the further expansion of functions kernalja and here it will not be described.

mFUN16
Function mFUN16 - additional vyrisovka an element, in register pair HL - the address of the script for this element. It is reserved for the further expansion of functions kernalja and here it will not be described.

mFUN17
Function mFUN17 - the given command allows to display sprajt in the size 8x8 pix. In register pair HL the address most sprajta, and in register pair DE - coordinates Xa, Ya. Is set

IN: HL - ni?aeoa address, DE - coordinates Xa, Ya
OUT: by default there are no target data

mFUN18
Function mFUN18 carries out following actions: the register pair IX specifies on what or the element of the script, in L undertakes Xa (IX+1), in H undertakes Yp (IX+2), in E undertakes SizeXa (IX+3), in D undertakes SizeYp (IX+4); Then current coordinates of a window (Xa, Yp) undertake and increase to HL.

IN: IX - the address of the script of a current element
OUT: smart manipulations with addition of coordinates

mFUN19
Function mFUN19 - clears the set area of the screen. In register pair HL coordinates Xa, Yp are set; In register pair DE the sizes of area for clearing SizeXa, Size Yp are set. In And (accumulator) - attributes in which the cleared area will be painted. In the register With - a flag: bit0=1 - to clear area pikselnuju, bit1=1 - to clear area attribute.

IN: HL - Xa, Yp; DE - SizeXa, SizeYp; A - attr; C - flag
OUT: by default there are no target data

mFUN20
Function mFUN20 returns the address of the system button x in register pair HL. On an input it is necessary to specify a serial number.

IN: A - number of the button
OUT: HL - the address of the button

mFUN21
Function mFUN21 is a standard processing of a roller. It is reserved for the further expansion of functions kernalja and here it will not be described.

mFUN22
Function mFUN22 returns coordinates of an arrow concerning a window in register pair BC.

IN: by default there are no entrance data
OUT: BC - coordinates of mixture

mFUN23
Function mFUN23 returns the address of the table of addresses of the screen in register pair HL. The table of addresses of the screen represents the tablet from addresses/lines under the order, for example: *4000, *4100, *4200 ? now for what it? If you have coordinates Xa, Yp it is possible to receive quickly the address in the screen, instead of to calculate its each time, it noticeably raises speed at vyrisovke sprajtov and other graphic elements, we shall consider on an example:

CALL mFUN23
EX DE, HL
LD L, 5
LD H, 0
ADD HL, HL
ADD HL, DE
LD A, (HL)
INC HL
LD H, (HL)
LD L, A
; the Call of the procedure
; In DE we have the address of the tablet
; Coordinate Yp = 5
; H = 0
;
; The address of displacement in the tablet
;
;
;
; In HL we have the address in the screen

IN: by default there are no entrance data
OUT: HL - the address of the table of the screen.

mFUN24
Function mFUN24 carries out multiplication odnobajtnogo numbers on dvuhbajtnoe. On an input in A (accumulator) - odnobajtnoe number, in register pair BC - dvuhbajtnoe. On an output it is had: A, HL.

IN: A*BC=?
OUT: ? =A, HL

mFUN25
Function mFUN25 - a press of the text a font 5x5 with a line | in the beginning. (it is used for a press of the text on buttons). In the end of the text *00.

IN: In HL - the address of the text, in BC - Xp, Yp
OUT: by default there are no target data

mFUN26
Function mFUN26 transforms the address in the screen / pixel on the address in the screen / attributes. On an input in HL - addr scr, on output HL - addr attr.

IN: In HL - screen address
OUT: In HL - attr address

home site news history screens software develop download feedback

| 1995-2000 © Ascendancy Creative Labs, 2000-2004 © FishBone Crew | webdesign by breeze\fishbone crew |