GyanBit
LOADING MANUAL...

How to use GyanBit

A complete guide to coding, testing, and flashing your games.

HOW IT ALL WORKS

graph TD A[Open Studio IDE] -->|Write Code| B(JavaScript using bit.* API) B --> C{Test Game} C -->|Click RUN| D[OLED Simulator in Browser] D -->|Find a Bug?| B C -->|Game is Perfect!| E(Connect hardware via USB) E --> F[Click FLASH] F -->|Auto-translates to MicroPython| G[Game runs on real Controller!] G --> H((PLAY!))

GAME ENGINE LAYERS

graph TD L4["Layer 4: bit.* API
Student-facing game engine interface"] L3["Layer 3: Lightweight JS Interpreter
Optimized for 264KB RAM, stripped-down runtime"] L2["Layer 2: PIO Assembly Driver
RP2040 Programmable I/O, independent display refresh"] L1["Layer 1: C-based Hardware Abstraction
Chip-level I2C OLED, PWM audio, GPIO buttons"] L4 --> L3 L3 --> L2 L2 --> L1

It has four layers working together:

The first layer is a C-based hardware abstraction layer that handles everything at the chip level — initializing the OLED display over I2C, driving audio through PWM, and reading button states from GPIO pins.

Above that is a PIO assembly driver that uses the RP2040's Programmable I/O state machines to handle display refresh independently, so the game logic never gets blocked waiting for the screen to update.

The third layer is a lightweight JavaScript interpreter optimized specifically for 264KB of RAM. A standard JS engine is too heavy for this hardware, so our runtime strips everything down to only what the game loop needs — no unnecessary overhead, boots in under 2 seconds, runs at a stable 30fps.

And the top layer is the bit.* API — our student-facing game engine interface. Eleven drawing commands, button input handlers, square wave audio, and a 30fps game loop. That is what students write their games against.

So in short, the GyanBit Runtime is a purpose-built, four-layer game engine — hardware driver at the bottom, PIO display system above that, JS interpreter in the middle, and a clean game API on top. Every layer was designed around this specific hardware to get maximum performance at minimum cost.

Make Your First 2D Game with GyanBit

Get started making your very first game with the GyanBit game engine, using JavaScript! GyanBit is a great tool for both beginners and advanced programmers, and if you make a game, you can play it on your own DIY handheld console! Follow this four-part series in order, and you'll get to make your very own puzzle game.

Part 1

Getting familiar with the GyanBit Engine + Make your first puzzle!

Part 2

Maze Game (Part 1/3): Characters, Enemies and Maps.

Part 3

Maze Game (Part 2/3): Adding Gameplay Mechanics

Part 4

Maze Game (Part 3/3): Polish & Flash to Hardware

BASIC TUTORIAL: DRAWING A BOX

GyanBit games run inside a loop. The screen is 128 pixels wide and 64 pixels tall. The top-left corner is X: 0, Y: 0.

my_first_game.js
// 1. Tell GyanBit to loop this code 30 times a second
bit.loop(() => {
  // 2. Clear the screen every frame so it doesn't smear
  bit.clear();

  // 3. Draw a filled box at X=60, Y=30, Width=8, Height=8
  bit.fill(60, 30, 8, 8);

  // 4. Draw some text at the top left
  bit.text(2, 2, "HELLO WORLD!");
});

BASIC TUTORIAL: MOVING THE BOX

Let's use the D-Pad buttons (UP, DOWN, LEFT, RIGHT) to move our box!

moving_box.js
// Create variables outside the loop to remember the position
let playerX = 60;
let playerY = 30;

bit.loop(() => {
  bit.clear();

  // Check if a button is currently pressed down
  if (bit.isHeld('right')) { playerX += 2; }
  if (bit.isHeld('left'))  { playerX -= 2; }
  if (bit.isHeld('up'))    { playerY -= 2; }
  if (bit.isHeld('down'))  { playerY += 2; }

  // Draw the player using the updated coordinates
  bit.fill(playerX, playerY, 8, 8);
});

Meet BYTE Bot 🤖

Your AI coding buddy that lives on every page! Click the 🤖 button in the bottom-right corner to start chatting.

💬

WHAT IS BYTE BOT?

BYTE is an AI assistant that knows everything about GyanBit — the bit.* API, hardware specs, game tutorials, and more. It's like having a coding tutor available 24/7!

🎯

HOW TO TALK TO BYTE

Just click the 🤖 button and type your question! Try these:

  • "How do I draw a circle?"
  • "Help me make my snake move faster"
  • "What does bit.isHeld do?"
  • "I got an error, help!"
⚡

TIPS FOR BEST RESULTS

  • Keep questions short and specific
  • Tell BYTE what game you're building
  • Paste your code if you need help debugging
  • Try the code BYTE gives you in Studio!

🔒 SAFETY & PRIVACY

BYTE only knows about GyanBit and coding. It can't browse the internet, access your files, or see your personal information. Your chat stays on your device. BYTE is powered by Google's Gemini AI with strict safety filters enabled.

Architecture & Flowcharts

Visual breakdowns of how GyanBit works — from code to console.

🎮 GAME DEVELOPMENT WORKFLOW

flowchart TD A["Open GyanBit Studio"] --> B["Write JavaScript using bit.* API"] B --> C{"Click RUN"} C --> D["Game runs in OLED Simulator"] D --> E{"Bug found?"} E -->|"Yes"| B E -->|"No"| F["Connect hardware via USB-C"] F --> G["Click FLASH"] G --> H["JS auto-translates to MicroPython"] H --> I["Game runs on real console!"] I --> J(("PLAY!"))

🌐 SYSTEM ARCHITECTURE

graph LR subgraph Browser["Browser"] A["Code Editor"] --> E["GyanBitRuntime.js"] D["Virtual Gamepad"] --> E E --> C["OLED Simulator"] end subgraph Console["Physical Console"] F["RP2040 MCU"] --> G["SH1106 OLED"] H["D-Pad + Buttons"] --> F end A -->|"FLASH via USB-C"| I["MicroPythonGen.js"] I -->|"MicroPython"| F

🔌 HARDWARE BLOCK DIAGRAM

graph TB USB["USB-C Port"] --> REG["3.3V Regulator"] BAT["LiPo Battery"] --> REG REG --> RP["RP2040 MCU"] RP -->|"I2C/SPI"| OLED["SH1106 OLED 128x64"] DPAD["4-Way D-Pad"] --> RP BTNA["Button A"] --> RP BTNB["Button B"] --> RP BTNS["START Button"] --> RP RP --> BUZ["Piezo Buzzer"] USB -->|"Data"| RP

💻 IDE SOFTWARE ARCHITECTURE

graph TD APP["App.jsx"] --> TB["Toolbar"] APP --> CE["Code Editor"] APP --> OS["OLED Screen"] APP --> GP["GamePad"] APP --> GG["Game Gallery"] APP --> CP["Console Panel"] CE -->|"Source Code"| RT["GyanBitRuntime.js"] GP -->|"Button Events"| RT RT -->|"Pixel Buffer"| OS RT --> PF["PixelFont.js"] RT --> MP["MicroPythonGen.js"] GG -->|"Load Game"| CE

🗺️ WEBSITE PAGE STRUCTURE

graph TD HOME["index.html — Landing Page"] --> ABOUT["about.html — What is GyanBit"] HOME --> DOCS["docs.html — Tutorials + Manual"] HOME --> GAMES["games.html — Game Library"] HOME --> HW["hardware.html — Hardware Specs"] HOME -->|"Launch Studio"| STUDIO["studio.html — IDE"] DOCS --> T1["Part 1: Engine Basics"] DOCS --> T2["Part 2: Maze Characters"] DOCS --> T3["Part 3: Gameplay Mechanics"] DOCS --> T4["Part 4: Polish and Flash"] STUDIO --> EDITOR["Code Editor"] STUDIO --> SIM["OLED Simulator"] STUDIO --> PAD["Virtual Gamepad"] STUDIO --> GALLERY["Game Gallery"]

💰 UNIT COST BREAKDOWN (₹970 BOM)

pie title GyanBit Unit Cost Breakdown "RP2040 MCU ₹420" : 420 "SH1106 OLED ₹350" : 350 "PCB + Assembly ₹20" : 20 "Eco-Bamboo Case ₹20" : 20 "Battery + Power IC ₹150" : 150 "Kraft Packaging ₹10" : 10

⚡ FLASH-TO-HARDWARE SEQUENCE

sequenceDiagram participant S as Student participant IDE as GyanBit Studio participant GEN as MicroPythonGen participant RP as RP2040 Board S->>IDE: Clicks FLASH IDE->>IDE: Validates JS code IDE->>GEN: Sends JS source GEN->>GEN: Translates to MicroPython GEN->>IDE: Returns .py file IDE->>RP: Sends via USB-C WebSerial RP->>RP: Stores in flash memory RP-->>IDE: ACK - Flash complete IDE-->>S: Flashed successfully!

Operation & Educational Purpose

Everything you need to know about learning, building, and playing with GyanBit.

📦 IN THE BOX

🔌
RP2040 Mainboard

The brain of GyanBit — a powerful dual-core ARM Cortex-M0+ microcontroller.

🖥️
1.3" OLED Display

SH1106 monochrome 128×64 display — crisp whites on deep blacks.

🎮
D-Pad & Buttons

Tactile membrane buttons: D-Pad, A, B, and START for full game control.

♻️
Eco-Bamboo Shell

Sustainable bamboo-fiber enclosure. 100% biodegradable at end of life.

🚀 GETTING STARTED

STEP 1 — OPEN THE IDE

Go to the GyanBit website and click "Open Studio". The browser-based IDE will load instantly — no downloads needed.

STEP 2 — WRITE CODE

Use the bit.* API to write game logic in JavaScript. Try loading a sample game from the Gallery to see how it works!

STEP 3 — TEST IN SIMULATOR

Click ▶ RUN to instantly preview your game on the built-in OLED simulator. Use the on-screen D-Pad to play!

STEP 4 — FLASH TO HARDWARE

Connect your GyanBit via USB-C, click ⚡ FLASH. The code auto-translates to MicroPython and runs on the real console!

📖 API QUICK REFERENCE

Function Description
bit.clear() Clears the entire 128×64 screen
bit.fill(x,y,w,h) Draws a filled rectangle
bit.text(x,y,str) Renders pixel text at the given position
bit.line(x1,y1,x2,y2) Draws a line between two points
bit.circle(cx,cy,r) Draws an outline circle
bit.isHeld('btn') Returns true if button is held down (up/down/left/right/a/b)
bit.isPressed('btn') Returns true only on the frame the button was first pressed
bit.loop(fn) Registers the main game loop (runs at ~30fps)
bit.beep(freq,ms) Plays a square-wave beep at the given frequency

🔧 CARE & MAINTENANCE

🔋 Battery

Contains a rechargeable LiPo cell. Charge via USB-C with any standard 5V adapter. Avoid overcharging.

🧹 Cleaning

Wipe the bamboo shell with a dry or slightly damp cloth. Avoid harsh chemicals near the OLED screen.

♻️ Eco-Disposal

The bamboo shell is 100% biodegradable. End-of-life PCBs should be recycled at designated e-waste facilities.