Delete BazzBasic-AI-guide.txt
Browse files- BazzBasic-AI-guide.txt +0 -642
BazzBasic-AI-guide.txt
DELETED
|
@@ -1,642 +0,0 @@
|
|
| 1 |
-
---
|
| 2 |
-
name: bazzbasic
|
| 3 |
-
description: "BazzBasic BASIC interpreter language reference. Use when writing, debugging, or explaining BazzBasic code (.bas files). Triggers on: BazzBasic syntax, $ and # variable suffixes, SDL2 graphics in BASIC, SCREEN/DRAWSHAPE/LOADIMAGE commands, DEF FN functions, BazzBasic file I/O, sound commands, or any question about BazzBasic features. Always use this skill before writing any BazzBasic code."
|
| 4 |
-
---
|
| 5 |
-
|
| 6 |
-
# BazzBasic Language Reference
|
| 7 |
-
**Version:** 1.3b | **Author:** Kristian Virtanen (EkBass) | **Platform:** Windows x64
|
| 8 |
-
**Homepage:** https://ekbass.github.io/BazzBasic/
|
| 9 |
-
**GitHub:** https://github.com/EkBass/BazzBasic
|
| 10 |
-
**Manual:** https://ekbass.github.io/BazzBasic/manual/#/
|
| 11 |
-
**Examples:** https://github.com/EkBass/BazzBasic/tree/main/Examples
|
| 12 |
-
**Rosetta Code:** https://rosettacode.org/wiki/Category:BazzBasic
|
| 13 |
-
**Rosetta Code solutions:** https://github.com/EkBass/BazzBasic/tree/main/Examples/rosetta-code
|
| 14 |
-
**BazzBasic-AI-Guide:** https://huggingface.co/datasets/EkBass/BazzBasic_AI_Guide
|
| 15 |
-
**BazzBasic Beginner's Guide:** https://github.com/EkBass/BazzBasic-Beginners-Guide/releases
|
| 16 |
-
**Communities:** https://ekbass.github.io/BazzBasic/communities.html
|
| 17 |
-
|
| 18 |
-
---
|
| 19 |
-
|
| 20 |
-
## ⚠️ Critical Rules — Read First
|
| 21 |
-
|
| 22 |
-
| Rule | Detail |
|
| 23 |
-
|------|--------|
|
| 24 |
-
| Variables end with `$` | `name$`, `score$`, `x$` |
|
| 25 |
-
| Constants end with `#` | `MAX#`, `PI#`, `TITLE#` |
|
| 26 |
-
| Arrays declared with `DIM`, end with `$` | `DIM items$` |
|
| 27 |
-
| First use of variable requires `LET` | `LET x$ = 0` — after that `x$ = x$ + 1` |
|
| 28 |
-
| FOR and INPUT auto-declare, no LET needed | `FOR i$ = 1 TO 10` |
|
| 29 |
-
| Functions defined **before** they are called | Put at top or INCLUDE |
|
| 30 |
-
| Function name ends with `$`, called with `FN` | `FN MyFunc$(a$, b$)` |
|
| 31 |
-
| Function return value **must** be used | `PRINT FN f$()` or `LET v$ = FN f$()` |
|
| 32 |
-
| Arrays **cannot** be passed to functions directly | Pass individual elements, or serialize to JSON string — see *Passing Arrays to Functions* section |
|
| 33 |
-
| Case-insensitive | `PRINT`, `print`, `Print` all work |
|
| 34 |
-
| `+` operator does both add and concatenate | `"Hi" + " " + name$` |
|
| 35 |
-
| Division always returns float | `10 / 3` → `3.333...` |
|
| 36 |
-
|
| 37 |
-
---
|
| 38 |
-
|
| 39 |
-
|
| 40 |
-
## ABOUT
|
| 41 |
-
BazzBasic is built around one simple idea: starting programming should feel nice and even fun. Ease of learning, comfort of exploration and small but important moments of success. Just like the classic BASICs of decades past, but with a fresh and modern feel.
|
| 42 |
-
|
| 43 |
-
### What people have built with it
|
| 44 |
-
|
| 45 |
-
BazzBasic is built for beginners, but it isn't a toy. It can carry real 2D games and even 2.5D graphics work.
|
| 46 |
-
|
| 47 |
-
- https://github.com/EkBass/BazzBasic/blob/main/Examples/Voxel_terrain.bas
|
| 48 |
-
A Comanche-style heightmap renderer with procedurally generated terrain. Eight smoothing passes turn random noise into hills, valleys, water, beaches, forests, rock, and snow — each assigned a color by height band.
|
| 49 |
-
- https://github.com/EkBass/BazzBasic/blob/main/Examples/Raycaster_3d_optimized.bas
|
| 50 |
-
A smooth first-person raycaster engine written entirely in BazzBasic. Minimap, depth shading and real-time movement — proves that BazzBasic can handle serious graphics work.
|
| 51 |
-
- https://ek-bass.itch.io/rgb-vision
|
| 52 |
-
A speedrun platformer made for Jam for All BASIC Dialects #7 (itch.io).
|
| 53 |
-
- https://github.com/EkBass/BazzBasic/blob/main/Examples/2D_maze_FOV_demo_console.bas
|
| 54 |
-
2D maze with FOV in your console
|
| 55 |
-
- https://ek-bass.itch.io/eliza-bazzbasic-edition
|
| 56 |
-
A classic DOCTOR script from the 60s which made people honestly believe they are talking to a real human. Grandmother of modern AIs.
|
| 57 |
-
- https://github.com/EkBass/BazzBasic/blob/main/Examples/rosetta-code/BrainFuck.bas
|
| 58 |
-
BrainFuck interpreter. One of the first programs ever done with BazzBasic.
|
| 59 |
-
- https://github.com/EkBass/BazzBasic/blob/main/Examples/Anthropic_Claude_API_call.bas & https://github.com/EkBass/BazzBasic/blob/main/Examples/OpenAI_request.bas
|
| 60 |
-
Anthropic Claude API and OpenAI ChatGPT API available, both with less than 50 lines of code.
|
| 61 |
-
|
| 62 |
-
### STORY
|
| 63 |
-
Although over the years, as my own skills have grown, I have moved on to more versatile and modern languages, BASIC has always been something that has been fun to try out many different things with. Sometimes it's great to just make a simple adventure game again, a lottery machine, a quiz, or even just those balls bouncing on the screen. BazzBasic was created with this in mind. I wanted to create a language that makes it easy for you to give free rein to your curiosity and program something. And when you finish your first little game, you may crave something bigger and better. Maybe one day you will move on to another programming language, but then BazzBasic will have succeeded in doing what it was intended for.
|
| 64 |
-
To arouse your curiosity.
|
| 65 |
-
*EkBass*, author of BazzBasic
|
| 66 |
-
|
| 67 |
-
---
|
| 68 |
-
|
| 69 |
-
## Case sensitivity
|
| 70 |
-
BazzBasic is not case-sensitive except with string contents.
|
| 71 |
-
```basic
|
| 72 |
-
let blaa$ = "Hello"
|
| 73 |
-
PriNT BLAA$ ' output: Hello
|
| 74 |
-
```
|
| 75 |
-
|
| 76 |
-
---
|
| 77 |
-
|
| 78 |
-
## Variables & Constants
|
| 79 |
-
Variables and constants must be declared with LET before they can be used.
|
| 80 |
-
BazzBasic variables are not typed, but work the same way as in JavaScript, for example.
|
| 81 |
-
A variable needs the suffix $ which often is linked as STRING in traditional basic variants.
|
| 82 |
-
```basic
|
| 83 |
-
LET a$ ' Declare without value
|
| 84 |
-
LET b$, c$, d$ ' Multiple declarations without value
|
| 85 |
-
LET e$, f$ = "foo", g$ = 10 ' Multiple declaration, e$ stays empty, f$ and g$ gets values
|
| 86 |
-
|
| 87 |
-
LET name$ = "Alice" ' String variable
|
| 88 |
-
LET score$ = 0 ' Numeric variable
|
| 89 |
-
|
| 90 |
-
LET PI# = 3.14159 ' Constant (immutable)
|
| 91 |
-
LET TITLE# = "My Game" ' String constant
|
| 92 |
-
```
|
| 93 |
-
|
| 94 |
-
**Compound assignment operators** (variables only — **not** allowed with `#` constants):
|
| 95 |
-
|
| 96 |
-
```basic
|
| 97 |
-
x$ += 5 ' add
|
| 98 |
-
x$ -= 3 ' subtract
|
| 99 |
-
x$ *= 2 ' multiply
|
| 100 |
-
x$ /= 4 ' divide
|
| 101 |
-
s$ += " World" ' string concatenation
|
| 102 |
-
```
|
| 103 |
-
|
| 104 |
-
**Scope:** All main-code variables share one scope (even inside IF blocks).
|
| 105 |
-
`DEF FN` functions are fully isolated — only global constants (`#`) accessible inside.
|
| 106 |
-
|
| 107 |
-
**Comparison:** `"123" = 123` is TRUE (cross-type), but keep types consistent for speed.
|
| 108 |
-
|
| 109 |
-
---
|
| 110 |
-
|
| 111 |
-
### Built-in Constants
|
| 112 |
-
- **Boolean:** `TRUE`, `FALSE`
|
| 113 |
-
- **Math:** `PI#`, `HPI#` (π/2 = 90°), `QPI#` (π/4 = 45°), `TAU#` (2π = 360°), `EULER#` (e) — `#` suffix required
|
| 114 |
-
- **System:** `PRG_ROOT#` (program base directory path)
|
| 115 |
-
- **Keyboard:** `KEY_ESC#`, `KEY_ENTER#`, `KEY_SPACE#`, `KEY_UP#`, `KEY_DOWN#`, `KEY_LEFT#`, `KEY_RIGHT#`, `KEY_F1#`…`KEY_F12#`, `KEY_A#`…`KEY_Z#`, `KEY_0#`…`KEY_9#`, `KEY_LSHIFT#`, `KEY_LCTRL#`, etc.
|
| 116 |
-
|
| 117 |
-
---
|
| 118 |
-
|
| 119 |
-
## Arrays
|
| 120 |
-
BazzBasic arrays are fully dynamic and support numeric, string, or mixed indexing.
|
| 121 |
-
|
| 122 |
-
```basic
|
| 123 |
-
DIM scores$ ' Declare (required before use)
|
| 124 |
-
DIM a$, b$, c$ ' Multiple
|
| 125 |
-
scores$(0) = 95 ' Numeric index (0-based)
|
| 126 |
-
scores$("name") = "Alice" ' String key (associative)
|
| 127 |
-
matrix$(0, 1) = "A2" ' Multi-dimensional
|
| 128 |
-
|
| 129 |
-
DIM sounds$
|
| 130 |
-
sounds$("guns", "shotgun_shoot") = "shoot_shotgun.wav"
|
| 131 |
-
sounds$("guns", "shotgun_reload") = "reload_shotgun.wav"
|
| 132 |
-
sounds$("guns", "ak47_shoot") = "shoot_ak47.wav"
|
| 133 |
-
sounds$("guns", "ak47_reload") = "reload_ak47.wav"
|
| 134 |
-
sounds$("food", "ham_eat") = "eat_ham.wav"
|
| 135 |
-
```
|
| 136 |
-
|
| 137 |
-
| Function/Command | Description |
|
| 138 |
-
|-----------------|-------------|
|
| 139 |
-
| `LEN(arr$())` | Total element count (note empty parens) |
|
| 140 |
-
| `ROWCOUNT(arr$())` | Count of first-dimension rows — use this for FOR loops over multi-dim arrays |
|
| 141 |
-
| `HASKEY(arr$(key))` | 1 if exists, 0 if not |
|
| 142 |
-
| `DELKEY arr$(key)` | Remove one element |
|
| 143 |
-
| `DELARRAY arr$` | Remove entire array (can re-DIM after) |
|
| 144 |
-
| `JOIN dest$, src1$, src2$` | Merge two arrays; `src2$` keys overwrite `src1$`. Use empty `src1$` as `COPYARRAY`. |
|
| 145 |
-
|
| 146 |
-
**Always check with `HASKEY` before reading uninitialized elements.**
|
| 147 |
-
|
| 148 |
-
---
|
| 149 |
-
|
| 150 |
-
## Control Flow
|
| 151 |
-
|
| 152 |
-
```basic
|
| 153 |
-
' Block IF
|
| 154 |
-
IF score$ >= 90 THEN
|
| 155 |
-
PRINT "A"
|
| 156 |
-
ELSEIF score$ >= 80 THEN
|
| 157 |
-
PRINT "B"
|
| 158 |
-
ELSE
|
| 159 |
-
PRINT "F"
|
| 160 |
-
END IF ' ENDIF also works
|
| 161 |
-
|
| 162 |
-
' One-line IF (GOTO/GOSUB only)
|
| 163 |
-
IF lives$ = 0 THEN GOTO [game_over]
|
| 164 |
-
IF key$ = KEY_ESC# THEN GOTO [menu] ELSE GOTO [play]
|
| 165 |
-
|
| 166 |
-
' FOR (auto-declares variable)
|
| 167 |
-
FOR i$ = 1 TO 10 STEP 2 : PRINT i$ : NEXT
|
| 168 |
-
FOR i$ = 10 TO 1 STEP -1 : PRINT i$ : NEXT
|
| 169 |
-
|
| 170 |
-
' WHILE
|
| 171 |
-
WHILE x$ < 100 : x$ = x$ * 2 : WEND
|
| 172 |
-
|
| 173 |
-
' Labels, GOTO, GOSUB
|
| 174 |
-
[start]
|
| 175 |
-
GOSUB [sub:init]
|
| 176 |
-
GOTO [main]
|
| 177 |
-
|
| 178 |
-
[sub:init]
|
| 179 |
-
LET x$ = 0
|
| 180 |
-
RETURN
|
| 181 |
-
|
| 182 |
-
' Dynamic jump (variable must contain "[label]" with brackets)
|
| 183 |
-
LET target$ = "[menu]"
|
| 184 |
-
GOTO target$
|
| 185 |
-
|
| 186 |
-
' Other
|
| 187 |
-
SLEEP 2000 ' Pause ms
|
| 188 |
-
END ' Terminate program
|
| 189 |
-
```
|
| 190 |
-
|
| 191 |
-
---
|
| 192 |
-
|
| 193 |
-
## I/O
|
| 194 |
-
|
| 195 |
-
| Command | Description |
|
| 196 |
-
|---------|-------------|
|
| 197 |
-
| `PRINT expr; expr` | `;` = no space, `,` = tab |
|
| 198 |
-
| `PRINT "text";` | Trailing `;` suppresses newline |
|
| 199 |
-
| `INPUT "prompt", var$` | Splits on whitespace/comma |
|
| 200 |
-
| `INPUT "prompt", a$, b$` | Multiple values |
|
| 201 |
-
| `LINE INPUT "prompt", var$` | Read entire line with spaces |
|
| 202 |
-
| `CLS` | Clear screen |
|
| 203 |
-
| `LOCATE row, col` | Move cursor (1-based) |
|
| 204 |
-
| `CURPOS("row")` / `CURPOS("col")` | Read cursor row or col (1-based, matches LOCATE) |
|
| 205 |
-
| `CURPOS()` | Read cursor as `"row,col"` string |
|
| 206 |
-
| `COLOR fg, bg` | Text colors (0–15 palette) |
|
| 207 |
-
| `SHELL("cmd")` | Run shell command, returns output |
|
| 208 |
-
| `SHELL("cmd", ms)` | With timeout in ms (default 5000) |
|
| 209 |
-
|
| 210 |
-
**Escape sequences in strings:** `\"` `\n` `\t` `\\`
|
| 211 |
-
|
| 212 |
-
### Keyboard Input
|
| 213 |
-
| Function | Returns | Notes |
|
| 214 |
-
|----------|---------|-------|
|
| 215 |
-
| `INKEY` | Key value or 0 | Non-blocking |
|
| 216 |
-
| `KEYDOWN(key#)` | TRUE/FALSE | Held-key detection; **graphics mode only** |
|
| 217 |
-
| `WAITKEY(key#, ...)` | Key value | Blocks until key pressed; `WAITKEY()` = any key |
|
| 218 |
-
|
| 219 |
-
### Mouse (graphics mode only)
|
| 220 |
-
`MOUSEX`, `MOUSEY` — cursor position
|
| 221 |
-
`MOUSELEFT` - `MOUSERIGHT`, `MOUSEMIDDLE` — 1 if pressed, 0 otherwise
|
| 222 |
-
`MOUSEHIDE` — hide the mouse cursor (graphics screen only)
|
| 223 |
-
`MOUSESHOW` — restore the mouse cursor (graphics screen only)
|
| 224 |
-
|
| 225 |
-
### Console Read
|
| 226 |
-
`GETCONSOLE(row, col, type)` — type: 0=char (ASCII), 1=fg color, 2=bg color
|
| 227 |
-
|
| 228 |
-
---
|
| 229 |
-
|
| 230 |
-
## User-Defined Functions
|
| 231 |
-
|
| 232 |
-
```basic
|
| 233 |
-
' Define BEFORE calling. Name must end with $.
|
| 234 |
-
DEF FN Clamp$(val$, lo$, hi$)
|
| 235 |
-
IF val$ < lo$ THEN RETURN lo$
|
| 236 |
-
IF val$ > hi$ THEN RETURN hi$
|
| 237 |
-
RETURN val$
|
| 238 |
-
END DEF
|
| 239 |
-
|
| 240 |
-
PRINT FN Clamp$(5, 1, 10) ' ✓ OK — return value used
|
| 241 |
-
LET v$ = FN Clamp$(15, 0, 10) ' ✓ OK
|
| 242 |
-
FN Clamp$(5, 1, 10) ' ✗ ERROR — return value unused
|
| 243 |
-
```
|
| 244 |
-
|
| 245 |
-
- Isolated scope: no access to global variables, only global constants (`#`)
|
| 246 |
-
- Parameters passed **by value**
|
| 247 |
-
- Labels inside functions are local — GOTO/GOSUB cannot jump outside
|
| 248 |
-
- Supports recursion
|
| 249 |
-
- Arrays as parameters not allowed. Use ASJSON to make array as JSON-string to pass it.
|
| 250 |
-
- Use `INCLUDE` to load functions from separate files if many
|
| 251 |
-
|
| 252 |
-
---
|
| 253 |
-
|
| 254 |
-
## String Functions
|
| 255 |
-
|
| 256 |
-
| Function | Description |
|
| 257 |
-
|----------|-------------|
|
| 258 |
-
| `ASC(s$)` | ASCII code of first char |
|
| 259 |
-
| `CHR(n)` | Character from ASCII code |
|
| 260 |
-
| `INSTR(s$, search$)` | Position (1-based), 0=not found; case-sensitive by default |
|
| 261 |
-
| `INSTR(s$, search$, mode)` | mode: 0=case-insensitive, 1=case-sensitive |
|
| 262 |
-
| `INSTR(start, s$, search$)` | Search from position (case-sensitive) |
|
| 263 |
-
| `INVERT(s$)` | Reverse string |
|
| 264 |
-
| `LCASE(s$)` / `UCASE(s$)` | Lower / upper case |
|
| 265 |
-
| `LEFT(s$, n)` / `RIGHT(s$, n)` | First/last n chars |
|
| 266 |
-
| `LEN(s$)` | String length |
|
| 267 |
-
| `LTRIM(s$)` / `RTRIM(s$)` / `TRIM(s$)` | Strip whitespace |
|
| 268 |
-
| `MID(s$, start)` | Substring from start (1-based) |
|
| 269 |
-
| `MID(s$, start, len)` | Substring with length |
|
| 270 |
-
| `REPEAT(s$, n)` | Repeat string n times |
|
| 271 |
-
| `REPLACE(s$, a$, b$)` | Replace a$ with b$ in s$ |
|
| 272 |
-
| `SPLIT(arr$, s$, sep$)` | Split into array, returns count |
|
| 273 |
-
| `SRAND(n)` | Random alphanumeric string of length n |
|
| 274 |
-
| `STR(n)` | Number to string |
|
| 275 |
-
| `VAL(s$)` | String to number |
|
| 276 |
-
| `SHA256(s$)` | SHA256 hash (64-char hex) |
|
| 277 |
-
| `BASE64ENCODE(s$)` / `BASE64DECODE(s$)` | Base64 encode/decode |
|
| 278 |
-
|
| 279 |
-
---
|
| 280 |
-
|
| 281 |
-
## Math Functions
|
| 282 |
-
|
| 283 |
-
| Function | Description |
|
| 284 |
-
|----------|-------------|
|
| 285 |
-
| `ABS(n)` | Absolute value |
|
| 286 |
-
| `ATAN(n)` | Arc tangent |
|
| 287 |
-
| `ATAN2(n, n2)` | Returns the angle, in radians, between the positive x-axis and a vector to the point with the given (x, y) coordinates in the Cartesian plane |
|
| 288 |
-
| `BETWEEN(n, min, max)` | TRUE if min ≤ n ≤ max |
|
| 289 |
-
| 'INBETWEEN(n, min, max)' |TRUE if min < n < max (strictly between, not equal) |
|
| 290 |
-
| `CEIL(n)` / `FLOOR(n)` | Round up / down |
|
| 291 |
-
| `CINT(n)` | Round to nearest integer |
|
| 292 |
-
| `CLAMP(n, min, max)` | Constrain n to [min, max] |
|
| 293 |
-
| `COS(n)` / `SIN(n)` / `TAN(n)` | Trig (radians) |
|
| 294 |
-
| `DEG(rad)` / `RAD(deg)` | Radians ↔ degrees |
|
| 295 |
-
| `DISTANCE(x1,y1, x2,y2)` | 2D Euclidean distance |
|
| 296 |
-
| `DISTANCE(x1,y1,z1, x2,y2,z2)` | 3D Euclidean distance |
|
| 297 |
-
| `EXP(n)` | e^n |
|
| 298 |
-
| `INT(n)` | Truncate toward zero |
|
| 299 |
-
| `LERP(start, end, t)` | Linear interpolation (t: 0.0–1.0) |
|
| 300 |
-
| `LOG(n)` | Natural logarithm |
|
| 301 |
-
| `MAX(a, b)` / `MIN(a, b)` | Larger / smaller of two |
|
| 302 |
-
| `MOD(a, b)` | Remainder |
|
| 303 |
-
| `POW(base, exp)` | Power |
|
| 304 |
-
| `RND(n)` | Random integer 0 to n-1 if n > 0 |
|
| 305 |
-
| `RND(0)` | Float between 0.0 and 1.0 (IE: 0.5841907423666761) |
|
| 306 |
-
| `ROUND(n)` | Standard rounding |
|
| 307 |
-
| `SGN(n)` | Sign: -1, 0, or 1 |
|
| 308 |
-
| `SQR(n)` | Square root |
|
| 309 |
-
|
| 310 |
-
**Math constants:** `PI#`, `HPI#` (PI/2), `QPI#` (PI/4), `TAU#` (PI*2), `EULER#`
|
| 311 |
-
|
| 312 |
-
---
|
| 313 |
-
|
| 314 |
-
## Graphics
|
| 315 |
-
|
| 316 |
-
```basic
|
| 317 |
-
SCREEN 12 ' 640×480 VGA
|
| 318 |
-
SCREEN 0, 800, 600 ' Custom size
|
| 319 |
-
SCREEN 0, 1024, 768, "My Game" ' Custom size + title
|
| 320 |
-
FULLSCREEN TRUE ' Borderless fullscreen (graphics only)
|
| 321 |
-
FULLSCREEN FALSE ' Windowed
|
| 322 |
-
```
|
| 323 |
-
|
| 324 |
-
| Mode | Resolution |
|
| 325 |
-
|------|-----------|
|
| 326 |
-
| 1 | 320×200 |
|
| 327 |
-
| 2 | 640×350 |
|
| 328 |
-
| 7 | 320×200 |
|
| 329 |
-
| 9 | 640×350 |
|
| 330 |
-
| 12 | 640×480 ← recommended |
|
| 331 |
-
| 13 | 320×200 |
|
| 332 |
-
|
| 333 |
-
### Drawing Primitives
|
| 334 |
-
```basic
|
| 335 |
-
PSET (x, y), color ' Pixel
|
| 336 |
-
LINE (x1,y1)-(x2,y2), color ' Line
|
| 337 |
-
LINE (x1,y1)-(x2,y2), color, B ' Box outline
|
| 338 |
-
LINE (x1,y1)-(x2,y2), color, BF ' Box filled (FAST — use instead of CLS)
|
| 339 |
-
CIRCLE (cx,cy), radius, color ' Circle outline
|
| 340 |
-
CIRCLE (cx,cy), radius, color, 1 ' Circle filled
|
| 341 |
-
PAINT (x, y), fillColor, borderColor ' Flood fill
|
| 342 |
-
LET c$ = POINT(x, y) ' Read pixel color
|
| 343 |
-
LET col$ = RGB(r, g, b) ' Create color (0–255 each)
|
| 344 |
-
```
|
| 345 |
-
|
| 346 |
-
**Color palette (COLOR command, 0–15):** 0=Black, 1=Blue, 2=Green, 3=Cyan, 4=Red, 5=Magenta, 6=Brown, 7=Lt Gray, 8=Dk Gray, 9=Lt Blue, 10=Lt Green, 11=Lt Cyan, 12=Lt Red, 13=Lt Magenta, 14=Yellow, 15=White
|
| 347 |
-
|
| 348 |
-
### Screen Control
|
| 349 |
-
```basic
|
| 350 |
-
SCREENLOCK ON ' Buffer drawing (start frame)
|
| 351 |
-
SCREENLOCK OFF ' Present buffer (end frame)
|
| 352 |
-
VSYNC(TRUE) ' Enable VSync (default, ~60 FPS)
|
| 353 |
-
VSYNC(FALSE) ' Disable VSync (benchmarking)
|
| 354 |
-
CLS ' Clear screen
|
| 355 |
-
' Use CLS only with console, in graphics screen its slow
|
| 356 |
-
' With graphics screen, prefer LINE BF
|
| 357 |
-
```
|
| 358 |
-
|
| 359 |
-
### Shapes & Images
|
| 360 |
-
```basic
|
| 361 |
-
' Create shape
|
| 362 |
-
' LOADSHAPE and LOADIMAGE return a stable integer handle — never reassigned.
|
| 363 |
-
' SDL2 owns the resource; your code only ever holds this one reference. Use constants.
|
| 364 |
-
LET RECT# = LOADSHAPE("RECTANGLE", w, h, color) ' or "CIRCLE", "TRIANGLE"
|
| 365 |
-
LET IMG_PLAYER# = LOADIMAGE("player.png") ' PNG (alpha) or BMP
|
| 366 |
-
LET IMG_REMOTE# = LOADIMAGE("https://example.com/a.png") ' Download + load
|
| 367 |
-
|
| 368 |
-
' Sprite sheet — sprites indexed 1-based
|
| 369 |
-
DIM sprites$
|
| 370 |
-
LOADSHEET sprites$, 128, 128, "sheet.png" ' tileW, tileH, file
|
| 371 |
-
MOVESHAPE sprites$(1), x, y ' sprites$(1) = first sprite
|
| 372 |
-
|
| 373 |
-
' Transform
|
| 374 |
-
MOVESHAPE RECT#, x, y ' Position by center point
|
| 375 |
-
ROTATESHAPE RECT#, angle ' Degrees (absolute)
|
| 376 |
-
SCALESHAPE RECT#, scale ' 1.0 = original size
|
| 377 |
-
DRAWSHAPE RECT# ' Render to buffer
|
| 378 |
-
SHOWSHAPE RECT# / HIDESHAPE RECT# ' Toggle visibility
|
| 379 |
-
REMOVESHAPE RECT# ' Free memory (always clean up)
|
| 380 |
-
```
|
| 381 |
-
|
| 382 |
-
|
| 383 |
-
---
|
| 384 |
-
|
| 385 |
-
### Text Rendering (SDL2_ttf.dll required)
|
| 386 |
-
#### DRAWSTRING & LOADFONT
|
| 387 |
-
|
| 388 |
-
|
| 389 |
-
```basic
|
| 390 |
-
' Default font (Arial)
|
| 391 |
-
DRAWSTRING "Hello!", 100, 200, RGB(255, 255, 255)
|
| 392 |
-
|
| 393 |
-
' Load alternative font — becomes the new default
|
| 394 |
-
LOADFONT "comic.ttf", 24
|
| 395 |
-
DRAWSTRING "Hello!", 100, 200, RGB(255, 255, 255)
|
| 396 |
-
|
| 397 |
-
' Reset to Arial
|
| 398 |
-
LOADFONT
|
| 399 |
-
```
|
| 400 |
-
|
| 401 |
-
`DRAWSTRING x, y` positions the top-left of the text. Requires `SDL2_ttf.dll` in the same directory as the interpreter. Prefer this over PRINT, which makes graphic screen easily blinking.
|
| 402 |
-
|
| 403 |
-
---
|
| 404 |
-
|
| 405 |
-
## Sound
|
| 406 |
-
|
| 407 |
-
```basic
|
| 408 |
-
' LOADSOUND returns a stable integer handle — SDL2 manages the resource.
|
| 409 |
-
' The handle never changes; store it in a constant to protect it from accidental reassignment.
|
| 410 |
-
LET SND_JUMP# = LOADSOUND("jump.wav") ' Load (WAV recommended)
|
| 411 |
-
SOUNDONCE(SND_JUMP#) ' Play once, non-blocking
|
| 412 |
-
SOUNDONCEWAIT(SND_JUMP#) ' Play once, wait for finish
|
| 413 |
-
SOUNDREPEAT(SND_JUMP#) ' Loop continuously
|
| 414 |
-
SOUNDSTOP(SND_JUMP#) ' Stop specific sound
|
| 415 |
-
SOUNDSTOPALL ' Stop all sounds
|
| 416 |
-
```
|
| 417 |
-
|
| 418 |
-
Load all sounds at startup. Call `SOUNDSTOPALL` before `END`.
|
| 419 |
-
|
| 420 |
-
---
|
| 421 |
-
|
| 422 |
-
## File I/O
|
| 423 |
-
|
| 424 |
-
```basic
|
| 425 |
-
LET data$ = FileRead("file.txt") ' Read as string
|
| 426 |
-
DIM cfg$ : LET cfg$ = FileRead("settings.txt") ' Read as key=value array
|
| 427 |
-
FILEWRITE "save.txt", data$ ' Create/overwrite
|
| 428 |
-
FILEAPPEND "log.txt", entry$ ' Append
|
| 429 |
-
LET ok$ = FILEEXISTS("file.txt") ' 1=exists, 0=not
|
| 430 |
-
FILEDELETE "temp.dat" ' Delete file
|
| 431 |
-
```
|
| 432 |
-
|
| 433 |
-
**key=value parsing:** When `FileRead` assigns to a `DIM`'d array, lines `key=value` become `arr$("key")`. Lines starting with `#` are comments. Perfect for `.env` files.
|
| 434 |
-
|
| 435 |
-
```basic
|
| 436 |
-
DIM env$
|
| 437 |
-
LET env$ = FileRead(".env")
|
| 438 |
-
LET API_KEY# = env$("OPENAI_API_KEY")
|
| 439 |
-
```
|
| 440 |
-
|
| 441 |
-
**Paths:** Use `/` or `\\` — never single `\` (it's an escape char). Relative paths are from `PRG_ROOT#`.
|
| 442 |
-
**FileWrite with array** saves in key=value format (round-trips with FileRead).
|
| 443 |
-
|
| 444 |
-
---
|
| 445 |
-
|
| 446 |
-
## Network
|
| 447 |
-
|
| 448 |
-
```basic
|
| 449 |
-
LET res$ = HTTPGET("https://api.example.com/data")
|
| 450 |
-
LET res$ = HTTPPOST("https://api.example.com/submit", "{""key"":""val""}")
|
| 451 |
-
|
| 452 |
-
' With headers (optional last parameter)
|
| 453 |
-
DIM headers$
|
| 454 |
-
headers$("Authorization") = "Bearer mytoken"
|
| 455 |
-
headers$("Content-Type") = "application/json"
|
| 456 |
-
LET res$ = HTTPGET("https://api.example.com/data", headers$)
|
| 457 |
-
LET res$ = HTTPPOST("https://api.example.com/data", body$, headers$)
|
| 458 |
-
```
|
| 459 |
-
|
| 460 |
-
---
|
| 461 |
-
|
| 462 |
-
## Arrays & JSON
|
| 463 |
-
|
| 464 |
-
Nested JSON maps to comma-separated keys: `data$("player,name")`, `data$("skills,0")`
|
| 465 |
-
|
| 466 |
-
```basic
|
| 467 |
-
' Array → JSON string
|
| 468 |
-
LET json$ = ASJSON(arr$)
|
| 469 |
-
|
| 470 |
-
' JSON string → array (returns element count)
|
| 471 |
-
DIM data$
|
| 472 |
-
LET count$ = ASARRAY(data$, json$)
|
| 473 |
-
|
| 474 |
-
' Load/save JSON files
|
| 475 |
-
LOADJSON arr$, "file.json"
|
| 476 |
-
SAVEJSON arr$, "file.json"
|
| 477 |
-
```
|
| 478 |
-
|
| 479 |
-
---
|
| 480 |
-
|
| 481 |
-
## Fast Trigonometry
|
| 482 |
-
|
| 483 |
-
~20× faster than `SIN(RAD(x))`, 1-degree precision. Uses ~5.6 KB memory.
|
| 484 |
-
|
| 485 |
-
```basic
|
| 486 |
-
FastTrig(TRUE) ' Enable lookup tables (must call first)
|
| 487 |
-
LET x$ = FastCos(45) ' Degrees, auto-normalized 0–359
|
| 488 |
-
LET y$ = FastSin(90)
|
| 489 |
-
LET r$ = FastRad(180) ' Deg→rad (no FastTrig needed)
|
| 490 |
-
FastTrig(FALSE) ' Free memory
|
| 491 |
-
```
|
| 492 |
-
|
| 493 |
-
Use for raycasting, sprite rotation, particle systems, any high-freq trig.
|
| 494 |
-
|
| 495 |
-
---
|
| 496 |
-
|
| 497 |
-
## Command-Line Arguments
|
| 498 |
-
|
| 499 |
-
```basic
|
| 500 |
-
' bazzbasic.exe myprog.bas arg1 arg2
|
| 501 |
-
PRINT ARGCOUNT ' number of args (2 in this example)
|
| 502 |
-
PRINT ARGS(0) ' first arg → "arg1"
|
| 503 |
-
PRINT ARGS(1) ' second arg → "arg2"
|
| 504 |
-
```
|
| 505 |
-
|
| 506 |
-
`ARGCOUNT` and `ARGS(n)` are 0-based; ARGS does not include the interpreter or script name.
|
| 507 |
-
|
| 508 |
-
---
|
| 509 |
-
|
| 510 |
-
## Libraries & INCLUDE
|
| 511 |
-
|
| 512 |
-
```basic
|
| 513 |
-
INCLUDE "helpers.bas" ' Insert source at this point
|
| 514 |
-
INCLUDE "MathLib.bb" ' Load compiled library
|
| 515 |
-
|
| 516 |
-
' Compile library (functions only — no loose code)
|
| 517 |
-
' bazzbasic.exe -lib MathLib.bas → MathLib.bb
|
| 518 |
-
' Function names auto-prefixed: MATHLIB_functionname$
|
| 519 |
-
PRINT FN MATHLIB_add$(5, 3)
|
| 520 |
-
```
|
| 521 |
-
|
| 522 |
-
Library functions can read main-program constants (`#`). `.bb` files are version-locked.
|
| 523 |
-
|
| 524 |
-
---
|
| 525 |
-
|
| 526 |
-
## Passing Arrays to Functions
|
| 527 |
-
|
| 528 |
-
Arrays cannot be passed directly to `DEF FN` functions, but a clean workaround exists using JSON serialization. Convert the array to a JSON string with `ASJSON`, pass the string as a parameter, then deserialize inside the function with `ASARRAY`. This is the accepted pattern in BazzBasic v1.2+.
|
| 529 |
-
|
| 530 |
-
```basic
|
| 531 |
-
DEF FN ProcessPlayer$(data$)
|
| 532 |
-
DIM arr$
|
| 533 |
-
LET count$ = ASARRAY(arr$, data$)
|
| 534 |
-
RETURN arr$("name") + " score:" + arr$("score")
|
| 535 |
-
END DEF
|
| 536 |
-
|
| 537 |
-
[inits]
|
| 538 |
-
DIM player$
|
| 539 |
-
player$("name") = "Alice"
|
| 540 |
-
player$("score") = 9999
|
| 541 |
-
player$("address,city") = "New York"
|
| 542 |
-
|
| 543 |
-
[main]
|
| 544 |
-
LET json$ = ASJSON(player$)
|
| 545 |
-
PRINT FN ProcessPlayer$(json$)
|
| 546 |
-
END
|
| 547 |
-
```
|
| 548 |
-
|
| 549 |
-
**Notes:**
|
| 550 |
-
- The function receives a full independent copy — changes inside do not affect the original array
|
| 551 |
-
- Nested keys work normally: `arr$("address,city")` etc.
|
| 552 |
-
- Overhead is similar to copying an array manually; acceptable for most use cases
|
| 553 |
-
|
| 554 |
-
---
|
| 555 |
-
|
| 556 |
-
## Program Structure
|
| 557 |
-
|
| 558 |
-
```basic
|
| 559 |
-
' ---- 1. FUNCTIONS (or INCLUDE "functions.bas/bb") ----
|
| 560 |
-
DEF FN Clamp$(v$, lo$, hi$)
|
| 561 |
-
IF v$ < lo$ THEN RETURN lo$
|
| 562 |
-
IF v$ > hi$ THEN RETURN hi$
|
| 563 |
-
RETURN v$
|
| 564 |
-
END DEF
|
| 565 |
-
|
| 566 |
-
' ---- 2. INIT (declare ALL constants & variables here, not inside loops) ----
|
| 567 |
-
' Performance: variables declared outside loops avoid repeated existence checks.
|
| 568 |
-
[inits]
|
| 569 |
-
LET SCREEN_W# = 640
|
| 570 |
-
LET SCREEN_H# = 480
|
| 571 |
-
LET MAX_SPEED# = 5
|
| 572 |
-
|
| 573 |
-
SCREEN 0, SCREEN_W#, SCREEN_H#, "My Game"
|
| 574 |
-
|
| 575 |
-
LET x$ = 320
|
| 576 |
-
LET y$ = 240
|
| 577 |
-
LET running$ = TRUE
|
| 578 |
-
|
| 579 |
-
' ---- 3. MAIN LOOP ----
|
| 580 |
-
[main]
|
| 581 |
-
WHILE running$
|
| 582 |
-
IF INKEY = KEY_ESC# THEN running$ = FALSE
|
| 583 |
-
GOSUB [sub:update]
|
| 584 |
-
GOSUB [sub:draw]
|
| 585 |
-
SLEEP 16
|
| 586 |
-
WEND
|
| 587 |
-
SOUNDSTOPALL
|
| 588 |
-
END ' place at the end of main program so BazzBasic wont fall to subs in runtime
|
| 589 |
-
|
| 590 |
-
' ---- 4. SUBROUTINES (or INCLUDE "subs.bas") ----
|
| 591 |
-
[sub:update]
|
| 592 |
-
IF KEYDOWN(KEY_LEFT#) THEN x$ = x$ - MAX_SPEED#
|
| 593 |
-
IF KEYDOWN(KEY_RIGHT#) THEN x$ = x$ + MAX_SPEED#
|
| 594 |
-
RETURN
|
| 595 |
-
|
| 596 |
-
[sub:draw]
|
| 597 |
-
SCREENLOCK ON
|
| 598 |
-
LINE (0,0)-(SCREEN_W#, SCREEN_H#), 0, BF
|
| 599 |
-
CIRCLE (x$, y$), 10, RGB(0, 255, 0), 1
|
| 600 |
-
SCREENLOCK OFF
|
| 601 |
-
RETURN
|
| 602 |
-
```
|
| 603 |
-
|
| 604 |
-
**Key conventions:**
|
| 605 |
-
- Variables: `camelCase$` | Constants: `UPPER_SNAKE_CASE#` | Functions: `PascalCase$`
|
| 606 |
-
- Labels: `[gameLoop]` for jump targets, `[sub:name]` for subroutines
|
| 607 |
-
- Image/sound/shape IDs are stable integer handles — **always** store as constants: `LET MY_IMG# = LOADIMAGE("x.png")` — never use `$` variables for these
|
| 608 |
-
- Group many IDs → use arrays: `DIM sprites$` / `sprites$("player") = LOADIMAGE(...)` — but prefer named constants when count is small
|
| 609 |
-
|
| 610 |
-
---
|
| 611 |
-
|
| 612 |
-
## Performance Tips
|
| 613 |
-
|
| 614 |
-
- `LINE (0,0)-(W,H), 0, BF` to clear — much faster than `CLS`
|
| 615 |
-
- Always wrap draw code in `SCREENLOCK ON` / `SCREENLOCK OFF`
|
| 616 |
-
- Store `RGB()` results in constants/variables — don't call RGB in hot loops
|
| 617 |
-
- Declare all variables in `[inits]`, not inside loops or subroutines
|
| 618 |
-
- Use `FastTrig` for any loop calling trig hundreds of times per frame
|
| 619 |
-
- `SLEEP 16` in game loop → ~60 FPS
|
| 620 |
-
|
| 621 |
-
---
|
| 622 |
-
|
| 623 |
-
## IDE Features (v1.3)
|
| 624 |
-
|
| 625 |
-
### New File Template
|
| 626 |
-
When the IDE opens with no file (or a new file), this template is auto-inserted:
|
| 627 |
-
```basic
|
| 628 |
-
' BazzBasic version {ver_num}
|
| 629 |
-
' https://ekbass.github.io/BazzBasic/
|
| 630 |
-
```
|
| 631 |
-
|
| 632 |
-
### Beginner's Guide
|
| 633 |
-
- **IDE:** Menu → **Help** → **Beginner's Guide** — opens `https://github.com/EkBass/BazzBasic-Beginners-Guide/releases` in default browser
|
| 634 |
-
- **CLI:** `bazzbasic.exe -guide` or `bazzbasic.exe -help` — prints URL to terminal
|
| 635 |
-
|
| 636 |
-
### Check for Updates
|
| 637 |
-
- **IDE:** Menu → **Help** → **Check for updated...** — IDE reports if a newer version is available
|
| 638 |
-
- **CLI:** `bazzbasic.exe -checkupdate`
|
| 639 |
-
|
| 640 |
-
### Compile via IDE
|
| 641 |
-
- **Menu → Run → Compile as Exe** — compiles open file to standalone `.exe` (auto-saves first)
|
| 642 |
-
- **Menu → Run → Compile as Library (.bb)** — compiles open file as reusable `.bb` library (auto-saves first)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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