[f40a309] | 1 | /*
|
---|
| 2 | ============================================================================
|
---|
| 3 | biosdefs.h -- Buchla 700 BIOS and XBIOS definitions
|
---|
| 4 | Version 22 -- 1988-04-11 -- D.N. Lynx Crowe
|
---|
| 5 | ============================================================================
|
---|
| 6 | */
|
---|
| 7 |
|
---|
[f7428b1] | 8 | #pragma once
|
---|
[5fa506d] | 9 |
|
---|
[f7428b1] | 10 | #include "stdint.h"
|
---|
[f40a309] | 11 |
|
---|
| 12 | #define BIOS trap13
|
---|
| 13 | #define XBIOS trap14
|
---|
| 14 |
|
---|
| 15 | /* BIOS functions */
|
---|
| 16 |
|
---|
| 17 | /* function 0 unused (getmpb) */
|
---|
| 18 |
|
---|
| 19 | #define B_RDAV 1
|
---|
| 20 | #define B_GETC 2
|
---|
| 21 | #define B_PUTC 3
|
---|
| 22 | #define B_RDWR 4
|
---|
| 23 | #define B_SETV 5
|
---|
| 24 |
|
---|
| 25 | /* function 6 unused (tickcal) */
|
---|
| 26 |
|
---|
| 27 | #define B_GBPB 7
|
---|
| 28 | #define B_THRE 8
|
---|
| 29 | #define B_MCHG 9
|
---|
| 30 | #define B_DMAP 10
|
---|
| 31 |
|
---|
| 32 | /* function 11 unused (shift) */
|
---|
| 33 |
|
---|
| 34 | /* XBIOS functions */
|
---|
| 35 |
|
---|
| 36 | #define X_PIOREC 0
|
---|
| 37 | #define X_SETPRT 1
|
---|
| 38 | #define X_FLOPRD 2
|
---|
| 39 | #define X_FLOPWR 3
|
---|
| 40 | #define X_FORMAT 4
|
---|
| 41 | #define X_VERIFY 5
|
---|
| 42 | #define X_PRBOOT 6
|
---|
| 43 | #define X_RANDOM 7
|
---|
| 44 | #define X_ANALOG 8
|
---|
| 45 | #define X_CLRAFI 9
|
---|
| 46 | #define X_APICHK 10
|
---|
| 47 | #define X_MTDEFS 11
|
---|
| 48 |
|
---|
| 49 | /* device unit numbers */
|
---|
| 50 |
|
---|
| 51 | #define PRT_DEV 0
|
---|
| 52 | #define AUX_DEV 1
|
---|
| 53 | #define CON_DEV 2
|
---|
| 54 | #define MC1_DEV 3
|
---|
| 55 | #define MC2_DEV 4
|
---|
| 56 |
|
---|
| 57 | /* |
---|
| 58 | */
|
---|
| 59 | /*
|
---|
| 60 | ============================================================================
|
---|
| 61 | bpb -- BIOS parameter block
|
---|
| 62 | ============================================================================
|
---|
| 63 | */
|
---|
| 64 |
|
---|
| 65 |
|
---|
| 66 | struct bpb { /* BIOS parameter block returned by B_GBPB */
|
---|
[7258c6a] | 67 |
|
---|
| 68 | uint16_t recsiz; /* physical sector size in bytes */
|
---|
| 69 | uint16_t clsiz; /* cluster size in sectors */
|
---|
| 70 | uint16_t clsizb; /* cluster size in bytes */
|
---|
| 71 | uint16_t rdlen; /* root directory length in sectors */
|
---|
| 72 | uint16_t fsiz; /* FAT size in sectors */
|
---|
| 73 | uint16_t fatrec; /* sector number of 1st sector of 2nd FAT */
|
---|
| 74 | uint16_t datrec; /* sector number of 1st data sector */
|
---|
| 75 | uint16_t numcl; /* number of data clusters on disk */
|
---|
| 76 | uint16_t bflags; /* flags */
|
---|
| 77 | uint16_t ntracks; /* number of tracks */
|
---|
| 78 | uint16_t nsides; /* number of sides (heads) */
|
---|
| 79 | uint16_t dspc; /* sectors per cylinder */
|
---|
| 80 | uint16_t dspt; /* sectors per track */
|
---|
| 81 | uint16_t hidden; /* number of hidden files */
|
---|
| 82 | int8_t serno[3]; /* disk serial number */
|
---|
[f40a309] | 83 | int8_t nada; /* --- filler - nothing here --- */
|
---|
| 84 | };
|
---|
| 85 |
|
---|
| 86 | #define BPBSIZE 32 /* length of a BPB */
|
---|
| 87 |
|
---|
| 88 | #define B_FAT16 0x0001 /* flag for using 16 bit FAT entries */
|
---|
| 89 |
|
---|
| 90 | /* |
---|
| 91 |
|
---|
| 92 | */
|
---|
| 93 |
|
---|
| 94 | /*
|
---|
| 95 | ============================================================================
|
---|
| 96 | dirent -- Directory entry
|
---|
| 97 | ============================================================================
|
---|
| 98 | */
|
---|
| 99 |
|
---|
[7258c6a] | 100 | struct dirent { /* Directory entry */
|
---|
| 101 |
|
---|
| 102 | int8_t fname[8]; /* file name */
|
---|
| 103 | int8_t fext[3]; /* file extension */
|
---|
| 104 | int8_t atrib; /* attribute byte */
|
---|
| 105 | int8_t unused[10]; /* unused space */
|
---|
| 106 | uint16_t crtime; /* 'LLHH' creation time */
|
---|
| 107 | uint16_t crdate; /* 'LLHH' creation date */
|
---|
[f40a309] | 108 | uint16_t bclust; /* 'LLHH' starting cluster number */
|
---|
| 109 | int32_t flen; /* 'LLHH' file length */
|
---|
| 110 | };
|
---|
| 111 |
|
---|
| 112 | #define DENTSIZE (sizeof (struct dirent))
|
---|
| 113 |
|
---|
| 114 | #define F_RDONLY 0x01 /* Read only file */
|
---|
| 115 | #define F_HIDDEN 0x02 /* Hidden file */
|
---|
| 116 | #define F_SYSTEM 0x04 /* System file */
|
---|
| 117 | #define F_VOLUME 0x08 /* Volume label */
|
---|
| 118 | #define F_SUBDIR 0x10 /* Sub-directory */
|
---|
| 119 | #define F_ARCHIV 0x20 /* Archived */
|
---|
| 120 |
|
---|
| 121 | /* |
---|
| 122 |
|
---|
| 123 | */
|
---|
| 124 |
|
---|
| 125 | /*
|
---|
| 126 | ============================================================================
|
---|
| 127 | fcb -- File Control Block
|
---|
| 128 | ============================================================================
|
---|
| 129 | */
|
---|
| 130 |
|
---|
[7258c6a] | 131 | struct fcb { /* file control block */
|
---|
| 132 |
|
---|
| 133 | struct dirent de; /* directory entry image for file */
|
---|
| 134 | uint16_t modefl; /* fcb flags */
|
---|
| 135 | uint16_t clsec; /* current sector in cluster */
|
---|
| 136 | uint16_t curcls; /* current cluster */
|
---|
| 137 | uint16_t offset; /* current offset into sector */
|
---|
| 138 | int32_t curlsn; /* current logical sector number in file */
|
---|
[f40a309] | 139 | int32_t curdsn; /* current logical sector number on disk */
|
---|
| 140 | int32_t curlen; /* current file length in bytes */
|
---|
| 141 | int32_t asects; /* allocated file length in sectors */
|
---|
| 142 | };
|
---|
| 143 |
|
---|
| 144 | #define FC_EOF 0x8000 /* end of file */
|
---|
| 145 | #define FC_BAD 0x4000 /* bad FAT entry encountered */
|
---|
| 146 | #define FC_ERR 0x2000 /* error encountered */
|
---|
| 147 | #define FC_OPN 0x1000 /* file open */
|
---|
| 148 |
|
---|
| 149 | #define FC_CR 0x0800 /* create mode */
|
---|
| 150 | #define FC_AP 0x0400 /* append mode */
|
---|
| 151 | #define FC_WR 0x0200 /* write mode */
|
---|
| 152 | #define FC_RD 0x0100 /* read mode */
|
---|
| 153 |
|
---|
| 154 | #define FC_EX 0x0080 /* exclusive mode */
|
---|
| 155 | #define FC_TR 0x0040 /* truncate mode */
|
---|
| 156 | #define FC_NB 0x0020 /* non-blocking mode */
|
---|
| 157 | #define FC_BF 0x0010 /* binary file mode */
|
---|
| 158 |
|
---|
| 159 | #define FC_RW (FC_RD | FC_WR) /* read-write mode */
|
---|
| 160 |
|
---|
| 161 | /* |
---|
| 162 | */
|
---|
| 163 |
|
---|
| 164 | /*
|
---|
| 165 | ============================================================================
|
---|
| 166 | BIOS and XBIOS function call formats
|
---|
| 167 | ------------------------------------
|
---|
| 168 |
|
---|
| 169 | In the list below, .W and .L refer to the size of the parameter
|
---|
| 170 | passed to the BIOS/XBIOS routine.
|
---|
| 171 |
|
---|
| 172 | The first parameter is always the function code, "code.W".
|
---|
| 173 |
|
---|
| 174 | BIOS calls are:
|
---|
| 175 | ---------------
|
---|
| 176 |
|
---|
| 177 | BIOS(B_RDAV, unit.W);
|
---|
| 178 | BIOS(B_GETC, unit.W);
|
---|
| 179 | BIOS(B_PUTC, unit.W, c.W);
|
---|
| 180 | BIOS(B_RDWR, rwflag.W, buf.L, count.W, recno.W, dev.W);
|
---|
| 181 | BIOS(B_SETV, vecnum.W, vecadr.L);
|
---|
| 182 | BIOS(B_GBPB, dev.W);
|
---|
| 183 | BIOS(B_THRE, unit.W);
|
---|
| 184 | BIOS(B_MCHG, unit.W);
|
---|
| 185 | BIOS(B_DMAP);
|
---|
| 186 |
|
---|
| 187 | XBIOS calls are:
|
---|
| 188 | ----------------
|
---|
| 189 |
|
---|
| 190 | XBIOS(X_PIOREC, unit.W)
|
---|
| 191 | XBIOS(X_SETPRT, unit.W, mode.W, baud.W, cfr0.W, cr1.W)
|
---|
| 192 | XBIOS(X_FLOPRD, buf.L, filler.L, dev.W, sector.W, track.W,
|
---|
| 193 | side.W, count.W)
|
---|
| 194 | XBIOS(X_FLOPWR, buf.L, filler.L, dev.W, sector.W, track.W,
|
---|
| 195 | side.W, count.W)
|
---|
| 196 | XBIOS(X_FORMAT, buf.L, filler.L, dev.W, spt.W, track.W, side.W,
|
---|
| 197 | intrlv.W, magic.L, virgin.W)
|
---|
| 198 | XBIOS(X_VERIFY, buf.L, filler.L, dev.W, sector.W, track.W,
|
---|
| 199 | side.W, count.W)
|
---|
| 200 | XBIOS(X_PRBOOT, buf.L, serial.L, type.W, execflag.W)
|
---|
| 201 | XBIOS(X_RANDOM)
|
---|
| 202 | XBIOS(X_ANALOG)
|
---|
| 203 | XBIOS(X_CLRAFI)
|
---|
| 204 | ============================================================================
|
---|
| 205 | */
|
---|