RISC OS Open
A fast and easily customised operating system for ARM devices
ROOL
Home | News | Software | Bugs | Bounties | Forum | Documents | Photos | Contact us
Account

Page "Message_ToolsChanged" does not exist. Please create it now, or hit the "back" button in your browser.

Buffers Introduction

Programmer's Reference Manuals
» Part 1 - Introduction
» Buffers
» Introduction

Overview

The Operating System makes extensive use of buffers as temporary holding areas for data after you or a device generate it, and before a device or you use it. For example, when a character is typed on the keyboard, the character is stored in the keyboard input buffer by the keyboard interrupt handler, and remains there until it is ready to be used.

All buffers are handled by the Buffer Manager. It is used by DeviceFS? to provide buffers for various devices to perform tasks such as:

  • Initialising buffers
  • Inserting data into a buffer
  • Removing data from a buffer
  • Deleting a buffer

All these facilities are provided by the Buffer module, and for more information please see the Buffer? section.

Filing System buffers

RISC OS uses buffers to hold whole areas of files in memory to increase file access efficiency. The buffers are integrated seamlessly into the Operating System and thus there is now direct way of accessing their contents. This section will not cover filing system buffers.

List of buffers

A complete list of buffers is available here.

Using buffers

Because the purpose of buffers is to store data before they are ready for use, the method of processing the data is First In, First Out (FIFO). This ensures that data loaded into the buffer first is removed first.

Some operations are not explicitly stated, such as when sending a character to the printer port; as this actually inserts the character into a buffer. There are several key buffer operations available:

  • Inserting a character into a buffer
  • Removing a character from the buffer
  • Counting the space in a buffer
  • Examine the next character in the buffer without removing it
  • Clear the buffer contents1

Fn1. The buffer is cleared implicitly when the escape condition is cleared – see the Character Input? section for more details.

Data format of buffers

With the exception of the mouse buffer, the data format is byte-orientated ASCII data. The keyboard buffer is provided in more detail within the Character Input? section.

Useful SWI calls

Numerous OS_Byte SWI calls are provided to control buffers. They are listed below:

  • OS_Byte 15 – Flush all buffers, or current buffer
  • OS_Byte 21 – Flush specific buffer
  • OS_Byte 128 – Get mouse co-ordinates, or number of bytes in an input buffer, or number of bytes free in an output buffer
  • OS_Byte 138 – Insert a byte into a buffer
  • OS_Byte 145 – Get a byte from a buffer
  • OS_Byte 152 – Examine status of a buffer
  • OS_Byte 153 – Insert a byte into one of two buffers

Changing buffer sizes is handled by the Buffer_Create? and Buffer_Register?. A full list of Buffer SWI Calls? are available. The printer buffer can be configured by the use of *Configure PrinterBufferSize.

See also

  • Buffer_Create?
  • Buffer_Register?
  • Buffer Numbers
  • Buffer SWI Calls?
  • Character Input?
  • OS_Byte 15
  • OS_Byte 21
  • OS_Byte 128
  • OS_Byte 138
  • OS_Byte 145
  • OS_Byte 152
  • OS_Byte 153
  • *Configure PrinterBufferSize
Created on January 27, 2010 15:24:00 by Alan Robertson (52)? (127.0.0.1)
Edit | Views: Print | Source | Linked from: Buffers

Search the Wiki

Commercial use

For commercial enquiries, please contact the owners of RISC OS, Castle Technology Ltd.

ROOL Store

The official C/C++ Development kit and more here.

Donate! Why?

Help ROOL make things happen – please consider donating!

Navigation

  • Home Page
  • All Pages
  • Recently Revised
  • Authors
  • Feeds
Site design © RISC OS Open Limited 2011 except where indicated
The RISC OS Open Instiki theme is based on Insitki's default layout

Valid XHTML 1.0  |  Valid CSS

Instiki 0.19.1(MML+)
This site runs on Rails

Hosted by Arachsys