Think #41
06 ноября 1999
  Софт  

NEOS - Description of a new operating system for the Spectrum.

<b>NEOS</b> - Description of a new operating system for the Spectrum.
        NeOS - the new operating

          system for the Spectrum


(C) 1999 Megus / Brainwave ^ X-Project.



        Error handler (RST # 8)



   If any serious error
calls the error handler. In
Depending on the type of error can
occur:

  - Return after the place of call error (R);

  - Exit the program (call to Exit

    from program) (Q);

  - Restore the stack of ERR_SP, then

    transition to ERR_JP (E);

  - Return code and the interactive error

    Register A (O).

   Thus the error can not simply
treat, but also to return some
information program. These are
error function when working with disk
devices.

   The error handler is invoked as follows
as follows: immediately after the command code RST # 8
must be followed by an error code. For example:

     RST # 8

     DEFB 2; Out of text window

   Possible to use not only
standard error handler, but
any other. For this
must pereustvanovit system
variable HK_ERR. If it is not zero,
when you call RST # 8 is a transition to
address specified in it, otherwise
If the standard
handler. At the entrance to the outside
handler (and also necessary for
entrance into the built-handler!) in
Register C is present the error code, and
DE registry, he also multiplied by 2.



               Error Codes


# 00. OK (R)


   Is not an error, an informant about
success of any operation.

# 01. No such library function (R)


   This error can occur when
accessing the library in the absence of
It called function.

# 02. Out of text window (E)


   The error occurs when trying to install
Print out the coordinates of the text box.

# 03. Read error (O)


   Interactive error reading from
disk device. At the exit of
A register of issues:

  # 00 - Retry;

  # 01 - Abort;

  # 02 - Ignore.

# 04. Not enough memory (Q)


   The error occurs when attempting to allocate
memory.

# 05. Write error (O)


   Interactive error writing to disk
device. The output of a register A gives:

  # 00 - Retry;

  # 01 - Abort;

  # 02 - Ignore.

# 06. No such driver function (E)


   The error occurs when calling
non-existent driver functions.

# 07. Fatal error (Q)


   Fatal error in the program.

# 08. Unknown command (E)


   Occurs when a command input,
unknown shell.

# 09. Syntax error (E)


   The error occurs when incorrect
specifying command parameters.

# 0A. No such page (R)


   The error occurs when attempting to
switch to non-existent page.


# 0B. Unreleased function (R)


   The error occurs when calling
non-existent library functions.

# 0C. Read only (E)


   The error occurs when attempting to produce
write to the disk device
read-only.

# 0D. No disk (E)


   The error occurs when there is no disk in the
device.


   On the rest of the system error numbers
responds string: Error Nmm.

# 0E. Unknown file system (E)


   The error occurs when it is impossible
determine the membership drive a
file system.

# 0F. Can't open file (E)


   The error occurs when it is impossible
open the file, but not in its absence.

# 10. No such disk drive (E)


   The error occurs when trying to choose
non-existent disk device.


# 11. No such file (E)


   The error occurs when you try to
to a nonexistent file.

# 12. Unable to delete file (E)


   The error occurs when it is impossible
delete a file, for any reason.

# 13. Unable to make directory (E)


   The error occurs when it is impossible
create the directory.



            Entry point kernalya


# 004B. System info
# 004E. Wait for keypress
# 0051. Wait for keypress + click
# 0054. Click sound
# 0057. Exit from program

# 005A. Add driver
# 005D. Remove driver
# 0060. Add library
# 0063. Remove library

# 0066. NMI handler

# 0069. Open driver
# 006C. Open library

# 006F. RAM info
# 0072. Change page
# 0075. Allocate high memory block
# 0078. Allocate low memory block
# 007B. Free high memory block
# 007E. Free low memory block
# 0081. Get max length of high memory block
# 0084. Reallocate memory map
# 0087. Get page status
# 008A. Set page status
# 008D. Select 4MB page
# 0090. Change page in low memory
# 0093. Clear screen
# 0096. Clear window
# 0099. Fill window with attribute
# 009C. Call symbol-output driver
# 009F. Put character
# 00A2. Put string
# 00A5. Messager
# 00A8. Put byte-number
# 00AB. Put word-number
# 00AE. Put double-word-number
# 00B1. Scroll window up
# 00B4. Scroll window down
# 00B7. Scroll text window up
# 00BA. Scroll text window down
# 00BD. Draw styled box
# 00C0. Draw window
# 00C3. Vertical menu
# 00C6. Put sprite

# 00C9. Recognize disk
# 00CC. Change disk drive
# 00CF. Open file
# 00D2. File driver caller
# 00D5. Read bytes from file
# 00D8. Write bytes from file
# 00DB. Read sectors
# 00DE. Write sectors

# 00E1. Go lower by pixel
# 00E4. Go higher by pixel
# 00A7. Go lower by cell
# 00EA. Go lower at attributes
# 00ED. Go higher at attributes
# 00F0. Calculate screen address
# 00F3. Calculate attribute address
# 00F6. Convert screen address to attribute
# 00F9. String comparision

# 00FC. Input string
# 00FF. Command interpreter
# 0102. Read number
# 0105. Shut AY
# 0108. Change directory



        Function "Memory manager"



   This set of functions designed to
Control paged memory.

Options:

# 006F. RAM info


   Function gives basic information about
top (paging) memory.

 Log in: -
Output: HL - обший amount of upper memory

            (In KB);

       DE - free upper memory

            (In KB);

       BC - number of pages in the upper

            memory.


# 0072. Change page


   Function changes the page in
# C000-# FFFF.

 Input: A - page number.
Output: Z - OK;

       NZ - no such page.


# 0075. Allocate high memory block


   The function allocates a block of upper memory.

 Input: C - unit volume.
Output: Z - memory allocated;

       NZ - lack of continuous

             memory;

       HL - address of the block;

       BC - Home of the block.

# 0078. Allocate low memory block


   The function allocates a block of low memory.

 Login: DE - volume in bytes;
Output: HL - starting address of block

            memory.

# 007B. Free high memory block


   Frees the block top
memory.

 Log in: BC - page number;

       D - high byte address;

       E - the number of released

           kilobytes.
Exit: -

# 007E. Free low memory block


   Frees the block of low memory.

 Login: DE - amount to free memory

            bytes.
Output: HL - address of the new limit lower

            memory.

# 0081. Get max length of high memory block


   Function gives the size of the largest block
free upper memory.

 Log in: -
Output: A - unit volume in kilobytes.

# 0084. Reallocate memory map


   Function moves the memory card.

 Login: DE - a new position map;

       BC - A new page map.
Exit: -


# 0087. Get page status


   Function gives information about the page.

 Log in: BC - page.
Yield: DE - map Employment page.


# 008A. Set page status


   Function sets information about the
page.

 Log in: BC - page;

       DE - map Employment page.
Exit: -

# 008D. Select 4MB page


   In NeOS v1.0 is not implemented.

# 0090. Change page in low memory


   In NeOS v1.0 is not implemented.



          Other features kernalya


# 00E1. Go lower by pixel


   The function calculates the address of the next
lines to the screen.

 Input: HL - address in the display area.
Output: HL - address of the next line.

# 00E4. Go higher by pixel


   The function calculates the address of the previous
lines to the screen.

 Input: HL - address in the display area.
Output: HL - address of the previous line.


# 00E7. Go lower by cell


   The function calculates the address of the next
familiarity on the screen.

 Input: HL - address in the display area.
Output: HL - address of the next familiarity.


# 00EA. Go lower at attributes


   The function calculates the address of the next
familiarity in the attributes.

 Input: HL - address of the attributes.
Output: HL - address of the next familiarity.

# 00ED. Go higher at attributes


   The function calculates the address of the previous
familiarity in the attributes.

 Input: HL - address of the attributes.
Output: HL - address of previous familiarity.

# 00F0. Calculate screen address


   The function calculates the address in the screen on
coordinates in the familiarity.

 Log in: BC - coordinates in familiarity.
Output: HL - address in the display area.

# 00F3. Calculate attribute address


   The function calculates the address of the attributes
the coordinates of familiarity.

 Log in: BC - coordinates in familiarity.
Output: HL - address of the attributes.

# 00F6. Convert screen address to attribute


   The function takes the address in the screen
area addressed in the attributes.

 Input: HL - address in the display area.
Output: HL - address of the attributes.

# 00F9. String comparision


   The function compares 2 sequences
bytes.

 Input: HL - address of a single line;

       DE - the address of another line;

       C - number of bytes to compare.
Output: Z - strings are identical;

       NZ - lines are different.
Variable registers: B.



         Options "Screen manager"



   This set of functions designed to
perform basic actions with
screen. It may be useful for
organization of the user interface and
etc.

   When you specify coordinates and sizes
register pair, the most significant byte -
coordinate Y, Jr. - coordinate X. All
functions that use the driver symbol
output (output characters, lines, messages,
numbers, menus) are working in the current text
window.

Options:

# 0093. Clear screen


   The function clears the screen and sets
new current attributes.

 Input: C - attribute;

       B - border.
Exit: -

# 0096. Clear window


   The function clears the window without flooding it
attributes.

 Log in: BC - the upper left

            corner of the window;

       DE - the size of the window.
Exit: -

# 0099. Fill window with attribute


   The function fills in the attribute window without
changing the image in it.

 Log in: BC - the upper left

            corner of the window;

       DE - the size of the window;

       H - attribute.
Exit: -

# 009C. Call symbol-output driver


   Function causes the current driver
character output.

 Input: A - number of driver functions.
Exit: -
Variable registers: -

# 009F. Put character


   Function displays a single character.

 Input: C - code for the character.
Exit: -
Variable registers: -

# 00A2. Put string


   The function outputs the string of characters.
Marker for the end of the line is the code # FF. In
line can meet the following
control codes:

  db # 10, N - Set the color of ink N;

  db # 11, N - Set the color of paper N;

  db # 12, N - Installation bright N;

  db # 13, N - install flash N;

  db # 14, N - setting current attributes;

  db # 16, X, Y - coordinate the installation print.

 Input: HL - address of string.
Exit: -

# 00A5. Messager


   Display a message from the table.
Message delimiter is the code # FF.
To derive the function is used Put
string, so you can use
control codes.

 Input: HL - address of the table;

       C - line number (0 - first

           line).
Exit: -

# 00A8. Print byte-number


   Function displays the number in the range
# 0 - # FF (8 bits). The output is in the system
calculus, given 7 bit system
variable flags1.

 Input: C - number.
Exit: -

# 00AB. Print Word-Number


   Function displays the number in the range
# 0 - # FFFF (16 bit).

 Input: HL - number.
Exit: -

# 00AE. Print double-word-number


   Function displays the number in the range
# 0 - # FFFFFFFF (32 bits).

 Input: HL - lower 16-bit numbers;

       IX - the older 16-bit numbers.
Exit: -

# 00B1. Scroll Window Up


   Function moves the window up on one
familiarity with the attributes, clearing
bottom line, and pouring its current
attributes.

 Log in: BC - window coordinates;

       DE - the size of the window.
Exit: -

# 00B4. Scroll Window Down


   Function moves the window down to one
familiarity with the attributes, clearing
top line and pouring its current
attributes.

 Log in: BC - window coordinates;

       DE - the size of the window.
Exit: -


# 00B7. Scroll Text Window Up


   The function shifts the current text box
Up to one familiarity.

 Log in: -
Exit: -
Variable registers: -

# 00BA. Scroll Text Window Down


   The function shifts the current text box
down on one familiarity.

 Log in: -
Exit: -
Variable registers: -

# 00BD. Draw Styled Box


   Function draws a rectangle
stylized frame without having to install
attributes. Address style specified in the
variable styles. Style is
is a set of characters that
draws frame (total 8 characters).

 Log in: BC - the upper left

            corner of the frame;

       DE - the size of the window;

       A - identity (A = 0 - ROM).

  Exit: -

# 00C0. Draw Window


   Function draws a window on the screen and clears
him.

 Login: IX - a pointer to a window handle.
Exit: -

# 00C3. Vertical Menu


   The function displays a vertical
menu (the menu text should be printed
advance!). Menu selection is made
cursor keys, Enter (choice
points), Edit (exit from the menu). Coordinates
menu in the descriptor are relative
the current text window.

 Login: IX - pointer to handle the menu;

       E - the initial number of points.
Output: E - item number, E = # FF - if

       clicked Edit.

# 00C6. Put sprite


   The function displays a sprite.

 Input: HL - address of the sprite;

       DE - the size of a sprite;

       BC - the coordinates of the sprite

          (7 bits of C = 0 - black and white sprite

           7-bit C = 1 - color sprite).
Yield: DE - address after the withdrawal.



        Function "System manager"


# 004B. System info


   Function gives basic information about
system and computer.

 Log in: -
Output: A - computer code;

       BC - version (vB.C);

       HL - address of the ID-Thong system.

# 004E. Wait for keypress


   The function expects a keystroke.

 Log in: -
Output: A - key code.
Variable registers: -

# 0051. Wait for keypress + click


   The function expects a pressing and
produces a click when pressed.

 Log in: -
Output: A - key code.
Variable registers: -

# 0054. Click sound


   Function produces a small click on
Beeper.

 Log in: -
Exit: -
Variable registers: -

# 0057. Exit from program


   Function makes emergency
(Mostly) out of running
program to restore the stack
(STACK_P), interruptions and subsequent
transition to address identified
variable PROGRET.

 Log in: -
Exit: -

# 0066. NMI handler


   Immediately upon arrival nonmaskable
interrupt jumps to the address
HK_NMI, which should have a team
transition to the interrupt handler.



        System variables NeOS



     Unmovable block of variables



   Name Address Len Description

 TEMPFA # 5B00 Time 512. Region
 HK_ERR # 5D00 2 Error manager
 HK_INT1 # 5D02 2 User INT 1
 HK_INT2 # 5D04 2 User INT 2
 HK_INT3 # 5D06 2 User INT 3
 HK_INT4 # 5D08 2 User INT 4
 HK_INT5 # 5D0A 2 User INT 5
 HK_NMI # 5D0C 3 NMI handler
 STACK_P # 5D0F 2 The value of the stack

                         before starting

                         program
 PROGRET # 5D11 2 Address return

                         from the program
 ERR_SP # 5D13 2 The value of the stack

                         after error
 ERR_JP # 5D15 2 Address return

                         by mistake
 DRV_BEG # 5D17 4 pointer to

                         Home Tabley
                         particle driver
 LIB_BEG # 5D1B 4 pointer to

                         Home Tabley
                         particle libraries
 RES_BEG # 5D1F 4 pointer to

                         Home Tabley
                         particle residents
 VARLEN # 5D23 1 Length of mixing
                         schaemogo block

                         variables
 F_DRV # 5D24 7 Fake-driver
 F_LIB # 5D2B 7 Fake-bibl.
 F_RES # 5D32 7 Fake-resident
 NEOSFD # 5D39 1946 FD file from
                         rytogo NeOS
 TOTRRET # 5D67 2 Call TR-DOS
 TOTR # 5D69 ... Calling the TR-DOS



      Move blocks of variables



   At the beginning of this block indicates the register
IY. This area can be moved
arbitrary domain (preferably at the bottom
memory). Accessing the variables is
through the offset (index).



   The name of the Indus. Len Description

 scratr +0 1 Acre. Attributes
 atrf +1 a mask attribute
 scrcrd +2 2 Acre. coordinates
 fontadr +4 1 Address Font

                        (High byte)
 border +5 a Border color
 styles +6 2 Address Table

                        frame styles
 textwin +8 4 Parameters

                        textbox

                        (X, Y, W, H)
 limcrd +12 2 limit

                        coordinates in

                        text box
 symdrv +14 2 Address Driver

                        serial-by-character

                        O

 lastkey +16 1 Code last

                        keystroke
 repwait +17 1 Pause before

                        autorepeat
 reprate +18 1 Frequency of auto
                        Repeat
 repcnt +19 1 inside. counter
 lastki1 +20 1 inside. Vac.

 pagemp +21 4 pointer to

                        memory card
 ramtop +25 2 Top border

                        lower memory
 curpage +27 2 Current. Home
 ports +29 4 Contents

                        Port management
                        of memory

 drive +33 1 Current disco
                        Boc device
 drvnum +34 1 No.

                        Devices
 drivdsc +35 2 Address Descriptor

                        current drive
                        Vågå device
 drivtab +37 2 Address Table

                        Descriptors

                        Devices
 curdbl +39 2 Number of the first

                        unit current

                        directory
 dskerr +41 1 Code last

                        reactions to discrete
                        kovuyu error

 pnt_x +42 2 Coordinates X
 pnt_y +44 2 Y coordinate
 brd_l +46 2 Left border
 brd_r +48 2 Right border
 brd_u +50 2 Top border
 brd_d +52 2 Lower bound
 buttons +54 1 Comp. Buttons:

                        bit0: Right

                        bit1: Left

                        bit2: average
 sens_x +55 1 The sensitivity
                        sequence of X
 sens_y +56 1 The sensitivity
                        sequence of Y

 flags1 +57 1 flag (see below)
 flags2 +58 1 flag (see below)
 neos_r +59 4 pointer to

                        slave. reg. NeOS
 neostmp +63 4 ext. change.
 scrbeg +64 1 st.bayt screen
 countrs +65 2 counters mouse
 interp +67 4 address of the external

                        interpreter



   Description of the bits of flag variables. In
parentheses indicate the state of bits 0 / 1.

flags1:

  bit 0: Flag clicking on the button (no / yes);

  bit 1: click when you press the

         (Yes / no);

  bit 2: Output mode characters on the screen

         (Replace / XOR);

  bit 3: Reserve;

  bit 4: Language input lines (LAT / RUS);

  bit 5: Register set: 1-Caps Lock;

  bit 6: Office-bit drivers

         char output;

  bit 7: Base in the derivation

         numbers (10/16).

flags2:

  bit 0: delay for promotion drive

         (No / yes);

  bit 1: using a driver file

         systems;

  bit 2: Use an interpreter

         batch files.

   The remaining bits are undefined and should
be zero.



   Immediately after the system variables can
walk description of disk devices.



    Description of different data formats



            Format Index



   The first 2 bytes - number of pages
The following 2 bytes - address.



       Format descriptor unit



Offset Length Description


  0 1 Number of sectors per track

  January 1 code lengths sector

  Jan. 2 The number of sectors in the block

  March 2 address the device driver

  February 5 address the current driver

               filesystem

  July 2 Address buffer FAT

  September 1 Current sector FAT
 January 10 a flag byte
 January 11 Page buffer FAT
 January 12 Length FAT


Total 13 bytes.



     Table format disk parameters



Offset Length Description


  0 1 Number of sectors per track

               (0 - end of table)

  January 1 Number of sections of the device

  February 2 Number of tracks on the disc

  ... ... (Continued)



   Since for the same size
sector allowed several different
formats, the parameters of the descriptors are
one after another. Table ends
a null byte.


          Disc Format Descriptor


Offset Length Description


  0 16 Disc name

  February 16 disk capacity in blocks

  February 18 number of free blocks

  February 20 Sector size in bytes

  January 22 block size in sectors

Total 23 bytes.

       The format of the descriptor directory


Offset Length Description


  0 1 Number of Files

  January 1 Number of deleted files

  February 2nd volume in the blocks directory

Total of 4 bytes.


         The format of the file descriptor



Offset Length Description


  0 16 Filename

  March 16 File Extension

  January 19 File attributes

               Bit 0 - Read Only

               Bit 1 - Hidden File

               bit 2 - System File

               Bit 3 - flag disklabel

               Bit 4 - title

                       subdirectory

               Bit 5 - archive file

               Bit 6 - segmented /

                       continuous

  February 20 Address File Download

  February 22 File creation time

  Feb. 24 Founded file

  April 26 The length of the file

  February 30 initial block file


  32 1 Number of device file

  33 2 The initial unit of its

               directory

  35 1 Number of files in a directory

  36 2 address the read buffer

  38 2 Current Block file

  40 1 Current sector in the block

  41 4 position in the file

  45 1 Flags file:

               Bit 0 - no title

                changed / unchanged

               bit 1 - the sector is not

                changed / unchanged

               bit 2 - the current sector

                do not read / read



Total 46 bytes.

   The first 32 bytes of the file descriptor -
directory entry, which gives the function
Get catalogue cell.

    The format of the information stored in the CMOS


Offset Length Description


  0 1 Seconds

  January 1 Second Alarm

  January 2 Minutes

  January 3 Minutes alarm

  January 4 Hours

  May 1 Alarm Clock

  June 1 Day of the Week

  July 1 Number

  Aug. 1 Month

  September 1st Year

  April 10 System CMOS registers


  63 1 boot disk


   The first 14 bytes of CMOS may not coincide
for different circuits, data
correct only for GLUK'ovskoy scheme.
Therefore, do not read the time on
bytes, use the special
function.

          The format of the descriptor window


Offset Length Description


  0 1 X coordinate

               (7 bits = 0 - no shadows

                7 bits = 1 - with a shadow)

  January 1 Y coordinate

  February 1 width of the window

  March 1 window height

  April 1 attribute window

  May 1 attribute shadow

  June 1 style of window frame

Total 7 bytes.


          Format Descriptor menu



Offset Length Description


  0 1 X coordinate

  January 1 Y coordinate

  February 1 width of the strip separation

  January 3 Number of points

  April 1 attribute nevydel. item

  May 1 attribute apportionment. item

Total 6 bytes.



        Table of types of computers



   Function System info shows the output
type of computer. Here is the table of correspondence
specific models and code layout
ports for memory management system
variables:

 0 - Spectrum 128;

     ports +0 - # 7FFD;
 1 - Pentagon 512;

     ports +0 - # 7FFD;
 2 - Scorpion ZS 256;

     ports +0 - # 7FFD;

     ports +1 - # 1FFD;
 3 - Scorpion + GMX

     ports +0 - # 7FFD;

     ports +1 - # 1FFD;

     ??
 4 - KAY 256;

     ports +0 - # 7FFD;

     ports +1 - # 1FFD;
 5 - KAY 1024;

     ports +0 - # 7FFD;

     ports +1 - # 1FFD;

     ??
 6 - Profi;

     ports +0 - # 7FFD;

     ports +1 - # DFFD;
 7 - Sam Coupe.

     ports +0 - # FA;

     ports +1 - # FB.


   System variable ports +3 always
contains the state of the port # EFF7.



In the appendix to this edition of the newspaper recorded three 
firmware NEOS - for 128, 256 and 512 kilobyte machines.







Other articles:

From the Author - In the school holidays ...

News - In the city there were modems, finishes work on CD-ROM.

NEOS - Description of a new operating system for the Spectrum.

Overview of new products - Japan Crossword (demo).

Congratulations - November 7!

WANTED - Searching software ...

Advertising - Advertisements and announcements ...


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

Similar articles:
Iron - how to avoid glitches with the second treatment interruption on machines with the division of the field memory.
List BBS - A list of running BBS.
Projects - an overview of upcoming projects: the game "Guess the melody", a new clone of the Spectrum, the magazine Deja Vu # A, a new OS for the Spectrum - Doors 2002 Aqua.

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