[Coco] emulator questions

Roger Taylor rtaylor at bayou.com
Tue Nov 25 16:00:01 EST 2003


At 01:50 PM 11/25/2003 -0500, you wrote:
>You are aware, right, that BASIC has such a conversion function built
>in?  To convert a program, just load it in and resave it using
>SAVE"progname",A and it will be saved in ASCII.


Also, loading an ASCII BASIC program retokenizes it in memory, at the 
expense of time.  A large ASCII BASIC program can take a very long time to 
load.  The occasional hybrid BASIC/ML program can only be saved back in 
tokenized format to retain everthing, and some of those can't even be resaved.

I think the best use I've seen yet for storing in ASCII format is the 
QuikPro Database generator, that built your database out of premade 
segments of BASIC code which were reassembled into another BASIC listing in 
ASCII format.  You can build BASIC programs from other BASIC programs 
easily if you're dealing with plain text/ASCII.





>Art Flexser
>
>On Tue, 25 Nov 2003, LM wrote:
>
> > Do have any reference material as to which bytes represent which functions
> > in basic?  I started on a short program to convert from the tokenized
> > basic to straight ASCII and it appears to be working really well.  I just
> > don't have all the correspondences between byte codes and BASIC
> > instructions in yet.  Now that MESS is working, I could just compare
> > listings of some of my games with the basic files viewed through a hex
> > editor.  Was hoping someone might have a list already created to save some
> > time though.

I have the complete list right here, for Color BASIC, ECB, DECB, and SECB, 
including all the functions.
Function tokens are preceded by $FF.

The binary BASIC file format is:

$FF
length of program

16-bit address of next line
this 16-bit line number
this line data
8-bit null terminator

.. repeat ..

16-bit null address
8-bit null

the line data is the text version of the line that has been tokenized

Something like:

10 CLS

...might appear as the following as the disk file:

255     | header/flag
0       | total bytes following MSB
8       | total bytes following LSB
38      | next line address MSB
7       | next line address LSB
0       | this line number MSB
10      | this line number LSB
158     | CLS token
0       | null address MSB
0       | null address LSB
0       | null line data





More information about the Coco mailing list