Class | IntegerBasicFile |
In: |
lib/DOSFile.rb
test/backup/DOSFile.rb |
Parent: | DOSFile |
Adapted from FID.C -- a utility to browse Apple II .DSK image files by Paul Schlyter (pausch@saaf.se)
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).
IB_REM_TOKEN | = | 0x5D |
IB_UNARY_PLUS | = | 0x35 |
IB_UNARY_MINUS | = | 0x36 |
IB_QUOTE_START | = | 0x28 |
IB_QUOTE_END | = | 0x29 |
INTEGER_BASIC_TOKENS | = | [ # $00-$0F "HIMEM:","<$01>", "_", " : ", "LOAD", "SAVE", "CON", "RUN", # Direct commands "RUN", "DEL", ",", "NEW", "CLR", "AUTO", ",", "MAN", # $10-$1F "HIMEM:","LOMEM:","+", "-", # Binary ops "*", "/", "=", "#", ">=", ">", "<=", "<>", "<", "AND", "OR", "MOD", # $20-$2F "^", "+", "(", ",", "THEN", "THEN", ",", ",", "\"", "\"", "(", "!", "!", "(", "PEEK", "RND", # $30-$3F "SGN", "ABS", "PDL", "RNDX", "(", "+", "-", "NOT", # Unary ops "(", "=", "#", "LEN(", "ASC(", "SCRN(", ",", "(", # $40-$4F "$", "$", "(", ",", ",", ";", ";", ";", ",", ",", ",", "TEXT", # Statements "GR", "CALL", "DIM", "DIM", # $50-$5F "TAB", "END", "INPUT", "INPUT", "INPUT", "FOR", "=", "TO", "STEP", "NEXT", ",", "RETURN", "GOSUB", "REM", "LET", "GOTO", # $60-$6F "IF", "PRINT", "PRINT", "PRINT", "POKE", ",", "COLOR=","PLOT", ",", "HLIN", ",", "AT", "VLIN", ",", "AT", "VTAB", # $70-$7F "=", "=", ")", ")", "LIST", ",", "LIST", "POP", "NODSP", "DSP", "NOTRACE","DSP", "DSP", "TRACE", "PR#", "IN#", ] |
IB_REM_TOKEN | = | 0x5D |
IB_UNARY_PLUS | = | 0x35 |
IB_UNARY_MINUS | = | 0x36 |
IB_QUOTE_START | = | 0x28 |
IB_QUOTE_END | = | 0x29 |
INTEGER_BASIC_TOKENS | = | [ # $00-$0F "HIMEM:","<$01>", "_", " : ", "LOAD", "SAVE", "CON", "RUN", # Direct commands "RUN", "DEL", ",", "NEW", "CLR", "AUTO", ",", "MAN", # $10-$1F "HIMEM:","LOMEM:","+", "-", # Binary ops "*", "/", "=", "#", ">=", ">", "<=", "<>", "<", "AND", "OR", "MOD", # $20-$2F "^", "+", "(", ",", "THEN", "THEN", ",", ",", "\"", "\"", "(", "!", "!", "(", "PEEK", "RND", # $30-$3F "SGN", "ABS", "PDL", "RNDX", "(", "+", "-", "NOT", # Unary ops "(", "=", "#", "LEN(", "ASC(", "SCRN(", ",", "(", # $40-$4F "$", "$", "(", ",", ",", ";", ";", ";", ",", ",", ",", "TEXT", # Statements "GR", "CALL", "DIM", "DIM", # $50-$5F "TAB", "END", "INPUT", "INPUT", "INPUT", "FOR", "=", "TO", "STEP", "NEXT", ",", "RETURN", "GOSUB", "REM", "LET", "GOTO", # $60-$6F "IF", "PRINT", "PRINT", "PRINT", "POKE", ",", "COLOR=","PLOT", ",", "HLIN", ",", "AT", "VLIN", ",", "AT", "VTAB", # $70-$7F "=", "=", ")", ")", "LIST", ",", "LIST", "POP", "NODSP", "DSP", "NOTRACE","DSP", "DSP", "TRACE", "PR#", "IN#", ] |