Documentation

Introduction

Bscript is a programming language that compiles to binary. It is designed to be easy to learn and use, and to be a good first language for beginners. It is also designed to be a good language for teaching computer science concepts, such as how computers work, how programming languages work, and how to write compilers.

Why Bscript?

Bscript it supports variables, no more writing registry adresses manually like in Bssembly. There are also quality of life improvements to locations and jumping.

Specs

Regestries: 256
RAM: 4096 Bytes
ROM: Infinite
Screen: 256x256 = 65536 Pixels
Colors: 24 bits

Datatypes

Variables

var foo = 34
var bar = 35
var foobar = 0
foobar = foo + bar
out(foobar); -> 69

Functions

var foo = 0
inc(foo)
out(foo); -> 1

Jumping and locations

var index = 0
loc:start
inc(index)
lth(index, 10, to:start)
out(index); -> 10

RAM manipulation

var foo = 0
put16(foo, 100u16)
inc(foo)
ret16(100u16, foo)
out(foo); -> 0

16bit locations

Two 8bit registers represented by a single variable.

var foo:u16 = 256u16
var bar:u16 = 1024
var baz = 0
put16(69, foo)
ret16(256u16, baz)
out(baz); -> 69
out16(bar); -> 1024

Playing sound

Use 5 different waves to make noises.

snd(0, 1, 2, 10);square
snd(1, 1, 2, 10);sawtooth
snd(2, 1, 2, 10);triangle
snd(3, 1, 2, 10);noise
snd(4, 1, 2, 10);sine

Instructions

Instructions are the building blocks of Bscript and Bssembly. They are the commands that the computer executes. There are 59 instructions, each with a unique number. The instructions are listed below.