Graphic Pack BASIC 64
Graphic pack Basic 64 TC2048
Graphic pack Basic 64
Extension to Sinclair Basic
Version for TC2048
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 - Introdution
The Basic 64 program gives the possibility to the user, to use the extended graphic
capabilities and special text printintg, suported by the design of the TC2068 (in ZX
Spectrum mode) and TC2048 microcomputers.
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 existint ones, allowing the use of those graphics modes in Basic programs.
Is possible too, the use of machine code routines to use those capabilities.
CAP 1 - System
Put the Basic64 tape in the tape recorder and type:
After the LOADER stop to LOAD, this message apears on the screen:
TEM O SISTEMA FDD LIGADO AO COMPUTADOR? (S/N)
(Do you have the FDD system connected to the computer (Y/N))
If the answer is no, so the BASESTA code block is loaded. If the answer
is yes, the BASEST code block is loaded, what justifies, is that with the
FDD connected, the machine code routine is a little diferent. Then the second code block
is loaded, then a message apears 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 realocate BASIC, start the new system
variables introduced by Basic64, open the new channels (#4 and #5) and prepare the Basic
interpretor, so it accepts the syntax of the new comands.
The user must execute a RANDOMIZE USR 31488, 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
After editing, you can return to extended mode with the INK *n or PAPER
1.1 SAVE and LOAD Basic64
There are two ways of saving programs in Basic64, one of them envolving, the change of the
basic program in the tape.
In a first step, comun 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 have two graphic modes permited by the system:
0 - 256x192 pixeis (256x176 pixeis in the
zone dedicated to printing)
1 - 512x192 pixeis (512x176 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:
The modes 0 and 1 can be used in the same program and are independent from the printing
commands. It's possivle in any of both, to use the cannels #4 and/or #5 in the following
#4: This channel is specially dedicated to print in 64 columns. It uses the character set
in the ROM, apointed by the system variable CHARS. Each character is defined in a matrix
with 8x8 pixeis. The printing is invoked by the comands PRINT #4... and LIST #4...
#5: This channel permits a flexible printing, because it is programable by the user.It
have two steps of freedom.
-Number of columns in screen (system variable MAXCL)
-Number of pixeis, in the horizontal, of the pixeis matrix of the defenition of the
characters (system variable LARG).
There is a new character set defined in a 6x8 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 6x8 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
-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 make
from the first line of the program.
-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. If n=1, the mode 512x192 is active.
If n=0, the mode 256x192 is active.
-PLOT* x,y Puts a PLOT of INK in the pixel x,y and update the PLOT
position. OVER and INVERSE acts as normal.
-LINE x,y,z Draws a line from the PLOT position, changing horizontally x
and vertically y and make a 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 draw a oval.
2.3 Memory organization
The memory map is caracterized for the existence of two DISPLAY FILES and the realocation
of the reserved Basic area. It is moved to address 33489 (pointed by the system variable
PROG). Next to the abribute area of the second DISPLAY FILE is the Basic64 routine
(address 31488), which is above Basic area.
The new character set is in a zone between the two DISPLAY FILES, in the address 23755.
Basically we have:
ROM | 1º Display | Atribute | Printer | System | Channels | 80H |
Charater | Free |
| File | 1º D.F. |
Buffer | Variables |
| | Set 6x8 | |
23296 23552 23434
| 2º Display | Atribute | Basic64 | Basic | Variables |
80H | Edit | 0DH | 80H |
| File | 2º D.F. | Routine |
program | |
| Buffer | | |
| Input | 0DH | Temp. | Stack |
Free | Stack | 3EH | User Defined |
| Buffer | | Buffer | Calculator
| | Graphics |
STKEND SP RAMTOP
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
|Nº of bytes
||Coordinate x of the last PLOT
||Coordinate y of the lasr PLOT
||Resolution mode: 0 = 256x176, 1 =
||Column of the last printed character
||21 minus the line of the last printed
||Used by channel #5
||Channel that is beeing used
||Maximum column number in use
||Pixels character wide used by channel #5
||Maximum column number to use in cahnnel
||256 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
3.1.1 Printing in 64
The channel #4 must be openned. This operation is made from a ROM routine in the address
1601h. 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 1601h ;channel opening
RST 10h ;printing of the character !, in the actual line and
3.1.2 Printing in 85
Is equal to the above, simply now the channel #5 is used:
LD A,5 ;the channel #5 is being openned
CALL 1601h ;channel opening
RST 10h ;printing of the character !, in the actual line and
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 4x8 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
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
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
LD A,5 ;the channel opening is only made once
LD A,10 ;line
LD A,50 ;column
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 203Ch. 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
Note: the channel must be opened.
3.4 Printing of a numeric constant
For this the ROM routinr PRINT_FP in address 2DE3h 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, we
CALL 2D2Bh ;put BC in the calculator stack
CALL 2DE3h ;PRINT_FP
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 *"BASEST"CODE 31488,2000
SAVE *"SETNM"CODE 23755,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
12 LOAD *"BASEST"CODE
... and modify line 14 to:
14 RANDOMIZE USR 31488: OUT255,0: LOAD *"SETNM"CODE 23755
This time the LOADER is ready to be saved in a the disk. Execute:
SAVE *"START" LINE 12
... and Basic64 will start by pressing the reset button in the TIMEX FDD