Class: NADOLTokens
- Inherits:
-
NADOLFile
- Object
- NativeFileType
- NADOLFile
- NADOLTokens
- Defined in:
- lib/native_file_types/apple2/NADOLFile.rb
Overview
file packed by the NADOL EDITOR application. format is a series of unnumbered lines, where each line has the following format:
<Length> (8-bit: including length byte, contents, zero>
<Tokens and/or Characters>
<Zero byte> ($00, to mark the end of the line)
each byte in the line is interpreted as follows: $00 - end of line marker $01 - $64 - NADOL tokens $65 - $70 - ??? unknown $71 - $7f - 1 to F spaces $80 - $FF - ASCII character with high bit set
Constant Summary collapse
- NADOL_EDITOR_TOKENS =
[ "?", #00 (so we can use token as an index in to this array) "READ(", #01 "FREE(", #02 "NOT(", #03 "LENGTH(", #04 "PDL(", #05 "SIZEOF(", #06 "LSCRN(", #07 "HSCRN(", #08 "CHECK(", #09 "MAKE(", #0a "SCREEN(", #0b "HEXPACK ",#0c "PROCEDURE ",#0d "ENDPROC", #0e "FUNCTION ",#0f "ENDFUNC", #10 "IF ", #11 "ELSE", #12 "ENDIF", #13 "WHILE ", #14 "ENDWHILE",#15 "DEFINE ", #16 "RESULT=", #17 "PRINT", #18 "PRINTHEX",#19 "PRINTBYTE",#1a "LABEL ", #1b "GOTO ", #1c "INVERSE", #1d "NORMAL", #1e "FLASH", #1f "CASE ", #20 "GOTOXY(", #21 "CLEAR", #22 "NEW", #23 "HOME", #24 "CLREOL", #25 "CLREOP", #26 "PRBLOCK(",#27 "STOP", #28 "COPY(", #29 "FILL(", #2a "MASK(", #2b "RSECT(", #2c "WSECT(", #2d "RBLOCK(", #2e "WBLOCK(", #2f "WTRACK(", #30 "WSYNC(", #31 "RECAL(", #32 "DISPLAY(",#33 "RTRACK(", #34 "RSYNC(", #35 "BEEP(", #36 "DISASM(", #37 "TEXT", #38 "FORMAT(", #39 "SETFORMAT(",#3a "WORKDRIVE ",#3b "INIT ", #3c "LOAD ", #3d "SAVE ", #3e "CATALOG", #3f "DELETE ", #40 "RENAME ", #41 "PACK ", #42 "CONVERT(",#43 "INPUT(", #44 "LORES", #45 "PLOT(", #46 "HLINE(", #47 "VLINE(", #48 "COLOR=", #49 "FIND(", #4a "HIRES", #4b "HCOLOR=", #4c "HPLOT", #4d "CALL(", #4e "PR#", #4f "IN#", #50 "FILTER(", #51 "LIST", #52 "RUN", #53 "AUXMOVE(",#54 "LCMOVE(", #55 "DELAY(", #56 "INTEGER", #57 "BYTE", #58 " AND ", #59 " OR ", #5a " MOD ", #5b " XOR ", #5c " WITH ", #5d " TO ", #5e " AT ", #5f "TAB(", #60 "ENDCASE", #61 "MON:", #62 "EDIT", #63 "SAVE@" #64 ]
Instance Attribute Summary
Attributes inherited from NativeFileType
#aux_code, #contents, #file_system_image, #file_type, #filename, #meta_data
Instance Method Summary collapse
Methods inherited from NADOLFile
file_system_file_types, load_address
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
Constructor Details
This class inherits a constructor from NativeFileType
Instance Method Details
#to_listing ⇒ Object
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 |
# File 'lib/native_file_types/apple2/NADOLFile.rb', line 150 def to_listing s="" index=0 while (index<contents.length) line_length=contents[index] index+=1 end_of_line=index+line_length-2 while(index<end_of_line) b=contents[index] if (b<=0x64) then s+=NADOL_EDITOR_TOKENS[b] elsif(b>0x70 and b<0x80) then s+=" "*(b-0x70) elsif(b>=0x80) then s+=(b-0x80).chr else raise sprintf("unknown token %02X at offset %04X",b,index) end index+=1 #move to next char end index+=1 #skip over end-of-line marker s+="\n" end s end |