Developper's Notes Addendum

BUFFERS MANAGEMENT

Introduction

As you know, OZ is very structured for i/o management. The different system buffers follow the same rule. They are basicly managed with a special OZ call ($004E).

1 - Buffer types

There are three different buffer types:

NameAccessDescription
KB$0216the keyboard buffer
RX$0233the recieve data buffer for the serial interface
TX$0229the transmit data buffer for the serial interface

The access links to a buffer frame placed in the OS RAM variables area. Each buffer frame is 8 bytes length.

Frame structure:

addresslengthdescription
IX2associated handle (for the serial port)
-011pointer for input
-021pointer for output
-031unused
-041buffer high byte address
-051buffer start address
-061buffer end address

The buffer area begins at $0B00, just after the handles and ends at $0BFF.

addresslengthdescription
0B00 32 KB buffer
0B20 96 TX buffer
0B80 128 RX buffer

2 - Buffer operation : OZ_BUFF routine

OZ works on these buffers with a special call placed in the system RAM. We will name it OZ_BUFF, called by the vector $004E (just before OZ_DI). Here is the call description :


OZ_BUFF, buffer interface

CALL $004E

IN:

IX buffer access
L reason call
Other register parameters depend on reason call

Reason call:
$00BF_PBWrite to buffer
$03BF_GBRead from buffer
$06BF_PBTWrite to buffer with timeout
$09BF_GBTRead from buffer with timeout
$0CBF_STAGet buffer status
$0FBF_PURPurge buffer

OUT:

Depends on reason code, see below.
IX always remains unchanged.


BF_PB (L = $00), Write byte to buffer

IN :
A value to put
IX buffer access

Out if call succeeded:
Fc=0, H full slots, L empty slots.

Out if call failed:
Fc=1, A=RC_EOF buffer is full.


BF_GB (L = $03), Read byte from buffer

IN : IX buffer access

Out if call succeeded:
Fc=0, A=C data , H full slots, L empty slots.

Out if call failed:
Fc=1, A=RC_EOF buffer is empty.


BF_PBT (L = $06), Write byte to buffer with timeout

IN :
A value to put
BC timeout, $FFFF for default
IX buffer access

Out if call succeeded:
Fc=0, BC remaining timeout

Out if call failed:
Fc=1, A=RC_SUSP, RC_ESC, RC_TIME


BF_GBT (L = $09), Read byte from buffer with timeout

IN :
BC timeout, $FFFF for default
IX buffer access

Out if call succeeded:
Fc=0, A data read, BC remaining timeout

Out if call failed:
Fc=1, A=RC_SUSP, RC_ESC, RC_TIME


BF_STA (L = $0C), Get buffer status

IN : IX buffer access

OUT: Fc=0, always.
H full slots (bytes in use)
L empty slots (free bytes)


BF_PUR (l = $0F), Purge buffer

IN : IX buffer access

OUT: Fc=0, always.


Thierry Peycru (Zlab), March 1998.