fn main() {
println("ClosedBit ready")
u256 result = (5 + 7) * 3
save result
}
Authoring Rules
Use `.cbp` source. Library declarations go at the top. Normal line-end semicolons are optional. Keep semicolons when writing multiple statements on one line or inside C-style `for (...)` headers.
Compiler Commands
tools\cbpc.bat compile cba app.cbp app.cba small fps compute graphics threaded max_memory 1024
tools\cbpc.bat compile exe game.cbp game.exe small fps graphics threaded usage_high
tools\cbpc.bat compile dll utility.cbp utility.dll small compute
tools\cbpc.bat compile library CB-Arcade.cbp CB-Arcade.cbl small graphics threaded
tools\cbpc.bat decompile app.cba app.cbpd
tools\cbpc.bat encrypt app.cba app.cbe
tools\cbpc.bat decrypt app.cbe restored.cba key_file app.cbe.key
- `small` compresses the package.
- `fps` targets frame latency and render responsiveness.
- `ai` targets tagged index and generation-heavy workloads.
- `graphics`, `compute`, and `threaded` select runtime services.
- `usage_high` targets higher CPU use. `uncapped` removes runtime resource ceilings but keeps validation and overflow checks.
Programs
library CB-Math
fn main() {
u256 base = 1_000_000
u256 bonus = 250_000
u256 total = base + bonus
println("total calculated")
save total
}
Saving
Use `.cb` when the file is a validated ClosedBit storage container. Use ordinary file helpers only when plain text is the goal.
library CB-Storage
fn main() {
u256 coins = 1_000_000 + 250_000
CB-Storage.write_u256("player.cb", "coins", coins)
u256 loaded = CB-Storage.read_u256_or("player.cb", "coins", zero)
println("save file checked")
save loaded
}
UI And Games
library CB-UI
fn main() {
string html = "<h1>ClosedBit App</h1><button>Start</button>"
ui.html(html)
}
library CB-Render
library CB-Input
fn main() {
init_window(960, 540, "ClosedBit Game")
while window_open() {
handle_events()
clear(0x071018)
draw_text(24, 24, "ClosedBit", 0x64F1AC, 24)
present()
}
}
Libraries
Built-in libraries use `CB-Name`. Compiled user libraries output `.cbl` and can be used by `.cbp` and `.cba` packages.
library CB-Math
fn Arcade.score_bonus(u256 score, u256 multiplier) {
return score * multiplier
}
Account And License
The website creates the account and product license. Desktop Studio stores the returned login cookie with Windows DPAPI and checks license status every 30 days.
POST /api/auth/login
POST /api/auth/register
GET /api/auth/me?product=closedbit-coding
GET /api/license/status?product=closedbit-game
POST /api/license/activate
Products:
closedbit-suite
closedbit-coding
closedbit-game