BIOS, CRDOS. Part 2.
ZXNet echo conference «zx.spectrum»
From Alexander Shherbakov → To All 1 April 1998
■ Hello, All!
Brief description of BIOS functions.
BIOS is the main part of ROM BIOS. If testing programs and initialization programs can be changed and supplemented without compromising compatibility with earlier versions of ROM BIOS, then changing the functions of the BIOS leads to complete or partial incompatibility of the previous software with it. Based on the above, a certain complexity is caused by
the optimal layout of the BIOS. Therefore, the following brief
description of BIOS functions should not be considered final,
because changes and modifications are possible here.
BIOS function calls are made through commands of the RST microprocessor. Their choice is explained by the following reasons.
Firstly, the use of RST commands with their fixed transition addresses predetermines a certain standard and has a disciplinary effect than a call through the CALL function.
Secondly, when using the RST command, 2 bytes are saved
for each BIOS function call, which is important for resident
programs and drivers.
List of BIOS functions
┌────────┬───────┬───────── ──────────────────────┐
│ Call: │ Address:│ Destination: │
├────────┴───────┴───────── ──────────────────────┤
│ CALL 5 0005H Calling basic BIOS functions. │
│ RST 1 0008H -+--"-+-- also -+--"-+-- │
│ RST 2 0010H Keyboard and display driver. │
│ RST 3 0018H Access to I/O ports, timer. │
│ Printer driver. │
│ RST 4 0020H HKML Driver. │
│ RST 5 0028H Reserved. │
│ RST 6 0030H Other functions. │
│ RST 7 0038H Reserved. │
└─────────────────────────── ─────────────────────┘
Description of BIOS functions.
To return from an application program to Loader, DOS or
a similar program, use the RET command or the
JMP 0 command. The use of these various commands is possible because
when the application program is called, the return address
to the original program is stored on the stack. After returning, Loader or DOS
reinstall the stack.
Because of this, the RST 0 command cannot be used to
call BIOS functions, since when processing this command, the
processor goes to address 0000H (saving the return address
on the stack). However, this command can be used toexits the application program.
Interrupt RST 1 provides access to the main functions of the BIOS, similar to subfunctions 00H - 0CH DOS CP/M. When
installing any DOS, it takes the interrupt vector RST 1 to
itself, ensuring conflict-free operation of programs developed for both BIOS and DOS. To ensure compatibility
of the BIOS with the DOS CP/M standard, it is possible to call
BIOS and DOS functions via the JMP 5 command.
The RST 2 interrupt ensures that the application program accesses the keyboard and display drivers. Unlike the RST 1 interrupt, direct access to the keyboard driver
via RST 2 allows you to:
- enter a pseudo-interrupt mode when a key is pressed;
- receive a key scan code;
- install another driver.
Accessing the display driver using the interrupt
RST 2 allows you to:
- set the video mode;
- set the color for displaying characters and background;
- convenient to work with graphics through graphic primitives;
- scrolling of any part of the screen and some
other functions.
The RST 3 interrupt serves the printer, some peripheral LSIs and input/output ports. Note that the driverThe printer, in addition to its main purposes - to transmit a byte to the printing device and monitor the readiness of the control unit, can recode characters or change the image of a character to ensure normal printing of Russian letters on printers that do not have the Cyrillic alphabet.
Access to peripheral LSIs (for example, a timer, an interrupt controller) and ports input/output (parallel and serial) via the RST 3 command not only simplifies the use
of these devices, because The BIOS takes on all the work associated
with programming these devices according to the user's wishes, but also ensures compatibility of two PCs with a non-standard
connection of a peripheral LSI on one of them (addresses
for installing peripheral LSIs are set in Setup).
The RST 4 interrupt provides access to the HKML driver, and
when installing drives, also to to the HGMD driver.
The HKML driver performs the following functions:
- controlling the motor of the drive (tape recorder);
- setting the write speed on the ML;
- writing/reading a byte from the ML.
Interrupts RST 5 and RST 7 in this version of ROM BIOS are not
used and reserved.
Interrupt RST 6 serves some functions, for example
reading CMOS memory,definition and composition of connected equipment, size and use of RAM, etc.
Brief description of CMOS Setup.
The purpose of CMOS Setup is to store various
system parameters with the ability to reinstall them. CMOS
Setup consists of two parts:
1. static memory chips (CMOS) of small capacity
(256 - 512 bytes)
2. software tools designed for:
- determining the contents of CMOS and setting parameters
of the system in accordance with them;
- outputting the contents of CMOS to the display (in convenient forms
for perceiving the values), with the ability to reinstallation.
Installation of static RAM in a PC is carried out by
installing an additional input/output port (BB55).
CMOS structure
The nominal capacity of RAM memory (Static RAM) is
256 bytes. Of these, the first 2 bytes are allocated to the CMOS identifier and the checksum (modulo 256) of CMOS cells with numbers from 2 to 256. If the RAM memory capacity exceeds 256 bytes, the remaining memory cells are not used and are not monitored for correctness. RAM cells with addresses 2 - 127
are intended for storing basic information, and with addresses
128 - 255 are reserved and can be used by the user to store various parameters.
If the RAM capacity exceeds 256 bytes, then the remaining memory cells
are controlled by the user.
Connecting ROM BIOS
1. Boot loader in ROM on the motherboard
2. Board with RAM disk controller, additional ROMs, CMOS
The bootloader from the ROM on the motherboard loads the BIOS from the ROM on the
additional board.
The additional board contains 2 parallel K580VV55 controllers.
Distribution of controller outputs:
PPA1, ABC - address bus
PPA2, A - device decoder
PPA2, B - data bus
PPA2, C - control bus
The address bus provides (theoretically) over 16 million addresses, but
practically only the lowest 4 pins are used from port C of PPA1, which reduces
the bit capacity to 1 million addresses. The most significant bits of port C are not used.
The number arriving at the device decoder from port A of PPA2 controls
the permission of RAM disks, ROM, CMOS. Theoretically, the number of individual
devices can be 256.
The lower 4 pins of port A of PPA2 control
RAM disks through a 16 output decoder.
The next 3 pins control the connection of additional ROMs, and
BIOShas address 000.
The most significant 8 bit controls the operation of CMOS.
What about crushing the baby?