Login
Back to forumReply to this topicGo to last reply

Posted By

softice
on 2020-10-24
16:11:20
 TED Basic v4.5

I have just uploaded the BASIC extension that I programmed when I was 14 or 15 and stopped developing at 16 years old. I still had many more features in mind, but never finished it and never released it, but it still may have some features with which you may like to play around.

Ted Basic is an extension to BASIC V3.5. It contains new statements for working with user-defined characters and some other graphics modes of the TED chip, as well as some commands from Basic v4.0 for disc access and commands for writing named procedures.

On top of the commands described below, there are some undocumented commands. Also some commands contain bugs. For example, “CHRSAVE” allows one to draw user-defined characters in GRAPHIC mode, but it does not always survive the memory lay-out changes when entering GRAPHIC mode very well. Nevertheless I have included some working demos.

Also there are still many non-implemented commands (e.g. PLAY – I made a bit of progress and then I got other interests…) , and unfortunately I did not manage to figure out how to implement functions with return values (I also never managed to figure out how to code a USR() function...). So overall are quite a few planned functions that I did not manage to implement.

Overall I hope that some 21st century Commodore PLUS/4 enthusiasts will have fun playing around with TED Basic, and perhaps even extend it.

I have just uploaded a D64 to the site, that hopefully will be available soon.

Here is an overview:


UDC ON / ODC OFF

Switches user-defined character mode on or off


OLD

Copy the character set from ROM to RAM


SYMBOL <character index>, <byte0>, …, <byte7>

Defines a user-defined character, with [character number] the display code (i.e., A becomes 1, and so forth - add 128 for the lower case characters) and [byte0] to [byte7] the eight bytes defining the rows of the character.

Example: UDC ON:OLD:SYMBOL 0, 0, 56, 102, 100, 100, 102, 56, 0

Changes the “@” symbol into the Commodore logo.


CHRCOPY to character index in RAM, from character index in ROM

Copies the ROM definition of character [from] to user-defined character [to].

Example: CHRCOPY 1,26

Changes the “A” to “Z”.


MCM ON / MCM OFF

Switches the multicolor mode on.


MCOLOR source #, color # [, luminance #]

Define multicolors 1 and 2 for the user-defined characters. Colors range from 0-15 and luminance from 0-7.

MCOLOR source #1 equals color source 3 of the usual COLOR command. MCOLOR source #2 is unique for the user-defined characters.


Example:
10 ** MCOLOR DEMO FOR TED BASIC
20 COLOR 0,1:COLOR 4,1
30 UDC ON:OLD
40 MCM ON
50 COLOR 1,10,7
60 SCNCLR
70 SYMBOL 32,10,10,10,10,95,95,95,95
80 CHAR 1,13,12,”[CTRL-2]TED[CMD-4] [CTRL-2]BASIC[CMD-4] [CTRL-2]DEMO”
90 FOR I = 1 TO 16
100 FOR J=0 TO 7
110 MCOLOR 1,I,J
120 A=I+1:IF I=16 THEN A=1
130 B=J+1:IF J=7 THEN B=0
140 MCOLOR 2,A,B
150 SLEEP 1
160 NEXT J
170 NEXT I
180 UDC OFF:MCM OFF

Type [CTRL-2] by pressing the CTRL key and 2 simultaneously. Similarly [CMD-4] means pressing the ‘Commodore’ key and 4 simultaneously.


WINDOW x1,y1,x2,y2

This defines a text window with top left corner (x1,y1) and bottom right corner (x2,y2) and then erases it.

(WARNING: WINDOW seems somewhat buggy. If x2<x1 or y2<y1 it does not issue a warning and crashes the computer.)

A demo:

100 SCNCLR
110 WINDOW0,0,39,1
120 PRINT “[ 6 x space bar]TED BASIC DEMO”
130 X1=INT(20*RND(1))
140 X2=X1+INT(20*RND(1))
150 Y1=INT(12*RND(1))
160 Y2=INT(12*RND(1))
170 WINDOW X1,Y1,X2,Y2
180 COLOR1,RND(1)*15+2,RND(1)*7
190 FOR I=1 TO 100
200 PRINT”[CTRL-9]TED[CTRL-0]”;
210 NEXT I
220 SLEEP 1
230 GOTO 130



**

This is a shorthand for REM to make the remarks in the code look a bit better.


