Difference between revisions of "BASIC file formats"

From Ninerpedia
Jump to navigation Jump to search
m
m
Line 1: Line 1:
BASIC programs written for TI BASIC and [[Extended BASIC]] are not stored in plain text in memory. Instead, the BASIC lines are ''tokenized''. For each command or special character or character sequence that has a meaning in BASIC there is a one-byte code, the ''token''.  
BASIC programs written for TI BASIC and [[Extended BASIC]] are not stored as plain text in memory. This is different with assembler programs which are edited as text files and then assembled to a [[Tagged Object Code]] file.
 
This is not appropriate for BASIC. When the program is started, and it would be stored as plain text, the BASIC interpreter would have to parse the line first, finding out the commands and the arguments, and then execute it. This is typical for script languages of today, but it would be just too slow, and we know well that TI BASIC and Extended BASIC are quite slow, compared with other platforms.
 
BASIC lines are ''tokenized''. For each command or special character or character sequence that has a meaning in BASIC there is a one-byte code, the ''token''. Example:
 
{| class="plainc"
|-
! Command
! Token (hex)
|-
| NEW
| 00
|-
| SAVE
| 07
|-
| EDIT
| 09
|-
| PRINT
| 9c
|-
| &
| b8
|-
| "..." (quoted string)
| c7
|-
| SEG$
| d8
|-
| VALIDATE
| fe
|}
 
You can find a [[BASIC tokens | complete table]] here.
 


'''TODO: continue'''
'''TODO: continue'''

Revision as of 19:05, 28 March 2015

BASIC programs written for TI BASIC and Extended BASIC are not stored as plain text in memory. This is different with assembler programs which are edited as text files and then assembled to a Tagged Object Code file.

This is not appropriate for BASIC. When the program is started, and it would be stored as plain text, the BASIC interpreter would have to parse the line first, finding out the commands and the arguments, and then execute it. This is typical for script languages of today, but it would be just too slow, and we know well that TI BASIC and Extended BASIC are quite slow, compared with other platforms.

BASIC lines are tokenized. For each command or special character or character sequence that has a meaning in BASIC there is a one-byte code, the token. Example:

Command Token (hex)
NEW 00
SAVE 07
EDIT 09
PRINT 9c
& b8
"..." (quoted string) c7
SEG$ d8
VALIDATE fe

You can find a complete table here.


TODO: continue