h6. [[Programmer's Reference Manuals]] h6(. » Buffers The Operating System makes extensive use of buffers as temporary holding areas for data. 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 [[BufferManager|Buffer Manager]]. This 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 h3. 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 contents (the buffer is cleared implicitly when the escape condition is cleared – see the [[Character Input]] section) h3. Data format 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. h3. Filing System buffers RISC OS uses buffers to hold areas of files in memory to increase file access efficiency. The buffers are integrated into the Operating System and there is no direct way of accessing their contents. This section does not cover filing system buffers. h3. SWI calls Changing buffer sizes is handled by the [[Buffer_Create]] and [[Buffer_Register]]. The [[BufferManager|Buffer Manager]] section documents other SWI calls. The printer buffer can be configured by the use of [[*Configure PrinterBufferSize|*Configure PrinterBufferSize]]. Several [[OS_Byte]] SWI calls are also provided to control buffers: * [[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 a 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 h4. See also * [[BufferManager]] * [[Buffer Numbers]] * [[Character Input]]