BBC Micro C library
Data Structures | Typedefs | Enumerations | Functions
os.h File Reference

BBC MOS API wrappers. More...

#include <string.h>
#include "stdint.h"
Include dependency graph for os.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  osfile_parameterblock_s
 
struct  osgbpb_controlblock_s
 

Typedefs

typedef struct osfile_parameterblock_s osfile_parameterblock
 
typedef enum osfile_action_e osfile_action
 
typedef struct osgbpb_controlblock_s osgbpb_controlblock
 
typedef enum osgbpb_action_e osgbpb_action
 

Enumerations

enum  osfile_action_e {
  osfile_saveblock = 0, osfile_writeinfo = 1, osfile_writeload = 2, osfile_writeexec = 3,
  osfile_writeattr = 4, osfile_readinfo = 5, osfile_deletenamedfile = 6, osfile_loadnamedfile = 0xff
}
 
enum  osgbpb_action_e {
  osgbpb_putbytes_seq = 1, osgbpb_putbytes = 2, osgbpb_getbytes_seq = 3, osgbpb_getbytes = 4,
  osgbpb_gettitleandbootopt = 5, osgbpb_readdirectory = 6, osgbpb_readlibrary = 7, osgbpb_readfilenames = 8
}
 

Functions

static void oswrch (uint8_t a_char)
 
static uint8_t osrdch (void)
 
static void osnewl (void)
 
static void osasci (uint8_t a_char)
 
static void gsinit (uint8_t *a, uint8_t *y)
 
static void gsread (uint8_t *a, uint8_t *x, uint8_t y)
 
uint8_t osrdrm (uint8_t y_romnum, uintptr_t address)
 
static uint8_t osrdsc (uintptr_t address)
 
void oswrsc (uint8_t a_byte, uintptr_t address)
 
static void oseven (uint8_t y_eventnum)
 
static void oscli (char *xy_command)
 
static void osbyte (uint8_t a_func, uint8_t *x, uint8_t *y)
 
void osword (uint8_t a_func, const void *xy_pointer)
 
void osfile (uint8_t a_action, const osfile_parameterblock *xy_pblock)
 
static uint8_t osbget (uint8_t y_handle)
 
static void osbput (uint8_t a_byte, uint8_t y_handle)
 
void osgbpb (uint8_t a_action, const osgbpb_controlblock *xy_pblock)
 
uint8_t osfind (uint8_t a_operation, uint8_t x, uint8_t y)
 
static uint8_t osfind_open_r (char *filename)
 
static uint8_t osfind_open_w (char *filename)
 
static uint8_t osfind_open_rw (char *filename)
 
static void osfind_close (uint8_t handle)
 

Detailed Description

BBC MOS API wrappers.

C style wrappers around the BBC Micro OS API calls

Typedef Documentation

◆ osfile_action

Action to be performed by osfile call

◆ osfile_parameterblock

Parameter block to be passed to osfile calls

◆ osgbpb_action

Action to be performed by osgbpb call

◆ osgbpb_controlblock

Control block to be passed to osgbpb calls

Enumeration Type Documentation

◆ osfile_action_e

Action to be performed by osfile call

◆ osgbpb_action_e

Action to be performed by osgbpb call

Function Documentation

◆ gsinit()

static void gsinit ( uint8_t a,
uint8_t y 
)
inlinestatic

GSINIT General string input initialise routine

This call cannot be used from a co processor

◆ gsread()

static void gsread ( uint8_t a,
uint8_t x,
uint8_t  y 
)
inlinestatic

GSREAD Read character from string input

This call cannot be used from a co processor

◆ osasci()

static void osasci ( uint8_t  a_char)
inlinestatic

OSASCI Write character routine where OSNEWL is called when A 0x0D

This routine performs an OSWRCH call with the accumulator contents unless called with 0x0D (13) when an OSNEWL call is performed.

Parameters
a_charcharacter to write

◆ osbget()

static uint8_t osbget ( uint8_t  y_handle)
inlinestatic

OSARGS Read or write an open file's arguments

Parameters
a_actionnumber specifying the action required (also returns data)
x_zp_pointerpoints to a four byte zero page control block
y_filehandlefile handle as provided by OSFIND, or zero OSBGET Get one byte from an open file
y_handlethe file handle, as provided by OSFIND

