It is currently Mon Oct 20, 2014 5:44 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Mar 24, 2012 9:47 pm 
Offline
 Profile

Joined: Sat Mar 10, 2012 10:27 pm
Posts: 41
I do most of my coding on Linux; it's where I have my tools. But going from an ASCII file into a BASIC program is a bit of a pain; currently I store it as ASCII on an SSD, load the SSD into BeebEm, *EXEC it, save the results.

Does anyone know of a tokenizer that'll make my life easier?


Top
 
PostPosted: Sat Mar 24, 2012 11:11 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
There's some C code, courtesy of Thomas Harte, on the Sample Code page of this very website, which does exactly this - converts an ASCII BASIC program into a tokenised form, ready for putting on a disc image or feeding to a Beeb in some other manner.

I incorporated the code into BeebAsm, in case you use that, and is available in the form of the PUTBASIC command.


Top
 
PostPosted: Sat Mar 24, 2012 11:11 pm 
Offline
User avatar
 Profile

Joined: Mon Jan 07, 2008 6:46 pm
Posts: 380
Location: Málaga, Spain
There's some C code, courtesy of Thomas Harte, on the Sample Code page of this very website, which does exactly this - converts an ASCII BASIC program into a tokenised form, ready for putting on a disc image or feeding to a Beeb in some other manner.

I incorporated the code into BeebAsm, in case you use that, and is available in the form of the PUTBASIC command.


Top
 
PostPosted: Sat Mar 24, 2012 11:50 pm 
Offline
 Profile

Joined: Sat Mar 10, 2012 10:27 pm
Posts: 41
RichTW wrote:
There's some C code, courtesy of Thomas Harte, on the Sample Code page of this very website, which does exactly this - converts an ASCII BASIC program into a tokenised form, ready for putting on a disc image or feeding to a Beeb in some other manner.


Huh? Oh! I hadn't even noticed those links along the top! I'm so used to forums saying exactly the same thing at the top...

Thanks! That'll help a lot.


Top
 
PostPosted: Thu Mar 29, 2012 12:32 am 
Offline
 Profile

Joined: Sat Mar 10, 2012 10:27 pm
Posts: 41
Heheh, that indicated an "error" with TOOLKIT PLUS :-)

I had a line "ON ERROR PRINT...." which I then edited with Toolkit Plus to REM out. So the resulting code is:
Code:
 2250REM ON ERROR PRINT'"Error detected":GOTO ERL+10
 2260CALL read
 2270REM ON ERROR OFF
 2280=?result


Thomas's program:
Code:
00001040  08 CA 31 F4 20 4F 4E 20   ..1. ON
00001048  45 52 52 4F 52 20 50 52   ERROR PR
00001050  49 4E 54 27 22 45 72 72   INT'"Err
00001058  6F 72 20 64 65 74 65 63   or detec
00001060  74 65 64 22 3A 47 4F 54   ted":GOT
00001068  4F 20 45 52 4C 2B 31 30   O ERL+10
00001070  0D 08 D4 0A D6 20 72 65   ..... re
00001078  61 64 0D 08 DE 12 F4 20   ad.....
00001080  4F 4E 20 45 52 52 4F 52   ON ERROR
00001088  20 4F 46 46 0D 08 E8 0C    OFF....
00001090  3D 3F 72 65 73 75 6C 74   =?result
00001098  0D FF                     ..


Toolkit Plus:
Code:
00001040  08 CA 24 F4 20 4F 4E 20   ..$. ON
00001048  85 20 F1 27 22 45 72 72   . .'"Err
00001050  6F 72 20 64 65 74 65 63   or detec
00001058  74 65 64 22 3A E5 20 9E   ted":. .
00001060  2B 31 30 0D 08 D4 0A D6   +10.....
00001068  20 72 65 61 64 0D 08 DE    read...
00001070  0C F4 20 4F 4E 20 85 20   .. ON .
00001078  87 0D 08 E8 0C 3D 3F 72   .....=?r
00001080  65 73 75 6C 74 0D FF      esult..

We can see the words after the REM have remained tokenized and weren't converted back into ASCII.

Very funny!


Top
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron