Difference between revisions of "File handling in SpecBAS"

From SinclairFAQ
Jump to: navigation, search
Line 29: Line 29:
 
==Supported file formats==
 
==Supported file formats==
  
As well as handling program files, ZXASCII and BANK files, SpecBAS allows the importing of some common file types.
+
As well as handling program files, ZXASCII and BANK files, SpecBAS allows the importing of some common file types, using the GRAPHIC, MUSIC and SAMPLE commands.
  
 
Supported audio file types:
 
Supported audio file types:

Revision as of 18:13, 16 November 2011


Dealing with files and file types in SpecBAS

File system

NOTE: To keep everything compatible with all current versions of SpecBAS, it is strongly advised that you keep all file names in lower-case only. Characters which are illegal in Windows and Linux file systems should not be used.

Program files

Using SAVE "filename" saves your BASIC listing as a SpecBAS program file. LOAD "filename" is used to retrieve the saved program. SpecBAS saves your work whenever you enter or alter a program line, and the RECOVER command will load in the last saved backup. Programs can be set to auto-execute using a LINE number. eg. SAVE "filename" LINE 10 . If LINE is present, then it will be saved with a flag to execute the program from that line when loaded.

MERGE "filename" merges the program specified by the filename into the current program. Lines that have the same line number as lines already present in the current program will replace those lines, otherwise they will be inserted in numerical order.

ZXASCII

BASIC listings can be stored as ASCII text files, allowing the use of any text editor to create SpecBAS programs. Using SAVE "filename" ASCII

Specify ASCII after the filename (but before any LINE item). If LINE is present, then it will be saved with a flag to execute the program from that line when loaded. SAVE "filename" [[ASCII] LINE numexpr] Programs created in a text editor can be loaded into SpecBAS, as long as the header “ZXASCII” is the alone on the first line of the program.

Banks

LOAD "filename" BANK <id|numvar> Loads the file specified in the string expression to a memory bank. If the ID number is specified, the bank will be overwritten (if it exists) and created with that ID number if not. If no ID number is specified, one will be chosen for you, and loaded into the numeric variable.

SAVE "filename" BANK id Saves a bank specified by the id number to a file. Any bank can be saved, regardless of how it was created – whether as a FONT bank, a SCREEN bank or whatever.

Loading and saving banks provides a powerful way of importing, exporting and working with data stored in any format.

Supported file formats

As well as handling program files, ZXASCII and BANK files, SpecBAS allows the importing of some common file types, using the GRAPHIC, MUSIC and SAMPLE commands.

Supported audio file types:

.MOD .S3M .MO3 .XM .IT .MTM .UMX .MP3 .MP2 .OGG .WAV .AIFF .MP1

Supported image file types:

.PNG .GIF .BMP