Inferno #04
22 июня 2003
  Софт  

Softinka - The functions of the operating system ZXVGS.

<b>Softinka</b> - The functions of the operating system ZXVGS.
              Options ZXVGS

All functions ZXVGS caused by RST # 08
with the number of functions in the next byte (hook
code). The program continues to address
lying for hook code.

       RST # 08

       DEFB function
In the following tables the column labeled "input" describes 
the registers containing the function arguments. Column marked 
"exit" - the register in which function returns, and other 
registers are unchanged. The contents of AF at the entrance 
ignored, the state F at the exit is not defined. In some cases, 
the function can set the 7-bit register R, it would mean that 
one or more screen interrupt was missed.



      Byte value after RST 8.

# 00 - # 1a - BASIC interpreter errors
# 1b-# 31 - Interface a hook codes
# 32 - # 47 - command codes DISCiPLE

# 78 - # 7e - Internal Use

          RSX'ah
# 7f - internal call ROM
# 80 - # 83 - Joystick
# 84 - # 85 - mouse

# 87 - # 88 - speed
# 89 - # 8f - Keyboard
# 90 - # 9f - control the screen - so far

          not used
# A0-# a1 - Information
# A2-# a3 - setup (config)
# A4-# a5 - sound
# A6-# a7 - Screen

# Ac-# af - RSX'y
# B0-# bf - memory banks
# C0-# c1 - the current path (current path)
# C2-# c3 - directory
# C4-# c7 - disc information
# C8-# cf - Working with Files
# D0-# db - direct access to files

# E0-# e7 - operation with files that have

          headlines (headers)
# E8-# e9 - image
# Ea-# eb - shipment Games
# Ec-# ed - work with pieces of files

          (Raw data)
# Ee-# ef - the selection of files
# F0-# f7 - Printer
# F8-# fb - Overlays
# Fc-# fe - system calls
# Ff - OK

Notes:
 * Interface a hook codes are processed
through MDR.RZX and BI1.RZX.
 * Commands are processed through DISCiPLE
MGT.RZX and BD1.RZX.



          Internal call ROM

Code # 7F is reserved for internal use
system.
Used to call ZX Rom from the system.



               Joysticks

Note. Function calls # 80 .. # 83 can
be interrupted by the user. To avoid
exit without saving the results, use # A3 (will be available in 
future versions). 

Perhaps the use of 4 independent joysticks. Usually used the 
first two. The meaning of bits 0 .. 4 is compatible with the 
value from the port of Kempston joystick (# 1F, b0 = right, b1 
= left, b2 = down, b3 = up, b4 = fire). Bit 5 - the second fire 
(usually not used). Bits 6 and 7 are common to all joysticks 
represent two more buttons. Bit 6 (HALT) can cause delays in 
the game (when fitted) or activate the option. Bit 7 (EXIT) can 
interrupt the game or cause a transition the main menu.


The specification calls:

Number name description input output
# 80 J0 read joystick 0 - A = state
# 81 J1 read joystick 1 - A = state
# 82 J2 read joystick 2 - A = state
# 83 J3 read joystick 3 - A = state



           Using a Mouse

You can use an external mouse (operated outside the main 
program), as well as generates an interrupt. The problem of 
computing absolute coordinates, drawing a pointer and

