Timex/Sinclair 1000 Emulator Help Page
Overview | Keyboard help | Language help | Error messages | Saving your program | Reporting bugs | Privacy policy
This is a fully-functional emulator, reproducing the early-80's Timex/Sinclair 1000 (Sinclair ZX-81) in a browser. It even supports Z-80 assembly language and authentic speed, so most anything you could do on a T/S 1000, you should be able to do here.
Some sample programs can be found in the Software Library. It's my hope that others will contribute their own programs to the library and that it will grow.
If you're unfamiliar with the T/S 1000, you may find it a bit odd to use. When writing BASIC programs in the T/S 1000, single keystrokes would represent entire commands. Also, the keyboard consisted only of letters, numbers, "Space", "Shift", "Enter" and a period ("."). Other symbols were generated by key combinations. For this reason the emulator's page includes a keyboard "cheat sheet", both for those who haven't used the T/S 1000 before and also for those who may be fuzzy on the key combinations after nearly two decades away from the machine. More details on the keyboard can be found below.
Here's the basic overview of the T/S 1000:
This is my second browser-based retro-computing experiment. The first was my TRS-80 Level I Simulator. Since the T/S 1000 ROM has been released to public domain, I'm able to provide a full-fledged emulator this time around.
This is the initial release of this Java-based Emulator. As such, it's an experiment. Comments are welcome.
---
Special thanks to Peter Phillips and George Phillips.
Here is a picture of the T/S 1000 keyboard:
When you type 0-9, A-Z, Shift, Space, Enter, or "." on your keyboard while working in the emulator window, the emulator will respond as if you pressed the equivalent key on the T/S 1000 keyboard. (You may have to click on the emulator window first to "bring it in focus" before it will respond to the keyboard.)
Note to Mac users: if you are using Internet Explorer you may need to use the "/" key in place of the Shift key.
In the T/S 1000, what a key means changes depending on the cursor you see on the screen. The cursor is a black block containing one of four letters:
Cursor | Meaning |
---|---|
[K] | Command. If you press a letter, the T/S 1000 will type the command written in white above that letter's key on the keyboard. The remaining keys (0-9, period, Space, Enter) have their usual meanings. |
[L] | Letter. All keys (A-Z, 0-9, period, Space, Enter) have their usual meanings. |
[F] | Function. If you press a letter, the T/S 1000 will type the function written in white below that letter's key on the keyboard. This mode is entered manually by hitting Shift+Enter. If you hit a key that has no function associated with it, you will exit "function" mode. |
[G] | Graphics. This is like Letter mode except that everything you type will have its colours reversed (light on black background instead of black on light background). If you press Shift in combination with certain keys (A, S, D, F, G, H, Q, W, E, R, T, Y, or 1-8), the T/S 1000 will type a graphics character as printed on the right side of that key. This mode is entered manually by hitting Shift+9. |
In general, pressing Shift in combination with a key will type what is printed in red on the keyboard for that key. In Graphics mode, Shift in combination with some keys will print graphics characters (as mentioned in the table above).
If you hit Space while a program is running, it will act as a Break key, returning you to the [K] prompt.
Some keys have special meanings when pressed in combination with Shift:
Key combo | Meaning |
---|---|
Shift+1 | Edit. Edits the current program line indicated by a [>] marker in the LIST. |
Shift+5 | Left arrow. Moves the cursor left one character on the current line being typed, without deleting characters. |
Shift+6 | Down arrow. Moves the cursor down one line in the LIST. |
Shift+7 | Up arrow. Moves the cursor up one line in the LIST. |
Shift+8 | Right arrow. Moves the cursor right one character on the current line being typed. |
Shift+9 | Graphics. Changes the cursor to [G], indicating graphics mode. See above. |
Shift+0 | Delete. Backspaces over the character just before the cursor and deletes it. |
Shift+Enter | Function. Changes the cursor to [F], indicating function mode. See above. |
Language Reference: |
Subsections: Commands | Functions | Operations | Miscellaneous
This is not intended to be tutorial, but rather a refresher/reference guide.
Notation used in this reference:
The following commands may be typed only at the [K] prompt:
Command | Key | Description |
---|---|---|
NEW | A | Erases program and varaibles from memory and starts again. |
SCROLL | B | Scroll the contents of the display up one line. (The top line moves off.) |
CONT | C | Continue program from where you stopped via STOP or Break (see Keyboard help on Break key). |
DIM v(a[, b...]) | D | Define an array. v may be represent a numeric array (if v is a single letter A-Z) or a string array (if v is a single letter followed by a $, i.e. A$-Z$). The range of the array will be 1 through a by 1 through b, etc. If the array is a string array, the last dimension of the array is the string length. |
REM | E | Remark. Everything that follows this command is ignored. This command is usually used to make notes in a program listing so that it is easier to follow. |
FOR v = a TO b [STEP s] | F | Defines a loop for looping variable v which starts at a and runs to b in steps of s. Looping variables can only be a single letter, A-Z. If STEP is omitted, the step is 1. Note: use Shift+4 to type "TO" and Shift+E to type "STEP". Do not spell these words out. |
GOTO l | G | Go to line l in the program next. |
GOSUB l | H | Branch to the subroutine at line l. When a RETURN is hit, execution then resumes at the next line after the GOSUB. |
INPUT v | I | Prompt the user for input and then assign it to variable v. v may be a numeric variable, a string or an array element. Note: the stop a program at the INPUT prompt, hit Shift+A. If you are entering a string, Use Shift+5 to move to the left of the quote first. |
LOAD "name" | J | Load your program. In the emulator, this will open a window into which you can paste an encoded text version of your saved program generated by SAVE. As a better alternative, use the "Load or Save Program" button on the emulator's page. |
LIST [l] | K | List your program, optionally starting with line l. |
LET v = x | L | Set variable (string, numeric, or array) to the value x. e.g. LET A=10 or LET A$="HELLO". On the T/S 1000, LET is not implicit and so cannot be omitted. |
PAUSE n | M | Pause for n 1/60ths of a second. (i.e. PAUSE 30 means pause for half a second.) |
NEXT v | N | Specifies the end of a FOR loop where variable v has its STEP value added to it. Additionally, if the new value does not end up beyond the FOR's b value, execution returns to the top of the FOR loop. |
POKE x,y | O | Set memory address x to the value y. This command should only be used by experienced users. |
PRINT [x1] [, | ;] [x2 [, | ;]] ... | P | Prints variable, string or expression x1 optionally followed by x2, etc. If these expressions are separated by semicolons, they follow immediately. A comma aligns to the next 16-character column. Examples: PRINT"CORRECT" or PRINT"HELLO, ";N$ or PRINT X*2;"IS THE ANSWER". See TAB and AT for additional options. |
PLOT x,y | Q | Draw a black pixel at the specified (x,y) coordinate. x may be between 0 and 63, y may be between 0 and 43. |
RUN [l] | R | Start running your program. If the optional parameter l is specified, the first line executed is line l and the program continues on from there. |
SAVE"name" | S | Saves your program. In the emulator, this will open a window containing an encoded text version of the T/S 1000's memory contents. As a better alternative, use the "Load or Save Program" button on the emulator's page. |
RAND [n] | T | Seed random number generator. If n is specified and between 1 and 65535, the random number generator will be reset to a specific point in its sequence. If n is 0 or is omitted, the random number generator will be seeded according to how long the T/S 1000 has been running. |
IF x THEN ... | U | The command following the THEN will only be executed if x is non-zero (in the case of a variable) or true (in the case of an evaluation such as "I>2"). Note: to type the word "THEN", hit Shift+3. Do not spell it out. |
CLS | V | Clear the screen. |
UNPLOT x,y | W | Draw a light pixel at the specified (x,y) coordinate. x may be between 0 and 63, y may be between 0 and 43. |
CLEAR | X | Clear all variables. |
RETURN | Y | Return from a subroutine and resume execution at the next line after the GOSUB that called it. |
COPY | Z | For T/S 1000's equipped with optional printer, this command would print a copy of the screen to the printer. The emulator does not support the printer. |
STOP | Shift+A | Stops a program at the current line in the same manner as if Break had been pressed. You may continue on from the next line after the STOP by issuing CONT at the [K] prompt. |
LPRINT ... | Shift+S | Same as PRINT except that the output would go to the T/S 1000's optional printer. The printer is not supported in this emulator. |
SLOW | Shift+D | Instructions following this command are executed in slow mode. In slow mode, the screen remains visible while the program continues. |
FAST | Shift+F | Instructions following this command are executed in fast mode. In fast mode on the original T/S 1000, the screen would blank when user input was not required. In this emulator, the screen does not blank; however, the emulator will run as fast as the T/S 1000 would in fast mode. |
LLIST | Shift+G | Similar to LIST except that the output would go to the T/S 1000's optional printer. The printer is not supported in this emulator. |
The following functions may be entered by selecting the [F] prompt:
Function | Key | Description |
---|---|---|
ASN x | A | Trigonometric function. Returns the arc-sine of a value x. The result is between -pi/2 and +pi/2 |
INKEY$ | B | Returns, as a string, the key which is currently being pressed. If no key is being pressed, this function returns an empty string. |
AT y,x | C | Used in conjunction with PRINT, this function positions the cursor at row y, column x. e.g. PRINT AT 11,13;"CENTRE" prints the word "CENTRE" in the centre of the printable screen. x is in the range 0-31 and y is in the range 0-21. (Lines 22 and 23 are reserved for user input and error messages.) |
ATN x | D | Trigonometric function. Returns the arc-tangent of a value x. The result is between -pi and pi. |
TAN x | E | Trigonometric function. Returns the tangent of a value x. |
SGN x | F | Returns -1 if x is negative, 1 if x is positive, or 0 if x is 0. |
ABS x | G | Returns the absolute value of x. i.e. the result has the negative sign removed, if there was any. |
SQR x | H | Returns the square root of x. x must not be a negative number. |
CODE x$ | I | Returns a numeric code corresponding to the first character of the string x$. If the string is empty, the value returned is 0. |
VAL x$ | J | Returns the numeric value of whatever is in the string x$. |
LEN x$ | K | Returns the length (i.e. number of characters) in the string x$. |
USR x | L | This function should only be used by experienced programmers. It branches to the machine language code at memory location x. Upon successful return from that code, the result of the USR function will be the contents of the BC Z-80 register returned by the machine language subroutine. |
pi | M | Returns the value of pi: 3.1415927. |
NOT x | N | Returns a 0 if x is non-zero, or a 1 if x is zero. In evaluating conditions such as would be done in the IF statement, NOT x will be false if x is true, and vice versa. |
PEEK x | O | Return the contents of memory location x as a value from 0 to 255. |
TAB x | P | Used in conjunction with PRINT, this function moves the cursor to column x of the current line. If the cursor is already past column x, it moves to column x of the next line. |
SIN x | Q | Trigonometric function. Returns the sine of x. |
INT x | R | Returns the greatest integer lower than or equal to the value in x. e.g. PRINT INT 2.7 will return 2, PRINT INT 3 will return 3. PRINT INT -2.7 will return -3. |
ACS x | S | Trigonometric function. Returns the arc-cosine of x as a value between 0 and pi. |
RND | T | Returns a random real value between 0 and 1. |
CHR$ x | U | Opposite of CODE. Returns a string character equivalent to the code value x. |
COS x | W | Trigonometric function. Returns the cosine of x. |
EXP x | X | Returns the value ex where e = 2.7182818. |
STR$ x | Y | Returns a string version of the number x. Opposite of VAL. |
LN x | Z | Returns the natural logarithm of x. Opposite of EXP. x must be positive. |
Note: there is no function associated with the V key.
The following math operations are supported:
Operation | Key | Description |
---|---|---|
x * y | Shift+B | Multiplies x by y. |
x / y | Shift+V | Divides x by y. |
x + y | Shift+K | Returns the sum of x and y. |
x - y | Shift+J | Returns the difference x minus y. |
x ** y | Shift+H | Returns the value of xy (i.e. x to the power of y). |
x = y | Shift+L | Returns a true result (1) if x equals y. Otherwise the result is false (0). |
x < y | Shift+N | Returns a true result (1) if x is less than y. Otherwise the result is false (0). |
x > y | Shift+M | Returns a true result (1) if x is greater than y. Otherwise the result is false (0). |
x <= y | Shift+R | Returns a true result (1) if x is less than or equal to y. Otherwise the result is false (0). |
x >= y | Shift+Y | Returns a true result (1) if x is greater than or equal to y. Otherwise the result is false (0). |
x <> y | Shift+T | Returns a true result (1) if x does not equal y. Otherwise the result is false (0). |
x AND y | Shift+2 | Returns true (1) if both x and y are true (non-zero), otherwise returns false (0). |
x OR y | Shift+W | Returns true (1) if either x and/or y are true (non-zero), otherwise returns false (0). |
The following additional miscellaneous keys are supported:
Name | Key | Description |
---|---|---|
"" | Shift+Q | Used to represent a quote within a string. i.e. PRINT"SAY, ""HELLO""" will print SAY, "HELLO" on the screen. |
Error messages appear on the second last line of the screen. The form is "#/#" where the first # is an error code and the second # is the line in which the error occurred. For example, "B/20" means error code B occurred in line 20. If the error was in a command you typed at the [K] prompt, the line number will be 0.
Additionally, if, after you enter a line, you see a [S] marker, this means that there is a syntax error -- a typo in your command which the computer does not understand.
The T/S 1000 error codes are given below:
Code | Meaning |
---|---|
0 | Not an error. The computer has reached the end of the program and has stopped. |
1 | The variable v in "NEXT v" does not have a corresponding FOR. |
2 | The variable being used was not initialised by a LET, INPUT, DIM, or FOR. |
3 | The array element being referenced is outside the range set by the DIM statement. Or the string position being referenced is beyond the end of the string. |
4 | Not enough memory left to carry out this operation. |
5 | No more room on screen. If the PRINT position reaches the bottom of the screen, the program will stop with this error. You may erase the screen and continue using CONT. |
6 | Overflow. The number being calculated is too large. |
7 | A RETURN was reached, but there was no GOSUB executed to which to return. |
8 | You cannot use the INPUT command at the [K] prompt. It can only be used within a program. |
9 | A STOP statement was reached. To continue with the next statement after it, use CONT. |
A | The parameter given to this function was not in the valid range. |
B | The integer parameter given to this function was out of range (e.g. negative or too large). |
C | VAL was used on a string that does not contain a number or numeric equation. |
D | Break was pressed, or STOP was pressed in response to an INPUT. |
F | The SAVE command needs to be followed by a file name. |
There is no error code E.
Saving your program (preferred method):
There are two methods of saving your program. The easiest is to use the "Save Program" button. This will bring up a window that will offer you the chance to save a file called TS1000.P to your local hard drive. This file is in the popular .P format that is compatible with most T/S 1000 and ZX81 emulators. You can rename this file to be anything you want.
Warning: if you leave the emulator's page or hit reload/refresh while viewing it, the emulator will reset and your program and data will be lost. There is a checkbox on the bottom of the page which, when checked, should give you a warning before this happens and offer you the opportunity to copy the program text, as described above. However, this feature may not work on all browsers.
Loading your program (preferred method):
You can reload this file later by clicking "Load Program" in the T/S 1000 browser window. This will bring up a new window that will allow you to Browse to the location of your saved TS1000.P file. (Of course, you rename the file to be anything you want. TS1000.P is the default name.) Select the file, and click Load. The program will be immediately reloaded into the T/S 1000 emulator browser window.
Note: The older version of the online T/S 1000 emulator exclusively saved programs in a uuencoded format. In this format, your program will have appeared as a string of illegible text, with the first line reading "begin". In this old method, you would have to cut-and-paste your program into Notepad or another text editor to save it. If you saved a program in such a format, you can still load it back in the Load Program window. Simply Browse to the text file containing the uunencoded program and follow the same steps above.
Saving your program as a uuencoded file (alternate method):
If you type SAVE"name" at the [K] prompt, it will bring up a text window that contains your program in the form of an encoded sequence of text. This encoded text contains your program, though it will not be readily understandable by a user in this form. You can copy this text (e.g. with CTRL-C) and paste it into a text file (e.g. into Notepad) for safe keeping on your own computer.
Loading your program as a uuencoded file (alternate method):
Type LOAD"name" at the [K] prompt to bring up a text window. Paste into this text window the encoded text (generated above) of the program you wish to load. For example, if your program is in a text file in Windows' Notepad, follow these steps:
A note on importing/exporting uuencoded programs between this emulator and other T/S 1000 emulators:
The text used in the alternate methods above is a uuencoded binary. When converted to a binary via uudecode, it is exactly the .P cassette file format used by many other T/S 1000 emulators, including my own MS-DOS based T/S 1000 emulator. Similarly, you can load binaries saved by other T/S 1000 emulators by uuencoding them and pasting the result in text box brought up by the LOAD command.
There are a number of uuencode/decode utililties available on the net. If you want to import or export your programs, you can find uuencode and uudecode programs here:
If you find a bug in the emulator, please report it to me. Be sure to specify your computer type and the brand and version of your browser. Of course, any other email regarding the emulator can be sent to me as well.
BEFORE EMAILING: The emulator and its associated pages require both Java Applet (i.e. Java Virtual Machine) and JavaScript support in your browser. Make sure these options are installed and enabled. Without them, virtually nothing here will work. If you are uncertain whether your browser suppports these features or has them enabled, consult the Help Page for your browser (usually accessible from your browser's Help menu). I confess I haven't tested this on many different systems or browser versions, and I'm definitely not familiar with the configuration of all breeds of browsers, so your browser's Help Page is probably a better bet for assistance in that regard.
Since this emulator makes aggressive use of Java and JavaScript, I felt it would be polite to disclose what it's doing. First off, your BASIC programs are stored in your computer's memory, running in your local Java Virtual Machine. Though the "Load or Save Program" window is mediated by a web page, your programs are not uploaded to any server. (Unless, of course, you intentionally fill out the form to submit it to the Software Library. Anythng you enter on that form will ultimately end up on the web page for your submitted program, but I'm hoping that it's obvious enough what you're doing when you fill out the form.)
A cookie is submitted to your browser by the JavaScript, but this is strictly to save your preference for the "confirm on exit" checkbox -- nothing else. No other data is stored on your computer's hard drive, aside from what may end up in your browser cache. (If I could store on your hard drive, it'd make saving your BASIC programs a lot simpler.)
Finally, the hit counter at the bottom of the page does do some rudamentary visitor tallying. It records the referring page that brought you here, and visitors' IPs in order to determine how many visitors are new and how many are "repeat customers". This is so I can get an idea of how popular this site is and whether it's worth the trouble to keep it going and/or expand upon it. :-) I do not share this data with others.
Beyond that, there is no malicious code or subterfuge in my Java and JavaScript. In theory it's supposed to be an isolated enivornment anyway. Nonetheless, I can't be reponsible for the consequences if your browser's Java VM is not working properly. I've seen Java crash Internet Explorer 4.0 regularly, for example. If you're worried, save anything important before visiting here, and as a general rule it's always a good idea to make backups.
All content ©2001 Jeff Vavasour. Updated September 06, 2007.