1 | /*
|
---|
2 | ============================================================================
|
---|
3 | biosdefs.h -- Buchla 700 BIOS and XBIOS definitions
|
---|
4 | Version 22 -- 1988-04-11 -- D.N. Lynx Crowe
|
---|
5 | ============================================================================
|
---|
6 | */
|
---|
7 |
|
---|
8 | #pragma once
|
---|
9 |
|
---|
10 | #include "stdint.h"
|
---|
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 | bpb -- BIOS parameter block
|
---|
60 | ============================================================================
|
---|
61 | */
|
---|
62 |
|
---|
63 |
|
---|
64 | struct bpb { /* BIOS parameter block returned by B_GBPB */
|
---|
65 |
|
---|
66 | int16_t recsiz; /* physical sector size in bytes */
|
---|
67 | int16_t clsiz; /* cluster size in sectors */
|
---|
68 | int16_t clsizb; /* cluster size in bytes */
|
---|
69 | int16_t rdlen; /* root directory length in sectors */
|
---|
70 | int16_t fsiz; /* FAT size in sectors */
|
---|
71 | int16_t fatrec; /* sector number of 1st sector of 2nd FAT */
|
---|
72 | int16_t datrec; /* sector number of 1st data sector */
|
---|
73 | int16_t numcl; /* number of data clusters on disk */
|
---|
74 | uint16_t bflags; /* flags */
|
---|
75 | int16_t ntracks; /* number of tracks */
|
---|
76 | int16_t nsides; /* number of sides (heads) */
|
---|
77 | int16_t dspc; /* sectors per cylinder */
|
---|
78 | int16_t dspt; /* sectors per track */
|
---|
79 | int16_t hidden; /* number of hidden files */
|
---|
80 | int8_t serno[3]; /* disk serial number */
|
---|
81 | int8_t nada; /* --- filler - nothing here --- */
|
---|
82 | };
|
---|
83 |
|
---|
84 | #define BPBSIZE 32 /* length of a BPB */
|
---|
85 |
|
---|
86 | #define B_FAT16 0x0001u /* flag for using 16 bit FAT entries */
|
---|
87 |
|
---|
88 | /*
|
---|
89 | ============================================================================
|
---|
90 | dirent -- Directory entry
|
---|
91 | ============================================================================
|
---|
92 | */
|
---|
93 |
|
---|
94 | struct dirent { /* Directory entry */
|
---|
95 |
|
---|
96 | int8_t fname[8]; /* file name */
|
---|
97 | int8_t fext[3]; /* file extension */
|
---|
98 | uint8_t atrib; /* attribute byte */
|
---|
99 | int8_t unused[10]; /* unused space */
|
---|
100 | uint16_t crtime; /* 'LLHH' creation time */
|
---|
101 | uint16_t crdate; /* 'LLHH' creation date */
|
---|
102 | uint16_t bclust; /* 'LLHH' starting cluster number */
|
---|
103 | uint32_t flen; /* 'LLHH' file length */
|
---|
104 | };
|
---|
105 |
|
---|
106 | #define DENTSIZE (sizeof (struct dirent))
|
---|
107 |
|
---|
108 | #define F_RDONLY 0x01u /* Read only file */
|
---|
109 | #define F_HIDDEN 0x02u /* Hidden file */
|
---|
110 | #define F_SYSTEM 0x04u /* System file */
|
---|
111 | #define F_VOLUME 0x08u /* Volume label */
|
---|
112 | #define F_SUBDIR 0x10u /* Sub-directory */
|
---|
113 | #define F_ARCHIV 0x20u /* Archived */
|
---|
114 |
|
---|
115 | /*
|
---|
116 | ============================================================================
|
---|
117 | fcb -- File Control Block
|
---|
118 | ============================================================================
|
---|
119 | */
|
---|
120 |
|
---|
121 | struct fcb { /* file control block */
|
---|
122 |
|
---|
123 | struct dirent de; /* directory entry image for file */
|
---|
124 | uint16_t modefl; /* fcb flags */
|
---|
125 | int16_t clsec; /* current sector in cluster */
|
---|
126 | int16_t curcls; /* current cluster */
|
---|
127 | int16_t offset; /* current offset into sector */
|
---|
128 | int16_t curlsn; /* current logical sector number in file */
|
---|
129 | int16_t curdsn; /* current logical sector number on disk */
|
---|
130 | int32_t curlen; /* current file length in bytes */
|
---|
131 | int16_t asects; /* allocated file length in sectors */
|
---|
132 | };
|
---|
133 |
|
---|
134 | #define FC_EOF 0x8000u /* end of file */
|
---|
135 | #define FC_BAD 0x4000u /* bad FAT entry encountered */
|
---|
136 | #define FC_ERR 0x2000u /* error encountered */
|
---|
137 | #define FC_OPN 0x1000u /* file open */
|
---|
138 |
|
---|
139 | #define FC_CR 0x0800u /* create mode */
|
---|
140 | #define FC_AP 0x0400u /* append mode */
|
---|
141 | #define FC_WR 0x0200u /* write mode */
|
---|
142 | #define FC_RD 0x0100u /* read mode */
|
---|
143 |
|
---|
144 | #define FC_EX 0x0080u /* exclusive mode */
|
---|
145 | #define FC_TR 0x0040u /* truncate mode */
|
---|
146 | #define FC_NB 0x0020u /* non-blocking mode */
|
---|
147 | #define FC_BF 0x0010u /* binary file mode */
|
---|
148 |
|
---|
149 | #define FC_RW (FC_RD | FC_WR) /* read-write mode */
|
---|
150 |
|
---|
151 | /*
|
---|
152 | ============================================================================
|
---|
153 | BIOS and XBIOS function call formats
|
---|
154 | ------------------------------------
|
---|
155 |
|
---|
156 | In the list below, .W and .L refer to the size of the parameter
|
---|
157 | passed to the BIOS/XBIOS routine.
|
---|
158 |
|
---|
159 | The first parameter is always the function code, "code.W".
|
---|
160 |
|
---|
161 | BIOS calls are:
|
---|
162 | ---------------
|
---|
163 |
|
---|
164 | BIOS(B_RDAV, unit.W);
|
---|
165 | BIOS(B_GETC, unit.W);
|
---|
166 | BIOS(B_PUTC, unit.W, c.W);
|
---|
167 | BIOS(B_RDWR, rwflag.W, buf.L, count.W, recno.W, dev.W);
|
---|
168 | BIOS(B_SETV, vecnum.W, vecadr.L);
|
---|
169 | BIOS(B_GBPB, dev.W);
|
---|
170 | BIOS(B_THRE, unit.W);
|
---|
171 | BIOS(B_MCHG, unit.W);
|
---|
172 | BIOS(B_DMAP);
|
---|
173 |
|
---|
174 | XBIOS calls are:
|
---|
175 | ----------------
|
---|
176 |
|
---|
177 | XBIOS(X_PIOREC, unit.W)
|
---|
178 | XBIOS(X_SETPRT, unit.W, mode.W, baud.W, cfr0.W, cr1.W)
|
---|
179 | XBIOS(X_FLOPRD, buf.L, filler.L, dev.W, sector.W, track.W,
|
---|
180 | side.W, count.W)
|
---|
181 | XBIOS(X_FLOPWR, buf.L, filler.L, dev.W, sector.W, track.W,
|
---|
182 | side.W, count.W)
|
---|
183 | XBIOS(X_FORMAT, buf.L, filler.L, dev.W, spt.W, track.W, side.W,
|
---|
184 | intrlv.W, magic.L, virgin.W)
|
---|
185 | XBIOS(X_VERIFY, buf.L, filler.L, dev.W, sector.W, track.W,
|
---|
186 | side.W, count.W)
|
---|
187 | XBIOS(X_PRBOOT, buf.L, serial.L, type.W, execflag.W)
|
---|
188 | XBIOS(X_RANDOM)
|
---|
189 | XBIOS(X_ANALOG)
|
---|
190 | XBIOS(X_CLRAFI)
|
---|
191 | ============================================================================
|
---|
192 | */
|
---|