Bas2Tap

Description

This program can be used to convert an Oric BASIC program to and from TAPE binary format. Technicaly this means that instead of using the Oric BASIC line based text editor, you can edit an ORIC BASIC program entirely in a comfortable text editor, and then convert it automaticaly to a tape file format that can later be loaded on the emulator -or played on a real Oric-.

Utilisation

To transform a binary file as a texte file:

	%OSDK%\bin\Bas2Tap [switches] source_file destination_file
Switches
  • With the -t2b switch Bas2Tap converts a binary encoded tape to text format:

    -t2b tapefile textfile 
    		
  • The -b2t[0|1] switch convert a text file to binary encoded tape format

    -b2t0 textfile tapefile 
          => Generate a TAPE file that do not auto run after the loading is finished 
          (you have to manualy use the RUN command)
    -b2t1 textfile tapefile 
          => Generate a TAPE file that auto run after the loading is finished
    		
  • The -color[0|1] switch set if the REM and ' statements should be colorized or not

Extended BASIC

By default Bas2Tap will expect the source program to contain line numbers, you can enable the extended BASIC features using one of the commands starting by the # symbol. Here is a list of what you can use:

  • #labels

    This command enables the mode labels with automatic generation of line numbers. You can mix and match sections of code with or without line numbers as long as the resulting merge content stays logical with line numbers increasing.

    Labels have to start on the column zero, and can be followed by one or two colon-separated values, one giving the new reference line number and the other being the increment. The § symbol can be used to get the current line number.

                    my_label
                       PRINT"The current line number is ";§
    		anotherLabel:+5
                       PRINT"Now lines are increasing by multiple of 5"
                    farLabel:32000
                       PRINT"We are now at line 32000"
                       GOTO my_label
    		
  • #optimize

    This parameter removes all white spaces and comments to the exported binary file. This makes debugging much harder, but it also can reduce a typical program size by a few kilobytes easily.

  • #define name value

    Just defines a symbol and gives it a value. Please note that the name can't contain any Oric BASIC instruction name, so things like "CONTAINER" (contains CONT) or "DEEPPIT" (contains PI) are not allowed (but "Container" and "DeepPit" should be fine)

                    #define Cross 1
                    #define Circle 2
                       A=Cross:B=Circle
    		
  • ~

    The tilde character must be followed by a letter in either upper or lower case. Upper case ones will be exported as the equivalent of CHR$(27)+letter (so can be used to insert attributes, color changes, etc...) while lower case ones will be exported as one byte control code, such as carriage return and cursor down.

                    PRINT@15,11;"~N~CLOADING"
                    PRINT@15,12;"~N~ALOADING"
                    I$=I$+"a plastic bag~m~j"
    		


Known issues


No known problem - please signal any issue on the Cross development tools forum.

comments powered by Disqus
Coverity Scan Build Status
History
Version 2.1
  • The DATA instruction should not be usable with defines
  • Correctly filtered out comments at the end of a #define...
Version 2.0
  • Added support for labels and auto-numbering (use § as a keyword to expand to the current line number)
  • Added support for escape sequences to directly integrate carriage return or attribute changes inside strings without having to use CHR$ (use the character ~ as the ESCape prefix)
  • Added a basic support for #defines
  • The -optimize option now also filters out as much whitespace as possible
Version 1.3
  • Added a -optimize option (used to disable things like comments)
Version 1.2
  • Support for pure comments without line numbers (accepts lines starting by ' or ; or //)
Version 1.1
  • Added filtering of strings before parsing, to remove superfluous spaces, tabs and other carriage returns before starting the syntax conversion pass
Version 1.0
  • Added the handling of token codes over 246 to allow the dump of corrupted files, these will have a CORRUPTED ERROR CODE nnn message at the location of the corrupted data (in this particular case it was the game ENCOUNTER from Severn Software at line 11150 having a 'NEXT WITHOUT FOR' message displayed
  • Fixed the program so it can output to a file instead of stdout
Version 0.2
  • Fixed a bug causing loading problems
Version 0.1
  • Created Bas2Tap by joining and extending two of Fabrice Frances programs: Bas2Txt and Txt2Bas
  • Added error messages when missing line numbers are found
  • Added support for the #file preprocessor directive making it possible to link together more than one BASIC source code and get the right error messages