EasyManuals Logo
Home>Sinclair>Desktop>ZX Spectrum

Sinclair ZX Spectrum User Manual

Sinclair ZX Spectrum
82 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #64 background imageLoading...
Page #64 background image
Chapter 7
62
ROM. For instance, the extended BASIC can be used to control the SPECTRA
interface’s RS232 socket, and the new command CLS# (which resets the screen
colours) will operate successfully since it does not rely on the ZX Interface 1 hardware.
However, the most beneficial reason for using the ZX Interface 1 ROM is that it already
contains the necessary infrastructure to handle new BASIC commands and yet only
occupies half of the available ROM space (the ZX Interface 1 ROM is 8K in size
whereas the SPECTRA interface supports a 16K external ROM).
Should the external ROM be currently paged in at the moment that the Spectrum is
reset then it will be automatically be paged out. It will also be paged out when
configuration switch 2 is set to the off position and there is an onboard ROM fitted. If a
device connected behind the SPECTRA interface requests access to the ROM
address space then an onboard ROM or a plugged in ROM cartridge will always be
disabled.
Adding new BASIC commands
The process of creating new BASIC commands is well documented in Sinclair
literature due to the ZX Interface 1 ROM naturally providing a mechanism to extend
Sinclair BASIC. The mechanism requires the new commands to be run from RAM and
so they need to be loaded every time the Spectrum is reset. Having these commands
in ROM has the advantage that they are instantly available and do not take up
valuable RAM space. The process of hooking the commands into the parser of the
ZX Interface 1 ROM will be different but the approach used to examine the syntax of
the new commands can be the same. The operation of the ZX Interface 1 command
parser and examples of adding new BASIC commands are described in the Spectrum
Shadow ROM Disassembly book [4] and the Spectrum Micro Drive Book [7]. Another
useful reference is The Complete Spectrum ROM Disassembly book [8] as it will often
be necessary to make calls into the BASIC ROM. A commented assembly file of the
second edition ZX Interface 1 ROM is available from www.wearmouth.demon.co.uk [5]
and provides an ideal starting point for creating a customised version of the ROM. The
first place in this file to examine is the routine at location $01AA which is responsible
for identifying the token of the BASIC command that produced the syntax error that
caused the ZX Interface 1 ROM to be paged in. This routine could be patched to
perform checks for further tokens, or the command handlers that are currently called
could be patched to support alternate forms of those commands. Each patch should
change the existing ROM code as little as possible by simply redirecting program
execution into a continuation routine located within the additional 8K space. In this
way, all routine address entry points remain the same and so existing machine code
programs that directly rely on them will still function correctly.
Although it is possible to remove unwanted commands from the ZX Interface 1 ROM
to make additional space available, it is recommended to keep them in place so that
the enhanced ROM is fully backwards compatible with all existing programs.
Supporting the new attribute modes
One use for the additional 8K of space would be to add BASIC commands that select
and operate on the new attribute modes provided by the SPECTRA interface. However,

Table of Contents

Other manuals for Sinclair ZX Spectrum

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Sinclair ZX Spectrum and is the answer not in the manual?

Sinclair ZX Spectrum Specifications

General IconGeneral
BrandSinclair
ModelZX Spectrum
CategoryDesktop
LanguageEnglish

Related product manuals