User Manual for TC2068

Graphic pack Basic 64 TC2068
Graphic pack Basic 64
Extension to Sinclair Basic
Version for TC2068
Graphic Pack Basic 64

Note: The Basic64 routines can be used in the user programs.
Comercial programs must refer that the Basic64 routines are used.

CAP 0 – Introduction

The Basic 64 program, version 1.1, gives the possibility to the user, to use the extended graphic capabilities and special text printing, supported by the design of the TC2068 (in native 2068 mode).

Two special channels are used, to print in 64 columns (channel #4) or print in a variable number of columns (channel #5). There is implemented a new group of Basic commands in addition to the existing ones, allowing the use of those graphics modes in Basic programs. Is possible too, the use machine code routines to use those capabilities.

CAP 1 – System initialization

Put the Basic64 tape in the tape recorder and type:


After the LOADER stop to LOAD, this message appears on the screen:

(Do you have the FDD system connected to the computer (Y/N))

If the answer is no, so the BASEST1A code block is loaded. If the answer is yes, the BASEST1 code block is loaded, what justifies, is that with the FDD connected, the machine code routine is a little different. Then the second code block is loaded, then a message appears on the screen:

0 OK, 0:2

Now you can verify that a line 0 exists and include a direct call to the routine and a copyright message. The call to the routine, will relocate BASIC, start the new system variables introduced by Basic64, open the new channels (#4 and #5), and prepare the Basic interpreter, so it accepts the syntax of the new commands.

The user must execute a RANDOMIZE USR 32280, after a CLEAN n, RUN n or a GOSUB n to access the extended commands. You are advised to edit the Basic programs in 32 columns mode, so execute the following command:

OUT 255,0

After editing, you can return to extended mode with the INK *n or PAPER *n.

1.1 SAVE and LOAD Basic64 programs

There are two ways of saving programs in Basic64, one of them involving, the change of the basic program in the tape.

In the first step, common to both processes, the program is saved in the tape by the usual way. To call it, you can LOAD the Basic64 routine and then LOAD the program. If you want to LOAD all in a single step (using just one LOAD””), you must perform the following way: first, make a NEW and then from the Basic64 tape execute MERGE””, after that, you make a LIST and see that line 15 have a comment. Replace that line with one with a LOAD”name” to LOAD the program in Basic64 and save this LOADER with SAVE “BASIC64” LINE 10

CAP 2 -Extended Basic

2.1 Resolution modes

The user has two graphic modes permitted by the system:

0 – 256×192 pixels (256×176 pixels in the zone dedicated to printing)
1 – 512×192 pixeis (512×176 pixeis, the same)

Those modes, both using the two DISPLAY FILES, are relative to the new graphical commands, which we will introduce and will be explained in the next section:

  • PLOT* x,y
  • LINE x,y
  • LINE x,y,z
  • CIRCLE* x,y,r
  • SCREEN$ n

The modes 0 and 1 can be used in the same program and are independent of the printing commands. It’s possible in any of both, to use the channels #4 and/or #5 in the following way:

#4: This channel is specially dedicated to printing in 64 columns. It uses the character set in the ROM, appointed by the system variable CHARS. Each character is defined in a matrix with 8×8 pixels. The printing is invoked by the commands PRINT #4… and LIST #4…

#5: This channel permits a flexible printing because it is programable by the user. It has two steps of freedom.

-Number of columns in screen (system variable MAXCL)

-Number of pixels, in the horizontal, of the pixels matrix of the definition of the characters (system variable LARG).

There is a new character set defined in a 6×8 pixel matrix, pointed by the system variable CHRST. This set is used to print in 80/85 columns and can be used to print in 64 columns. So the #5 channel is defined, by default, in the following way:

-Printing the new character set in 85 columns and with a 6×8 pixels matrix, using the PRINT #5… and LIST #5… commands.

2.2 New Basic Commands

2.2.1 Text printing commands

  • PRINT #n… The n parameter is the used channel (#4 or #5). The field … indicates a sequence of the PRINT command, separated by separators (, ; and “). The parameters can be numerical and string expressions and control characters (AT m,n TAB n).
  • LIST #n;m The n parameter is the used channel (#4 or #5). This command lists the program starting from line m. If m is not specified, then the list will be made from the first line of the program.

2.2.2 Graphical commands

  • CLS* Erases the two DISPLAY FILES.
  • INK* n The user can only put a combined INK and PAPER for both DISPLAY FILES. This command puts INK=n and PAPER=7-n.
  • PAPER* n Like INK*n. Puts PAPER=n, INK=7-n
  • SCREEN$ n Sets the resolution mode.
    • n=1, the mode 512×192 is active.
    • n=0, the mode 256×192 is active.
  • PLOT* x,y Puts a PLOT of INK in the pixel x,y and updates the PLOT position. OVER and INVERSE act as normal.
  • LINE x,y,z Draws a line from the PLOT position, changing horizontally x and vertically y and making an arc of a circle.
  • LINE x,y LINE x,y,0
  • CIRCLE* x,y,r Draw a circle with center x,y, and radius r, if the screen mode is 0. If screen mode is 1, it draws an oval.

2.3 Memory organization

The new memory map is characterized by the existence of two DISPLAY FILES and the relocation of the reserved BASIC area, STACK area, and RAM RESIDENT CODE area. The BASIC area is moved to address 34313 (pointed out by the system variable PROG). Next to the CHANNEL area (CHANS), is the new character set (lenght=768 bytes), the Basic64 routine (lenght=2030 bytes), which is followed by the BASIC area. The STACK and RAM RESIDENT CODE areas stay in the upper 8K RAM block.

Basically, we have:

The abribute zone of the two DISPLAY FILES are not used by Basic64, so they may be used to contain machine code.


2.4 New system variables

In the adicion of the microcomputer’s system variables, the routine uses the next system variables:


Nº of bytesAdressNameUsage
231491XCOORDCoordinate x of the last PLOT
131493YCOORDCoordinate y of the lasr PLOT
131494FLAGSystem flag
131499VDMODResolution mode: 0 = 256×176, 1 = 512×176
131500COLColumn of the last printed character
131501LIN21 minus the line of the last printed character
231502XCRUsed by channel #5
131505CURSTChannel that is beeing used
131506NCOLMaximum column number in use
131507LARGPixels character wide used by channel #5
131508MAXCLMaximum column number to use in cahnnel #5
131509CHRST256 minus the address of the character set used by channel #5. By default is equal to 31510-256=31254


CAP 3 – Using machine code

3.1 Printing a character in 64, 85 or 128 columns

The printing of a character in 64 or 85 columns is perfectly deirect, evolving just the openning of the correct channel, followed by a RST 10h, the acumulator must have the code of the character we want to print. This character can be as shown next, a control character.

3.1.1 Printing in 64 columns

The channel #4 must be openned. This operation is made from a ROM routine in the address 1230h. This routine have as parameter, the number of the channel to open, which must be in the acumulator. So to print the character !, ASCII code 21h, we would have:

LD A,4            ;the channel #4 is being openned
CALL 1230h   ;channel opening
LD A,21h
RST 10h        ;printing of the character !, in the actual line and columns

3.1.2 Printing in 85 columns

Is equal to the above, simply now the channel #5 is used:

LD A,5            ;the channel #5 is being openned
CALL 1230h   ;channel opening
LD A,21h
RST 10h        ;printing of the character !, in the actual line and columns

3.1.3 Printing in 128 or other number of columns

First is necessary to define a new character set, which in the case of 128 columns, must be defined in a 4×8 matrix. In any case, each character is always defined by 8 bytes.

The definition of each character is made like the UDGs, but is this case only the first 4 columns counting from the left, may be used to generate the character set (128 columns). This number 4 was found by dividing the 512 pixels of the resolution by the 128 collumns (512/128=4 pixeis).

After the character set is in memory, for example, in the address 50000, the systema variables LARG and MAXCL, must be updated. LARG will contain 4 and MAXCL 128.

3.2 Using the control characters

The usage of the control characters is direct: open the channel, followed by a RST 10h. After the “printng” of the control character, the parameters will be send by RST 10h too. For an example, to make the same as PRINT #5; AT 10,50;”!”. we would have:

LD A,5          ;the channel opening is only made once
CALL 1230h
LD A,16h
RST 10h
LD A,10        ;line
RST 10h
LD A,50        ;column
RST 10h
LD A,21h
RST 10h

The use of TAB is made the same way. The control characters INK, PAPER and BRIGHT do not have efect.

3.3 Printing a string

The printing of a string is just a sequence of RST 10h. There is a routine in ROM that makes that work, in address 21DBh. This routine have as parameters the registers DE and BC, which have the address of the string and the lenght of the string. For example, the printing of a string in address 50000 and with lenght of 100 bytes, should be made in the next way:

LD DE,50000
LD BC,100

Note: the channel must be opened.

3.4 Printing of a numeric constant

For this the ROM routine PRINT_FP in address 31A1h is used. This routine prints the number in the top of the calculator stack. If we want to print a 2 byte number in 64 columns, for example 28054, we must do:

LD A,4
CALL 1230h
LD BC,28054
CALL 30E9h    ;put BC in the calculator stack

Adenda – Using FDD system

If you have a FLOPPY DISK DRIVE SYSTEM (FDD) from TIMEX, it’s advised to change the LOADER (BASIC_64) in the tape. With the FDD system turned on and Basic64 loaded in memory, type:

SAVE *”BASEST1″CODE 32280,2030

followed by:

SAVE *”SETNM”CODE 31510,768

Then, execute MERGE “BASIC_64” to reload the LOADER from tape.Then make a LIST , erase lines 2 to 12. Enter the next line to the program:


… and modify line 14 to:

14 RANDOMIZE USR 32280: OUT255,0: LOAD *”SETNM”CODE 31510

This time the LOADER is ready to be saved in a the disk. Execute:


… and Basic64 will start by pressing the reset button in the TIMEX FDD interface.

Back to top