mk90.api

Pipe services

Dispatcher-bound endpoints of the single RAM byte FIFO.

Routine summary

RoutineInputResult
pipe_writeR0 = byte; current task owns writer endpointR0 = 0 success, 15 wrong owner or 21 reader closed. R1–R5 preserved.
pipe_readCurrent task owns reader endpointR0 = 0 success / 15 wrong owner; R1 = byte 0–255 or FFFF for EOF. R2–R5 preserved.
pipe_close_readCurrent task owns reader endpointRegisters preserved; non-owner close has no effect.
pipe_close_writeCurrent task owns writer endpointRegisters preserved; non-owner close has no effect.

pipe_write

pipe_write
R0 = byte; current task owns writer endpoint
ContractValue
Entry address0x243A
ReturnsR0 = 0 success, 15 wrong owner or 21 reader closed. R1–R5 preserved.

Blocks in WAIT_WRITE while the FIFO is full. A read wakes the writer. Closing the reader wakes it with EPIPE. There is no caller-supplied descriptor or independently creatable pipe.

pipe_read

pipe_read
Current task owns reader endpoint
ContractValue
Entry address0x24A4
ReturnsR0 = 0 success / 15 wrong owner; R1 = byte 0–255 or FFFF for EOF. R2–R5 preserved.

Blocks in WAIT_READ while the FIFO is empty and the writer remains open. Drains buffered data before returning EOF after writer closure.

pipe_close_read

pipe_close_read
Current task owns reader endpoint
ContractValue
Entry address0x250C
ReturnsRegisters preserved; non-owner close has no effect.

Clears the read endpoint and wakes a writer blocked for space. It is also called by task-return cleanup and by consumer stack-fault recovery.

pipe_close_write

pipe_close_write
Current task owns writer endpoint
ContractValue
Entry address0x2534
ReturnsRegisters preserved; non-owner close has no effect.

Clears the write endpoint and wakes an empty-buffer reader. Remaining data stays available to read before EOF.

Pipe control

The 256-byte FIFO is at 0x0100; its 16-byte control record is at 0x07F0. The dispatcher creates and binds endpoints; applications do not modify this record directly.

OffsetField
0Write index, 0–255.
2Read index, 0–255.
4Byte count, 0–256.
6Reader TCB pointer; zero when closed.
8Writer TCB pointer; zero when closed.
10Active flag / module-lifetime lock.
12Consumer TCB retained for completion wait.
14Reserved.

Pipe lifecycle and error propagation.