PILOT Language Reference
PILOT (Programmed Inquiry, Learning Or Teaching) is an educational language from the 1960s, popular on Atari computers. PBXA64 embeds PILOT blocks inside PowerBASIC functions using #PCODE / #ENDP directives.
V10 Feature: PILOT #PCODE blocks are fully lowered to working PowerBASIC code by the compiler. Multiple blocks are supported with block-scoped labels and variables. All PILOT variables are automatically declared as LOCAL for #DIM ALL compatibility.
Command Reference
| Command | Description | Example |
T: | Type (print text) | T: Hello, World! |
A: | Accept (read input) | A: What is your name? |
M: | Match (pattern test) | M: YES |
Y: | Yes branch (match success) | Y: Correct! |
N: | No branch (match failure) | N: Try again! |
C: | Compute (assignment) | C: score = score + 1 |
J: | Jump (goto label) | J: *START |
U: | Use (conditional jump/text) | U: score>=3: *WIN |
E: | End (exit PILOT block) | E: |
R: | Remark (comment) | R: This is a comment |
S: | Screen (no-op, accepted) | S: DRAW 50 |
*LABEL | Label (jump target) | *START |
PILOT Variables
| Variable | Type | Description |
$A | String | Input from the last A: command |
#A | Numeric | Numeric value of the last A: input (via VAL) |
$name | String | Named string variable (e.g., $NAME) |
#count | Numeric | Named numeric variable (e.g., #SCORE) |
Pattern Matching
| Pattern | Match Type | Example |
| Exact text | Exact match after TRIM$/UCASE$ | M: YES matches "YES", " yes " |
Y* | Prefix match | M: Y* matches "YES", "YELLOW" |
*ING | Suffix match | M: *ING matches "RUNNING" |
*ORL* | Substring match | M: *ORL* matches "WORLD" |
* | Wildcard (any input) | M: * matches anything |
| Numeric | Exact number match | M: 42 matches #A = 42 |
#VAR | Numeric variable match | M: #EXPECTED matches #A = #EXPECTED |
$VAR | String variable match | M: $ANSWER matches $A = $ANSWER |
Example: Quiz Program
FUNCTION PBMAIN() AS LONG
#PCODE
C: score = 0
*LOOP
T: What is 5 + 3?
A:
M: 8
Y: Correct! $score = $score + 1
N: Wrong! The answer is 8.
T: Play again? (YES/NO)
A:
M: Y*
Y: *LOOP
T: You got #score correct!
E:
#ENDP
FUNCTION = 0
END FUNCTION
How PILOT Maps to PB
| PILOT | Generated PowerBASIC |
T: Hello $name | PRINT "Hello "; name$ |
A: | INPUT a$ : a# = VAL(a$) |
M: YES | match = (UCASE$(TRIM$(a$)) = "YES") |
Y: *LABEL | IF match THEN GOTO LABEL |
C: a = b + c | a# = b# + c# |
J: *LABEL | GOTO LABEL |
U: x>=5: *WIN | IF x# >= 5 THEN GOTO WIN |
E: | GOTO EndOfPilotBlock |
*LABEL | LABEL: |
Multiple Blocks: Multiple #PCODE / #ENDP blocks can appear in a single PB function. Each block gets unique internal prefixes for labels and variables to prevent name collisions.