bb2 file formatMiscellaneous Forums/General Help/bb2 file format
| I found this site so I thought I'd have a look at the source code but now I find it's some wierd Amiga format.|
I can't find any info on Google so I thought I'd ask here and see if there is anyone still around who knows something about the bb2 or bb2.xtra formats or how to convert them into a PC text file?
| You will need to use an emulator as Ted used to keep source tokenized for smaller files by default. |
| Aha. Ok, thanks skid. |
| Most of the .bb source on aminet should hopefully be in ascii. Tokenized source like static userlib numbers was optimal for the time but doesn't make it easy to recover / translate.|
I can't remember but it might be possible to build a bb detokenizer.
I just saved a print "hello" and got in binary
81 20 22 68 65 6c 6c 6f 22 00 00
and found this old list
but unfortunately the lib id doesn't look if it matches up for the print command
perhaps someone else a little more familiar can comment
converting the above to a bb program, and tokenizing it in Ted I suppose could be other option, bleh.
hmm, quick look in the original manual reveals:
The Blitz 2 editor stores all the BASIC keywords as tokens, these
tokens are 16 bit numbers encoding which library the BASIC keyword
comes from and an offset detailing where in the library the keyword's
ASCII name, help information and compile time code can be found.
Because the user can configure Blitz 2 to use some libraries and not
others problems can arise when a program's source code includes tokens
that are not available in the libraries that Blitz 2 loaded when it
was run. The error Token Not Found $xxxx signals the token code it
was unable to locate.
Each library can include 128 statements and functions. The token
code uses the lower 7 bits for which function/ statement it is
and the upper 9 bits to signify which library the token came from.
so $dd81 gives us command 1 with lib#443 which anded with 255 (high bit obviously dictates it's a token so 9 bit reference above is wrong) gives us the correct decoding for print, woot!
| Part of the problem is that what the tokenizer converted each token into was dependent on the individual installation's library numbers, so it wasn't uncommon to find source code full of undecodeable ?????? statements or incorrect commands picked up from differently-numbered libraries.|
In the latter days of Amiga Blitz (1999-ish?), the Blitz List members tended to share code almost exclusively exported in ASCII format because of this. All you can realistically do (unless you're really willing to get into parsing the files, and even then you can't account for conflicting libnums) is load the code into AmiBlitz on WinUAE and hope for the best (then export as ASCII if it looks OK).
| Thanks guys. It would be cool to code a bb2 detokenizer but I don't have the time atm so I'll take the emulator route for now. :) |