Post Reply 
HP BASIC (Series 200/300): Detokenizer
09-16-2017, 11:22 PM
Post: #1
HP BASIC (Series 200/300): Detokenizer
I received a question from a person who has some floppy disks containing HP BASIC programs; He wonders wether it is possible to read these programs on a modern PC.
The first problem can easily be solved: A program like HPDir or the old LIF Utils can help to copy the files from LIF to FAT (DOS) formatted disks.
But then: The Basic programs normally were not saved in ASCII - Format, but in tokenized PROG format.
So the question is: Is there a de-tokenizer program available ( for free, preferably) that translates HP series 200/300 BASIC (version 5 or 6) programs into simple ASCII text? I faintly remember that I read about such a tool, but where?
Find all posts by this user
Quote this message in a reply
09-17-2017, 12:16 AM
Post: #2
RE: HP BASIC (Series 200/300): Detokenizer
If you have a 200/300 system available load the program then use the "SAVE" command to write it out to disk, this saves the program as ASCII text.

Paul.
Find all posts by this user
Quote this message in a reply
09-17-2017, 10:52 AM
Post: #3
RE: HP BASIC (Series 200/300): Detokenizer
@ Paul:
Yes, of course, I could do that as I have got working HP 300 series systems; but I am looking for a solution for people who have no (more) access to vintage hardware ( only some old floppy disks).

@ Mike:
Using an emulator is a good idea. I just have read that the emulator for series 200 machines by Olivier De Smet supports (boots) BASIC up to version 5.0. The floppy disks that should be translated probably were used on a (much) more modern 9000/375; I am afraid at least BASIC 6.2 was in use at that time.
Does anyone know of a series 300 emulator, or whether Olivier plans to develop further his emulator? On the real 9836 machine you can use BASIC 6.2 as well.
Maybe BASIC 6.x just hasn't been tested yet on Olivier's emulator. Did anyone try this out meanwhile? The latest information I found about the emulator dates from beginning of 2011. Maybe BASIC 6.2 wasn't easily available for download at that time.
Find all posts by this user
Quote this message in a reply
09-18-2017, 03:24 PM (This post was last modified: 09-18-2017 03:25 PM by Martin Hepperle.)
Post: #4
RE: HP BASIC (Series 200/300): Detokenizer
There is a detokenizer for the Integral Technical Basic at
http://insar.stanford.edu/~lharcke/programming/
which could be useful for starting. But one would also need a means to read the LIF formatted floppy disk.

The best way is probably, as already mentioned, to go through a SAVE statement using the real thing or printing to a laptop via a serial interface.

Martin
Find all posts by this user
Quote this message in a reply
09-21-2017, 12:06 AM
Post: #5
RE: HP BASIC (Series 200/300): Detokenizer
@ Mike:
I found a download source for Olivier's emulator; just google "Smet 9836 emulator". But I didn't test it yet.
@ Martin: Thanks for the link. I am not sure whether HP-UX Technical BASiC uses the same file formats and BASIC tokens as Workstation BASIC?
The guy who wants his old BASIC programs transformed into ASCII text didn't get back to me. So it seems it's not that important for him. Since I could use SAVE on vintage hardware for that purpose, I won't investigate that any further.
Thank you guys for your hints!
Find all posts by this user
Quote this message in a reply
11-02-2017, 02:13 PM
Post: #6
RE: HP BASIC (Series 200/300): Detokenizer
(09-18-2017 03:24 PM)Martin Hepperle Wrote:  There is a detokenizer for the Integral Technical Basic at
http://insar.stanford.edu/~lharcke/programming/
which could be useful for starting. But one would also need a means to read the LIF formatted floppy disk.

I am not sure about the integral detokenizer, but the HP-85 and HP-87 are more works in progress. They can identify the tokens, but the arguments are left as an exercise to the reader.

So you'll get something out of the program, but it will not be a listing that you can feed to another BASIC system.

I too tried to fix this, but its a lot of work, and as Martin pointed put, you just feed it to an (emulated) computer and get the listing.

**vp
Find all posts by this user
Quote this message in a reply
07-23-2019, 07:05 AM
Post: #7
RE: HP BASIC (Series 200/300): Detokenizer
I am searching for an HP Basic 4.0 for hp 9000/200 detokenizer

The given link is broken

May someone help me?

Thanks
Find all posts by this user
Quote this message in a reply
07-27-2019, 10:25 AM
Post: #8
RE: HP BASIC (Series 200/300): Detokenizer
(07-23-2019 07:05 AM)gintilisano Wrote:  The given link is broken

It's still available on the Internet Archive. Hope that helps.
Find all posts by this user
Quote this message in a reply
07-27-2019, 01:20 PM
Post: #9
RE: HP BASIC (Series 200/300): Detokenizer
(07-23-2019 07:05 AM)gintilisano Wrote:  I am searching for an HP Basic 4.0 for hp 9000/200 detokenizer
...
May someone help me?

It depends on what you want to do, but if your need is to get a text listing of a Basic 4 program stored in binary (tokenized) format, the easiest way, as suggested in a post above, is to load the program into Olivier De Smet's emulator and LIST the program. The emulator is not so robust for intensive tasks, but will do the job. You may need to make a disc image, if the target program is on a floppy disc, but it will be much easier than developing a HP Basic 4 detokenizer.

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
07-30-2019, 07:30 AM
Post: #10
RE: HP BASIC (Series 200/300): Detokenizer
Solved.

I create a hex dump of the original LIF floppy disk using LIF utilities for dos in a vintage computer, then convert the hex dump to a binary LIF image usinge the Olivier De Smet (Thanks Olivier) Python program. Then I load the diskette in Olivier simulator, use the BASIC SAVE command to store a ASCII program file, I save the LIF image and extract the file with LIF utilities.

The ASCII file must be converted in text format, i use the followin QB64/QB45 code

CLS
DIM h AS STRING * 1


INPUT "file lif: ", a$
INPUT "file txt: ", B$

OPEN a$ FOR RANDOM AS #1 LEN = 1

OPEN B$ FOR OUTPUT AS #2
flag = 0
n = 0
WHILE NOT EOF(1)
n = n + 1
GET #1, n, h
i = ASC(h)
IF flag = 1 AND i >= 48 AND i < 58 THEN
flag = 0
END IF

IF i > 31 AND i < 126 AND flag = 0 THEN
PRINT #2, h;
ELSE
IF i = 0 THEN
PRINT #2, CHR$(13)
flag = 1
n = n + 1
END IF
IF i = 255 THEN
PRINT #2, "<FF>";
END IF
END IF
WEND
CLOSE #1
CLOSE #2

The resulting file is nor perfect, ma the task is done.
Find all posts by this user
Quote this message in a reply
07-30-2019, 01:00 PM
Post: #11
RE: HP BASIC (Series 200/300): Detokenizer
(07-30-2019 07:30 AM)gintilisano Wrote:  ...
Then I load the diskette in Olivier simulator, use the BASIC SAVE command to store a ASCII program file, I save the LIF image and extract the file with LIF utilities.
The ASCII file must be converted in text format, i use the followin QB64/QB45 code
...

Great !

The last step (converting the HP ASCII file into pure text file) could be avoided since Olivier's emulator simulates a printer at address 701.
You could have just done:
PRINTER IS 701; WIDTH OFF ! width off used to avoid line breaks after 80 char.
LIST
and get the text file into the file printer-xxx.txt in the current emulator directory.

J-F
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: