Class: MBasic

Inherits:
CPMFile show all
Defined in:
lib/native_file_types/cpm/MBasic.rb

Overview

the CP/M MBASIC file format is very similar to the MS-DOS BASICA/GWBASIC formats, described at www.chebucto.ns.ca/~af380/GW-BASIC-tokens.html

Constant Summary collapse

SINGLE_BYTE_TOKENS =
{
	0x81=>'END',
	0x82=>'FOR',
	0x83=>'NEXT',
	0x84=>'DATA',
	0x85=>'INPUT',
	0x86=>'DIM',
	0x87=>'READ',
	0x88=>'LET',
	0x89=>'GOTO',
	0x8A=>'RUN',
	0x8B=>'IF',
	0x8C=>'RESTORE',
	0x8D=>'GOSUB',
	0x8E=>'RETURN',
	0x8F=>'REM',
	0x90=>'STOP',
	0x91=>'PRINT',
	0x92=>'CLEAR',
	0x93=>'LIST',
	0x94=>'NEW',
	0x95=>'ON',
	0x96=>'DEF',
	0x97=>'POKE',
	0x98=>'CONT',
	0x9B=>'LPRINT',
	0x9C=>'LLIST',
	0x9D=>'WIDTH',
	0x9E=>'ELSE',
	0x9F=>'TRACE',
	0xA0=>'NOTRACE',
	0xA1=>'SWAP',
	0xA2=>'ERASE',
	0xA3=>'EDIT',
	0xA4=>'ERROR',
	0xA5=>'RESUME',
	0xA6=>'DEL',
	0xA7=>'AUTO',
	0xA8=>'RENUM',
	0xA9=>'DEFSTR',
	0xAA=>'DEFINT',
	0xAB=>'DEFSNG',
	0xAC=>'DEFDBL',
	0xAD=>'LINE',
	0xAE=>'POP',
	0xAF=>'WHILE',
	0xB0=>'WEND',
	0xB1=>'CALL',
	0xB2=>'WRITE',
	0xB3=>'COMMON',
	0xB4=>'CHAIN',
	0xB5=>'OPTION',
	0xB6=>'RANDOMIZE',
	0xB7=>'SYSTEM',
	0xB8=>'OPEN',
	0xB9=>'FIELD',
	0xBA=>'GET',
	0xBB=>'PUT',
	0xBC=>'CLOSE',
	0xBD=>'LOAD',
	0xBE=>'MERGE',
	0xBF=>'FILES',
	0xC0=>'NAME',
	0xC1=>'KILL',
	0xC2=>'LSET',
	0xC3=>'RSET',
	0xC4=>'SAVE',
	0xC5=>'RESET',
	0xC6=>'TEXT',
	0xC7=>'HOME',
	0xC8=>'VTAB',
	0xC9=>'HTAB',
	0xCA=>'INVERSE',
	0xCB=>'NORMAL',
	0xCC=>'GR',
	0xCD=>'COLOR',
	0xCE=>'HLIN',
	0xCF=>'VLIN',
	0xD0=>'PLOT',
	0xD1=>'HGR',
	0xD2=>'HPLOT',
	0xD3=>'HCOLOR',
	0xD4=>'BEEP',
	0xD5=>'WAIT',
	0xDD=>'TO',
	0xDE=>'THEN',
	0xDF=>'TAB(',
	0xE0=>'STEP',
	0xE1=>'USR',
	0xE2=>'FN',
	0xE3=>'SPC(',
	0xE4=>'NOT',
	0xE5=>'ERL',
	0xE6=>'ERR',
	0xE7=>'STRING$',
	0xE8=>'USING',
	0xE9=>'INSTR',
	0xEA=>"'",
	0xEB=>'VARPTR',
	0xEC=>'SCRN',
	0xED=>'HSCRN',
	0xEE=>'INKEY$',
	0xEF=>'>',
	0xF0=>'=',
	0xF1=>'<',
	0xF2=>'+',
	0xF3=>'-',
	0xF4=>'*',
	0xF5=>'/',
	0xF6=>'^',
	0xF7=>'AND',
	0xF8=>'OR',
	0xF9=>'XOR',
	0xFA=>'EQV',
	0xFB=>'IMP',
	0xFC=>'MOD',
	0xFD=>'\\',
}
DOUBLE_BYTE_TOKENS =
{
	0x81=>'LEFT$',
	0x82=>'RIGHT$',
	0x83=>'MID$',
	0x84=>'SGN',
	0x85=>'INT',
	0x87=>'SQR',
	0x88=>'RND',
	0x89=>'SIN',
	0x8A=>'LOG',
	0x8B=>'EXP',
	0x8C=>'COS',
	0x8D=>'TAN',
	0x8E=>'ATN',
	0x8F=>'FRE',
	0x90=>'POS',
	0x91=>'LEN',
	0x92=>'STR$',
	0x93=>'VAL',
	0x94=>'ASC',
	0x95=>'CHR$',
	0x96=>'PEEK',
	0x97=>'SPACE$',
	0x98=>'OCT$',
	0x99=>'HEX$',
	0x9A=>'LPOS',
	0x9B=>'CINT',
	0x9C=>'CSNG',
	0x9D=>'CDBL',
	0x9E=>'FIX',
	0xAA=>'CVI',
	0xAB=>'CVS',
	0xAC=>'CVD',
	0xAE=>'EOF',
	0xAF=>'LOC',
	0xB0=>'LOF',
	0xB1=>'MKI$',
	0xB2=>'MKS$',
	0xB3=>'MKD$',
	0xB4=>'VPOS',
	0xB5=>'PDL',
	0xB6=>'BUTTON',
}

Instance Attribute Summary

Attributes inherited from NativeFileType

#aux_code, #contents, #file_system_image, #file_type, #filename, #meta_data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from CPMFile

#load_address, split_filename

Methods inherited from NativeFileType

#<=>, #==, all_native_file_types, best_fit, code_for_tests, compatability_score, #data_without_header, file_type_matches?, #full_filename, #header_length, #initialize, is_valid_file_if, #load_address, load_address, matching_score, native_file_types_possible_on_file_system, non_matching_score, #to_hex_dump, #to_info_dump, #type_description

Methods included from SubclassTracking

extended

Constructor Details

This class inherits a constructor from NativeFileType

Class Method Details

.file_system_file_typesObject



8
9
10
11
12
# File 'lib/native_file_types/cpm/MBasic.rb', line 8

def MBasic.file_system_file_types
  {
    AppleCPM=>"BAS",
  }
end

Instance Method Details

#to_listingObject



178
179
180
181
182
183
184
# File 'lib/native_file_types/cpm/MBasic.rb', line 178

def to_listing
  if @contents[0]==0xFF then
    buffer_as_gbasic(@contents)
  else
    @contents
  end
end