Previous Next Contents Index
Appendix 2: The Channels

THE 'DISK READ' CHANNEL
Offset  Length  Name        Contents
0       2       MAIN_OUT    'main' ROM output routine address = #0008.
2       2       MAIN_IN     'main' ROM input routine address = #0008.
4       1       CHSPEC      "D", channel specifier ("D"+128 denotes a temporary
                            channel).
5       2       DISC_OUT    DISCiPLE output routine address = #150D,DCHAN_OUT.
7       2       DISC_IN     DISCiPLE input routine address = #148A,D_INPUT.
9       2       CHLEN       Channel length = 551.
11      1       CHDRIVE     Drive number.
12      1       CHFLAG      Holds 0, indicating 'read' channel.
13      2       CHRPT       Offset of next byte to be read from buffer.
15      2       CHBUFF      Offset of buffer from start of channel = 39.
17      1                   Not used.
18      1       LENGTH_HI   MSB of file length (i.e. number of 64K blocks).
19      1       CHDIRDESC   Directory description.
20      10      CHNAME      Filename.
30      1       CHTYPE      Filetype.
31      2       LENGTH      MID and LOW bytes of file length.
33      2       ADDR        File address.
35      2       LENGTH_2    Length excluding variables if a BASIC file.
37      2       AUTOSTART   Autostart line or address.
39      510     BUFFER      Data bytes.
549     1       NXT_TRACK   Next track number.
550     1       NXT_SECT    Next sector number.

THE 'DISK WRITE' CHANNEL
Offset  Length  Name        Contents
0       2       MAIN_OUT    'main' ROM output routine address = #0008.
2       2       MAIN_IN     'main' ROM input routine address = #0008.
4       1       CHSPEC      "D", channel specifier ("D"+128 denotes a temporary
                            channel).
5       2       DISC_OUT    DISCiPLE output routine address = #150D,DCHAN_OUT.
7       2       DISC_IN     DISCiPLE input routine address = #148A,D_INPUT.
9       2       CHLEN       Channel length = 787.
11      1       CHDRIVE     Drive number.
12      1       CHFLAG      Holds 1, indicating 'write' channel.
13      2       CHRPT       Offset of next byte to be read from buffer. The
                            following 774 bytes are also used in the DFCA from
                            address #1AD0.
15      2       CHBUFF      Offset of buffer from start of channel = 39.
17      1       NXT_SECT    Sector number of sector where this buffer will be
                            written.
18      1       NXT_TRACK   Track number of sector where this buffer will be
                            written.
19      1       CHDIRDESC   Directory description. Please note that the next 256
                            bytes are the same as a CATalogue entry.
20      10      CHNAME      Filename.
30      2       CHCNT       Sectors used, MSB first!
32      1       FRST_TRK    First track.
33      1       FRST_SECT   First sector.
34      195     CHBITMAP    File bitmap.
229     1       LENGTH_HI   File length MSB (number of 64K blocks).
230     1       CHTYPE      File type.
231     2       LENGTH      MID and LOW bytes of file length.
233     2       ADDR        File address.
235     2       LENGTH_2    Length excluding variables if a BASIC file.
237     2       AUTOSTART   Autostart line or address.
239     22      Z80REGS     Contains IY, IX, DE', BC', HL', IF, DE, BC, HL, IF
                            and SP respectively (only with SNAPSHOT files).
261     14                  Not used.
275     510     BUFFER      Data bytes.
785     1       NXT_TRACK   Next track number.
786     1       NXT_SECT    Next sector number.

THE 'MICRODRIVE' CHANNEL
Microdrive channels can only be openend and used by using the IF1 hookcodes.

Offset  Length  Name        Contents
0       2       MAIN_OUT    'main' ROM output routine address = #0008.
2       2       MAIN_IN     'main' ROM input routine address = #0008.
4       1       CHSPEC      "M", channel specifier ("M"+128 denotes a temporary
                            channel).
5       2       DISC_OUT    DISCiPLE output routine address = #2DB8,MCHAN_OUT.
7       2       DISC_IN     DISCiPLE input routine address = #2C39,M_INPUT.
9       2       CHLEN       Channel length = 595.
11      2       CHBYTE      Position of the next byte to be received or stored
                            in the buffer (0..512).
13      1       CHREC       Record number 0..255.
14      10      CHNAME      Filename.
24      1       CHFLAG      Flag byte:
                            Bit 0 set indicates a 'write' channel.
                            Bit 0 reset indicates a 'read' channel.
                            Bits 1-7 unused.
25      1       CHDRIV      Drive number 1..2.
26      2       CHMAP       Address of microdrive map. Not used by DISCiPLE.
28      12      HEAD_PRE    Header preamble (10 #00, 2 #FF). Used to mark the
                            start of the header block.
40      1       HDFLAG      Bit 0 set indicates a header block. Not used by
                            DISCiPLE.
41      1       HDNUMB      Sector number from which the header comes. Not used
                            by DISCiPLE.
42      2                   Unused.
44      10      HDNAME      Cartridge name. Not used by DISCiPLE.
54      1       HDCHK       Header checksum. Not used by DISCiPLE.
55      12      DATA_PRE    Data preamble, as for the header. Used to mark the
                            start of the data block.
67      1       RECFLG      Bit 0 reset indicates a data block. Not used by
                            DISCiPLE.
                            Bit 1 is set if the record is the EOF one.
                            Bit 2 is reset if the record is part of a
                            'PRINT-type' file.
68      1       RECNUM      Record number 0..255.
69      2       RECLEN      Number of bytes in the record (0..512).
71      10      RECNAME     Record name (same as filename).
81      1       DESCHK      Checksum of the preceding 14 bytes.
82      512     CHDATA      Data buffer.
594     1       DCHK        Checksum of the preceding 512 bytes.

THE 'NETWORK' CHANNEL
Although the DISCiPLE doesn't support network channels from BASIC, they are used
(by master, assistant and pupil stations) with all pupil related network actions.

Offset  Length  Name        Contents
0       2       MAIN_OUT    'main' ROM output routine address = #0008.
2       2       MAIN_IN     'main' ROM input routine address = #0008.
4       1       CHSPEC      "N", channel specifier ("N"+128 denotes a temporary
                            channel).
5       2       DISC_OUT    DISCiPLE output routine address = #3877,NCHAN_OUT.
7       2       DISC_IN     DISCiPLE input routine address = #3819,NCHAN_IN.
9       2       CHLEN       Channel length = 276.
11      1       NCIRIS      Destination station number 0..64.
12      1       NCSELF      Own station number 1..64.
13      2       NCNUMB      Current block number 0..65535.
15      1       NCTYPE      Packet type: #00 normal, #01 EOF packet.
16      1       NCOBL       Number of bytes in the output buffer (=0 during
                            reading).
17      1       NCDCS       Checksum of data block.
18      1       NCHCS       Checksum of header block (NCIRIS..NCDCS).
19      1       NCCUR       Position of the last character read from the buffer.
20      1       NCIBL       Number of bytes in the input buffer (=0 during
                            writing).
21      256     NBUFFER     Data bytes.
Previous Next Contents Index