Pipe services
Dispatcher-bound endpoints of the single RAM byte FIFO.
Routine summary
| Routine | Input | Result |
|---|---|---|
| pipe_write | R0 = byte; current task owns writer endpoint | R0 = 0 success, 15 wrong owner or 21 reader closed. R1–R5 preserved. |
| pipe_read | Current task owns reader endpoint | R0 = 0 success / 15 wrong owner; R1 = byte 0–255 or FFFF for EOF. R2–R5 preserved. |
| pipe_close_read | Current task owns reader endpoint | Registers preserved; non-owner close has no effect. |
| pipe_close_write | Current task owns writer endpoint | Registers preserved; non-owner close has no effect. |
pipe_write
pipe_write
R0 = byte; current task owns writer endpoint| Contract | Value |
|---|---|
| Entry address | 0x243A |
| Returns | R0 = 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| Contract | Value |
|---|---|
| Entry address | 0x24A4 |
| Returns | R0 = 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| Contract | Value |
|---|---|
| Entry address | 0x250C |
| Returns | Registers 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| Contract | Value |
|---|---|
| Entry address | 0x2534 |
| Returns | Registers 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.
| Offset | Field |
|---|---|
| 0 | Write index, 0–255. |
| 2 | Read index, 0–255. |
| 4 | Byte count, 0–256. |
| 6 | Reader TCB pointer; zero when closed. |
| 8 | Writer TCB pointer; zero when closed. |
| 10 | Active flag / module-lifetime lock. |
| 12 | Consumer TCB retained for completion wait. |
| 14 | Reserved. |