require 'NativeFileType' class Trs80LevelIIBasic:any } end #BASIC files should start with 0xFF is_valid_file_if lambda {contents[0]==0xFF} #filename should either have no extension, or end /BAS is_valid_file_if lambda {filename=~/\/(BAS|)$/} SINGLE_BYTE_TOKENS={ 0x80=>'END', 0x81=>'FOR', 0x82=>'RESET', 0x83=>'SET', 0x84=>'CLS', 0x85=>'CMD', 0x86=>'RANDOM', 0x87=>'NEXT', 0x88=>'DATA', 0x89=>'INPUT', 0x8A=>'DIM', 0x8B=>'READ', 0x8C=>'LET', 0x8D=>'GOTO', 0x8E=>'RUN', 0x8F=>'IF', 0x90=>'RESTORE', 0x91=>'GOSUB', 0x92=>'RETURN', 0x93=>'REM', 0x94=>'STOP', 0x95=>'ELSE', 0x96=>'TRON', 0x97=>'TROFF', 0x98=>'DEFSTR', 0x99=>'DEFINT', 0x9A=>'DEFSNG', 0x9B=>'DEFDBL', 0x9C=>'LINE', 0x9D=>'EDIT', 0x9E=>'ERROR', 0x9F=>'RESUME', 0xA0=>'OUT', 0xA1=>'ON', 0xA2=>'OPEN', 0xA3=>'FIELD', 0xA4=>'GET', 0xA5=>'PUT', 0xA6=>'CLOSE', 0xA7=>'LOAD', 0xA8=>'MERGE', 0xA9=>'NAME', 0xAA=>'KILL', 0xAB=>'LSET', 0xAC=>'RSET', 0xAD=>'SAVE', 0xAE=>'SYSTEM', 0xAF=>'LPRINT', 0xB0=>'DEF', 0xB1=>'POKE', 0xB2=>'PRINT', 0xB3=>'CONT', 0xB4=>'LIST', 0xB5=>'LLIST', 0xB6=>'DELETE', 0xB7=>'AUTO', 0xB8=>'CLEAR', 0xB9=>'CLOAD', 0xBA=>'CSAVE', 0xBB=>'NEW', 0xBC=>'TAB(', 0xBD=>'TO', 0xBE=>'FN', 0xBF=>'USING', 0xC0=>'VARPTR', 0xC1=>'USR', 0xC2=>'ERL', 0xC3=>'ERR', 0xC4=>'STRING$', 0xC5=>'INSTR', 0xC6=>'POINT', 0xC7=>'TIME$', 0xC8=>'MEM', 0xC9=>'INKEY$', 0xCA=>'THEN', 0xCB=>'NOT', 0xCC=>'STEP', 0xCD=>'+', 0xCE=>'-', 0xCF=>'*', 0xD0=>'/', 0xD1=>'[', 0xD2=>'AND', 0xD3=>'OR', 0xD4=>'>', 0xD5=>'=', 0xD6=>'<', 0xD7=>'SGN', 0xD8=>'INT', 0xD9=>'ABS', 0xDA=>'FRE', 0xDB=>'INP', 0xDC=>'POS', 0xDD=>'SQR', 0xDE=>'RND', 0xDF=>'LOG', 0xE0=>'EXP', 0xE1=>'COS', 0xE2=>'SIN', 0xE3=>'TAN', 0xE4=>'ATN', 0xE5=>'PEEK', 0xE6=>'CVI', 0xE7=>'CVS', 0xE8=>'CVD', 0xE9=>'EOF', 0xEA=>'LOC', 0xEB=>'LOF', 0xEC=>'MKI$', 0xED=>'MKS$', 0xEE=>'MKD$', 0xEF=>'CINT', 0xF0=>'CSNG', 0xF1=>'CDBL', 0xF2=>'FIX', 0xF3=>'LEN', 0xF4=>'STR$', 0xF5=>'VAL', 0xF6=>'ASC', 0xF7=>'CHR$', 0xF8=>'LEFT$', 0xF9=>'RIGHT$', 0xFA=>'MID$', 0xFB=>"'", } def to_listing s="" p=1 while(p