◆ osbput()

static void osbput ( uint8_t  a_byte,
uint8_t  y_handle 
)
inlinestatic

OSBPUT Write a single byte to an open file

Parameters
a_bytethe byte to be written
y_handlethe file handle, as provided by OSFIND

◆ osbyte()

static void osbyte ( uint8_t  a_func,
uint8_t x,
uint8_t y 
)
inlinestatic

OSBYTE - OS call specified by the contents of A taking parameters in X and Y

Parameters
a_funcOS function to call
xparameter to OS function
yparameter to OS function

◆ oscli()

static void oscli ( char *  xy_command)
inlinestatic

OSCLI Passes line of text to the CLI

Parameters
xy_command0 terminated command to pass to CLI

◆ oseven()

static void oseven ( uint8_t  y_eventnum)
inlinestatic

OSEVEN Generate an event

◆ osfile()

void osfile ( uint8_t  a_action,
const osfile_parameterblock xy_pblock 
)

OSFILE Read or write a whole file or its attributes

Parameters
a_actionsub action osfile should perform
xy_pblockpointer to parameter block, also used for returning values

◆ osfind()

uint8_t osfind ( uint8_t  a_operation,
uint8_t  x,
uint8_t  y 
)

OSFIND Open or close a file for byte access

Parameters
a_operation0 = close, 0x40 = open for read, 0x80 = open for write, 0xc0 = open for read/write
x
y
Returns

◆ osfind_close()

static void osfind_close ( uint8_t  handle)
inlinestatic

Close an open file (OSFIND helper)

Parameters
handleopen file handle

◆ osfind_open_r()

static uint8_t osfind_open_r ( char *  filename)
inlinestatic

Open a file for reading (OSFIND helper)

Parameters
filename0 terminated filename (modifies the terminator)
Returns
filehandle

◆ osfind_open_rw()

static uint8_t osfind_open_rw ( char *  filename)
inlinestatic

Open a file for reading and writing (OSFIND helper)

Parameters
filename0 terminated filename (modifies the terminator)
Returns
filehandle

◆ osfind_open_w()

static uint8_t osfind_open_w ( char *  filename)
inlinestatic

Open a file for writing (OSFIND helper)

Parameters
filename0 terminated filename (modifies the terminator)
Returns
filehandle

◆ osgbpb()

void osgbpb ( uint8_t  a_action,
const osgbpb_controlblock xy_pblock 
)

OSGBPB Read or write a group of bytes

This routine transfers a number of bytes to or from an open file. It can also be used to transfer filing system information.

Parameters
a_actioninformation to be transferred.
xy_pblockpointer to a control block in memory

◆ osnewl()

static void osnewl ( void  )
inlinestatic

OSNEWL Write a newline to selected output stream

◆ osrdch()

static uint8_t osrdch ( void  )
inlinestatic

OSRDCH Read character from currently selected input stream

Returns
character read

◆ osrdrm()

uint8_t osrdrm ( uint8_t  y_romnum,
uintptr_t  address 
)

OSRDRM Read byte in paged ROM

This call cannot be used from a co processor

Parameters
y_romnumROM bank number 0-15
addressaddress in ROM, range 0x8000 - 0xbfff
Returns
byte read

◆ osrdsc()

static uint8_t osrdsc ( uintptr_t  address)
inlinestatic

OSRDSC Read a byte from current screen memory

This call cannot be used from a co processor

This call is synonumous with OSRDRM with the address in the range of screen memory not paged ROM

Parameters
addressaddress in screen memory
Returns
byte read

◆ osword()

void osword ( uint8_t  a_func,
const void *  xy_pointer 
)

OSWORD OS call specified by contents of A taking parameters in a parameter block

Parameters
a_funcOS function to call
xy_pointerpointer to parameter block

◆ oswrch()

static void oswrch ( uint8_t  a_char)
inlinestatic

OSWRCH Write character to currently selected output stream

Parameters
a_charcharacter to write

◆ oswrsc()

void oswrsc ( uint8_t  a_byte,
uintptr_t  address 
)

OSWRSC write byte to screen memory

Parameters
a_bytevalue to be written
addressaddress to be written to