A cold reset is done when the machine is first powered on, and when the reset button is pressed, unless the user has set up a warm reset address (see section 3.2). It completely restarts the system, losing any information which existed before the reset.
A cold reset first does a checksum test of the internal 32K ROM. If this
is passed it then locates any RAM in the system. It searches the whole
4megabyte address space apart from the internal ROM and cartridge
slot (segments 00h
to 07h
). It examines each
16K segment in turn, doing a memory test on each one. If a segment passes
the memory test then it will be added to the list of available RAM
segments. There is no test for RAM reflections so any extension RAM must
be decoded fully. The memory test detroys any data which may have been in
the RAM segment previously.
After the RAM test, the 4megabyte memory space is then searched for extension ROMs. The ROM search will only find ROMs in segments which are multiples of 16. This means that extension ROMs have to be decoded only to 256K boundaries, but can reflect throughout this 256k space. An exception is made for the cartridge slot in that all four segments are examined for ROM, but a test is done to ignore reflections by checking that any two ROMs in the cartridge slot are different. The details of extension ROMs are explained in section 6.3 and chapter 9.
Having created the ROM list, various internal variables are set up,
including the system entry points at the start of the page zero segment.
The remainder of the I/O system is then initialised by linking in and
initialising all the builtin and extension ROMs as will be
explained in more detail later on. The copyright display program is then
entered which displays a flashing
message and an Intelligent Software copyright message on the screen,
until a key is pressed by the user. This display and waiting for a key
can be suppressed by an extension ROM setting the variable
CRDISP_FLAG
to a nonzero value when it is initialized.
When a key is pressed, the display will be removed and the system will call each extension ROM in turn with action code 1 (see chapter 9 for explanation of action codes). Any ROM which wants to set itself up as the current applications program simply does an EXOS reset call (see sections 9.3 and 11.2) to claim the system and then has full control.
A warm reset is performed when the reset button on the
machine is pressed, if the user has set up a warm reset address, and if
the system variable area has not been corrupted. A warm reset address can
be set up simply by storing the address in the variable
RST_ADDR
which is in a defined
place in the system segment. The address stored must be in Z80page
0 and will be jumped to when the warm reset sequence is complete. The
warm reset routine will thus always be in RAM since the page zero segment
is RAM.
A warm reset does not do a RAM test or a ROM search. All memory allocated
to the user is undisturbed and any system RAM extensions or user devices
which are linked in, remain. However all channels are forcibly closed and
all devices are reinitialized, any RAM which was allocated to
channel RAM areas is freed. The details of this will be explained later on
(in fact an EXOS reset call is
simulated with the reset flags set to 10h
- see
section 11.2).
EXOS will set RST_ADDR
back to
zero before jumping to the warm reset address. This ensures that if the
system has crashed then a second press of the reset button will do a cold
reset. Also, as long as the user waits for a short time before setting
its warm reset address up again, pressing the reset button twice quickly
will always do a cold reset.
The code at the warm reset entry point will be entered exactly as if it had just done an EXOS reset call so it will have to set up its stack pointer and reenable interrupts (see section 11.2). The contents of Z80pages 1, 2 and 3 will be undefined so the user must reset these for himself. Particulary, in the case of a ROM applications program which normally runs with its ROM in page 3, it will have to page its own ROM back in. This means of course that the applications program must have stored its segment number in the page zero segment in order for the warm reset routine to restore it. Also note that any software or hardware interrupt address (described in section 4.2) which may have been set up will have been lost, and so these must be set up again.