T2P.EXE

Anything Sinclair ZX Basic related; history, development, tips - differences between BASIC on the ZX80 and ZX81
Post Reply
User avatar
Math123
Posts: 44
Joined: Sun May 11, 2008 11:14 pm
Location: Germany Wuppertal
Contact:

T2P.EXE

Post by Math123 »

I made T2P.EXE which is a new version of the ZXtext2P.EXE program.
It lets you write ZX81 Basic files with a text editor on your PC and translate it to a P-file.
This new version has a lot of corrections and a number of surprising additions.

First of all there is no need to select lable-mode or number-mode any more. This is done automaticly.
You can write line numbers or leave it. And you can have labels as well. You can reference a label then
as its line number or as its address in memory.

The second big thing is that you can write your source Basic-program as a batch file that will
call T2P.EXE itself when startet. So write the text as batch. Just start it. It will translate and even start
EightyOne (or any other program) with the created P-file. (The simple text file mode is still available)

Just an example of such a batch file:

Code: Select all

@echo off
t2p %0
if errorlevel 1 echo &pause&goto END
start %~n0.p
:END
exit

#AUTOSTART=1

@Start:
        print "demo2"

100     for x=1 to 3
          print x
        next x

        goto @Start
The lines above "exit" are for the batch. The lines after "exit" are for T2P.EXE.
Here we have a label "@Start" and later a line number "100". And some lines without any of them.

All this can be found on my site http://www.swatosch.de/zx81 with downloadable demos and documentation in German and English and a video showing how to start with T2P.EXE.

enjoy
Matthias
zx81ultra
Posts: 31
Joined: Thu Feb 13, 2020 4:19 am
Location: Bolivia

Re: T2P.EXE

Post by zx81ultra »

Hello,

Really great, I saw the video, Thank You.

Just curious, in which language is T2P written ?
Camilo Eid - ZX81
User avatar
Math123
Posts: 44
Joined: Sun May 11, 2008 11:14 pm
Location: Germany Wuppertal
Contact:

Re: T2P.EXE

Post by Math123 »

Like the old version http://freestuff.grok.co.uk/zxtext2p/index.html written in C.
User avatar
XavSnap
Posts: 1940
Joined: Sat May 10, 2008 4:23 pm
Location: 'Zx81 France' Fb group.

Re: T2P.EXE

Post by XavSnap »

Win32 DOS original/old release (recompiled) by Chris Cowley for W10 compatibility:
zxtext2p.zip
(36.33 KiB) Downloaded 196 times
Xavier ...on the Facebook groupe : "Zx81 France"(fr)
zx81ultra
Posts: 31
Joined: Thu Feb 13, 2020 4:19 am
Location: Bolivia

Re: T2P.EXE

Post by zx81ultra »

Do you think it can be recompiled for OSX ?
Camilo Eid - ZX81
User avatar
Math123
Posts: 44
Joined: Sun May 11, 2008 11:14 pm
Location: Germany Wuppertal
Contact:

Re: T2P.EXE

Post by Math123 »

Sure. Just try the original sources.
I will publish my source file shortly. Just need to do some errorfixing...
zx81ultra
Posts: 31
Joined: Thu Feb 13, 2020 4:19 am
Location: Bolivia

Re: T2P.EXE

Post by zx81ultra »

Hello,

I tried the following code with T2P:

10 LET A$="COS 1"
20 LET B=VAL A$
30 PRINT B

I get a 2/20 error code when run. If I type the program with the ZX81 keyboard it runs OK. Is there a way to tell T2P that the COS text has to be treated as a function ?

best regards
Camilo Eid - ZX81
User avatar
Math123
Posts: 44
Joined: Sun May 11, 2008 11:14 pm
Location: Germany Wuppertal
Contact:

Re: T2P.EXE

Post by Math123 »

In Strings and Rem-Lines t2p pretends to interpret any text as simple letters. Using the hexvalue of the wanted token is the clue.

As the ZX81 manual tells the code of COS is C8.
So this should work:
10 LET A$="\c8 1"
Last edited by Math123 on Wed Jul 21, 2021 4:37 pm, edited 1 time in total.
zx81ultra
Posts: 31
Joined: Thu Feb 13, 2020 4:19 am
Location: Bolivia

Re: T2P.EXE

Post by zx81ultra »

Excellent, thank you !
Camilo Eid - ZX81
User avatar
Math123
Posts: 44
Joined: Sun May 11, 2008 11:14 pm
Location: Germany Wuppertal
Contact:

Re: T2P.EXE

Post by Math123 »

On the other hand if you would like to have a variable with name COS or any other keyword-like name then you can use the "Ghost"- character "|" to prevent t2p from detecting the keyword.

To get:
10 LET COS = 33
20 PRINT COS COS

enter:
10 LET C|OS = 33
20 PRINT COS CO|S

t2p ignores the "|" in the translation.
Post Reply