source: buchla-68k/orig/LATTICE/DOS.H@ a838f5b

Last change on this file since a838f5b was 3ae31e9, checked in by Thomas Lopatic <thomas@…>, 8 years ago

Imported original source code.

  • Property mode set to 100755
File size: 5.2 KB
Line 
1/**
2*
3* This header file supplies information needed to interface with the
4* particular operating system and C compiler being used.
5*
6**/
7
8
9/**
10*
11* The following symbols define which processor is being used.
12*
13* I8080 Intel 8080
14* I8085 Intel 8085
15* Z80 Zilog Z80
16* I8086 Intel 8086 or 8088
17* M68000 Motorola 68000
18* GA16 General Automation 16-bit mini
19* IBMPC IBM Personal Computer (also sets I8086)
20*/
21
22
23/**
24*
25* The following symbols specify which operating system is being used.
26*
27* CPM Any CP/M OS
28* CPM80 CP/M for Intel 8080 or Zilog Z80
29* CPM86 CP/M for Intel 8086
30* CPM68 CP/M for Motorola 68000
31* MSDOS Microsoft's MSDOS
32*
33* Note: CPM will be set to 1 for any of the above.
34*
35* UNIX "Standard" UNIX
36* QUNIX Quantum's QUNIX OS
37* MIBS General Automation's MIBS OS
38* OASIS OASIS OS
39* PICK PICK OS
40*
41*/
42
43#if CPM80
44#define CPM 1
45#endif
46#if CPM86
47#define CPM 1
48#endif
49#if CPM68
50#define CPM 1
51#endif
52#if MSDOS
53#define CPM 1
54#endif
55
56
57/**
58*
59* The following definitions specify the particular C compiler being used.
60*
61* LATTICE Lattice C compiler
62* BDS BDS C compiler
63* BTL Bell Labs C compiler or equivalent
64* MANX MANX Aztec C compiler
65*
66*/
67#define LATTICE 1
68
69
70
71/**
72*
73* The following type definitions take care of the particularly nasty
74* machine dependency caused by the unspecified handling of sign extension
75* in the C language. When converting "char" to "int" some compilers
76* will extend the sign, while others will not. Both are correct, and
77* the unsuspecting programmer is the loser. For situations where it
78* matters, the new type "byte" is equivalent to "unsigned char".
79*
80*/
81#if LATTICE
82typedef char byte;
83#endif
84
85#if BDS
86#define byte char
87#endif
88
89#if BTL
90typedef unsigned char byte;
91#endif
92
93#if MANX
94#define byte char
95#endif
96
97/**
98*
99* Miscellaneous definitions
100*
101*/
102#define SECSIZ 128 /* disk sector size */
103#if CPM
104#define DMA (char *)0x80 /* disk buffer address */
105#endif
106
107/**
108*
109* The following structure is a File Control Block. Operating systems
110* with CPM-like characteristics use the FCB to store information about
111* a file while it is open.
112*
113*/
114struct FCB
115 {
116 char fcbdrv; /* drive code */
117 char fcbnam[8]; /* file name */
118 char fcbext[3]; /* file name extension */
119#if MSDOS
120 short fcbcb; /* current block number */
121 short fcblrs; /* logical record size */
122 long fcblfs; /* logical file size */
123 short fcbdat; /* create/change date */
124 char fcbsys[10]; /* reserved */
125 char fcbcr; /* current record number */
126 long fcbrec; /* random record number */
127#else
128 char fcbexn; /* extent number */
129 char fcbs1; /* reserved */
130 char fcbs2; /* reserved */
131 char fcbrc; /* record count */
132 char fcbsys[16]; /* reserved */
133 char fcbcr; /* current record number */
134 short fcbrec; /* random record number */
135 char fcbovf; /* random record overflow */
136#endif
137 };
138
139#define FCBSIZ sizeof(struct FCB)
140
141/**
142*
143* The following symbols define the sizes of file names and node names.
144*
145*/
146#if CPM
147#if MSDOS
148#define FNSIZE 16
149#define FMSIZE 64
150#else
151#define FNSIZE 16 /* maximum file node name size */
152#define FMSIZE 16 /* maximum file name size */
153#endif
154#endif
155
156#if UNIX
157#define FNSIZE 16
158#define FMSIZE 64
159#endif
160
161
162/**
163*
164* The following structures define the 8086 registers that are passed to
165* various low-level operating system service functions.
166*
167*/
168#if I8086
169struct XREG
170 {
171 short ax,bx,cx,dx,si,di;
172 };
173
174struct HREG
175 {
176 byte al,ah,bl,bh,cl,ch,dl,dh;
177 };
178
179union REGS
180 {
181 struct XREG x;
182 struct HREG h;
183 };
184
185struct SREGS
186 {
187 short es,cs,ss,ds;
188 };
189#endif
190
191/**
192*
193* The following symbols define the code numbers for the various service
194* functions.
195*
196*/
197#if MSDOS
198#define SVC_DATE 0x2a /* get date */
199#define SVC_TIME 0x2c /* get time */
200#endif
201
202/**
203*
204* The following codes are used to open files in various modes.
205*
206*/
207#if LATTICE
208#define OPENR 0x8000 /* open for reading */
209#define OPENW 0x8001 /* open for writing */
210#define OPENU 0x8002 /* open for read/write */
211#define OPENC 0x8001 /* create and open for writing */
212#else
213#define OPENR 0
214#define OPENW 1
215#define OPENU 2
216#endif
217
218/**
219*
220* The following codes are returned by the low-level operating system service
221* calls. They are usually placed into _oserr by the OS interface functions.
222*
223*/
224#if MSDOS
225#define E_FUNC 1 /* invalid function code */
226#define E_FNF 2 /* file not found */
227#define E_PNF 3 /* path not found */
228#define E_NMH 4 /* no more file handles */
229#define E_ACC 5 /* access denied */
230#define E_IFH 6 /* invalid file handle */
231#define E_MCB 7 /* memory control block problem */
232#define E_MEM 8 /* insufficient memory */
233#define E_MBA 9 /* invalid memory block address */
234#define E_ENV 10 /* invalid environment */
235#define E_FMT 11 /* invalid format */
236#define E_IAC 12 /* invalid access code */
237#define E_DATA 13 /* invalid data */
238#define E_DRV 15 /* invalid drive code */
239#define E_RMV 16 /* remove denied */
240#define E_DEV 17 /* invalid device */
241#define E_NMF 18 /* no more files */
242#endif
243
244struct MELT
245{
246 struct MELT *fwd;
247#if FPTR
248 unsigned size; /* number of MELTs in the block */
249#else
250 long size;
251#endif
252};
253
254#define MELTSIZE sizeof (struct MELT)
255
256
Note: See TracBrowser for help on using the repository browser.