Class: IntegerBasicFile

Inherits:
DOSFile show all
Defined in:
lib/DOSFile.rb

Overview

Integer Basic file format: <Length_of_file> (16-bit little endian) <Line> .….. <Line>

where <Line> is: 1 byte: Line length 2 bytes: Line number, binary little endian <token> <token> <token> .….. <end-of-line token>

<token> is one of: $12 - $7F: Tokens as listed below: 1 byte/token $80 - $FF: ASCII characters with high bit set $B0 - $B9: Integer constant, 3 bytes: $B0-$B9,

followed by the integer value in
2-byte binary little-endian format
(Note: a $B0-$B9 byte preceded by an
 alphanumeric ASCII(hi_bit_set) byte
 is not the start of an integer
 constant, but instead part of a
 variable name)

<end-of-line token> is: $01: One byte having the value $01

(Note: a $01 byte may also appear
 inside an integer constant)

Note that the tokens $02 to $11 represent commands which can be executed as direct commands only – any attempt to enter then into an Integer Basic program will be rejected as a syntax error. Therefore, no Integer Basic program which was entered through the Integer Basic interpreter will contain any of the tokens $02 to $11. The token $00 appears to be unused and won’t appear in Integer Basic programs either. However, $00 is used as an end-of-line marker in S-C Assembler source files, which also are of DOS file type “I”.

(note here a difference from Applesoft Basic, where there are no “direct mode only” commands - any Applesoft commands can be entered into an Applesoft program as well).

Constant Summary

Constants inherited from DSKFile

DSKFile::APPLESOFT_TOKENS

Instance Attribute Summary

Attributes inherited from DOSFile

#contents, #filename, #locked

Attributes inherited from DSKFile

#contents, #filename

Instance Method Summary collapse

Methods inherited from DOSFile

#catalog_filename, catalog_filename, #initialize

Methods inherited from DSKFile

#==, #buffer_as_applesoft_file, #can_be_picture?, #hex_dump, #initialize, #length_in_sectors, #to_ascii

Constructor Details

This class inherits a constructor from DOSFile

Instance Method Details

#file_extensionObject



155
156
157
# File 'lib/DOSFile.rb', line 155

def file_extension
	".bas"
end

#file_typeObject



151
152
153
# File 'lib/DOSFile.rb', line 151

def file_type
	"I"
end

#file_type_byteObject



159
160
161
# File 'lib/DOSFile.rb', line 159

def file_type_byte
	0x01
end

#to_sObject

display file with all INTEGER BASIC tokens expanded to ASCII



164
165
166
# File 'lib/DOSFile.rb', line 164

def to_s
	buffer_as_integer_basic_file(@contents)
end