OrbitDeck for iOS includes a self-contained Tiny BASIC interpreter (Operating Tools → Tiny BASIC). It is source-compatible with the BASIC on the OrbitDeck desktop app and CardSat, and adds live satellite, station, pass, space-weather and geomagnetic data as read-only variables, a 240 × 135 graphics display, and a sandboxed file store. This guide documents the full dialect as implemented in the app.
The Tiny BASIC screen has two panes — a program editor and a graphics display — side by side on a wide iPad and stacked on iPhone.
.txt program from the Files app, Load sample restores the built-in demo, and Share source exports your program text via the iOS share sheet.PRINT produces, selectable for copying. A status line below reports how many statements ran and how many graphics calls were made, or the error if one occurred.INPUT, a panel appears listing each prompt so you can fill in the values before you press Run (see INPUT).?, mirroring classic BASIC — for example ?divide by zero. The status line repeats the message.A program is a list of numbered lines, lowest number first:
10 PRINT "HELLO, ORBIT"
20 FOR I=1 TO 3
30 PRINT I
40 NEXT
50 END
GOTO, GOSUB, IF…THEN n and ON…GOTO.: — for example 10 A=1: B=2: PRINT A+B.print = PRINT). Variable and function names are treated as upper-case.REM; everything to the end of the line is ignored. DATA lines are likewise skipped during normal execution and read only by READ.GOTO, GOSUB, RETURN, DATA, READ, RESTORE) require a numbered program and will report an error in immediate mode.THEN is guarded by an IF. In 10 IF X>0 THEN PRINT "POS" : PRINT "ALWAYS", the second PRINT runs regardless of X. Put conditional work on its own line or branch with THEN lineNumber.Numeric variables are a single letter A–Z and hold double-precision floating-point values. Assignment may use LET or omit it:
10 LET A=3.5
20 B=A*2
30 PRINT B
String variables are a single letter followed by $ — A$–Z$. Join strings with +:
10 N$="OSCAR"
20 PRINT N$ + "-100"
Arrays are declared with DIM and are zero-based — DIM A(12) creates indices 0…11. Two kinds exist:
DIM A(10) then A(3)=7. A scalar A and the array A(…) are independent.@() — a single unnamed array: DIM @(6) then @(0)=2.ERASE name.A named array may hold up to 1024 elements and the anonymous array up to 256, with a combined budget of 2048 elements across all arrays.
10 DIM A(12),@(6)
20 DATA 2,3,5,7,11,13
30 FOR I=0 TO 5: READ @(I): NEXT
40 A(0)=100
50 PRINT @(2), A(0)
Numeric operators, from lowest to highest precedence:
| Level | Operators | Notes |
|---|---|---|
| Logical OR | OR | Result is 1 (true) or 0 (false) |
| Logical AND | AND | 1 or 0 |
| Comparison | = <> < > <= >= | Return 1 or 0 |
| Add / subtract | + - | |
| Multiply / divide / modulo | * / % MOD | % and MOD are the same truncating remainder |
| Power | ^ | Right-associative |
| Unary | - + NOT | NOT yields 1 for a zero operand, else 0 |
Comparison and logical operators produce 1 for true and 0 for false, so they can be used directly in arithmetic. Parentheses group as usual. Dividing or taking a remainder by zero raises ?divide by zero.
Strings concatenate with + and compare with the same relational operators (=, <>, ordering by Unicode). A relation is treated as a string comparison when either side looks like a string (a literal in quotes or a $ variable/function).
SIN(30) is 0.5. Use the RAD and DEG constants to convert if you need radians.| Statement | Purpose |
|---|---|
LET v=expr | Assign a value. LET is optional. Targets: scalars, A$–Z$, A(i), @(i). |
PRINT items · ? | Print text and numbers. ? is shorthand. See below for separators. |
LPRINT items | Like PRINT but the line is prefixed with [LPRINT] (a stand-in for a printer). |
INPUT v[,v…] | Read values supplied in the INPUT panel before the run. Numeric or $ variables. |
IF cond THEN … | If the condition is non-zero, run the statement after THEN; if THEN is followed by a bare line number, jump there. |
FOR v=a TO b [STEP s] … NEXT | Counted loop; default step 1. Negative steps count down. |
GOTO n | Jump to line n. |
GOSUB n … RETURN | Call a subroutine and return to the following statement. |
ON expr GOTO n1,n2,… | Jump to the expr-th line number (1-based); out-of-range falls through. |
DIM name(n) · DIM @(n) | Declare arrays. Multiple declarations may be comma-separated. |
ERASE name | Discard a named array. |
DATA v1,v2,… | Inline numeric constants read by READ. |
READ v[,v…] | Read the next DATA value(s) into variables or array elements. |
RESTORE | Rewind the DATA pointer to the beginning. |
REM text | Comment to end of line. |
END · STOP | End the program. |
CLS PSET LINE CIRCLE TEXT SHOW | Graphics — see Graphics. |
FOPEN FPRINT FCLOSE FILES | Sandboxed files — see Files. |
SATSEL i · TXSEL i | Choose a satellite / transponder for the live variables — see below. |
Separate PRINT items with commas or semicolons:
PRINT continues the same line. A PRINT with no arguments flushes the pending line.10 A=42: N$="ISS"
20 PRINT "SAT ", N$, "CODE"; A
produces SAT ISS CODE42.
OrbitDeck collects INPUT values before the program runs rather than pausing mid-run. When your program contains INPUT statements, an INPUT values panel lists each prompt (its label text and the target variable); fill them in, then press Run. Values are consumed in order. A missing numeric value is 0; a missing string is empty.
10 INPUT "YOUR ALTITUDE KM"; A
20 INPUT "CALLSIGN"; C$
30 PRINT C$ + " AT " ; A ; " KM"
| Function | Returns |
|---|---|
ABS(x) | Absolute value |
INT(x) | Floor (largest integer ≤ x) |
ROUND(x) | Nearest integer |
FRAC(x) | Fractional part |
SGN(x) | −1, 0, or 1 |
SQR(x) | Square root (of max(0, x)) |
EXP(x), LOG(x), LOG10(x) | Exponential and natural / base-10 logs |
SIN(x), COS(x), TAN(x) | Trig, argument in degrees |
ASN(x), ACS(x), ATN(x) | Inverse trig, result in degrees |
ATN2(y,x) | Two-argument arctangent, degrees 0…360 range via atan2 |
MIN(a,b), MAX(a,b), HYP(a,b) | Minimum, maximum, hypotenuse |
RND · RND(n) | Random 0…1; with an argument, a random integer 0…n−1 |
| Function | Returns |
|---|---|
LEFT$(s,n), RIGHT$(s,n) | First / last n characters |
MID$(s,start[,len]) | Substring from 1-based start, optional length |
CHR$(n) | Character for byte value n |
STR$(x) | Number formatted as text |
UCASE$(s), LCASE$(s), TRIM$(s) | Upper / lower case, trim whitespace |
GRID$(lat,lon) | Four-character Maidenhead locator |
DXCC$(code) | Name of the DXCC entity for an ARRL numeric code |
TIME$, DATE$ | Current UTC HH:MM:SS and YYYY-MM-DD |
| Function | Returns |
|---|---|
LEN(s) | Character count |
ASC(s) | Byte value of the first character |
VAL(s) | Number parsed from text (0 if none) |
INSTR(hay,needle) | 1-based position of needle in hay, or 0 |
| Function | Returns |
|---|---|
GCDIST(lat1,lon1,lat2,lon2) | Great-circle distance in km |
GCAZ(lat1,lon1,lat2,lon2) | Initial great-circle bearing in degrees |
FSPL(freqMHz,distKm) | Free-space path loss in dB |
DXCCLAT(code), DXCCLON(code) | Reference latitude / longitude for a DXCC entity |
PASSAOS(k), PASSLOS(k), PASSMAX(k) | For the k-th upcoming pass of the selected satellite: minutes to AOS, minutes to LOS, and maximum elevation (degrees). Index 1…PASSN. |
| Name | Value |
|---|---|
PI | π |
TWOPI | 2π |
DEG | Degrees per radian (180/π) |
RAD | Radians per degree (π/180) |
CLIGHT | Speed of light, 299 792 458 m/s |
KBOLT | Boltzmann constant, 1.380649×10−23 |
REARTH | Earth radius, 6378.137 km |
The interpreter exposes OrbitDeck's live state as read-only numeric variables. They are populated from your station, the selected satellite, the current pass prediction, the Sun and Moon, space weather, and a planning-grade geomagnetic model at run time. Many "OK" flags are 1 when the corresponding data is available and 0 otherwise, so you can guard on them.
| Variable | Meaning |
|---|---|
UTCH UTCM UTCS | Hour, minute, second |
UTCDAY UTCMON UTCYR | Day, month, year |
LSTHR | Local sidereal time, hours |
TIMEOK | 1 when the clock is set (also gates TIME$/DATE$) |
| Variable | Meaning |
|---|---|
MYLAT MYLON MYALT | Observer latitude, longitude, altitude (m) |
MAGDECL | Approximate magnetic declination (degrees, east positive) |
NSAT NFAV | Catalog size and number of favorites |
POSOK | 1 when the station position is known |
| Variable | Meaning |
|---|---|
SATAZ SATEL | Azimuth and elevation (degrees) |
SATRNG SATRR | Slant range (km) and range rate (km/s) |
SATLAT SATLON SATALT | Sub-point latitude, longitude, altitude (km) |
SATSUN | 1 if the satellite is sunlit |
SATINC SATECC SATRAAN SATMM | Inclination, eccentricity, RAAN, mean motion |
SATNOR | NORAD catalog number |
GPAGE | Element-set age in days |
DECAYD DECAYSRC | Estimated decay lifetime (days) and its source (1 n-dot, 2 B*) |
SATOK | 1 when satellite look angles are valid |
| Variable | Meaning |
|---|---|
AOSIN LOSIN | Minutes to AOS / LOS of the next pass |
PASSEL | Maximum elevation of the next pass (degrees) |
PASSVIS | 1 if the next pass is optically visible (satellite sunlit, Sun below −6°) |
PASSN | Number of upcoming passes found (up to 8) |
PASSOK | 1 when a pass was found |
Use PASSAOS(k), PASSLOS(k) and PASSMAX(k) to read individual passes 1…PASSN.
| Variable | Meaning |
|---|---|
SUNAZ SUNEL | Sun azimuth and elevation (degrees) |
MOONAZ MOONEL | Moon azimuth and elevation (degrees) |
| Variable | Meaning |
|---|---|
SFI | 10.7 cm solar flux |
SSN | Sunspot number |
KP AINDEX | Planetary Kp and A index |
MUF | Modeled daytime MUF |
SPWXOK | 1 when space-weather values are available |
TXSEL)| Variable | Meaning |
|---|---|
NTX | Number of transponders on the satellite |
TXDL TXUL TXBW | Downlink center, uplink center, bandwidth (Hz) |
TXINV TXLIN | 1 if inverting / linear |
DOPPRX DOPPTX | Doppler-corrected downlink / uplink dial frequencies (Hz) |
TXOK | 1 when a transponder is selected |
| Variable | Meaning |
|---|---|
LSHELL | McIlwain L-shell at the sub-point |
BFIELD BRATIO | Field magnitude (nT) and B/B0 ratio |
INBELT INSAA | 1 inside a radiation belt / South Atlantic Anomaly |
FLARE, BZ, SWSPEED). On iOS these read 0 unless OrbitDeck has a value for them; guard on the matching "OK" flag where one exists. The geomagnetic figures use the same centered-dipole model as Orbital Zones, not a full IGRF model.By default the live variables describe OrbitDeck's currently selected satellite. Inside a program you can switch context:
SATSEL i — select catalog index i (0-based) and refresh all SAT…, pass and geomagnetic variables, plus the PASSAOS/PASSLOS/PASSMAX tables. It clears any transponder selection.TXSEL i — select transponder index i (0-based) on the current satellite and populate TX… and DOPPRX/DOPPTX.10 REM Report the next pass of catalog entry 0
20 SATSEL 0
30 IF PASSOK=0 THEN 60
40 PRINT "SAT ", SATNOR, " NEXT AOS ", ROUND(AOSIN), " MIN, MAX EL ", ROUND(PASSEL)
50 END
60 PRINT "NO PASS FOUND"
The display is 240 × 135 pixels; (0,0) is the top-left corner. Colors are an index 0…9 into the palette:
| Index | Color | Index | Color |
|---|---|---|---|
| 0 | Black | 5 | Yellow |
| 1 | White | 6 | Teal |
| 2 | Red | 7 | Orange |
| 3 | Green | 8 | Gray |
| 4 | Blue | 9 | Dark green |
| Statement | Effect |
|---|---|
CLS | Clear the display to black |
PSET x,y[,c] | Plot a point (color defaults to 1) |
LINE x1,y1,x2,y2[,c] | Draw a line |
CIRCLE x,y,r[,c] | Draw a circle outline |
TEXT x,y,value | Draw text (a string or a number) at x,y |
SHOW | Marker to present the frame (drawing is shown after the run regardless) |
Programs can write small text files, confined to OrbitDeck's private Application Support/OrbitDeck/Basic directory. Programs cannot supply paths or escape that sandbox.
| Statement | Effect |
|---|---|
FOPEN "name" | Open (creating if needed) a file for appending |
FPRINT items | Append a line to the open file (same item rules as PRINT) |
FCLOSE | Close the open file |
FILES | Print the list of files in the sandbox |
File names may be up to 40 characters of letters, digits and _ . -; they may not start with a dot or contain a slash.
Execution is bounded so a runaway program cannot hang the app:
| Limit | Value |
|---|---|
| Statements per run | 2,000,000 (then too many statements) |
| Wall-clock time | ~10 seconds (then program ran too long) |
Nested FOR loops | 8 |
GOSUB depth | 16 |
| Total array elements | 2048 (named ≤ 1024, anonymous ≤ 256) |
Division or modulo by zero, out-of-range array indices, RETURN without GOSUB, NEXT without FOR, and unknown names all raise a descriptive ? error.
The Load sample action loads this program, which exercises arrays, DATA/READ, graphics and live variables:
10 REM OrbitDeck Tiny BASIC
20 DIM A(12),@(6)
30 DATA 2,3,5,7,11,13
40 FOR I=0 TO 5: READ @(I): NEXT
50 CLS
60 FOR I=0 TO 11
70 A(I)=50+20*SIN(I*30)
80 LINE 120,67,120+95*COS(I*30),67+A(I)*SIN(I*30),3
90 NEXT
100 CIRCLE 120,67,30,5
110 TEXT 70,4,"ORBITDECK BASIC"
120 PRINT "MY GRID DATA: LAT=",MYLAT," LON=",MYLON
130 IF SATOK=0 THEN 160
140 PRINT "SAT ",SATNOR," AZ=",ROUND(SATAZ)," EL=",ROUND(SATEL)
150 PRINT "NEXT AOS IN ",ROUND(AOSIN)," MIN"
160 SHOW
170 END
10 IF PASSOK=0 THEN 70
20 PRINT "PASS AOS(MIN) LOS(MIN) MAXEL"
30 FOR K=1 TO PASSN
40 PRINT K, ROUND(PASSAOS(K)), ROUND(PASSLOS(K)), ROUND(PASSMAX(K))
50 NEXT
60 END
70 PRINT "NO PASSES IN THE WINDOW"
10 REM 291 = United States reference point
20 D=GCDIST(MYLAT,MYLON,DXCCLAT(291),DXCCLON(291))
30 B=GCAZ(MYLAT,MYLON,DXCCLAT(291),DXCCLON(291))
40 PRINT DXCC$(291)
50 PRINT "RANGE ", ROUND(D), " KM BEARING ", ROUND(B), " DEG"
10 FOPEN "log.txt"
20 FPRINT DATE$, " ", TIME$, " SFI=", SFI, " KP=", KP
30 FCLOSE
40 FILES
This interpreter is designed to run the same programs as the OrbitDeck desktop app and CardSat. A few platform notes:
INPUT is collected up front through the INPUT panel rather than pausing execution.PASSAOS/PASSLOS/PASSMAX accept indices 1…PASSN; index 0 is accepted as an alias for the first pass for compatibility with early program versions.Share your programs with Actions → Share source, and reopen saved .txt programs with Actions → Open file….