BBC Micro C library
Functions
basic.h File Reference

BBC BASIC style API. More...

#include <string.h>
#include <stdio.h>
#include "stdint.h"
#include "os.h"
Include dependency graph for basic.h:

Go to the source code of this file.

Functions

static void CLS (void)
 
void COLOUR (uint8_t colour)
 
void PLOT (uint8_t plotcode, uint16_t x, uint16_t y)
 
static void DRAW (uint16_t x, uint16_t y)
 
static void ENVELOPE (const void *block)
 
void GCOL (uint8_t action, uint8_t colour)
 
uint8_t INKEYNEG (int8_t key)
 
void MODE (uint8_t mode)
 
static void MOVE (uint16_t x, uint16_t y)
 
static void PRINT (const char *string)
 
void PRINTTAB (uint8_t x, uint8_t y, const char *string)
 
void SOUND (int16_t channel, int16_t amplitude, int16_t pitch, int16_t duration)
 

Detailed Description

BBC BASIC style API.

C wrappers in the style of BBC BASIC keywords

Function Documentation

◆ CLS()

static void CLS ( void  )
inlinestatic

Clear the text area of the screen

◆ COLOUR()

void COLOUR ( uint8_t  colour)

Set the text foreground and background colour

Parameters
colour0-15 for foreground, 128-143 for background

◆ DRAW()

static void DRAW ( uint16_t  x,
uint16_t  y 
)
inlinestatic

Draws lines on the screen in MODEs 0,1,2,4 and 5 draws from current graphics point set by MOVE or DRAW previously.

Parameters
xend of line x coordinate in osunits
yend of line y coordinate in osunits

◆ ENVELOPE()

static void ENVELOPE ( const void *  block)
inlinestatic

The envelope statement is used with the SOUND statement to control the volume and pitch of a sound while it is playing.

Parameters
blockpointer to 14 byte block containing envelope parameters

◆ GCOL()

void GCOL ( uint8_t  action,
uint8_t  colour 
)

Selects the graphics foreground colour and the graphics background colour.

Parameters
actionmode of action to use, 0 = plot, 1 = OR, 2 = AND, 3 = EOR, 4 = invert
colourlogival colour to use

◆ INKEYNEG()

uint8_t INKEYNEG ( int8_t  key)

INKEY with a negative number enables you to test whether a particular key is pressed at this instant

key negative key code

Returns
1 if pressed, 0 if not

◆ MODE()

void MODE ( uint8_t  mode)

Select which display mode the computer is about to use.

Parameters
modenumber of new mode

◆ MOVE()

static void MOVE ( uint16_t  x,
uint16_t  y 
)
inlinestatic

moves the graphics cursor to a particular absolute position without drawing a line

Parameters
xnew x coordinate in osunits
ynew y coordinate in osunits

◆ PLOT()

void PLOT ( uint8_t  plotcode,
uint16_t  x,
uint16_t  y 
)

PLOT is the multi-purpose point, line and triangle drawing statement in BASIC. With the graphcis extension ROM fitted, it also provides shape and sprite plotting routines.

It is also the code behind the DRAW and MOVE keywords

Parameters
plotcodeaction to perform
xx coordinate in osunits
yy coordinate in osunits

◆ PRINT()

static void PRINT ( const char *  string)
inlinestatic

Text output routine

Note this is sumplified from the BASIC version and can only output single zero terminated strings.

Parameters
stringstring to output (zero terminated)

◆ PRINTTAB()

void PRINTTAB ( uint8_t  x,
uint8_t  y,
const char *  string 
)

Text output routine at a specific text coordinate

Note this is sumplified from the BASIC version and can only output single zero terminated strings.

Parameters
xtext coordinate
ytext coordinate
stringstring to output (zero terminated)

◆ SOUND()

void SOUND ( int16_t  channel,
int16_t  amplitude,
int16_t  pitch,
int16_t  duration 
)

Generate sounds

Parameters
channel0-4, 0 = noise channel, 1-3 squarewave
amplitudeloudness -15 (loudest) tp 0 (silence)
pitch0-255 pitch, A440 = 89, 4 units per semi-tone, 48 per octave
duration-1 to 254 note duration in 20ths of a second