1 /* pro_defs.h: various global defnitions
2 
3    Copyright (c) 1997-2003, Tarik Isani (xhomer@isani.org)
4 
5    This file is part of Xhomer.
6 
7    Xhomer is free software; you can redistribute it and/or modify
8    it under the terms of the GNU General Public License version 2
9    as published by the Free Software Foundation.
10 
11    Xhomer is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15 
16    You should have received a copy of the GNU General Public License
17    along with Xhomer; if not, write to the Free Software
18    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19 */
20 
21 
22 #include "pro_version.h"
23 #include "pro_config.h"
24 
25 /* This macro handles byte and word write access to "reg" with
26    write-enable mask "we" */
27 
28 #define WRITE_WB(reg, we, access) \
29   if ((access) == WRITEB) (reg) = (pa & 1)? \
30     (((reg) & ~(we)) \
31     | ((data << 8) & (we)) | ((reg) & 0377)): \
32     (((reg) & ~(we)) \
33     | ((data & 0377) & (we)) | ((reg) & ~0377)); \
34   else \
35     reg = ((reg) & ~(we)) \
36           | (data & (we))
37 
38 
39 /* This one handles only word accesses */
40 
41 #define WRITE_W(reg, we) \
42   reg = ((reg) & ~(we)) \
43         | (data & (we))
44 
45 
46 /* This macro sets a single bit in a register */
47 
48 #define pro_setbit(reg, bit) \
49   reg = reg | (1 << bit)
50 
51 
52 /* This macro clears a single bit in a register */
53 
54 #define pro_clrbit(reg, bit) \
55   reg = reg & ~(1 << bit)
56 
57 
58 /* Uses scroll register offset to calculate video buffer address */
59 
60 #define vmem(vaddr) \
61   (((vaddr) + pro_vid_y_offset) & PRO_VID_VADDR_MASK)
62 
63 /* Uses frame buffer address to calculate cache tag address */
64 
65 #define cmem(index) \
66   ((index) >> PRO_VID_CLS)
67 
68 
69 /* Serial line control structure */
70 
71 struct serctrl
72 	{
73 	  int	stop;
74 	  int	parity;
75 	  int	penable;
76 	  int	cs;
77 	  int	ibaud;
78 	  int	obaud;
79 	  int	dtr;
80 	  int	dsr;
81 	  int	rts;
82 	  int	cts;
83 	  int	ri;
84 	  int	cd;
85 	  int	ibrk;
86 	  int	obrk;
87 	  int	perror;
88 	};
89 
90 /* Entry points into serial I/O routines */
91 
92 struct sercall
93 	{
94 	  int	(*get)();
95 	  int	(*put)();
96 	  void	(*ctrl_get)();
97 	  void	(*ctrl_put)();
98 	  void	(*reset)();
99 	  void	(*exit)();
100 	};
101 
102 
103 /* System configuration */
104 
105 #if (PRO_BASE_1M == 0)
106 #define PRO_CSR_INIT		0025		/* 256K */
107 #else
108 #define PRO_CSR_INIT		0037		/* 1M */
109 #endif
110 
111 #if (PRO_EBO_PRESENT == 1)
112 #define PRO_VID_CSR		0000000
113 #define PRO_VID_NUMPLANES	3
114 #else
115 #define PRO_VID_CSR		0020000
116 #define PRO_VID_NUMPLANES	1
117 #endif
118 
119 /* CTI Bus Board IDs */
120 
121 #define PRO_ID_RD		0000401
122 #define PRO_ID_RX		0000004
123 #define PRO_ID_VID		0177402
124 #define PRO_ID_EBO		0177403
125 #define PRO_ID_MEM		0000034
126 
127 /* Option module present register */
128 
129 #define PRO_OMP_RD		0001	/* RD50 in slot 1 */
130 #define PRO_OMP_RX		0002	/* RX50 in slot 2 */
131 #define PRO_OMP_VID		0004	/* Video in slot 3 */
132 #define PRO_OMP_EBO		0010	/* Extended bitmap in slot 4 */
133 #define PRO_OMP_MEM		0020	/* Memory in slot 5 */
134 
135 #define PRO_OMP		(PRO_RD_PRESENT*PRO_OMP_RD \
136 			| PRO_RX_PRESENT*PRO_OMP_RX \
137 			| PRO_VID_PRESENT*PRO_OMP_VID \
138 			| PRO_EBO_PRESENT*PRO_OMP_EBO \
139 			| PRO_MEM_PRESENT*PRO_OMP_MEM)
140 
141 
142 /* Register writeable bit definitions */
143 
144 /* System module */
145 
146 #define PRO_LED_W		0000017
147 #define PRO_CSR_W		0000200
148 #define PRO_BATRAM_W		0000377
149 
150 /* RX50 controller */
151 
152 #define PRO_RX_CSR0_C_W		0000377
153 #define PRO_RX_CSR1_C_W		0000377
154 #define PRO_RX_CSR2_C_W		0000377
155 #define PRO_RX_CSR3_C_W		0000377
156 #define PRO_RX_CSR5_C_W		0000377
157 
158 /* RD controller */
159 
160 #define PRO_RD_EP_W		0000377
161 #define PRO_RD_SEC_W		0177437
162 #define PRO_RD_CYL_W		0001777
163 #define PRO_RD_HEAD_W		0000007
164 #define PRO_RD_S2C_W		0000377
165 
166 /* Video board */
167 
168 #define PRO_VID_CSR_W		0043503
169 #define PRO_VID_P1C_W		0000077
170 #define PRO_VID_OPC_W		0037477
171 #define PRO_VID_CMP_W		0177777
172 #define PRO_VID_SCL_W		0000377
173 #define PRO_VID_X_W		0001777
174 #define PRO_VID_Y_W		0000377
175 #define PRO_VID_CNT_W		0177777
176 #define PRO_VID_PAT_W		0177777
177 #define PRO_VID_MBR_W		0000177
178 
179 /* Realtime clock */
180 
181 #define PRO_CLK_CSR0_W		0000177
182 #define PRO_CLK_CSR1_W		0000377
183 #define PRO_CLK_AL_SEC_W	0000377
184 #define PRO_CLK_AL_MIN_W	0000377
185 #define PRO_CLK_AL_HOUR_W	0000377
186 
187 /* Keyboard and printer controllers */
188 
189 #define PRO_2661_DATA_W		0000377
190 #define PRO_2661_MR1_W		0000377
191 #define PRO_2661_MR2_W		0000377
192 #define PRO_2661_CMD_W		0000357
193 
194 /* Communication port controller */
195 
196 #define PRO_COM_W		0000377
197 
198 /* Memory expansion board */
199 
200 #define PRO_MEM_CMD_W		0000207
201 
202 /* Clock constants */
203 
204 #define PRO_CLK_AL_X		0300		/* alarm "don't care" bits */
205 #define PRO_CLK_UIP		0200		/* update in progress */
206 #define PRO_CLK_SET		0200		/* set realtime clock */
207 #define PRO_CLK_PIE		0100		/* periodic int enable */
208 #define PRO_CLK_AIE		0040		/* alarm int enable */
209 #define PRO_CLK_UIE		0020		/* update-ended int enable */
210 #define PRO_CLK_IRQF		0200		/* interrupt request flag */
211 #define PRO_CLK_PF		0100		/* periodic interrupt flag */
212 #define PRO_CLK_AF		0040		/* alarm flag */
213 #define PRO_CLK_UF		0020		/* update ended flag */
214 #define PRO_CLK_VRT		0200		/* valid RAM and time */
215 #define PRO_CLK_RS		0017		/* rate select bits */
216 #define PRO_CLK_DM		0004		/* data mode */
217 #define PRO_CLK_24H		0002		/* 24 hour mode */
218 #define PRO_CLK_RTC_SWITCH	6000000		/* number of instructions simulated
219 						   before switching to realtime mode */
220 #define PRO_CLK_RTC_CATCHUP	1000		/* time until RTC catchup interrupt */
221 
222 
223 /* Keyboard and printer controller constants */
224 
225 #define PRO_2661_RD		0002		/* receiver done */
226 #define PRO_2661_TR		0001		/* transmitter ready */
227 #define PRO_2661_OM		0300		/* operating mode */
228 #define PRO_2661_OM1		0200		/* operating mode */
229 #define PRO_2661_OM0		0100		/* operating mode */
230 #define PRO_2661_RXEN		0004		/* receiver enable */
231 #define PRO_2661_TXEN		0001		/* transmitter enable */
232 #define PRO_2661_LOOPBACK	0200		/* local loopback */
233 #define PRO_2661_NORMAL		0000		/* normal operation */
234 #define PRO_2661_DSR		0200		/* DSR input pin */
235 #define PRO_2661_DTR		0002		/* DTR output pin */
236 #define PRO_2661_FB		0010		/* force break */
237 #define PRO_2661_CL		0014		/* character length */
238 #define PRO_2661_SBL		0300		/* stop bit length */
239 #define PRO_2661_PT		0040		/* parity type */
240 #define PRO_2661_PC		0020		/* parity control */
241 #define PRO_2661_BAUD		0017		/* baud */
242 
243 /* Maintenance port constants */
244 
245 #define PRO_MAINT_RD		0200		/* receiver done */
246 #define PRO_MAINT_TR		0200		/* transmitter ready */
247 
248 /* Communication port constants */
249 
250 #define PRO_COM_RP		0007	/* register pointer */
251 #define PRO_COM_CMD		0070
252 #define PRO_COM_EOI		0070	/* end of interrupt */
253 #define PRO_COM_VEC		0343	/* interrupt vector mask */
254 #define PRO_COM_IR_RCV		0030	/* receiver interrupt */
255 #define PRO_COM_IR_XMIT		0020	/* transmitter interrupt (XXX manual says 0000) */
256 #define PRO_COM_IR_NONE		0034	/* no interrupt pending */
257 #define PRO_COM_RIE		0030	/* receiver interrupt enable */
258 #define PRO_COM_TIE		0002	/* transmitter interrupt enable */
259 #define PRO_COM_RCL1		0200	/* receiver character length 1 */
260 #define PRO_COM_RCL0		0100	/* receiver character length 0 */
261 #define PRO_COM_RXEN		0001	/* receiver enable */
262 #define PRO_COM_SB		0014	/* stop bits */
263 #define PRO_COM_EO		0002	/* even/odd parity */
264 #define PRO_COM_PEN		0001	/* parity enable */
265 #define PRO_COM_SBRK		0020	/* send break */
266 #define PRO_COM_TXEN		0010	/* transmitter enable */
267 #define PRO_COM_MM		0200	/* maintenance mode */
268 #define PRO_COM_DTR		0020	/* dtr */
269 #define PRO_COM_RTS		0010	/* rts */
270 #define PRO_COM_TBR		0360	/* transmitter baud rate */
271 #define PRO_COM_RBR		0017	/* receiver baud rate */
272 #define PRO_COM_TU		0100	/* transmitter underrun */
273 #define PRO_COM_TBMT		0004	/* transmit buffer empty */
274 #define PRO_COM_INTP		0002	/* interrupt pending */
275 #define PRO_COM_RXCA		0001	/* receive character available */
276 #define PRO_COM_FE		0100	/* receiver framing error */
277 #define PRO_COM_RXPE		0020	/* receiver parity error */
278 #define PRO_COM_AS		0001	/* all sent */
279 #define PRO_COM_DSR		0200	/* dsr */
280 #define PRO_COM_RI		0100	/* ri */
281 #define PRO_COM_CTS		0040	/* cts */
282 #define PRO_COM_CD		0020	/* cd */
283 #define PRO_COM_INTQ_DEPTH	16	/* com pending interrupt queue depth */
284 #define PRO_COM_DATAQ_DEPTH	6	/* com read data queue depth */
285 
286 
287 /* Interrupt controller preselect codes */
288 
289 #define PRO_PRESEL_IMR		0
290 #define PRO_PRESEL_ACR		1
291 #define PRO_PRESEL_RESP		2
292 
293 #define PRO_NO_INT		255
294 
295 #define PRO_INT_MM		0200	/* master mask bit in mode reg */
296 #define PRO_INT_IM		0004	/* interrupt mode bit in mode reg */
297 #define PRO_INT_VS		0002	/* vector selection bit in mode reg */
298 #define PRO_INT_PM		0001	/* priority mode bit in mode reg */
299 
300 /* Interrupt codes */
301 /* MSB is controller number, LSB is interrupt bit */
302 
303 #define	PRO_INT_KB_RCV		0x0002	/* keyboard receiver */
304 #define	PRO_INT_KB_XMIT		0x0004	/* keyboard transmitter */
305 #define	PRO_INT_COM		0x0008	/* communications port */
306 #define	PRO_INT_MODEM		0x0010	/* modem controls change */
307 #define	PRO_INT_PTR_RCV		0x0020	/* printer receiver */
308 #define	PRO_INT_PTR_XMIT	0x0040	/* printer transmitter */
309 #define	PRO_INT_CLK		0x0080	/* clock */
310 
311 #define	PRO_INT_0A		0x0101	/* option module 0, int A */
312 #define	PRO_INT_1A		0x0102	/* option module 1, int A */
313 #define	PRO_INT_2A		0x0104	/* option module 2, int A */
314 #define	PRO_INT_3A		0x0108	/* option module 3, int A */
315 #define	PRO_INT_4A		0x0110	/* option module 4, int A */
316 #define	PRO_INT_5A		0x0120	/* option module 5, int A */
317 
318 #define	PRO_INT_0B		0x0201	/* option module 0, int B */
319 #define	PRO_INT_1B		0x0202	/* option module 1, int B */
320 #define	PRO_INT_2B		0x0204	/* option module 2, int B */
321 #define	PRO_INT_3B		0x0208	/* option module 3, int B */
322 #define	PRO_INT_4B		0x0210	/* option module 4, int B */
323 #define	PRO_INT_5B		0x0220	/* option module 5, int B */
324 
325 /* Event Queue codes */
326 
327 #define PRO_EQ_BITS		19	/* event queue size (2^19 = 512K) */
328 #define PRO_EQ_SIZE		(1<<PRO_EQ_BITS)
329 #define PRO_EQ_MASK		(PRO_EQ_SIZE - 1)
330 
331 #define PRO_EQ_CLK_IPS		(40*8192)	/* SOBs/sec */
332 #define PRO_EQ_CLK_UF		((PRO_EQ_CLK_IPS*300)/1000000)
333 				/* update-ended event - 300 uS */
334 
335 /* XXX make these more accurate */
336 
337 #define PRO_EQ_PAL		9000	/* instructions/PAL (50 Hz) field */
338 #define PRO_EQ_NTSC		7500	/* instructions/NTSC (60 Hz) field */
339 #define PRO_EQ_CMD		1	/* time to complete video command */
340 #define PRO_EQ_KB		2	/* loopback test delay */
341 #define PRO_EQ_KB_POLL		10000	/* keyboard polling interval */
342 #define PRO_EQ_KB_RETRY		1000	/* write retry delay */
343 #define PRO_EQ_PTR		2	/* loopback test delay */
344 #define PRO_EQ_PTR_POLL		100	/* printer polling interval */
345 #define PRO_EQ_PTR_RETRY	1000	/* write retry delay */
346 #define PRO_EQ_COM		3	/* loopback test delay */
347 #define PRO_EQ_COM_POLL		100	/* communication port polling interval */
348 #define PRO_EQ_COM_RETRY	1000	/* write retry delay */
349 #define PRO_EQ_RD		5	/* hard disk read/write delay (at least 5 for diagnostics) */
350 
351 
352 #define PRO_EQ_NUM_EVENTS	11
353 
354 #define PRO_EVENT_CLK		1
355 #define PRO_EVENT_CLK_UF	2
356 #define PRO_EVENT_VID		3
357 #define PRO_EVENT_VID_CMD	4
358 #define PRO_EVENT_KB		5
359 #define PRO_EVENT_KB_POLL	6
360 #define PRO_EVENT_PTR		7
361 #define PRO_EVENT_PTR_POLL	8
362 #define PRO_EVENT_COM		9
363 #define PRO_EVENT_COM_POLL	10
364 #define PRO_EVENT_RD		11
365 
366 /* Video codes */
367 
368 #define PRO_VID_P1_VME		0000040		/* plane 1 video memory enable */
369 #define PRO_VID_P2_VME		0000040		/* plane 2 video memory enable */
370 #define PRO_VID_P3_VME		0020000		/* plane 3 video memory enable */
371 
372 #define PRO_VID_VADDR_MASK	0037777		/* mask for 14 address */
373 #define PRO_VID_MEMSIZE		32*1024		/* size of one plane buffer */
374 #define PRO_VID_MEMWIDTH	1024		/* width of entire frame buffer */
375 #define PRO_VID_MEMHEIGHT	256		/* height of entire frame buffer */
376 #define PRO_VID_SCRWIDTH	1024		/* screen width */
377 #define PRO_VID_SCRHEIGHT	240		/* screen height */
378 
379 #define PRO_VID_SKIP		0		/* number of window update cycles to skip */
380 
381 #define PRO_VID_CLS		6		/* frame buffer cache line size (0-6) */
382 #define PRO_VID_CLS_PIX		(16 << PRO_VID_CLS)		/* cache line size in pixels */
383 
384 #define PRO_VID_P1_HRS		0000030		/* plane 1 horizontal resolution select */
385 #define PRO_VID_P1_1024		0000000		/* plane 1 1024 pixel resolution */
386 #define PRO_VID_P1_OFF		0000030		/* plane 1 display off */
387 
388 #define PRO_VID_DIE		0040000		/* done interrupt enable */
389 #define PRO_VID_OC1		0001000		/* operation class bit 1, plane 1 */
390 #define PRO_VID_OC0		0000400		/* operation class bit 0, plane 1 */
391 #define PRO_VID_EFIE		0000100		/* end of frame interrupt enable */
392 #define PRO_VID_LM		0000001		/* line mode - NTSC (0), PAL (1) */
393 #define PRO_VID_TD		0100000		/* transfer done */
394 #define PRO_VID_P1_OP		0000007		/* plane 1 logical operation select */
395 #define PRO_VID_P2_OP		0000007		/* plane 2 logical operation select */
396 #define PRO_VID_P3_OP		0003400		/* plane 3 logical operation select */
397 #define PRO_VID_CME		0002000		/* color map enable */
398 #define PRO_VID_R_MASK		0000340		/* red mask */
399 #define PRO_VID_G_MASK		0000034		/* green mask */
400 #define PRO_VID_B_MASK		0000003		/* blue mask */
401 #define PRO_VID_INDEX		0003400		/* colormap index */
402 #define PRO_VID_RGB		0000377		/* colormap rgb mask */
403 
404 /* Pixel operations */
405 
406 #define PRO_VID_PIX_NOP		000		/* nop */
407 #define PRO_VID_PIX_XOR		001		/* xor */
408 #define PRO_VID_PIX_SET		002		/* set pixel */
409 #define PRO_VID_PIX_CLR		003		/* clear pixel */
410 #define PRO_VID_PIX_REP		004		/* replace pixel */
411 
412 /* Bit mode logical operations */
413 
414 #define PRO_VID_BM_NOP		00		/* nop */
415 #define PRO_VID_BM_XOR		01		/* xor */
416 #define PRO_VID_BM_MOVE		02		/* move pattern to screen  */
417 #define PRO_VID_BM_NMOVE	03		/* move pattern complement to screen  */
418 #define PRO_VID_BM_SETPAT	04		/* bit set pattern to screen  */
419 #define PRO_VID_BM_CLRPAT	05		/* bit clear pattern to screen  */
420 #define PRO_VID_BM_CLRBIT	06		/* bit clear */
421 #define PRO_VID_BM_SETBIT	07		/* bit set */
422 
423 /* Word mode logical operations */
424 
425 #define PRO_VID_WM_NOP		00		/* nop */
426 #define PRO_VID_WM_COM		01		/* complement screen */
427 #define PRO_VID_WM_MOVE		02		/* move pattern to screen */
428 #define PRO_VID_WM_NMOVE	03		/* move pattern complement to screen */
429 #define PRO_VID_WM_S1		05		/* shift screen 1 bit */
430 #define PRO_VID_WM_S2		06		/* shift screen 2 bits */
431 #define PRO_VID_WM_S4		07		/* shift screen 4 bits */
432 
433 /* RX50 controller */
434 
435 /* Version 11 is the first that has (undocumented) format capability */
436 
437 #define PRO_RX_VERSION		0001		/* version of RX50 controller */
438 
439 #define PRO_RX_EXTEND		0007		/* extended function */
440 #define PRO_RX_FUNC		0160		/* function */
441 #define PRO_RX_DONE		0010		/* done bit */
442 #define PRO_RX_DRIVE		0004		/* drive select */
443 #define PRO_RX_DISK		0002		/* disk select */
444 #define PRO_RX_DISKNUM		0006		/* msb drive select, lsb disk select */
445 
446 /* function codes */
447 
448 #define PRO_RX_CMD_STAT		00		/* read status */
449 #define PRO_RX_CMD_MAINT	01		/* maintenance mode */
450 #define PRO_RX_CMD_RESTORE	02		/* restore drive */
451 #define PRO_RX_CMD_INIT		03		/* rx init */
452 #define PRO_RX_CMD_READ		04		/* read sector */
453 #define PRO_RX_CMD_EXTEND	05		/* extended function */
454 #define PRO_RX_CMD_ADDR		06		/* read address */
455 #define PRO_RX_CMD_WRITE	07		/* write sector */
456 
457 /* extended function codes */
458 
459 #define PRO_RX_CMD_RETRY	00		/* read with retries */
460 #define PRO_RX_CMD_DELETE	01		/* write with deleted data mark */
461 #define PRO_RX_CMD_RFORMAT	02		/* report format */
462 #define PRO_RX_CMD_SFORMAT	03		/* set format */
463 #define PRO_RX_CMD_VERSION	04		/* report version number */
464 #define PRO_RX_CMD_COMPARE	05		/* read and compare */
465 
466 /* RD controller */
467 
468 #define PRO_RD_OPENDED		0000001		/* operation ended */
469 #define PRO_RD_RESET		0000010		/* reset */
470 #define PRO_RD_DRQ		0000200		/* data transfer request */
471 #define PRO_RD_BUSY		0100000		/* busy */
472 
473 #define PRO_RD_IDNF		0010000		/* ID not found error */
474 #define PRO_RD_ERRORS		0177400		/* mask for all errors */
475 
476 #define PRO_RD_ERROR		0000400		/* error status */
477 #define PRO_RD_DATAREQ		0004000		/* data request */
478 #define PRO_RD_SEEKC		0010000		/* seek complete */
479 #define PRO_RD_WFAULT		0020000		/* write fault */
480 #define PRO_RD_DRDY		0040000		/* drive ready */
481 
482 #define PRO_RD_SEC		0000377		/* sector mask */
483 
484 /* RD commands */
485 
486 #define PRO_RD_CMD		0377
487 #define PRO_RD_CMD_RESTORE	0020
488 #define PRO_RD_CMD_READ		0040
489 #define PRO_RD_CMD_WRITE	0060
490 #define PRO_RD_CMD_FORMAT	0120
491 
492 /* LK201 Keyboard constants */
493 
494 #define PRO_LK201_BELL_PITCH	2000		/* bell pitch in Hz */
495 #define PRO_LK201_BELL_DURATION	125		/* bell duration in ms */
496 
497 /* Serial port assignments */
498 
499 #define PRO_SER_NUMDEV		3
500 
501 #define PRO_SER_KB		0
502 #define PRO_SER_PTR		1
503 #define PRO_SER_COM		2
504 
505 /* Misc codes */
506 
507 #define PRO_NOREG		0177777		/* response for undefined read */
508 #define PRO_NOCHAR		256		/* no character */
509 #define PRO_SUCCESS		1		/* success status code */
510 #define PRO_FAIL		-1		/* failure status code */
511 
512 /* Video overlay */
513 
514 #define PRO_OVERLAY_MAXA	128		/* max alpha value */
515 #define PRO_OVERLAY_A		80		/* alpha value for printing */
516 
517 /* Serial I/O */
518 
519 #define PRO_SERIAL_WDEPTH	2		/* serial port write FIFO depth */
520 
521 /* Function Protoypes */
522 
523 /* pro_init.c */
524 
525 #include <stdio.h> /* For FILE */
526 
527 #ifdef TRACE
528 GLOBAL int trace(void);
529 #endif
530 #ifdef IOTRACE
531 GLOBAL FILE *iotfptr;
532 #endif
533 GLOBAL struct sercall *pro_la50device;
534 GLOBAL struct sercall *pro_kb;
535 GLOBAL struct sercall *pro_ptr;
536 GLOBAL struct sercall *pro_com;
537 GLOBAL int pro_la50device_port;
538 GLOBAL int pro_kb_port;
539 GLOBAL int pro_ptr_port;
540 GLOBAL int pro_com_port;
541 GLOBAL void pro_reset(void);
542 GLOBAL void pro_exit(void);
543 
544 /* pro_2661kb.c */
545 
546 GLOBAL void pro_2661kb_eq(void);
547 GLOBAL void pro_2661kb_poll_eq(void);
548 GLOBAL int pro_2661kb_rd(int pa);
549 GLOBAL void pro_2661kb_wr(int data, int pa, int access);
550 GLOBAL void pro_2661kb_reset(void);
551 GLOBAL void pro_2661kb_open(void);
552 
553 /* pro_2661ptr.c */
554 
555 GLOBAL void pro_2661ptr_eq(void);
556 GLOBAL void pro_2661ptr_poll_eq(void);
557 GLOBAL int pro_2661ptr_rd(int pa);
558 GLOBAL void pro_2661ptr_wr(int data, int pa, int access);
559 GLOBAL void pro_2661ptr_reset(void);
560 GLOBAL void pro_2661ptr_open(void);
561 
562 /* pro_maint.c */
563 
564 GLOBAL int pro_maint_mode;
565 GLOBAL int pro_maint_rd(int pa);
566 GLOBAL void pro_maint_wr(int data, int pa, int access);
567 
568 /* pro_eq.c */
569 
570 GLOBAL void pro_eq_sched(int eventnum, int interval);
571 GLOBAL int pro_eq_ptr;
572 GLOBAL unsigned char PRO_EQ[PRO_EQ_SIZE];
573 GLOBAL void (*pro_event[PRO_EQ_NUM_EVENTS+1])(void);
574 GLOBAL void pro_eq_reset(void);
575 
576 /* pro_int.c */
577 
578 GLOBAL int pro_int_irr[4];
579 GLOBAL void pro_int_set(int intnum);
580 GLOBAL int pro_int_ack(void);
581 GLOBAL int pro_int_rd(int pa);
582 GLOBAL void pro_int_wr(int data, int pa, int access);
583 GLOBAL void pro_int_reset(void);
584 
585 /* pro_null.c */
586 
587 GLOBAL struct sercall pro_null;
588 GLOBAL int pro_null_get(int dev);
589 GLOBAL int pro_null_put(int dev, int schar);
590 GLOBAL void pro_null_ctrl_get(int dev, struct serctrl *sctrl);
591 GLOBAL void pro_null_ctrl_put(int dev, struct serctrl *sctrl);
592 GLOBAL void pro_null_reset(int dev, int portnum);
593 GLOBAL void pro_null_exit(int dev);
594 
595 /* pro_digipad.c */
596 
597 GLOBAL struct sercall pro_digipad;
598 GLOBAL int pro_digipad_get(int dev);
599 GLOBAL int pro_digipad_put(int dev, int schar);
600 GLOBAL void pro_digipad_ctrl_get(int dev, struct serctrl *sctrl);
601 GLOBAL void pro_digipad_ctrl_put(int dev, struct serctrl *sctrl);
602 GLOBAL void pro_digipad_reset(int dev, int portnum);
603 GLOBAL void pro_digipad_exit(int dev);
604 
605 /* pro_lk201.c */
606 
607 GLOBAL struct sercall pro_lk201;
608 GLOBAL int pro_lk201_get(int dev);
609 GLOBAL int pro_lk201_put(int dev, int key);
610 GLOBAL void pro_lk201_ctrl_get(int dev, struct serctrl *sctrl);
611 GLOBAL void pro_lk201_ctrl_put(int dev, struct serctrl *sctrl);
612 GLOBAL void pro_lk201_reset(int dev, int portnum);
613 GLOBAL void pro_lk201_exit(int dev);
614 
615 /* pro_la50.c */
616 
617 GLOBAL int pro_la50_dpi;
618 GLOBAL struct sercall pro_la50;
619 GLOBAL int pro_la50_get(int dev);
620 GLOBAL int pro_la50_put(int dev, int key);
621 GLOBAL void pro_la50_ctrl_get(int dev, struct serctrl *sctrl);
622 GLOBAL void pro_la50_ctrl_put(int dev, struct serctrl *sctrl);
623 GLOBAL void pro_la50_reset(int dev, int portnum);
624 GLOBAL void pro_la50_exit(int dev);
625 
626 /* pro_serial.c */
627 
628 GLOBAL struct sercall pro_serial;
629 GLOBAL int pro_lp_workaround;
630 GLOBAL char *pro_serial_devname[4];
631 GLOBAL int pro_serial_get(int dev);
632 GLOBAL int pro_serial_put(int dev, int schar);
633 GLOBAL void pro_serial_ctrl_get(int dev, struct serctrl *sctrl);
634 GLOBAL void pro_serial_ctrl_put(int dev, struct serctrl *sctrl);
635 GLOBAL void pro_serial_reset(int dev, int portnum);
636 GLOBAL void pro_serial_exit(int dev);
637 
638 /* pro_kb.c */
639 
640 GLOBAL struct sercall *pro_kb_orig;
641 GLOBAL int pro_kb_get(void);
642 GLOBAL int pro_kb_rd(int pa);
643 GLOBAL void pro_kb_wr(int data, int pa, int access);
644 GLOBAL void pro_kb_filter(void);
645 GLOBAL void pro_kb_reset(void);
646 GLOBAL void pro_kb_open(void);
647 GLOBAL void pro_kb_exit(void);
648 
649 /* pro_ptr.c */
650 
651 GLOBAL int pro_ptr_rd(int pa);
652 GLOBAL void pro_ptr_wr(int data, int pa, int access);
653 GLOBAL void pro_ptr_reset(void);
654 GLOBAL void pro_ptr_open(void);
655 GLOBAL void pro_ptr_exit(void);
656 
657 /* pro_clk.c */
658 
659 GLOBAL int pro_force_year;
660 GLOBAL int pro_int_throttle;
661 GLOBAL void pro_clk_eq(void);
662 GLOBAL void pro_clk_uf_eq(void);
663 GLOBAL int pro_clk_rd(int pa);
664 GLOBAL void pro_clk_wr(int data, int pa, int access);
665 GLOBAL void pro_clk_reset(void);
666 
667 /* pro_com.c */
668 
669 GLOBAL void pro_com_eq(void);
670 GLOBAL void pro_com_poll_eq(void);
671 GLOBAL int pro_com_rd(int pa);
672 GLOBAL void pro_com_wr(int data, int pa, int access);
673 GLOBAL void pro_com_reset(void);
674 GLOBAL void pro_com_open(void);
675 GLOBAL void pro_com_exit(void);
676 
677 /* pro_vid.c */
678 
679 GLOBAL void pro_clear_mvalid(void);
680 GLOBAL unsigned short PRO_VRAM[3][PRO_VID_MEMSIZE/2];
681 GLOBAL unsigned char pro_vid_mvalid[(PRO_VID_MEMSIZE/2) >> PRO_VID_CLS];
682 GLOBAL int pro_vid_p1c;
683 GLOBAL int pro_vid_scl;
684 GLOBAL int pro_vid_csr;
685 GLOBAL int pro_vid_y_offset;
686 
687 GLOBAL void pro_vid_eq(void);
688 GLOBAL void pro_vid_cmd_eq(void);
689 GLOBAL int pro_vram_rd(int *data, int pa, int access);
690 GLOBAL int pro_vram_wr(int data, int pa, int access);
691 GLOBAL int pro_vid_rd(int pa);
692 GLOBAL void pro_vid_wr(int data, int pa, int access);
693 GLOBAL void pro_vid_reset(void);
694 GLOBAL void pro_vid_exit(void);
695 
696 /* pro_menu.c */
697 
698 GLOBAL int pro_menu(int key);
699 GLOBAL void pro_menu_reset(void);
700 
701 /* pro_rd.c */
702 
703 GLOBAL char *pro_rd_dir;
704 GLOBAL char *pro_rd_file;
705 GLOBAL int pro_rd_heads;
706 GLOBAL int pro_rd_cyls;
707 GLOBAL int pro_rd_secs;
708 GLOBAL void pro_rd_eq(void);
709 GLOBAL int pro_rd_rd(int pa);
710 GLOBAL void pro_rd_wr(int data, int pa, int access);
711 GLOBAL void pro_rd_reset(void);
712 GLOBAL void pro_rd_exit(void);
713 
714 /* pro_rx.c */
715 
716 GLOBAL char *pro_rx_dir[4];
717 GLOBAL char *pro_rx_file[4];
718 GLOBAL int pro_rx_closed[4];
719 GLOBAL void pro_rx_open_door(int disknum);
720 GLOBAL void pro_rx_close_door(int disknum);
721 GLOBAL int pro_rx_rd(int pa);
722 GLOBAL void pro_rx_wr(int data, int pa, int access);
723 GLOBAL void pro_rx_reset(void);
724 GLOBAL void pro_rx_exit(void);
725 
726 /* pro_mem.c */
727 
728 GLOBAL unsigned short MEMROM[1024];
729 GLOBAL int pro_mem_rd(int pa);
730 GLOBAL void pro_mem_wr(int data, int pa, int access);
731 GLOBAL void pro_mem_reset(void);
732 GLOBAL void pro_mem_exit(void);
733 
734 /* pro_reg.c */
735 
736 GLOBAL int pro_led;
737 GLOBAL int pro_csr;
738 GLOBAL unsigned short ROM[8192];
739 GLOBAL unsigned short IDROM[32];
740 GLOBAL unsigned short BATRAM[50];
741 GLOBAL int rom_rd(int *data, int pa, int access);
742 GLOBAL int rom_wr(int data, int pa, int access);
743 GLOBAL int reg_rd(int *data, int pa, int access);
744 GLOBAL int reg_wr(int data, int pa, int access);
745 
746 /* term_x11.c / term_ncurses.h */
747 
748 GLOBAL int pro_nine_workaround;
749 GLOBAL int pro_libc_workaround;
750 GLOBAL int pro_window_x;
751 GLOBAL int pro_window_y;
752 GLOBAL int pro_screen_full;
753 GLOBAL int pro_screen_window_scale;
754 GLOBAL int pro_screen_full_scale;
755 GLOBAL int pro_screen_gamma;
756 GLOBAL int pro_screen_pcm;
757 GLOBAL int pro_screen_framebuffers;
758 GLOBAL int pro_mouse_x;
759 GLOBAL int pro_mouse_y;
760 GLOBAL int pro_mouse_l;
761 GLOBAL int pro_mouse_m;
762 GLOBAL int pro_mouse_r;
763 GLOBAL int pro_mouse_in;
764 GLOBAL int pro_keyboard_get(void);
765 GLOBAL void pro_keyboard_bell_vol(int vol);
766 GLOBAL void pro_keyboard_bell(void);
767 GLOBAL void pro_keyboard_auto_off(void);
768 GLOBAL void pro_keyboard_auto_on(void);
769 GLOBAL void pro_keyboard_click_off(void);
770 GLOBAL void pro_keyboard_click_on(void);
771 
772 GLOBAL void pro_colormap_write(int index, int rgb);
773 GLOBAL void pro_mapchange(void);
774 GLOBAL void pro_scroll(void);
775 GLOBAL int pro_screen_init(void);
776 GLOBAL void pro_screen_update(void);
777 GLOBAL void pro_screen_close(void);
778 GLOBAL void pro_screen_reset(void);
779 GLOBAL void pro_screen_title(char *title);
780 GLOBAL void pro_screen_service_events(void);
781 
782 /* term_overlay_x11.c / term_ncurses.h */
783 
784 GLOBAL int pro_overlay_on;
785 GLOBAL unsigned char *pro_overlay_data;
786 GLOBAL unsigned char *pro_overlay_alpha;
787 GLOBAL void pro_overlay_print(int x, int y, int xnor, int font, char *text);
788 GLOBAL void pro_overlay_clear(void);
789 GLOBAL void pro_overlay_enable(void);
790 GLOBAL void pro_overlay_disable(void);
791 GLOBAL void pro_overlay_init(int psize, int cmode, int bpixel, int wpixel);
792 GLOBAL void pro_overlay_close(void);
793