| www.retrosoftware.co.uk http://www.retrosoftware.co.uk/forum/ |
|
| Tokenizing an ASCII into BASIC http://www.retrosoftware.co.uk/forum/viewtopic.php?f=73&t=753 |
Page 1 of 1 |
| Author: | sweh [ Sat Mar 24, 2012 9:47 pm ] |
| Post subject: | Tokenizing an ASCII into BASIC |
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? |
|
| Author: | RichTW [ Sat Mar 24, 2012 11:11 pm ] |
| Post subject: | Re: Tokenizing an ASCII into BASIC |
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. |
|
| Author: | RichTW [ Sat Mar 24, 2012 11:11 pm ] |
| Post subject: | Re: Tokenizing an ASCII into BASIC |
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. |
|
| Author: | sweh [ Sat Mar 24, 2012 11:50 pm ] |
| Post subject: | Re: Tokenizing an ASCII into BASIC |
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. |
|
| Author: | sweh [ Thu Mar 29, 2012 12:32 am ] |
| Post subject: | Re: Tokenizing an ASCII into BASIC |
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! |
|
| Page 1 of 1 | All times are UTC [ DST ] |
| Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |
|