track events are on your programme.Dlya use the mouse in any 
management programs with the following requirements: 

 1. Disable interrupts! Turn on IM 2.
 2. Set the value of the register I (preferably # 80 .. # FE). 
It must not point in ROM!

 3. Fill in the interrupt table (257
bytes from the address I * 256) identical bytes.
Beware! Some types of mice (AMX) generate vectors IM 2!
 4. At the address indicated interrupt table, place:

       NOP

       NOP

       NOP

       JP ownint
"Ownint" - address maintenance procedures
preryvaniy.Esli you do not need a handler, you can put EI: RETI 
instead transition.

 5. Book 128B buffer for maintenance procedures mouse. Put the 
address this buffer in the HL (# 5B00 .. # FF80). You do not

will have to spoil this area after
setting your mouse.
 6. Book a byte to store the horizontal smescheniya.Pomestite 
his address in BC.

 7. Book a byte to store vertical displacement. Put his address
in DE.
 8. Call the function # 84. She will fill
buffer and the area under the NOPs. And in the case
need to replace the interrupt table.
 9. Allow me to interrupt!
For older programs, it is recommended to put XOR A: RET in the 
beginning of the buffer to avoid crashes when you call to 
initialize the mouse. 

Coordinates will be changed to the specified address. They are 
all 8-bit. You can only read them and compare with the 
standards for opredeneniya changes. To test buttons

simply call the procedure from the beginning of the buffer. It 
will return the state of the buttons in A, preserving the 
values ​​of other registers (b0 = left button, b1 = right; bit 
set indicates the press). Please note that some types of mice

(RS232, AMX) can generate its own interrupt, useless for our 
program. All non-staff interrupts are "eaten" (return address 
is removed from the stack). And if the return address refers to 
the byte after the command HALT, it will be decremented to 
continue to HALT human interruption. The mouse can be 
deactivated by specifying 0 as a buffer address (in HL). Data

returned in this case, are useful for the RSX
- They help to disable the driver used by the main program, 
connect your driver to process the request, after which

turn off your driver and return the driver of the main program.

The specification calls:

Number name description input output
# 84 MSEINI set I = page A = result

              Mouse BC = ^ xcoord

                      DE = ^ ycoord

                      HL = ^ buf

            interview HL =??? A = result

              Mouse BC = ^ xcoord

                               DE = ^ ycoord

                               HL = ^ buf

           disable HL = 0 A = result

              Mouse BC = ^ xcoord

                               DE = ^ ycoord

                               HL = ^ buf
# 85 MSEGET read state - A = keys

          (For ext. B = dy

         use) C = dx



                Speed

Function # 87 switches the processor into a rapid 
rezhim.Skorost not qualified - simply assumed that the program 
works faster. Function # 88 returns the processor is in 
standards mode is 3.5MHz. 

The specification calls:

Number name description input output
# 87 FAST (Scorpion) - A = result

            accelerates

             work

           CPU
# 88 SLOW (Scorpion) - A = result

           returns

             3.5MHz



               Keyboard

Extended keyboard can be used to enter text in certain programs.
Provides several additional buttons (on the emulators, SAM 
Coupe, ZX128 keypad).

Will be used in BASIC, if there will be patches or ways to 
intercept INT. 

Function call # 8F??? should be placed in
IM 2 processor, at least to the conservation
AF. Or may be caused by illicit
interrupts about 50 times per second.

While not apply! Not completed yet!

The specification calls:

Number name description input output
# 8C? KBDGET get char () (A)

           from buffer
# 8D? KBDTST read char () (A)

           from buffer

            'Leave it
# 8E? KBDMOD mode selection (BC) (A = result)
# 8F? KBDINT sync. () (A)

            interrupt



           Management Screen

Function # 90 .. # 9F designed to display the menu, move the 
mouse pointer and text output in 42, 51 or 64 column. In 
particular, the additional screen modes. 

In the current version ZXVGS not implemented!

The specification calls:

Number name description input output
# 9F? CHOICE ask user HL = ^ title A = result

           what to do BC = ^ options

The specification calls config 'system info:

Number name description input output
# A0? Unknown
# A1? Unknown



           Function Setting

Teams # A2 and # A3 mashinnozavisimymi control functions.
Parameters:

Option D E meaning
Type # 80-83 0 does not change
joystick 1 Sinclair 1

                   2 Sinclair 2

                   3 Kempston

                   April Fuller

                   5 arrows SAM Coupe

                      + 

                   6 function

                      Button SAM Coupe

                   7 (undefined)

                   8 TC2068 left

                      (AY # F5, # F6)

                   9 TC2068 right

                      (AY # F5, F6)
Type mice. # 84 0 Kempston Mouse
Changing a server mouse
impossible, 2 SAM Mouse
when the driver 3 J3 mouse
active. 4 AMX Mouse

                   5 AY mouse

                      (Ukrainian)

                   6 (undefined)

                   7 (undefined)

                   8 M $ Mouse

                      in YAMOD.8250 / 0

                   9 M $ Mouse

                      in YAMOD.8250 / 1

                  10 M $ Mouse

                      in YAMOD.8250 / 2

                  11 M $ Mouse

                      in YAMOD.8250 / 3
The presence of # A4 mask (1 = no)
Sound
devices.

Printer Type # F7 (not defined)

The specification calls:

Number name description input output
# A2? GETCFG take the function D = A = error

            setting E = mode

             function
# A3? SETCFG establish the function D = A = error

            parameter E = mode0

             function E = mode1



            Sound configuration

Function # A4 provides information about available audio 
devices. Bit 0 corresponds to the beeper on port # FE, bit 1 - 
BEEPER procedure in ROM Beysika.Sbroshenny bit means - do not 
generate sound in this way (you do not want to hear this 
sound). Fixed bit 2 indicates the presence AY-3-8910 / 2 ports 
# BFFD and # FFFD (as well as # BEFD and # FEFD for misspelled 
players), bit 3 - chip SAA 1099 (SAM Coupe) by port # 00FF and 
# 01FF. If one of the two last bit is cleared, you should not 
use these ports! This can lead to crash!

If this function is called without first calling the function # 
A5 (post # AF), it identifies all the available audio devices 
(downward compatibility, will be removed). 

Function # A5 is used to auto-detect audio device. Device number
should be in D, and some of the parameters - in
E. (An asterisk "*" indicates that the device
has fixed the port addresses.)

Parameter to the function # A5

 D unit E
# 01 * AY-3-891X (ZX128) channels (in the form

                              Register 7)
# 02 * AY-3-8912 (TC2068) channels (in the form

                              Register 7)
# 03 * both (1 and 2) channels (in the form

                              Register 7)
# 04 * SAA1099 (SAM) channels (in the form

                          Register 14'15

                          ; B6, b7 - your choice)
# 08 8255 D / A (MB-02) channels b0 .. b3

The specification calls:

Number name description input output
# A4 SOUND information - A = flags
# A5? OPENSOUND find D = A = number of difference

           unit E = E = channels channels



             Display Settings

# A6? VIDEO () (A, D = ula, E = mode, B, C)

returns the type of ULA in the D (Display Properties)
Options - in the case D

Country D computer graphics
England # 00 Sinclair ZX ULA 6C001E-7

            Spectrum (+)

       # 01 Sinclair AMSTRAD 40056

            ZX + 128

       # 02 Amstrad ZX +2 ULA 7K010E5

       # 03 Amstrad ZX GATE ARRAY

            +2 A / +2 B / +3 40077

       # 0C MGT SAM Coupe ASIC
Porto # 20 Timex TS 2068 - 60Hz
gallium Sinclair 2068

       # 21 Timex TS 2068 -

            Computer 2068 50Hz, grey

       # 22 Timex TS 2068 -

            Computer 2048 50Hz, black
Poland # 80 ELWRO 800?

            Junior

       #? Solum?
Russia # C0 Pentagon?

       # C1 Scorpion ZS?
et al # F0 Warajevo emulator

       # FF unknown

B, C - parameters of the time frame synchronization in ticks 
Z80 (fast RAM) 

# A7 OPENVIDEO
Log (BC = timing, DE = mode, HL = buffer)
Exit (BC = timing, DE = mode, H = tacts, L = len)

Options # E8, # E9, # F3 use the value
screen mode (screenmode).

LINT: + # 80

LINT interface generates an interrupt to the
how the display line indicated in the port # F9. Interrupt can 
be recognized cheniem port # F9. Presence should be determined 
by the function # A???. (At the moment such a possibility is 
supported only on SAM Coupe.)


 the main modes of non-core modes
E Bulletin E description
# 00 Standard # 08 Standard

   screen # 4000 screens # 4000

                               and # C000
# 01 Standard # 09 Standard

   screen # 6000 screens # 4000

                               and # 6000
# 02 high colour # 0A high colour

   screen # 4000 screens # 4000

                               and # C000
# 03 hires # 0B hires

   screen # 4000 screens # 4000

                               and # C000
# 04 Standard # 0C standard

   screen # C000 screens # 4000

                        # 6000, # C000, # E000
# 05 Standard # 0D standard

   screen # E000 screens # C000

                               and # E000
# 06 high colour # 0E high colour

   screen # C000 screen # 4000

                        and # C000 - 1:3
# 07 high colour # 0F high colour

   screen # C000 screen # 4000

                        and # C000 - 1:2

When HL> # 4000 at HL placed relotsiruemy code for selecting 
one of the main screen mode. In this case, L contains

the length of this code, and H - the number required him
taktov.Vyzovami with H = 0 mode is selected directly.

The specification calls:

Number name description input output
# A6? VIDEO info? A

             on the screen D = ula

                                 E = mode

                                   B

                                   C
# A7 OPENVIDEO include BC = timing BC = timing

             display DE = mode DE = mode

              Mode HL = buffer H = tacts

                                 L = len



               Management

   Resident Expansion

    Resident System Extentions (RSX)

Function # AC is used to load RSX
in memory of the system without activation. In the case of
no errors (A = 0), handle (handle) selected RSX back in D.

Function # AD? calls internal functions
of the available RSX.

Function # AE is designed to control
all loaded RSX.Pri E = 0 puts in HL
name of the file that caused the boot program or an error if 
the program was launched directly, without reference to the 
file. BC must contain a buffer size of at least

# 0080.

# AF function loads the RSX, the corresponding
file extension, followed by the RSX download the file. For 
example, for File "GAME.Z80" RSX is loaded from a file

"ZX: Z80.RZX". This is not the case
Extensions "V00" (native program ZXVGS)
and "RZX" (RSX will ship directly, and not
"RZX.RZX").

Function # AF downloads:
 * Files "*. V00" - the desired program (then the file "*. SV 
@", if it exists)  * For "*. RZX" - required RSX,

 * For the rest - "ZX: ext.RZX" (if found; "ext" - the file 
extension), and the name of the file will be available through 
the function # AE at E = 0;


The specification calls:

Number name description input output
# AC RSXINIT take RSX DE = ^ rsxname D = handle

                                 A = error
# AD? RSXCTRL call D = handle?

          function RSX E = A = error function
# AE RSXINFO information E = what?

            on the RSX HL A = error

                         BC
# AF RSXLOAD download DE = ^ filename

          file RSX'om A = error



              Memory banks

These functions, you can manage up to 4MB
memory. (What does the result 4128kB mode
16kB 8208kB mode or 32kB.)

Introduction

There is a 16kB RAM switchable in the upper
(Section D) of memory (# C000 .. # FFFF).
It is possible to use virtual
memory banks, the contents of which will move the software. 
Banks # 00 .. # 07 preferred and can be switched quickly, the 
individual functions # B0 .. # B7 with no arguments. 

The Bank must be opened before the operation with
him. If the opening is not enough memory
(RAM in case of non-virtual banks or
external memory for virtual), generated a fatal error. Pre-
Check the free space!
Outdoor pot filled with zeros. Options
do not check the PC, SP and I, so using them in the wrong 
context can cause a system crash. 

If, for hardware reasons it is impossible to switch the top 
quarter of memory available only virtual banks (with a long 
switching time). If the hardware can only reasons to switch 
both the upper quarter of the memory simultaneously (32kB, # 
8000 .. # FFFF), then switching the top quarter of the 
simulated with or without rewriting another quarter (section 
C). In this case, can not open bank switching

quickly and not debasing this section C. She
copied when it opens.

There are three types of banks:
 1. Individual - numbers 0 .. 15 - each can be opened in his 
regime.  2. Parametric - numbers 16 to the return value of 
function A # BF. This group exists only if the function # BF

returns greater than 15. Open mode is determined for the first 
public bank in this group and will be the same for others.  3. 
Virtual - numbers in excess of the value returned by the # BF. 
This group exists only if the function returns # BF A value 
less than 255. Open mode determined for the first public bank in

group and will be the same for others. These
Banks can only be opened as virtual. To open the first virtual
Bank at least one of the real banks
should be opened as a slow (bit 0 in
Register D dropped) - he will replace the state
on virtual and will be used for
Storage of virtual memory (banks, particularly public, preserve 
the real state). 

Options

Options # B0 .. # B7 choose one of the privileged 
bankov.Funktsiya # B8 choose any bank - his number is 
transferred in register E.


Function # B9 provides information about banks.

Function # BA used to get a piece of code switching banks. For 
more details see next section. 

# BB function copies the contents of section C
all open 32kB pages, or ignored in the case of 16kB-page mode.

Function # BC tries to open the Bank E and D mode and returns 
udavshiysya regime D. See the table settings.


Function # BD closes bank E. If E is included in the current 
bank, then contents of the top quarter of the memory is not 
defined (ie, may contain ROM or # FF-s) to select another bank.


Function # BE closes all banki.Soderzhimoe
top quarter of the RAM is undefined.

# BF function returns the register number of the E
current bank, and in case D his regime.
The register B returns the number of open bankov.Registr A 
contains a number of additional banks (except virtual):

 * 0 - 48 kB (standard ZX48)
 * 1 - 64 kB (32kB usually one bank, so called ZX80kB)
 * 2 - 80 kB (two additional bank -
usually 16kB)
 * 5 - 128 kB (five additional banks
- ZX128)
 * 6 - 144 kB (view extended TC2048)
 * 27 - 480 kB (Pentagon 512kB two
reserved pages)

Parameters:

D vh.dannye vyh.dannye # BC # BD / BF

      when 1 when 0 when 1
0 must click

  quickly? bit1 = 0 bit1 = 1

  (Not virtual) 0 16Kvirt 32Kreal
1 domain bit0 + copy C

  # 8000 .. # BFFF a 32Kreal 16Kreal

  does not change?
2 contains a screen? no screen is a screen

3 corresponds to the incompatible compatible

  Bank ZX128? with OUT # 7FFD with OUT # 7FFD

  OUT (# 7FFD), E +16
4 can be put there, it is possible

  Table IM 2 will "snow"

  without "snow"? "Snow" will not
5 processor is yes, would not the bank

  inhibit ULA? brake fast
6 supports 8 no, but yes, 8 bits

  (???) bit color 1-bit color
7 will even open will not open
  if not, is Soble

  to their demands?


Function # BA - fast switching banks

Allows banks to click a lot faster.
Follow these instructions:
 1. Determine whether your program
work in a 32kB page mode. If
not, use mode% XXXXXX11 (will not be
to work on some types of equipment).
Otherwise, 32kB or 16kB.
Make sure stack and interrupts.
 2. Open a bank function # BC.
 3. Book 32B for the program to switch pages. Program moveable.
To use the program without moving it, you can fill the buffer 
with zeros, and place it in its complete programmu.Ili 33 bytes 
code "RET" (# C9), or "JP (HL)" (# E9), depending on the 
structure of your program.

 4. Book two bytes in the
# 5B00 .. # 7FFE, put their address in BC at
the first call to # BA (then BC will be
ignored).
 5. Call the # BA to put
Package include Bank E at HL. Function returns the actual 
length of the code in the BC and the number of ticks in A. DE 
point to the byte after the code so you can add (using LDIR) go 
your own code.  6. To select the bank, call this code.

Remember!
 * Each bank has its own program of inclusion.
 * (!!!) Code can be moved anywhere
place and at any time.
 * Code MUST NOT be used after the closure of the bank!
 The code, issued by the function # BA, no longer
32 bytes.
 * He always spoils AF, BC, and sometimes, but
that uses the stack.
 * To call any function ZXVGS you MUST call the code that 
includes a page that stood before the first call of these codes 
(the latter bank, selected functions # B0 .. # B8).  * Code 
MUST be in the bank, which He vklyuchet.Problem not occur when 
placing the code in the address # 4000 .. # 7FFF. After placing 
it in the address # 8000 .. # BFFF you can call a function to 
copy the # BB it in other banks. But if you want

use it with the addresses # C000 .. # FFFF, you
themselves must copy it in the included
page.
 * In some cases (such as emulators) function returns the # BA 
# FF, which means that the code contains a function call

# B8. Remember the stack!

The specification calls:

Number name description input output
# B0 BNK0 include - A =?
.. .. privileged # B7 BNK7 vanny Bank

        Fatal Error

         when unopened
# B8 BNKE include - A =?

           any bank

        Fatal Error

         when unopened
# B9 BNKCTRL data DE = infonum A

            Bank of BC

                                  DE

                                  HL
# BA BNKCODE get E = number BC = length

           program HL = ^ buffer DE = ^ end

         Switching BC = ^ word A = tacts
# BB BNKCOPY copy - A =?

           section C

         all banks
# BC BNKOPEN open D = mode0 D = mode1

             Bank E = number A = xor
# BD BNKCLOSE close E = number A =?

             jar
# BE BNKRESET close - A =?

           All banks
# BF BNKINFO information - B = opened

             for all D = mode

             Banks E = bank

                                 A = memory



           Current directory

The specification calls:

Number name description input output
# C0 GETPATH ​​current path DE = ^ buf A = error

           (Disk) name = DE ^
Begins with a drive letter and colon
# C1 SETPATH ​​Change the way DE = ^ name A = error



     Reading the contents of the directory

# C2 function returns the directory entry,
selected function # C3. HL points to the
string format (as determined by the function # C3
used either at H = 0, or if HL
indicates the zero-byte internal system structure is returned 
when H = 1), DE points to a buffer. In this buffer is returned 
directory entry - ASCII Text, ready for display. (Use the HL = 
0 for fill the file selector (fileselector),

then HL = ^ '% f% n' for taking the file name
selected by the user.)

Function # C3 chooses directory finds elements and copies them 
into an internal buffer. (The buffer should be released (DE = 
0) after read completely directory.) HL indicates

on the format string (system format on
default or at H = 0 or
if HL points to null byte internal system structure is returned 
by H = 1). Can use the following formatting characters:

 *% A attributes
 *% B number of allocation units, engaged in a file or string 
"Dir"  *% C file comment

 *% D date of last modification
 *% E filename extension
 *% F the path to (real)
 *% G group name files (GID)
 *% K number of the first allocation unit
 *% L the length, in bytes, or the string "Dir"
 *% M file name without extension
 *% N filename extension
 *% P path (the pointed by DE)
 *% S file name extension (?)
 *% T the time of last modification
 *% U username file (UID)
 *% X attributes U * IX
Other characters are copied without change.
Decimal number between% and the letter indicates a fixed width 
polya.Polozhitelnye value - right-aligned,

negative - on the left. Value after
point indicates the number of cut characters
in a row. Examples:

"%-16.16m%-3.3e% l" - NeOS 1.0 style

                                     (DEC)
"%-8.8m <% 1.1e>% 3b% 13l" - TR-DOS style

              (Start parameter is not available)
"% X%-9g%-9u% 8l% 6d% 5t% n" - U * IX style

                                   (Ls-l)
"%-9.8m%-4.3e% 13l% 9.8d% 9t" - MS-DOS 6.20

                           style (default)

Internal system structure consists of
following fields (not fully defined):
 * + # 00 - - 4B;
 * + # 04 - - 4B;
 * + # 08 - - 4B;
 * + # 0C - - 4B;
 * + # 10 - - 4B;
 * + # 14 - - 4B;
 * + # 18 - - 4B;
 * + # 20 - ASCIIZ filename without a path -

          to 32B;

Free disk space can be found at the "# C4 or # C5.

Note: some drives (most of the network, such as "TCP:", "HTTP:" 
or "FTP:") do not show all possible subdirectories, but only 
those that have been used recently (or are in the tabs). 

The specification calls:

Number name description input output
# C2 take the element BC = number of A = error

           Catalog HL = ^ buf1 HL ^ = entry

           (Entry) DE = ^ format DE =?

                                  BC =?
# C3 set HL = ^ name A = error

            mask DE = ^ format BC = number of

           Directory BC = attr DE =?

                                  HL =?



            Data on disk

Options # C4 and # C6 return information
specified drive / path or file.
Options # C5 and # C7 change information
specified drive / path or file, but only
if possible.

Options

 BC returns # C4 # C6
# 0000 disk space in KB HL ASCIIZ text
# 0001 depth directory L ASCIIZ text

         (1 = root)

The specification calls:

Number name description input output
# C4 GETINFO get DE = ^ name A = error

           parameters BC = infonum BC

           numerically HL DE

              form HL
# C5 SETINFO set DE = ^ name A = error

           parameters BC = infonum BC

           in the numerical value HL = DE

              form HL
# C6 GETINF $ get DE = ^ name A = error

           parameters BC = infonum BC

             in the form HL = ^ buf DE

             line HL
# C7 SETINF $ set DE = ^ name A = error

           parameters BC = infonum BC

             in the form HL = ^ value DE

             line HL



        Manipulating files

# CB function deletes a file or directory
(Directory must be empty).

# CC function checks for the file (error or not).

The remaining functions are not defined yet.

The specification calls:

Number name description input output
# C8? RESET Initialization - A = error

        filesystem
# C9? FLUSH release - -
       all buffers to disk
# CA? MAKE create a DE = ^ name - "
           or directory
# CB KILL to delete the file DE = ^ name - "
       or an empty directory
# CC EXIST check DE = ^ name - "
          presence of a file

          or directory
# CD? ASSIGN connects DE = ^ name - "
           new drive HL = ^ newname
# CE? MOVE move / rename DE = ^ oldname - "
       files / directories HL = ^ newname
# CF? COPY duplication DE = ^ srcname - "
       files / directories HL = ^ desname



      Simple file functions

Options for working with files. If you want to download the 
entire file into memory, or to retain a portion of memory as a 
file, see first function # E0 .. # ED.


Function # D0 always closes the file with the specified handle. 
If the handle is given as 0, it will close all open files.

# D1 function opens a file for reading (returns an error if the 
file does not exist). # D2 function opens a file for writing -

delete an existing file and create a new,
zero length.
Function # D3 opens the file and read, and
on zapis.Esli file does not exist, it will
created with the first record.

Options # D4 .. # D7 are used for reading and
record file. Options # D4 # D5 and remit
the number of bytes (returns
The number of bytes transferred in fact - if
it is less than requested, an error is generated). # D6 
function reads bytes from a file to limit or to the values ​​# 
00 or # 0D (including them). Function # D7 writes bytes to Byte 
# 00, which is not recorded. It can be written only when the 
first byte in line.


# D8 function returns the current position in
file. # D9 function allows you to move
current position in the file and returns the old position in 
fayle.Smeschenie counted depending on the register B: # FF means

"From the beginning," # 00 "from the current position", and # 01
Since the end of a file. Error value is returned if crossed the 
start or end file. Addressing capabilities file of up to

8MB (23-bit addresses).
Function # DA says, is whether the current
position at end of file (EOF).
# DB function truncates the file to the current position.

Following features - an almost direct calls
systemic structure FILEDISK. Its definition can still be 
changed in the future. 

The specification calls:

Number name description input output
# D0 CLOSE to close the file handle to D = A = error
# D1 OPENI open file DE = ^ name A = error

           read D = handle
# D2 OPENO open file DE = ^ name A = oschibka

           write D = handle
# D3 OPENO open file DE = ^ name A = oschibka

        read / write D = handle
# D4 READ reads D = BC = readed handle

           from the File BC = length A = error

                       HL = ^ databuf
# D5 WRITE record handle D = BC = written

            a file BC = length A = error

                       HL = ^ data
# D6? GETL read line D = A = handle error

           from the File BC = maxlen BC = length

                       HL = ^ linebuf
# D7? PUTL record string handle D = A = error

            to file HL = ^ line
# D8 FPOS get a handle D = EHL = pos

       current position of the A = error
# D9 SEEK set D = handle EHL = oldpos

           the position where B = A = error

                       EHL = newpos
# DA? EOF checking D = A = handle error

         at the end
# DB? TRUNC cut the file handle to D = A = error

      on the current position



           Files with the headline

Options # E0 .. # E7 operate on files with a title (like tape).

Before calling a function # E4 .. # E6 type header must be set 
to one of the functions # E0 .. # E3. This setting is valid 
until the next call to any of the functions

# E0 .. E3. If the file exists, then in certain registers, 
return values, taken from the title of this fayla.Esli file is 
missing or the type of title does not conformity is not, it 
returns an error indication. Error can be ignored if it made an 
entry in the file, but Reading such a file will always result in

an error.

At the entrance to the function # E3 buffer size indicated in 
BC. The length returned in BC, is limited to this size, whereas 
the DE contains the actual size. This is to avoid the 
limitations of tape - you can not upload a real tape the first 
few byte file length, and its checksum could not be verified. 
Also, BC = # 1B00 and HL = # 4000 are recognized as your wish

download or burn the screen (although you
can download it and save from other
addresses).

Reading and writing an error if we assume
or recorded fewer bytes than trebovalos.V
this case, check the BC.
The operation verification is equivalent to reading and
occurs both on tape - error if the data is different or the 
file is too short. 

Function # E7 vyzavaetsya before # E4 .. # E6. Allows you to 
set the offset, which gives the possibility of sequential access

file. This means, for example, the reading of successive parts 
of a file in different banks memory. Error is returned when the 
position goes through the end of the file. Options

# E0 .. # E3 always set the offset to 0
(Immediately after the title).

Calling any of the functions # E4 .. # E7 without calling one 
of the # E0 .. # E3 causes a fatal error. 

File with the headline can be up to 65535 bytes
long (not including the header). Rest
cut off. The header format may vary in different file systems. 
Therefore, discouraged processing files with a title with the 
help of other functions, except when a file or a screen play 
shipment. 

For files with extensions other than
". CZX", ". DZX", ". DAT", ". ROM", ". SCR", called 
sootvetstvyuschee RSX. So you can, for example, download data 
or BASIC program from a file "*. Z80"! For details, see the 
documentation for the RSX. 

The specification calls:

Number name description input output
# E0 HEADER0 select File DE = ^ name A = error

          type of program BC = prog DE = length

                       HL = line BC = prog

                                 HL = line
# E1 HEADER1 select File DE = ^ name A = error

              Type H = DE = tip'imya length

          number array H = tip'imya
# E2 HEADER2 select File DE = ^ name A = error

              Type H = DE = tip'imya length

         character array H = tip'imya
# E3 HEADER3 choice DE = ^ name A = error

            Binary BC = maxlen DE = length

              File HL = start HL = start

                                 BC = length
# E4 LOAD read the file, the length of BC = A = error

            in memory of HL = start BC = readed
# E5 SAVE write to the file length BC = A = error

            from memory HL = start BC = written
# E6 VERIFY to compare the length of BC = A = error

              File HL = start

            memory BC = verified
# E7 SHIFT move DE = shift A = error

         position in the file



             Screen Files

To read or write Spectrum screens can be used and the function 
# E8 # E9. Operation always involves 6912

bytes of memory. Separating these functions allows you to 
convert graphics from / to different image formats. Recorded 
screen is 256x192 pixels and 16 colors, but there may 
isklyucheniya.Esli contents of the downloaded file is not 
compatible with restrictions Spectrum, the result will not 
opredelen.Oshibka returned if the file was not recorded, or 
does not exist or format is not recognized. 

In future releases will be used ZXVGS
RSX to read and write images with extensions other than ". SCR" 
and ". CZX". These functions can also be shown on the screen

dialog with a list of valid formats if
was not given the file extension or file for
reading is missing, or the name of the file is empty.

Other display modes are also supported.

The specification calls:

Number name description input output
# E8 LOADSCR load screen DE = ^ name A = error

            from file HL = addr
# E9 SAVESCR save screen DE = ^ name A = error

             to file HL = addr



         Files game shipments

Options # EA # EB and designed to preserve and restore the 
state of gaming or configuration of these programm.Vyzov

function allows the user to select
one of 10 such files. When you save
users may comment fayl.Fayly saved with the name of the current 
program and one of the extensions "SV0" .. "SV9" (User 
selectable). 

D = 0 dialog appears and the file will
the default extension ". SV?". In this case, E contains the 
character code placed in the 3-th position of the extension 
(unfit characters are replaced by "!"). This is available for 
download defoltnoy configuration when you run or save the 
output. The comment line at Conservation is set to "Autosaved"

(May include date and time). This
can be used along with standard
call (when the user selects himself)

For the function # EA at HL = 0 uses the address from the 
header. 

Expansion of "SV @" (E = # 40) reserved
to store the file table records. If
file exists, ZXVGS download "*. SV @"
immediately after the file is "*. V00". Later, the file is 
saved when the user invokes the menu ZXVGS. The new curricula 
must be preserves the function # EB at each table updates 
rekordov.Fayly "*. SV?" stored and loaded on the disk "SV:". 

The specification calls:

Number name description input output
# EA LOADCFG load settings BC = length A = error

                         DE = ^ title

                         HL = addr
# EB SAVECFG save settings BC = length A = error

                         DE = ^ title

                         HL = addr



          Files without a title

Function # EC is used to load a file or its initial part of the 
memory. The error code is returned if it was Loaded fewer bytes 
than requested. 

Function # ED is used to save
continuous area of ​​memory to a file. Code
error is returned if it was stored
less bytes than the required (low on
ROM).

Always check the BC error.

The specification calls:

Number name description input output
# EC LOADANY load BC = length A = error

            any file DE = ^ name BC = readed

                      HL = addr
# ED SAVEANY save BC = length A = error

            any file DE = ^ name BC = written

                      HL = addr



            File selector

Options # EE # EF, and allow the user to
select or enter the name of the file or directory in easy way. 
Perhaps an indication of the default name and the restriction 
of choice mask. The mask can be edited by the user, which means 
zaisklyucheniem "*/", choice of directory. There is also the 
title of the operation. To view the results (with path) to 
reserve 128 bytes a buffer. Functions return an error if

file selector was abandoned on the button
<EDIT>, Or file name is blank.

# EE function always returns the screen (memory # 4000 .. # 
5AFF) intact, that in many cases results in a limited way 
selector. Function # EF always uses full-screen interface, but 
leaves the screen in a random state. After This requires a 
screen refresh. 

It is recommended to use file selectors for each case specify 
the names of files the user. 

If the mask is "*. SZX" or "*. SCR",
a selector can also choose to allow
other graphics formats, and accordingly
can change the extension.

The specification calls:

Number name description input output
# EE FILESELL selector DE = ^ default A = error

            without spoiling BC = ^ mask name = DE ^

             Screen HL = ^ title
# EF FILESELH selector DE = ^ default A = error

            with damage BC = ^ mask name = DE ^

             Screen HL = ^ title



                Printer

The function returns # F0 control code
printera.V register E is given a code number,
in HL - address of buffer for him. In BC sets the maximum 
length (B is ignored - should be 0). When control codes placed 
in the clipboard, BC (B = 0) contains a number of characters, 
and A is 0. If the buffer was too small, BC returns the 
required size, and A> 0.Esli control code is not available, 
then BC = 0 and A> 0. 

Function # F1 sends the requested control code directly to 
printer.Sm.takzhe function # F0. 

# F2 function equivalent to the command BASIC
COPY.

Function # F3 print screen (256x192), taken from the specified 
address. 

# F4 function mimics the ZX Printer on a normal character 
printer. 

# F5 function mimics the ZX Printer dot-matrix printer, but for 
a character printer works like the # F4.


Function # F6 is designed for printing text with national 
characters. If there are no perekoditoraniya, the equivalent 
function # F7. Values ​​1 .. 5 in register D choose the 
character set ISO-8859-D. 

Function # F7 sends bytes directly to the printer (control 
sequence can be a function of # F0). 

Options # F0 .. # F6 service module
{PRINTER.RZX}.


        Printer control codes

          for the functions # F0 and # F1:

code meaning setting for your printer

                Epson FX HP LaserJet

             {EPSONFX.RZX} {LASERJET.RZX}
# 00 the number of needles on August 8
# 01 ahead of print 27,65,8?

   Screen
# 02 number of points of 224.1?

   in the mode1
# 03 choice mode1 27,75,224,1?
# 04 number of points of 192.3?

   in mode2
# 05 selection mode2 27,76,192,3?
# 06 code for CR 13 13
# 07 LF code for October 1910

The specification calls:

Number name description input output
# F0 GETPRINT take E = A = error code

          kontr.kod HL = ^ buffer BC = codelen

           printer BC = buflen code = HL ^
# F1? SETPRINT give E = A = error code

          kontr.kod
# F2 DUMP print 22 - A =?

        line of the screen

           Graphics
# F3? DUMPANY printing HL = address A =?

           24 lines

       screen graphics
# F4 ZXPRINT print the symbol E = A =?

          symbol as

         on the ZX Printer
# F5? HLPRINT printing HL = ^ pattern A =?

            character, E = symbol

       defined by HL

         as the ZX Printer
# F6? DEPRINT print D = modificator A =?

            symbol E = symbol

        with modifier
# F7 LPRINT line E = symbol A =?

        printer output



                Overlays

Options # F8 .. # FB designed to control overlays. Typically, 
overlays are The following levels of the game. Overlay can be

loaded with the function call # F8, indicating
Rooms overlay. Preparation of (feature # F9)
gives the result on server systems and allow to raise the 
upload speed (for example, Timex FDD 3000) - is not 
neobhodimoy.Zagruzka overlay buffer (function # FA) leads to 
accelerate your downloads. This option is ignored when not

RAM for storage. This can be used instead of downloading the 
overlays directly into the memory banks (like the games that 
run on ZX48, and the ZX128), because buffer overlays are stored 
in compressed form and, Also, can be stored in the shadow RAM at

ROM (MB-02). Function # FB removes the overlay from
buffer. All functions return free
buffer space in kilobytes. If free space is greater than 254kB, 
returns 255.


The specification calls:

Number name description input output
# F8 OVRLOAD load overlay E = number of A = free

            E = 0 mean

        main program
# F9 OVRPREPARE load E = number of A = free

          overlay to clipboard

      only if multitasking
# FA OVRSTORE copy overlay E = number of A = free

       the internal buffer
# FB OVRREMOVE remove E = number of A = free

     overlay of vnutr.bufera



            System calls

Options # FC .. # FF are designed to yield
from the program in the system menu and complete the
program.

Function # FC only causes the system menu. The program can be 
continued. # FD function terminates the program after the end 
of its work (closes all open files, banks, clears the buffer 
overlay, etc.) The function is similar to # FE # FD, but shows

the message you want to exit the menu.
Function # FF is reserved for BASIC interpreter, which causes 
her after of the last instruktsii.Eto useless programs ZXVGS. 
Normally (without the RSX) word of XPTR # 5C5F copied to CHADD

# 5C5D, # FF placed in ERRNR # 5C3A, and the program continues 
with the # 0058 (Processor errors).


The specification calls:

Number name description input output
# FC MENU exit the menu, - A =???

         return item

           "Continue"
# FD QUIT exit the menu - -

          with a message

       "Program finished"
# FE FATAL exit the menu DE = ^ text

{Zxvgs@yarek.com}, {http: \ zxvgs.yarek.com}





Other articles:

Events - On completion of the first part of a virtual musical party The Compo.

Softinka - On operating systems for Spectrum ChAOS and ZXVGS.

Inferno - The authors of the magazine.

Pentagon - Instructions on how to activate unused (zero), the banks ROM in your computer Pentagon.

Pentagon - Instructions for remaking the Pentagon-128 to exit at Reset'u in the 0-th bank ROM 27512.

Gameland - Black Raven Passage of game: Unknown shipment. Disk 1.

Gameland - Black Raven Passage of game: Unknown shipment. Disk 2.

Softinka - Description of the GUI for disk-TR-DOS - ChAOS.

Inferno - On the shell.

Softinka - Editor of two screen graphics DouBleScreen Editor v0.4.

Softinka - Operating system ZXVGS. Composition versions software.

Inferno - Introduction by the editors.

Iron - The results of the development of coders RGB - PAL / NTSC, at the end of 2002.

Gameland - On the game King's Bounty 3, Black Raven: Unknown shipment.

Others - On the survey.

For Coderz - Macros for assembler Alasm v4.4x.

Mathematics - Mandelbrot fractal.

Softinka - Music Editor Pro Tracker v3.71. Features of the program.

Softinka - Format RAR 2.x. Technical information.

Others - Registered users ZXVGS and CPM22QED.

Softinka - File Types defined in the OS ZXVGS.

Softinka - The functions of the operating system ZXVGS.

Softinka - The appearance of the operating system ZXVGS.

Softinka - IDEDOS - access to hard disks in OS ZXVGS.

Softinka - The description of the operating system ZXVGS.

Softinka - MEMDISK - file system for storing files in memory.

Softinka - OS Releases ZXVGS and their differences.

Softinka - Resident System Extensions (RSX) in ZXVGS.

Softinka - Version of the new operating system for Spectrum ZXVGS.

Iron - Advanced Keyboard sinclair-compatible personal computers.

For Coderz - An algorithm for finding the integer part of square root.

Events - Nominees virtual musical party The Compo.


Темы: Игры, Программное обеспечение, Пресса, Аппаратное обеспечение, Сеть, Демосцена, Люди, Программирование

Similar articles:

В этот день...   21 November