
XB Compiler Configuration & Coding Constraints

Numeric & Arithmetic Specification
•Type: 16-bit Integer only. Range: -32768 to 32767.
•Overflow: Standard wrap-around (e.g., 32767 + 1 = -32768).
•Functions: SQR, / (division), and ^ (exponentiation) return integer results only (e.g., 5 / 2 = 2).
•Recommendation: Use INT() in XB source to synchronize behavior between interpreted and compiled modes.

Syntax & Formatting Constraints
•Statement Separators: Double colon (::) supported. CRITICAL: Do not end a line with ::; this causes compiler crash.
•Line Limits: PRINT statements must not exceed 20 variables.
•String Limits: Truncation at 255 characters (no warning).
•Reserved Names: Avoid naming subprograms using internal symbols (e.g., NC, NV, ACCEP1, etc.).

Execution & Timing
•Performance: Compiled code runs 30x to 70x faster than XB.
•Delay Loops: FOR-NEXT is ineffective for timing. Use CALL SOUND for hardware-consistent delays.
•Error Trapping: Virtually non-existent in compiled code. Errors trigger immediate "quit" or return to title screen without line numbers. Debug thoroughly in XB/XB256 environment first.

Unsupported Commands & Functions
•Trigonometry/Math: ATN, COS, SIN, TAN, LOG, EXP.
•Program Structure: DEF, IMAGE, DISPLAY USING, CALL ERR.
•GOTO/GOSUB Targets: Cannot GOTO or GOSUB to a DATA statement.
•IF/THEN/ELSE: ON GOTO and ON GOSUB are prohibited within IF-THEN-ELSE blocks.

Command-Specific Behaviors
•RND: Always returns 0. Workaround: Use INT(RND * N) to generate range 0 to N-1.
•RANDOMIZE: Automatic; hardware seed at >83C0.
•RESTORE: Must target a DATA statement, never a comment/remark.
•DISPLAY: DISPLAY ERASE ALL crashes compiler; use CALL CLEAR.
•INPUT/ACCEPT: Prompt required for multiple variables. INPUT behaves as LINPUT for peripherals.
•CALL SAY: No leading spaces; single spaces between words; punctuation pronounced; unknown words skipped.

Subprogram & Assembly Integration
•Naming: User subprograms are truncated to the first 6 characters. Names must be unique within these 6 characters.
•CALL LINK: 
  ?Subprogram names must be lowercase string constants for compiler recognition as user-defined.
  ?Variable-based names (e.g., CALL LINK(A$)) are not supported.

•Memory: Assembly routines reside in low 8K memory; compiled code in high 24K memory.

Disk & Peripheral Access
•File Type: DISPLAY VARIABLE only (DV1 to DV245).
•Channels: Only #1, #2, and #3 are supported.
•Print behavior: Commas and semicolons in PRINT # are not supported; use colons only.

Compiler Options
•Chaining: Compiled programs cannot use RUN. Use CALL LOAD and CALL LINK("RUN") in the XB loader to chain.
