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).

Instance Attribute Summary

Attributes inherited from DOSFile

#contents, #filename, #locked, #sector_count

Instance Method Summary collapse

Methods inherited from DOSFile

#hex_dump, #initialize

Constructor Details

This class inherits a constructor from DOSFile

Instance Method Details

#file_extensionObject



129
130
131
# File 'lib/DOSFile.rb', line 129

def file_extension
	".bas"
end

#file_typeObject



125
126
127
# File 'lib/DOSFile.rb', line 125

def file_type
	"I"
end

#to_sObject

display file with all INTEGER BASIC tokens expanded to ASCII



134
135
136
# File 'lib/DOSFile.rb', line 134

def to_s
	buffer_as_integer_basic_file(@contents)
end