Skip to content

Latest commit

 

History

History
79 lines (53 loc) · 2.18 KB

File metadata and controls

79 lines (53 loc) · 2.18 KB

Commands

REM

0 frames

Comments. Ignored by the compiler.

PRINT "str"

chars + 4 frames (chars + 3 frames if no newline)

Write STX / ETX bounded string, with start=1 and end=0 bits (10 bits per frame) to data-string (output data convention).

CHR$ n

1 frame

Convert number n into its ASCII character (8bit). Useful for sending ASCII control characters using PRINT.

DATA bitstring|bool|int|str

Write binary / boolean / integer / string to data-string.

BIN bitstring

Write binary to data-string.

ASM code

Include raw cyclic tag {0, 1, ;} in the compiled output.

CLEAR n

Deletes n bits from data-string. (Borrowed from ZX Spectrum BASIC).

FILL n

Appends n set bits (1) to data-string, if leftmost data-bit is set.

ZFILL n

Appends n unset bits (0) to data-string, if leftmost data-bit is set.

INPUT v

UNIMPLEMENTED Assign the next bit of input data to variable v. Can only be used one at the beginning of the program. Special variable _ can be used to consume the first input bit which always has to be one to allow a CT program to get started. (Borrowed from the Python convention).

END

An alias for CLEAR 10, which clears the data-string frame by frame, which if all data is correctly aligned on 0 stop-bits, can allow the program to cycle as many times as needed to clear the entire data-string without triggering any further output or effects.

Graphics

3 frames + graphics command frame total

CT-BASIC can produce Tektronix 401x graphical output using the following ZX Spectrum borrowed commands:

CLS

8 frames

Clear screen. Writes Tektronix 401x control sequence ESC + FF.

DRAW Δx, Δy

4 frames

Draws a line from the last pixel of the previous PLOT or DRAW using relative offsets.

INK n

2 frames

Sets the ink (foreground) colour of the line drawing pen.

  1. Normal (solid)
  2. Dotted
  3. Dot-dashed
  4. Short-dash
  5. Long-dash
  6. Defocused, normal
  7. Defocused, dotted
  8. Defocused, dot-dashed

PLOT x, y

9 frames

Plots a point at absolute coordinate x, y.

  • x range: 0–1023.
  • y range: 0–779.

0, 0 represents the bottom-left corner of the screen.