Skip to navigation

Elite on the BBC Micro

Tube: tube_write [Elite-A, Parasite]

Name: tube_write [Show more] Type: Subroutine Category: Tube Summary: As the parasite, send a byte across the Tube to the I/O processor Deep dive: Tube communication in Elite-A
Context: See this subroutine in context in the source code References: This subroutine is called as follows: * CATS calls tube_write * CHPR calls tube_write * CLYNS calls tube_write * CPIX2 calls tube_write * DET1 calls tube_write * DIL2 calls tube_write * DILX calls tube_write * DKS1 calls tube_write * DKS4 calls tube_write * ECBLB calls tube_write * HANGER calls tube_write * HLOIN calls tube_write * LL30 calls tube_write * MSBAR calls tube_write * MT26 calls tube_write * PIXEL calls tube_write * RDKEY calls tube_write * SCAN calls tube_write * SPBLB calls tube_write * TT217 calls tube_write * TTX66 calls tube_write * UNWISE calls tube_write * WSCAN calls tube_write * read_0346 calls tube_write * scan_fire calls tube_write * update_pod calls tube_write * write_0346 calls tube_write

Tube communication in Elite-A uses the following protocol: Parasite -> I/O processor * Uses the FIFO 1 status and data registers to transmit the data * The parasite calls tube_write to send a byte to the I/O processor * The I/O processor calls tube_get to receive that byte from the parasite I/O processor -> Parasite * Uses the FIFO 2 status and data registers to transmit the data * The I/O processor calls tube_put to send a byte to the parasite * The parasite calls tube_read to receive that byte from the I/O processor This routine is called by the parasite to send a byte to the I/O processor. The code is identical to Acorn's MOS routine that runs on the parasite to implement OSWRCH across the Tube.
.tube_write BIT tube_r1s \ Check whether FIFO 1 is available for use, so we can \ use it to transmit a byte to the I/O processor. We do \ this by checking bit 6 of the FIFO 1 status register NOP \ Pause while the register is checked BVC tube_write \ If FIFO 1 is available for use then bit 6 of the \ status register will be set, so this loops back to \ tube_write until FIFO 1 is available for us to use STA tube_r1d \ FIFO 1 is available for use, so store the value we \ want to transmit in the FIFO 1 data register, so it \ gets sent to the I/O processor RTS \ Return from the subroutine