Z88 Developers' Notes
Contents   Contents of System Calls

OZ_Buff, buffers low level interface

CALL $004E

IN:
            IX = buffer access
                There are three different buffer types:
Name Access Description
KB $0216 the keyboard buffer
RX $0233 the recieve data buffer for the serial interface
TX $0229 the transmit data buffer for the serial interface

            L = reason call
 
Reason Name Function
$00 BF_PB Write to buffer
$03 BF_GB Read from buffer
$06 BF_PBT Write to buffer with timeout
$09 BF_GBT Read from buffer with timeout
$0C BF_STA Get buffer status
$0F BF_PUR Purge buffer

            A = value to put (if required)
            BC = timeout (if required)

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

Registers changed after return:
            Depends on reason code.


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.


Notes:

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

Frame structure:
address length description
IX 2 associated handle (for the serial port)
-01 1 pointer for input
-02 1 pointer for output
-03 1 unused
-04 1 buffer high byte address
-05 1 buffer start address
-06 1 buffer end address

The buffer area begins at $0B00, just after the handles and ends at $0BFF.
 
address length description
0B00 32 KB buffer
0B20 96 TX buffer
0B80 128 RX buffer