TLOAD[, device#] / TSAVE[, device#]

Loads or saves a Ted Basic program (unit 8 by default) and automatically adds a .TED extensions to the file name.

BLOAD “[filename]” [, dn]

A shorthand for LOAD “[filename]”,8,1, i.e., loading binary files into memory.

[, dn] is an optional device number, i.e, BLOAD “[filename]”,1 loads a binary file from tape.

BSAVE “[filename]”, start address, end address+1 [,dv]

Writes the memory to disk from [start address] to [end address].

DVERIFY”[filename]” [, Ddrive] [,on Uunit]

Verifies a program on disc

STORE

Puts a string in “constant memory”, which is not erased by NEW, CLR, running a program, nor a hard reset (it is of course erased by switching off the computer).

See also RECALL, CONSAVE and CONLOAD

RECALL

Prints the string to screen or to anyother device switched on using CMD or PRINTER.

CONSAVE kn

Saves the string to disc buffer n

CONLOAD kn
Reads the string from disc buffer n

Example:

10 CONLOAD 5
20 PRINT “Last user was ”;:RECALL:PRINT
30 INPUT “WHAT IS YOUR NAME”;N$
30 STORE N$
40 CONSAVE 5


SWAP A$, B$

This statement exchanges the value of the string variables A$ and B$. This only works for string variables.

FAST

Switches off the screen, speeding up the computer by approximately 33% .

SLOW

Switches the screen back on.

BEEP

Issues a ‘console beep’.

SWAP / FAST / SLOW / BEEP are illustrated in the demo “SORTING.TED”.


RECORD#channel,record[,offset]

Is used for direct access files in the 1541, e.g., for building databases. Identical to the “P” command and to RECORD# in Basic v4.0. See the manual of the 1541 unit.

DOKE address, number

A two-byte version of “POKE” (‘double poke’ writes a number between 0 and 65535 to two-bytes, typically an address in a pointer.

Example:

DOKE 788,52750

Corrects the interrupt vector. (Note: any other number would likely mess up the functioning of the Commodore until a press of the reset button; hold RUN/STOP if you want to keep the memory contents.)

CLS

Clears the text screen (identical to PRINT CHR$(147)). Provided for compatibility with other BASICs.


ESC “esc-code”

This allows you to use the “ESCAPE” functions normally issued from the command-line by pressing the ESCAPE button followed by a letter. See the Commodore manual for a list of these escape codes.

Example:

ESC”NC”

Removes all windows, clears the screen and switches off insertion mode.

SLEEP time

Pauses the computer for a while; works better than the typical waiting loop. Time is measured in arbitrary unit, about half a second. Time becomes shorter in “FAST” mode.

Example:

DO:BEEP:SLEEP 1:LOOP

(Try it also in FAST mode)

EBCM ON / EBCM OFF

Switches the extended background color mode ON or OFF

RVS OFF / RVS ON

RVS OFF replaces the usual reversed (RVS) characters for lower case. RVS ON switches back to standard mode. I.e., this mode allows you to use the graphics characters together with lower case characters.

DEFPROC “procedure-name”
ENDPROC
PROC “procedure-name”

Allows the definition of simple, named procedures. It works like a GOSUB.

See demo “PROC-DEMO.TED”.

Posted By

Csabo
on 2020-10-24
16:31:41
 Re: TED Basic v4.5

TED Basic V4.5 is up on the site. Thank you for submitting it!

Posted By

MMS
on 2020-10-24
18:50:33
 Re: TED Basic v4.5

wow, thanks!!!! I will check the functioms and new conmands

Posted By

SVS
on 2020-10-25
09:43:36
 Re: TED Basic v4.5

Nice work softice!
If you want to be inspired for new commands, read info about my old SVS-OS release and about OS92 by Solder.
When I did write SVS-OS I was a beginner of the ML coding, then my commands run when a wedge character ("<-") is met. You've made the things better, avoiding any wedging character. How and where the system acknowledges your new command words?

Posted By

softice
on 2020-10-25
10:49:05
 Re: TED Basic v4.5

Thanks, SVS! I did not quite know how to do it, so what I did is hack another BASIC extension that was on a collection of programs from a tape I bought in German y probably around 1987. I replaced their commands for my own.

Once I remember which BASIC extension I modified, or what tape collection it came from (or maybe I still have it somewhere), I will add the proper acknowledgments. I remember a couple of tapes fit into it and the whole cover may have been white with a rainbow on it...

Posted By

softice
on 2020-10-25
10:55:05
 Re: TED Basic v4.5

SVS-OS and OS92 look really nice. Quite professional!



Back to topReply to this topic


Copyright © Plus/4 World Team, 2001-2024. Support Plus/4 World on Patreon