XTender
SINCLAIR
ZX81 (TS1000) EMULATOR
Hypermanual
for Version 1.22
Original manual (c)
by Carlo Delhez, October 1997.
Hypermanual (c)
by Carlo Delhez, March 2002.
Feel free to make a local copy
of this manual for your own reference.
CONTENTS
[ to main page
of XTender support site ]
Introduction - Program
Description - Registration - Compatibility
- Comparison - Starting
XTender - AutoLoad-n-Run - Commandline
Qualifiers - Screen Output - Keyboard
Facilities - Keyboard Compatibility
- Keyboard Lock - File
Management - Printer Output - High
Resolution - ZX81 64k Memory Map - ROM
and 8-16k Area - Stopping XTender - Clock
Frequency - Slowing Down - Z80
Emulation - Programs from Tape to Disk
- Screen Saver - Warranty
- About the Author - XTender
Release History & Future - Final Notes
INTRODUCTION
The Sinclair ZX81 (or Timex/Sinclair TS1000)
is the second computer marketed by Sir Clive Sinclair in the early
eighties. In 1980, he introduced his first computer and called it ZX80.
In those days, computers were far from the 'common good' they are nowadays
and the ZX80 was a relatively cheap machine. It was offered for around
100 UK pounds (US$ 250) (and was marketed as "the world's first complete
personal computer for under 100 pounds"), while its closest competitor
(the VIC20 from Commodore) was about three times as expensive.
Although the ZX80 was quite a success (50,000
sold), it has some shortcomings, e.g. it can only do integer calculations
(no floating point), the screen flashes at every keepers and goes blank
during execution of programs (this does increase speed but is not very
'ergonomic'). An upgraded version of the ZX80 appeared within a year. It
has an 8k ROM (instead of the 4k of the ZX80), can do floating point mathematics
and offers a choice between FAST operation with black screen (as on the
ZX80) or SLOWer operation with normal screen. This updated version is called
ZX81.
The ZX81 has a Zilog Z80A processor operating
at approx. 3.2 MHz, 1k RAM (yes!, only 1024 bytes, but expandable to 48k),
32x24 text screen and 64x48 graphics resolution in black and white. Programs
can be stored on tape and be retrieved at 300 baud. The first versions
sold for 70 pounds (ready built) and 50 pounds (DIY kit); 50,000 ZX81s
were purchased in the first 3 months after its release.
Later computers from Sinclair include the ZX
Spectrum (1982, Zilog Z80 processor at 3.5 MHz, 16k ROM, up to 48k
RAM, colour, sound, high resolution, a lot faster thanks to video hardware
instead of -software, ASCII based character set and more expansion possibilities)
and the QL ("Quantum Leap", 1984, Motorola 68008 processor at 8
MHz, 48k ROM, 128k RAM, multitasking and superb operating system Qdos).
Although the ZX Spectrum undoubtedly was (and
still is) the most popular of all Sinclair machines, I think that many
people using PC's nowadays may have been introduced to the world of computers
by way of their (late) ZX81. I hope these people will re-enjoy working
with this simple yet very fine computer again.
Run XTender and be my guest!
PROGRAM
DESCRIPTION
XTender is an emulator of the Z80 processor
in a Sinclair ZX81 environment, written for PC's with a standard graphics
adapter (Hercules, CGA, EGA, or VGA). The Z80 Emulator is able to execute
programs written in the Z80 machine code language. The ZX81 environment
includes the original ZX81 ROM and additionally takes care of hardware
compatibility (e.g. keyboard reading, screen output control and redirecting
of signals originally heading for devices such as tape and printer). The
Z80 Emulator and the ZX81 environment are joined in a single block of 80x86
machine code, which - as a whole - is referred to as ZX81 emulator, and
is named XTender. XTender is written entirely in Assembly Language for
best performance. The source comprises over 8,000 lines (with the numerous
macros still unexpanded!).
REGISTRATION
XTender is distributed on a shareware basis.
You are allowed to make copies for other people, provided: you copy
all the files, you do not make changes in any of the files, you do not
add any files, and you do not charge any costs other than a small fee for
reproduction, postage and packing.
Test XTender during a trial period of 21
days and then delete the files if you don't like to use the program.
However, if you do like to use XTender, please
express your appreciation and support my efforts by becoming a registered
user. This will entitle you to the following benefits:
-
You will receive the complete registered package
containing the most recent version of the emulator and 3 library
volumes, containing a total of 240 original ZX81 programs. The
registered copy of the emulator offers various features which are not present
in the shareware version. Most importantly: only registered copies can
be slowed down! The registered package also contains the ZX81tape
tool, to convert your own ZX81 tapes to PC-files.
-
You will be entitled to free technical support
by the author.
-
You will receive the first official release of XT2
(the succesor of XTender), once available.
Ordering a registered copy
A registered copy of XTender, including three
library disks and the services described above is priced at US $ 20.
Orders can be placed via PayPal
only. PayPal is the leading provider
of world-wide secure internet transactions for eBay
and many other sellers, both professional and private. Membership is fully
free, and the payments you make are taken off your bank account or credit
card account in your own currency. No additional fees are charged.
If you want more information about PayPal,
click
here.
To order your registered copy of XTender instantly
via PayPal, just click this button:
Once your order has been received, a registered
copy of XTender will be sent to you by email.
COMPATIBILITY
Since the original ZX81 ROM in Z80 code is included
in XTender (with only a few minor changes, of no interest for ordinary
use) almost complete software compatibility is guaranteed. Almost,
since only some very specific software can not be emulated: (a) programs
using (standard or auxiliary) input/output ports such as video control,
ear/mic-lines, or other devices like sound-generators and EPROM programmers;
note that the keyboard and printer input-lines are emulated correctly;
and (b) programs taking over the interrupt vector (e.g. sprites, real-time
clock) are not supported by XTender.
Apart from these exceptional applications, any
program running on the ZX81 should also run on XTender.
COMPARISON
To name just a few advantages of XTender with
respect to the ZX81:
-
Safe operation in a well-stabilized PC: none of the
tricky business with wobbling RAM packs!
-
Full 64k RAM available, including POKEable
ROM and 8-16k area!
-
Reliable and fast data-storage: no more slow tapes!
-
The ZX81 display file can be moved to any part of
memory without a crash, machine code can also be executed in the top 32k
of memory: on the ZX81 only the bottom 32k could be used!
-
A choice of screen colour, and a screen invert option.
-
SuperBreak facility.
-
Reset under keyboard control.
-
etc. etc. etc.
A disadvantage could be the operation speed.
On old (slow) machines (XT, AT), the emulation might become quite dull.
On modern (fast) machines, the speed becomes far too high for normal operation.
Therefore, two versions of XTender are supplied: a speed-optimized version
for slow machines, and a slower variable-speed version for fast machines
(registered copies only!). More about this
in the section Slowing Down.
STARTING
XTENDER
For running XTender, you need a PC with a standard
graphics adapter (Hercules, CGA, EGA, VGA) and about 128k of free memory
to store the program and the required work space. Note that you need MSDOS
version 2.0 or higher. XTender refuses to start with lower version numbers.
XTender is designed to be compatible with all processors from the basic
8088 up to and including the Pentium-II (and beyond?!).
Two versions of XTender exist. These are named
XTENDER!
(with exclamation mark) and XTENDER (without exclamation
mark). The former is the fastest version and should be used on slow machines
(XT, AT). The latter is not speed-optimized, hence a little slower. However,
this one has the possibility to slow-down emulation considerably and should
be used on (very) fast machines; this slow version is supplied with registered
copies of XTender only.
To start the program, simply type
XTENDER! (fast version)
or
XTENDER (slow version,
registered
copies only)
(whichever you prefer or have) at a DOS prompt.
This will start XTender. First you will see a title page which displays
some general information about XTender and its usage (Note: in case of
registered
copies, the title page is skipped, use the /t qualifier to
see it, see section Commandline Qualifiers).
Now press any key to start the actual ZX81 emulation. Depending on the
speed of your computer, you will see some flashes and/or weird characters
while the ZX81 performs a reset, but eventually the famous inverse-K
cursor should appear and XTender is ready to be used.
XTender tries to determine what video card you
have installed simply by looking at the current video mode so as to make
a distinction between Hercules and non-Hercules. In Hercules, only a small
portion of the display will be used, in all other cases, the ZX81 screen
occupies almost the entire display. If you have CGA emulation on your Hercules
card and want to use it with XTender, make sure you do not start XTender
in video mode 7. Alternatively, you can force Hercules or CGA mode by the
/e
and /c qualifiers, respectively (see section Commandline
Qualifiers).
AUTOLOAD-n-RUN
To AutoLoad-n-Run a ZX81 program, you must
simply specify the name of the file in the commandline when you start XTender,
for example like this:
XTENDER program.p
This will start XTender as usual, but instead
of showing the K-cursor after reset, it will auto-load the ZX81
program "program.p". If this is a self-running program, the program
will even start running automatically after auto-load. Otherwise, you will
get the K-cursor as usual (but ofcourse the program you specified
is present in ZX81 memory!). If the file cannot be opened, the ZX81 will
reset and start as usual (no error is reported).
AutoLoad-n-Run will work only once. After NEW
or RST-0 or CTRL-ALT-ESC,
the program will not be auto-loaded again.
Note that the filename supplied in the commandline
must be a DOS-type filename ("8.3") without a path (unless the total size
of path and filename does not exceed 12 characters: everyhing beyond the
12th character is ignored). The extension ".p" must always be
typed. If you supply more than one filename, only the last one will be
used. Qualifiers may be placed in
front or behind the AutoLoad-n-Run filename.
If the P-file specified cannot be opened, this is reported and XTender
will not start.
For DOS-type filenames, you can even AutoLoad-n-Run
ZX81 programs from your Windows file browser by linking the file-extension
".P" to the XTender-executable.
COMMANDLINE
QUALIFIERS
Instead of starting XTender as described in the section
Starting
XTender, you can also use qualifiers in order to influence the
emulator's initial settings. Qualifiers are single-letter switch parameters
preceded by a forward slash '/', minus sign '-' or plus
sign '+' (there is no effective difference between these three
characters). The qualifiers currently available are as follows (preceded
by a forward slash here):
/?
display help page, briefly summarizing all qualifiers.
/b:nn
set background colour; this option only works
if you have an EGA/VGA video card; nn is a decimal number in the
range 0 through 15, corresponding with the 16 colours in the regular EGA
palette.
/c
force CGA screen mode; use this qualifier when
XTender tries to use Hercules although you have a CGA (or better) video
card installed.
/d:nnn
registered copies
only: set emulator delay factor; nnn is a decimal number in the
range 0 through 255; this qualifier is equivalent to the ZX81 command POKE
23,nnn after XTender has been started; for more information, see section
Slowing
Down. XTender! (with exclamation mark) cannot be slowed down (qualifier
not available).
/e
force Hercules screen mode; use this qualifier
when XTender tries to use CGA although you have a Hercules video card installed.
/f:nn
set foreground colour; this option only works
if you have an EGA/VGA video card; nn is a decimal number in the
range 0 through 15, corresponding with the 16 colours in the regular EGA
palette.
/h
display help page, briefly summarizing all qualifiers.
/i
force inverse video (e.g. white characters on
black background), which seems more comfortable for the eyes in case of
serious applications. Note that keystroke CTRL-F2 can be used
to toggle screen colour once the emulator is started (see section Keyboard
Facilities).
/k
alternative keyboard circuit. Some programs,
especially games, may fail to respond to the keyboard. If this happens,
these programs may have been designed specifically for a TS1000 (NTSC version
of ZX81); use the /k qualifier to emulate this properly (but a
cure is not guaranteed).
/m
skip ZX81 memory test; after a NEW or
reset, the ZX81 ROM performs two main actions: it tests the RAM and sets
up the display file. Each of these takes about half the reset-time. On
an emulator, the memory test is not necessary and can be omitted by this
qualifier, thus reducing the reset-time by at least 50%. Note that the
RAM is still cleared (zero-filled).
/r:nn
set default ZX81 RAM size. On the original ZX81,
the RAM size after reset is always 16k (or less if less RAM is available),
because this number is fixed in the ROM. On the emulator, you may change
this number to get any RAM size after a reset from 1k up to 48k (set nn
to a value of 1 through 48).
/s
disable screen-saver (registered
copies only).
/t
show title page of registered
copy. On registered copies, the title page is skipped by default. In
case you are a registered user and wish to see the title page (containing
a brief description of key usage and your name), use this qualifier.
Both upper- and lower-case letters may be used for
the qualifiers. Spaces between successive qualifiers are optional. When
the /? or /h qualifier is present, only the help page
will be displayed and XTender isn't actually started. Commands are interpreted
left-to-right: later settings supersede earlier settings.
Qualifiers may be placed in front or behind the
autoload-n-run
filename.
SCREEN
OUTPUT
XTender uses a PC timer interrupt to write the ZX81
screen into the PC video memory at a regular basis. For the obvious reasons
of speed, the pixel data is poked directly into the video RAM (instead
of using very dull PC Int's). This may not work properly on old PC systems.
Note that the screen routine is differential, i.e. only those parts of
the ZX81 screen that have changed since the last interrupt are updated
on the PC screen.
Before XTender starts emulating, it first determines
the relative speed of your computer. It does this by running a benchmark
test and the resulting benchmark is used to calculate the rate of screen
update. For example, if the measured benchmark is 1000 (approx. 33 MHz
386dx machine), the screen is updated at a rate of 100 Hz. Lower/higher
benchmarks result in proportionally lower/higher screen update frequencies.
As a result of this method, the performance of XTender is automatically
optimized for any machine. I have tested XTender on an original PC (benchmark
50, screen updated at 5 Hz) and the emulator (fast version) still executed
at a speed of 35% with respect to the real ZX81!
You can see the measured benchmark and resulting
screen update frequency by loading the program SYSINFO.P directly
after having started XTender. This will provide you with the information
you need.
The timer interrupt of the PC can be set to one
single frequency only. However, XTender actually needs three distinctively
different frequencies:
-
18.2 Hz to keep your PC's internal clock synchronized
(you'd be cross with me if I hadn't done this!).
-
50.0 Hz to update the ZX81 system variable FRAMES
(for processor-speed-independent timing loops).
-
xxxx Hz to update the PC video RAM (xxxx is an arbitrary
number determined by the measured benchmark).
I have applied some clever programming techniques
to make sure that all these frequencies are available from a single timer-interrupt!
When you return to DOS, the timer frequency is set to 18.2 Hz again.
An XTender user pointed out that (some?) screen-grabbers
seem to work fine with XTender, so if you want to make GIFs (or whatever
graphical format you prefer) of your favourite ZX81 pictures, a screen
grabber may be a useful tool to do just that!
KEYBOARD
FACILITIES
A problem for many users may be the keyboard: the
ZX81 works with tokens and single keypress entries (e.g. pressing just
P
gives the token PRINT). XTender solves this problem by providing
a graphical help screen. Just press CTRL-F1 and the keyboard
help screen will pop up. Press any key to return to the ZX81 screen. The
help screen is a touched-up scanned image of the original ZX81 keyboard.
As an example of keyboard operation, take a look
at the A-key on the help screen. It contains the following symbols:
-
the letter A itself
-
the command NEW
-
the command STOP
-
the function ARCSIN (abbreviated ASN)
-
a grey block
Pressing the A-key will produce one of these
symbols, depending on the current setting of the cursor.
Table: Example of keyboard usage.
cursor
|
keypress
|
effect
|
K
|
A
|
NEW
|
K or L
|
Shift-A
|
STOP
|
L
|
A
|
letter A
|
F
|
A or Shift-A
|
ARCSIN
|
G
|
A
|
inverse letter A
|
G
|
Shift-A
|
grey block
|
The K-cursor (for Keyword) always appears
at the beginning of a command line and after a THEN keyword; the
L-cursor
(for Letter) appears elsewhere. The F and G-cursors (for
Function and Graphics) can be activated by pressing Shift-Enter
(or keypad-5) and Shift-9, respectively.
The default ZX81 screen colour is black characters
on white background (unless you have used any one of the /i, /b
or /f qualifiers, see Commandline
Qualifiers). For games with a lot of graphics this may be OK, but for
text handling, I find the inverse far more comfortable for the eyes. Press
CTRL-F2
to change the display from black on white to white on black and vice versa.
Alternatively, you may wish to use F4 and/or F5
to change the fore- and background colours (EGA and VGA only): a regular
16-colour EGA palette is available.
Some ZX81 (machine coded) programs do not allow
you to stop them using Break (Space key). On XTender, programs
can always be stopped using CTRL-ESC. This will actually
cause a jump to an address in ROM where a RST 8 for error D
is located, and hence the stack is cleared, the error message is displayed
and you are back in Basic. Some programs crash the ZX81 if you try this,
as they may have messed around with the system variables, Basic area, screen
or even with the ROM code. If CTRL-ESC causes a ZX81 hang-up,
press
CTRL-ALT-ESC to recover. This restores the original
ROM code and subsequently executes a RST 0. Any program can be
aborted safely using CTRL-ALT-ESC. Note that the PEEK
value of address 23 is preserved (or at least, it should be!).
On some computers, CTRL-ALT-ESC is already
in use for system purposes; therefore, the keypress CTRL-SHIFT-ESC
may be used as an alternative.
In general, CTRL-ESC should only be used
when the normal Break is disabled. If you use CTRL-ESC in the
normal ZX81 editor, it will lock keyboard operation. Press CTRL-ESC
once more to get proper key response again. In the CBI editor, CTRL-ESC
merely produces a space character, i.e. does not lock the keyboard. In
all cases, avoid using CTRL-ESC when CBI Trace is active.
CTRL together with a key other than one
of the above has the effect of SHIFT pressed together with that
key. CTRL-C is hooked and has no drastic effect (it produces
Shift-C,
i.e. a question mark). CTRL-Break is more dangerous: it
immediately stops XTender and returns to the DOS prompt.
KEYBOARD
COMPATIBILITY
The ZX81 keyboard is totally different from the PC
keyboard. First of all, the ZX81 has only 40 keys. These are arranged according
to the familiar QWERTY layout, but - as you can imagine - 26 letter
keys, 10 number keys, Shift, Space and NewLine
(the ZX81 equivalent of Enter) already make a grand total of 39
keys. The remaining 40th key is a full stop ('.'). So: all other symbols
are hidden as Shifted keys and (to make things even more complicated)
in a non-PC-like fashion. The ZX81 works in UPPER CASE only, so in fact
you have 39 Shift options (barring Shift itself, all
keys can be Shifted, including Space and NewLine).
Symbols are scattered around the keyboard (can you imagine pressing Shift-B
for '*' and Shift-U for '$' !?!), hence you
will really need the CTRL-F1 help facility (see Keyboard
Facilities) or your own ZX81 manual as well as some patience for locating
the symbols.
For unShifted PC-keys, XTender maps almost
the entire PC keyboard to the ZX81 keyboard. Not only the 40 basic ZX81
keys, but also things like the arrow keys, backspace and the numeric pad
are mapped. For example, if you press 'arrow left', XTender will convert
this to Shift-5, the ZX81 equivalent. This makes editing (and
sometimes also playing games) less strenuous. The central key of the numeric
pad ('5') generates Shift-Enter, i.e. toggles Function
mode (a special cursor mode for obtaining functions tokens, see Keyboard
Facilities). More special keys: the square brackets [] are
converted to regular brackets () and the single forward quote
'
is converted to the ZX81 double quote ". The ESC
key
generates Shift-1 (Edit), i.e. brings the current cursored
Basic line down into the ZX81 line-editor.
Also for Shifted keys, the emulator helps
you a little bit. Pressing any one of the Shift keys will always
give you the ZX81-Shifted symbol (like Shift-U for '$').
But, if you press Alt instead of Shift, you will get
the PC-Shifted symbol, so you can press Alt-4 to get the
Dollar $ign. Some non-trivial ALTernatives are listed
below:
-
ALT-6 gives ** instead of ^
-
ALT-7 gives AND instead of &
-
ALT-[ gives <= instead of {
-
ALT-] gives >= instead of }
-
ALT-' gives "" instead of "
Note again how the single forward quote '
is converted to a ZX81 double quote " whereas the PC double quote
"
is converted to a ZX81 quadruple quote "". XTender effectively
doubles quotes.
Finally, if CAPSLOCK is on, the effect
of Shift is inverted for all keys (not only the letter
keys). So, pressing B with CAPSLOCK on gives *,
and Shift-B gives B. Note that this can be especially
nice for some games which use the keys 5 through 8 for
steering and do not allow you to press Shift (so you cannot use
the PC arrow keys). With CAPSLOCK on you can use the arrow
keys of the PC-keyboard!
KEYBOARD
LOCK
If you are a fast typist, the ZX81 may not always
be able to keep track of your typing. In some cases, the PC keyboard seems
to get locked altogether and the ZX81 does not respond anymore to
the characters you are typing. Just hit CTRL-ESC once to
cure this. (The reason for this problem is known; it is caused by a 'clash'
between ZX81 ROM code and XTender code; at the moment, this problem cannot
be solved.)
FILE
MANAGEMENT
Originally, the ZX81 did not have a disk operating
system. Programs could be stored on tape only (at a rather dull
rate of 300 baud, taking more than 7 minutes to SAVE or LOAD
a 16k program). As an alternative, several disk drive systems were
introduced by various companies but none of these were very successful.
People preferred to keep using tapes, and software was written to speed-up
tape data communication to, say, 6000 baud (20 seconds for 16k). This was
quite acceptable and a single tape of 60 minutes could contain up to 2.5
Mb of information. However, tapes are not a very reliable medium and the
sequential storage of tapes obstructs quick access. As a solution, I used
an RS232 interface to connect my ZX81 to a more modern Sinclair computer
(QL) which offers more advanced storage possibilities (drives) and which
is very well suited to act as a fileserver thanks to its multitasking
capabilities. I wrote the fileserver myself, as well as the client
software needed on the ZX81 to do the communication with the QL. Data could
now be exchanged at a rate of 9600 baud (13 seconds for 16k) and could
be accessed in a sufficiently quick and simple way. I called this serial
communication system
QZ, which later became the prototype for the
disk operating system offered by my ZX81 emulators XTricator (for QL) and
of course XTender (for PC).
To SAVE or LOAD a program, just
type
The files are SAVEd to and LOADed
from the default drive and path (these can be changed with the QZ commands
USE:
and CD:). The SAVEd programs appear as
name.P
files on the default drive/path (where P stands for Program; other
filetypes supported by XTender are Basic,
Code, Lines,
Screen
and Variables).
LOADing a non-existing program will display
the proper DOS error. If you SAVE a program which already existed,
it will simply be overwritten without any user confirmation. Saving a program
without a name (empty quotes) results in the usual error F. Originally,
QZ filenames were up to 12 characters long. In DOS, one is so unfortunate
to be restricted to 8. So: only the first 8 characters of the name
will be used. Do not include inverse characters in the name, since these
are used internally by the ZX81 to indicate the end of the name.
Most ZX81 users will be used to typing LOAD
"" for loading the first program found on tape. Since diskdrives
are not designed for sequential access, LOAD "" cannot be used
on the emulator. Instead, XTender will show the directory of the
current drive and path (same as *DIR:, see below).
QZ file handling commands can be passed to XTender
in a LOAD or SAVE statement. The first character of the
SAVE/LOAD
name must be an asterisk * to indicate that one or more QZ commands
follow (instead of the usual filename). The available commands, a short
description and examples of each command are listed below:
-
BACK:
-
Go one level back in current directory path; in fact
equal to CD:..: but included for compatibility reasons.
-
Example
-
*CD:
-
Change current directory to indicated path name;
note that the path name ends with a colon : (as in all other QZ
commands), so you cannot use CD: to change the directory on a
non-default drive; apply the command USE: first. The usual DOS
backslashes must be replaced by forward slashes.
-
Examples
-
LOAD "*CD:GAMES:"
-
LOAD "*CD:/ZX81/ASM/TOOLS:"
-
LOAD "*CD:..:" LOAD "*CD:/:"
-
*DEL:
-
Delete indicated file; the extension of the filename
(i.e. the filetype) must be typed first, followed by a colon : and
the main part of the name; the command is ended by a colon as well. The
filetypes recognized by XTender are B, C, L,
P,
S
and V. Note that only files in the current drive and path can
be deleted. For deleting files on other drives or paths, use CD:
and USE: first. DEL: is the same as
REMOVE:
-
Example
-
LOAD "*DEL:P:RUBBISH:" (deletes
RUBBISH.P)
-
*DIR:
-
Show the ZX81 files on the current drive; all the
specific ZX81 files (with extensions .B, .C, .L,
.P,
.S
or .V) are listed, together with their length, date and time;
note that the date is shown in the format "yy-mm-dd", not in the more usual
DOS format "mm-dd-yy"; the time is shown in 24-hour format. Subdirectories
without extension are shown too. At the end of each page, press any key
to see the next page or Q to stop the directory listing; at the
top of each page you will see the current drive and path name; the backslashes
are replaced by forward slashes; at the end of the file list you will see
the total number of files and the number of clusters left on the current
device (depending on your drive's FAT, a cluster can hold 512 bytes, 1k,
2k, 4k, etc.).
-
Examples
-
LOAD "*DIR:"
-
LOAD "" (convenient alternative!)
-
*KILL-XTR:
-
Stop the current XTender session, return to DOS.
-
Example
-
*LOAD:
-
Load one of the special filetypes (not P-files!).
The filetypes available are:
-
B for basic
-
all the lines of the current Basic program are deleted
and the the file is then inserted in the Basic area. The variables area
remains unchanged. XTender does not check if there is sufficient memory
available to insert the file. If not, a crash will result. If all is OK,
error 'I' will be generated (data merged).
-
Example
-
C for code
-
the code file is loaded from file to the address
specified; XTender tries to load all the bytes from the file but stops
after exceeding address 65535.
-
Example
-
LOAD "*LOAD:C:CHARSET:8192:"
-
L for lines
-
the lines in the file are merged with the current
Basic program. If a line with a certain number already exists in the current
program, it will be replaced by the new line with the same number. The
variables area remains unchanged. XTender does not check if there is sufficient
memory available to insert the lines. If not, a crash will result. If all
is OK, error 'I' will be generated (data merged).
-
Example
-
S for screen
-
the screen file is loaded from file into the current
ZX81 display file. It is assumed that the display file is fully expanded;
otherwise: ZX81 crash!
-
Example
-
V for variables
-
the variables area of the ZX81 is cleared, and then
the file is inserted in this area. The Basic program remains unchanged.
XTender does not check if there is sufficient memory available to insert
the file. If not, a crash will result. If all is OK, error 'I' will be
generated (data merged).
-
Example
-
*MAIN:
-
Go to root directory of current drive; in fact equal
to CD:/: but included for compatibility reasons.
-
Example
-
*MD:
-
Make new directory as indicated by path name; note
that the path name ends with a colon : (as in all other QZ commands),
so you cannot use MD: to create a directory on a non-default drive;
apply the command USE: first. The usual DOS backslashes must be
replaced by forward slashes.
-
Examples
-
LOAD "*MD:JUNK:"
-
LOAD "*MD:/ZX81/GAMES/SHOOT:"
-
LOAD "*MD:../LEVEL2:"
-
*RD:
-
Remove directory as indicated by path name; note
that the path name ends with ':' (as in all other QZ commands), so you
cannot use RD: to remove a directory on a non-default drive; apply the
command USE: first. The usual MS/DOS backslashes must be replaced by forward
slashes.
-
Examples
-
LOAD "*RD:OLD-DATA:"
-
LOAD "*RD:/ZX81/TAPE:"
-
LOAD "*RD:../BACKUP:"
-
*REMOVE:
-
Remove indicated file; the extension of the filename
(i.e. the filetype) must be typed first, followed by a colon : and
the main part of the name; the command is ended by a colon as well. The
filetypes recognized by XTender are B, C, L,
P,
S
and V. Note that only files in the current drive and path can
be deleted. For deleting files on other drives or paths, use CD:
and USE: first. REMOVE: is the same as DEL:.
-
Example
-
LOAD "*REMOVE:C:ZXASSEM:" (removes
ZXASSEM.C)
-
*ROOT:
-
Go to root directory of current drive; in fact equal
to CD:/: but included for compatibility reasons.
-
Example
-
*SAVE:
-
Creates one of the special-type files (not P-files!).
The filetypes available are:
-
B for basic
-
all the lines of the current Basic programs are written
to file. System variables, Basic variables and screen are not written
to file; a B-file is a compact way for storing short programs on disk.
-
Example
-
C for code
-
the code block starting at the address determined
by the first parameter and with a length determined by the second parameter
is written to file. The length must be larger than 0 and the calculated
end address may not exceed address 65535. Please note that the second parameter
does NOT represent the end address.
-
Example
-
LOAD "*SAVE:C:CHARSET:7680:512:"
(saves the contents of addresses 7680 through
8191)
-
L for lines
-
those lines of the current basic program with a line
number lying within the interval determined by the two parameters supplied
are written to file. The first line number must be smaller than or equal
to the second line number. The second line number must be smaller than
10,000. The two line numbers need not actually exist in the current program.
If no lines lie in the specified interval, a file of zero length is produced.
-
Example
-
LOAD "*SAVE:L:ELEPHANT:1000:2000:"
(saves all lines with numbers greater than or
equal to 1000 and less than or equal to 2000)
-
S for screen
-
the current ZX81 display file is written to file.
It is assumed that the display file is fully expanded; this means that
the resulting S-file is always 793 bytes in length (namely 24*33+1).
-
Example
-
V for variables
-
the current contents of the ZX81 variables area are
written to file (including the delimiting CHR$(128)). Directly after a
CLEAR
(or similar) command, this area is empty and the file will have length
1.
-
Example
-
*SHOW:
-
Shows information about the current version of XTender
plus a list of all QZ commands available.
-
Example
-
*USE:
-
Selects another drive as default drive. If you have
only one physical floppy drive, which can be accessed logically as A:
or B:, XTender will always use the last logical setting of this
drive to avoid the DOS message requesting to insert a disk (very few other
programs I know also do this!). But note that this only works from DOS
3.2 onwards. A path name cannot be included, use CD: instead.
-
Example
-
LOAD "*USE:D:" (selects drive D)
Please note the colon : at the end of each
command, acting as end marker. More than one command can be given in a
single LOAD or SAVE by separating successive commands
with a semi-colon ;. Only one asterisk is needed, for example:
LOAD "*USE:D:;CD:../GAMES:;DIR:"
Only the trailing colon of a line may be omitted
(i.e. the one behind DIR in the example above). Any non-supported
command after the asterisk will display the erroneous text plus the message
ERROR
IN QZ COMMAND, and stops with Error C (syntax error).
PRINTER
OUTPUT
No printer support is available.
HIGH
RESOLUTION
Sir Clive Sinclair himself said that it could not
be done. Still, in 1983, a first attempt to high resolution on a
ZX81 was presented when the High Resolution Toolkit by Richard Taylor was
marketed. Later, companies like Software Farm produced several games in
high resolution. Taking a closer look at this 'high resolution', one can
easily see that it is not really hi-res: for the 256 bit patterns that
are possible for 8 successive pixels, at most 128 are available, i.e. more
than half of the patterns cannot be used. The result of this semi hi-res
may, however, still be quite satisfactory.
Hi-res is detected by XTender by trapping an immediate
change in value of register IX (used by the ZX81 as NMI server
address). The term 'immediate' means that only the instruction LD IX,nn
(DDh.21h) is trapped. You could avoid the trap by using a sequence
like LD HL,nn, PUSH HL, POP IX. However, all hi-res programmes
tested use the (more obvious) immediate method.
After the detection, XTender tries to emulate
the semi hi-res by looking for the characteristically shaped 6k display
file in the bottom 16k of RAM and printing it to the PC screen appropriately.
If it cannot locate this display file, normal resolution will be switched
on.
As far as I know, only HRWP (hi-res word
processor) does not function properly on XTender; and it never will - it
seems too difficult to be emulated correctly.
ZX81
64K MEMORY MAP
Table: important areas in the ZX81 64k
memory map.
Begin Address
|
End Address
|
Description |
0000h
|
1FFFh
|
Original ZX81 8k ROM area. |
2000h
|
3FFFh
|
Often referred to as '8-16k area';
on the ZX81 this area can only be used when additional hardware is fitted
(e.g. 64k RAM pack or EPROM card); the standard ZX81 shadows its ROM in
this area. |
4000h
|
FFFFh
|
Up to 48k of RAM; at startup, the ZX81 allocates
at most 16k of RAM to BASIC; the remaining 32k is kept free for data storage;
more or less area can be allocated to BASIC by moving RAMtop (system variable
at 4004h) upward or downward. |
4000h
|
407Ch
|
System variables area. |
407Dh
|
[400Ch]-1
|
BASIC program area. |
[400Ch]
|
[4010h]-1
|
Display file (text mode!). |
[4010h]
|
[4014h]-1
|
BASIC variables area. |
[4014h]
|
[401Ch]-1
|
Workspace. |
[401Ch]
|
[4004h]-1
|
Free memory, available for BASIC; this area is
cleared by NEW; the machine code stack grows down from the top address
of this area. |
[4004h]
|
FFFFh
|
Free memory that cannot be used by BASIC and
that is also not influenced by NEW, hence useful for resident utilities
or RAMdisk; provided [4004h] is above 7FFFh, this area is also not altered
by RST 0 (reset). |
Note: [addr] is the value obtained
by PEEK(addr)+256*PEEK(addr+1), i.e. the usual
Z80 word-peek with the low byte logically in front of the high byte.
ROM
AND 8-16K AREA
On XTender, the ROM and 8-16k area are in fact also
part of RAM, i.e. they are not POKE-protected. This can
be nice for making slight changes in the ZX81 ROM or for using the 8-16k
area for machine code utilities that can be loaded from disk.
At startup, the 8-16k area contains a relocated
version of the Coral Basic Interpreter (CBI version 7.0). You can
start this program by typing
RAND USR 8192
This should give 0/0 in line 22 and a
black cursor in line 23. CBI may be useful for people with little ZX81
experience since it has both a full-entry keyword decoder, full-screen
editor and explains error messages on request. All usual ZX81 commands
are available, as well as 46 new ones (including commands for PROCedures
with two-way data exchange and structured loops). Naturally, CBI was written
for the ZX81, but runs equally well on XTender. For details on this program,
read the textfile supplied with XTender. Two useful commands to enter when
the black cursor appears are
ERR MSGS ON ... explains error messages
NOSTALGIC OFF ... enables full screen
editor
Note that you have to type the letters one-by-one,
the spaces are optional. The system variables of CBI are stored at address
65400 onwards (corresponding to address 32730 in the original version).
The CBI program ends at address 13522, so the part of memory from address
13523 up to and including 16383 is available for your own use.
STOPPING
XTENDER
There are three ways to stop your XTender
session.
First, the QZ command KILL-XTR: can
be typed as the argument of a SAVE or LOAD command, i.e.
LOAD "*KILL-XTR:"
which will bring you back to DOS. A fast alternative
is:
LOAD " STOP "
with STOP typed as a keyword (i.e. Shift-A)
instead of the separate letters.
Finally, for the very impatient: pressing CTRL-Break
will stop XTender as well!
CLOCK
FREQUENCY
The effective clock frequency can be determined in
several ways. First of all, you can RUN a (long) BASIC program
which does not have any INPUT, INKEY$, RND,
PAUSE
or similar commands (i.e. execution time must be fully determinate and
may not contain processor-independent loops). You can then compare the
execution time on XTender to the time which this same program requires
on a ZX81.
The ZX81 runs at approximately 3.2 MHz in FAST
mode and (effectively) at 0.8 MHz in SLOW mode (emulated by XTender).
Supposing a program on XTender takes half the time the ZX81 would take
to execute it in SLOW, the effective clock frequency is (0.8 MHz)/(0.5)
= 1.6 MHz.
Another way to find the clock frequency is to
use a machinecode test loop, embracing a single instruction which is executed
many (e.g. 65536) times. If you then count the number of frames needed
(and subtract the number of frames needed for just the empty loop) you
can get an idea of the clock frequency of that specific instruction, provided
you know the number of T-cycles the Z80 would normally need for that same
instruction.
A very good estimate of the emulated processor
speed can be obtained by LOADing the program CLCKFREQ.
This program does some simple printing and plotting, but the final result
is a reliable measure for the average speed of XTender and the effective
(emulated) processor speed.
SLOWING
DOWN
This entire section applies to registered
copies only.
On fast machines the speed of XTender can be reduced
by POKEing address 23. The byte at this address is used as delay
counter at each Z80 instruction. Default value is 0, which gives (practically)
no delay. A higher value will quickly slow-down the emulation process.
Values 1..128 yield a 'linear' slowdown: after
each Z80 instruction, the emulator will be halted some time; the length
of the idle period is linearly dependent on PEEK 23. When POKEing
128 into address 23, XTender will be running about 27 times as slow as
when you would have POKEd value 0.
POKEing values 129..255 results in a
'quadratic' slowdown and should be used on very fast machines only; even
values only slightly above 128 can result in a huge slowdown factor. Theoretically,
the maximum slowdown factor is about 3500 which is obtained by POKEing
255 into address 23 (but unfortunately I didn't have enough time for spare
to test it...)
Table: Example of slow-down on a 33 MHz
80386dx machine (benchmark 1000).
version
|
PEEK 23
|
speed percentage
|
clock frequency
|
XTENDER!
|
--
|
800%
|
6.4 MHz
|
XTENDER
|
0
|
540%
|
4.3 MHz
|
XTENDER
|
1
|
430%
|
3.4 MHz
|
XTENDER
|
4
|
290%
|
2.3 MHz
|
XTENDER
|
16
|
130%
|
1.0 MHz
|
XTENDER
|
64
|
40%
|
0.32 MHz
|
XTENDER
|
130
|
20%
|
0.16 MHz
|
XTENDER
|
140
|
9.6%
|
0.076 MHz
|
XTENDER
|
150
|
4.3%
|
0.035 MHz
|
Please note again that the slowing down does
not
work with XTENDER! (with exclamation mark, supplied in the shareware
package), only XTENDER (without exclamation mark, supplied in
the registered package) can
be slowed-down.
Once you have determined which value of PEEK
23 suits your needs best, you can start XTender with the /d:nnn
qualifier in order to set the delay factor to nnn without actually
having to poke it into the ZX81 memory (see Commandline
Qualifiers). Of course, you can still alter this initial value during
the session!
Z80
EMULATION
As far as I have been able to test, all Z80 instructions
are emulated correctly: since the ZX81 ROM is the basis for XTender to
function and since it is written entirely in Z80 code, the latter statement
is likely to be true. Also, many ZX81 programs have been tested on XTender
and all of them turned out to work without any problem! These programs
include (commercially marketed) games and utilities in BASIC and in machine
code.
Some brief remarks for Z80 freaks:
-
Register I
points to the ZX81 character set. The default value is I=1Eh
which means that the character set starts at address 1E00h (last half kilobyte
of ROM). If you want to change the character set, first POKE the
new set somewhere in memory (at an address which is a multiple of 512 bytes)
and then alter register I accordingly (so: only even values for
I
are
allowed). This will instantaneously change the display. The reversed sequence
of this procedure will not work the way you would expect! I advise not
to change the character set present in ROM.
-
The Subtract flag (N) of the Z80 flag register
(f) is not emulated. Many Z80 instructions alter this flag, but there is
only one instruction which uses the result, viz. DAA. Since
DAA
is used only once in the ZX81 ROM (where it has been replaced by an equivalent
non-standard Z80 instruction) and since proper emulation of the Subtract
flag reduces operation speed of XTender, I think this exclusion is a sensible
decision. When XTender encounters a DAA instruction, it always
performs a 'Decimal Adjust After Addition'. So, keep your fingers crossed!
Some programs using DAA are: Reversi (only the
machine coded version), MCTT (Machine Code Testing Tool) and Frogger. If
you should know of other programs which use DAA, please tell me!
-
The IN instructions are all neglected,
except for requests for port FEh (the keyboard) and port FBh (the printer).
Also, OUT instructions are neglected. Note, however, that
the instructions IND, INDR, INI, INIR,
OUTD,
OTDR,
OUTI
and OTIR alter the registers BC and HL (and
also (HL)'s) appropriately!
-
HALT waits for an interrupt. Interrupts
are not emulated and therefore HALT is made equal to NOP.
-
Some instructions cannot be used for changing
the ROM area (0-8k). These are: LD (HL),A, LD (DE),A,
LD
(HL),D, LD (HL),E and LDIR. The reason for this
is to protect the ROM against itself! The programmers of the ZX81 ROM have
made use of the write-protection of the 0-8k area for simplifying their
code (or is it a hitherto unknown bug of the ZX81 ROM?). So, XTender (which
has no write-protection in the ROM area) would alter its own code, which
is (in general!) a bad thing to do. Therefore, the above instructions are
emulated such that they have no effect in the first 8k of memory. Note
that this also protects the ROM against a program like MCODER-2,
which does the same kind of nasty things to the ZX81 ROM-area...
PROGRAMS
FROM TAPE TO DISK
Some trouble may be caused by the fact that ZX81
programs were usually stored on tape instead of disk. However, registered
users of XTender can use the ZX81TAPE tool supplied with the
registered package to convert their own tapes to P-files. Please
read the separate ZX81TAPE manual for more information about this
conversion tool.
SCREEN-SAVER
XTender has a built-in screen-saver which will be
activated when the ZX81 display remains unchanged and no key is
pressed during 3 minutes. When the screen saver is active, any keypress
(including Shift, F10, etc.) will restore the ZX81 screen.
Note that a change of the ZX81 display itself in the saved state will not
restore the ZX81 screen! If you have another screen-saver memory-resident,
it may or may not be superseded by the screen-saver of XTender (depending
on how exactly that screen-saver was written).
On registered copies,
the screen-saver can be disabled by using the /s qualifier at
startup (see section Commandline Qualifiers
for more information).
WARRANTY
If you come across an original ZX81 program that
doesn't work properly on XTender and also doesn't belong to any of the
"incompatibility categories" mentioned in this manual, please send me a
copy of the program with a brief description of the problem. If XTender
is to blame, I'll try to fix the bug as soon as possible (if feasible)
and you will get your disk back with an updated version of XTender.
ABOUT
THE AUTHOR
I was born in 1967 and I bought my first computer
(Guess what? It was a ZX81!) in 1982, (me.learning@highschool).
With no prior programming experience at all, I started writing simple Basic
programs. After about one year, it appeared to me that Basic just couldn't
solve the problems I devised. So, I turned to Z80 machine code (with obliging
help of Toni Baker; that is, of her book). A whole new world of possibilities
opened up before my very eyes. High-speed compact code and direct access
to all system resources at the lowest level, what else does a programmer
want? I created many Z80 programs for the ZX81, and some of them were published
in renowned international magazines like "Your Computer".
In 1987, (me.studying@university), I decided
to buy a Sinclair QL (during sales) and found this younger brother to be
just as interesting as the ZX81. It also gave me a good excuse for learning
68000 machine code. As I saw that less and less people were actually using
the ZX81, I sought a way for elongating its existence. I thought that (among
other things) a ZX81 emulator for the QL would be a good way to do so,
and I started writing this program (called XTricator) in the end of 1989.
At that point in time, it also became unacceptable
to not have a PC - so I bought one. In order to stay loyal to the absorbing
machines made by Sinclair, I decided to write a ZX81 emulator for MS/DOS
as well. The 8086-family of processors is (basically) very similar to the
Z80, so I did not really have to learn a new language, only a new OS. The
first beta version of XTender was already available in 1991, and
the first official release was in 1993. And just a few months later,
in 1994, I obtained my Ph.D. degree in Physics.
By now, in 2002, (me.hard@work), you can
see the final and ultimate result of my efforts. I sincerely hope that
many (former) ZX81 users will take some time to leap back in history and
(re)enjoy the overwhelming simplicity of the 64k, 8-bit, 3.2 MHz Z80, black
& white computer with 64x44 graphics resolution, which introduced over
a million people world-wide (including myself) to the wonderful world of
computing!
XTENDER
RELEASE HISTORY & FUTURE
The current version XTender will not get any additional
features anymore. Only bugs will be fixed. Instead, a new version of XTender
is being developed (codename "XTender2"). Check-out the XTender
page regularly for news about XTender2!
Table: XTender release history
in reverse chronological order.
1.22
|
August 2001 |
-
Added a file-check for AutoLoad-n-Run.
If the P-file specified does not exist, this is reported and XTender will
not start.
|
1.21
|
December 2000 |
-
Added AutoLoad-n-Run,
i.e.: the possibility to supply the filename of a P-file in the commandline.
This P-file will be auto-loaded and run. This also allows you to AutoLoad-n-Start
a ZX81 program by double-clicking the P-file in a Windows file browser.
(Thanks John for this idea.)
-
Fixed nasty bug in implementation of /r:nn qualifier.
-
Minor changes in help information.
|
1.18
|
October 1999 |
-
Changed ZX81/PC character mapping. The tilde-character
(~) is now mapped to ZX81 character 10 (graphics-mode, Shift-S).
This makes it possible to see and load files with long Windows names. For
example: "Long Name.p" can be loaded as "LONGNA~1.P",
and is also shown in the directory list in that way.
-
Improved syntax-checking of QZ
commands. In particular, a trailing colon (:) in the last
command of a line is no longer needed. It will be appended by XTender if
it is missing. (In previous verions of XTender, a missing trailing colon
might cause a system crash.). Example: LOAD "*CD:GAMES"
is allowed now.
|
1.17 |
October 1997,
June 1998 |
-
New qualifier/s
to disable screen-saver (registered
copies only).
-
Manual converted to hypertext, and made available
on the www.
-
This is (more or less) the final version of XTender:
development continues for XTender2 only.
|
1.16
|
May 1995 |
-
Development restarted after a period of rest.
-
Bugfix: keyboard handler is supposed not to lock
anymore (but it still does...).
|
1.14
|
March 1994 |
-
/d qualifier
revised: it would only accept numbers up to 128 (thanks Andrew).
-
The slow version of the emulator is now only distributed
with registered copies: if you can afford a
fast computer, you can also afford the registration fee!
-
Minor changes in the colour-handling routines.
|
1.12
|
January 1994 |
-
/r qualifier
has been added to set default RAM size at startup (thanks Philip for this
nice idea).
-
/k qualifier
has been added to obtain an alternative keyboard response (needed to get
some programs responding).
|
1.10
|
October 1993 |
-
On EGA/VGA machines, keys
F5 and F6 can now be used for changing the screen colours; a 16-colour
palette is available for fore- and background (thanks Russell for this
nice idea).
-
New qualifiers/b
and /f for selecting back- and foreground colours at startup (e.g.
/f:1 /b:11 for blue on cyan, EGA/VGA only).
-
Help screen is
now in blue, screen saver remains black (of
course!).
-
Delay factor at address 23 has been extended to the
range 0..255; values 0..128 give a linearly increasing delay period, values
129..255 a quadratically increasing delay period. XTender should now be
able to be slowed-down to 100% on any machine
(with POKE 23,255 XTender is a factor 3500 slower than with POKE
23,0).
-
When the emulator encounters unknown
Z80 code, it won't return to DOS anymore; instead, the code just gets
skipped (thanks Jack).
-
The source code is currently being adapted as to
let XTender run much better in a multitasking environment (such as Windows).
|
1.03
|
May 1993 |
-
Amstrad has stated that they now allow the ZX ROMs
to be distributed freely and be used in emulators; so: from now on, you
can use XTender without actually having to own a real ZX81.
-
Name of XTENDERF changed to XTENDER!
(with
exclamation mark).
-
Name of XTENDERS changed to XTENDER
(without).
-
LOAD
"" can now be typed as a fast method
to see a directory.
-
/d qualifier removed from XTender! (with
exclamation mark) as it wouldn't have any effect
|
1.02
|
March 1993 |
-
Bugfix: Shift-key was not seen immediately.
-
Sound has been removed from the emulator - no more
beeps!
-
Registered
versions now skip title page by default; the qualifier
/t can be used to show the title page of a registered copy.
-
Some features are now different in shareware and
registered
versions (see manual for details).
-
Manual includes new info about ZX81
magazines.
|
1.00
|
February 1993 |
|
0.93
|
January 1993 |
-
Made available via SIMTEL20 fileserver.
|
0.64
|
June 1992 |
-
Made available via SIMTEL20 fileserver.
|
0.xx
|
Oct'91 - Feb'93 |
-
Many preliminary versions are distributed and beta-tested...
|
0.07
|
October 1991 |
-
First documented beta-release.
|
FINAL
NOTES
For more information about XTender or ZX81 in general,
do not hesitate to contact me!
xtender@delhez.demon.nl
attn.
Carlo Delhez
voicemail
and fax: +31-20-7738133
Note: if you write in English,
German or French, the reply will be in English. If you write in Dutch,
the reply will be in Dutch.
Thank
you for reading the manual & for using XTender !!
All rights of XTender
and this manual reserved by law (copyright). Consequently, unauthorized
copying, hiring and lending prohibited (please refer to section registration
for more details). The information in the XTender hypermanual at www.delhez.demon.nl
supersedes the information in other printed or electronic copies of the
XTender manual that may be or become available by any other means. The
information in the hypermanual is believed to be accurate but is supplied
as-is.
The author cannot be held responsible for any damage resulting from the
usage of XTender and/or the manual. ZX80, ZX81, ZX Spectrum, QL and Qdos
are registered trademarks of Sinclair Research Limited.