1 #ifndef PC88MAIN_H_INCLUDED
2 #define PC88MAIN_H_INCLUDED
3 
4 #include <stdio.h>
5 #include "file-op.h"
6 
7 
8 #if 0	/* �� file-op.h */
9 extern char file_tape[2][QUASI88_MAX_FILENAME];	/* �ơ��������ϤΥե�����̾ */
10 extern char file_prn[QUASI88_MAX_FILENAME];	/* �ѥ�����ϤΥե�����̾ */
11 extern char file_sin[QUASI88_MAX_FILENAME];	/* ���ꥢ����ϤΥե�����̾ */
12 extern char file_sout[QUASI88_MAX_FILENAME];	/* ���ꥢ�����ϤΥե�����̾ */
13 #endif
14 
15 	/**** �֡��Ⱦ��� (I/O��ȿ��) ****/
16 
17 extern	int	boot_basic;			/* ��ư���� BASIC�⡼��	*/
18 extern	int	boot_dipsw;			/* ��ư���Υǥ��å�����	*/
19 extern	int	boot_from_rom;			/* ��ư�ǥХ���������	*/
20 extern	int	boot_clock_4mhz;		/* ��ư���� CPU����å�	*/
21 
22 extern	int	monitor_15k;			/* 15k ��˥��� 1:Yes 0:No  */
23 
24 extern	int	high_mode;			/* ��®�⡼�� 1:Yes 0:No     */
25 
26 	/**** �ǥ��åץ����å� ****/
27 
28 #define SW_1_MASK	(0x3e)
29 #define	SW_2_MASK	(0x3f)
30 #define	SW_N88		(0x01)			/* 1: N88  / 0: N	*/
31 #define	SW_V1		(0x80)			/* 1: V1   / 0: V2	*/
32 #define	SW_H		(0x40)			/* 1: H    / 0: S	*/
33 #define	SW_ROMBOOT	(0x08)			/* 1: ROM  / 0: DISK	*/
34 #define	SW_4MHZ		(0x80)			/* 1: 4MHz / 0: 8MHz	*/
35 
36 	/**** �ɡ��ϥݡ��� ****/
37 
38 /*extern byte	dipsw_1;			 * IN[30] �ǥ��åץ����å� 1 */
39 /*extern byte	dipsw_2;			 * IN[31] �ǥ��åץ����å� 2 */
40 /*extern byte	ctrl_boot;			 * IN[40] �ǥ������֡��Ⱦ��� */
41 /*extern byte	cpu_clock;			 * IN[6E] CPU ����å�       */
42 extern	int	memory_bank;			/* OUT[5C-5F] IN[5C] �Х�  */
43 
44 extern	byte	misc_ctrl;			/* I/O[32] �Ƽ�Ctrl       */
45 extern	byte	ALU1_ctrl;			/* OUT[34] ALU Ctrl 1     */
46 extern	byte	ALU2_ctrl;			/* OUT[35] ALU Ctrl 2     */
47 extern	byte	ctrl_signal;			/* OUT[40] ����ȥ��뿮��*/
48 extern	byte	baudrate_sw;			/* I/O[6F] �ܡ��졼��     */
49 extern	word	window_offset;			/* I/O[70] WINDOW ���ե��å�*/
50 extern	byte	ext_rom_bank;			/* I/O[71] ��ĥROM BANK   */
51 extern	byte	ext_ram_ctrl;			/* I/O[E2] ��ĥRAM����	  */
52 extern	byte	ext_ram_bank;			/* I/O[E3] ��ĥRAM���쥯��*/
53 
54 extern	byte	jisho_rom_bank;			/* OUT[F0] ����ROM���쥯��*/
55 extern	byte	jisho_rom_ctrl;			/* OUT[F1] ����ROM�Х�  */
56 
57 
58 #define	MISC_CTRL_EBANK		(0x03)		/* EROM BANK 00..11        */
59 #define	MISC_CTRL_AVC		(0x0c)		/* AVC                     */
60 #define	MISC_CTRL_TEXT_MAIN	(0x10)		/* TEXT   MAIN-RAM/HIGH-RAM*/
61 #define	MISC_CTRL_ANALOG	(0x20)		/* PALETTE  ANALOG/DEGITAL */
62 #define	MISC_CTRL_EVRAM		(0x40)		/* VRAM     EXTEND/STANDARD*/
63 #define INTERRUPT_MASK_SOUND	(0x80)		/* SND INT  Disable/Enable */
64 
65 #define	ALU1_CTRL_BLUE		(0x11)		/* ALU�����оݥץ졼�� B   */
66 #define	ALU1_CTRL_RED		(0x22)		/*                     R   */
67 #define	ALU1_CTRL_GREEN		(0x44)		/*                     G   */
68 
69 #define	ALU2_CTRL_DATA		(0x07)		/* ALU����ӥǡ���    0..7 */
70 #define	ALU2_CTRL_MODE		(0x30)		/* ALU�����⡼��  00B..11B */
71 #define	ALU2_CTRL_VACCESS	(0x80)		/* ���ꥢ������ VRAM/MAIN*/
72 
73 #define	MEMORY_BANK_MAIN	(3)		/* �Х�����        MAIN  */
74 #define	MEMORY_BANK_GRAM0	(0)		/*		       B   */
75 #define	MEMORY_BANK_GRAM1	(1)		/*		       R   */
76 #define	MEMORY_BANK_GRAM2	(2)		/*		       G   */
77 
78 #define	CPU_CLOCK_4HMZ		(0x80)		/* CPU CLOCK 4MHz / 8MHz   */
79 
80 #define	EXT_ROM_NOT		(0x01)		/* ��ĥ ROM ���쥯��	   */
81 
82 #define INTERRUPT_MASK_RTC	(0x01)		/* 1/600 ������ ����     */
83 #define INTERRUPT_MASK_VSYNC	(0x02)		/* VSYNC ������ ����     */
84 #define INTERRUPT_MASK_SIO	(0x04)		/* COM   ������ ����     */
85 
86 #define	JISHO_NOT_SELECT	(0x01)		/* ����ROM���쥯��	   */
87 #define	JISHO_BANK		(0x1f)		/* ����ROM�Х�	   */
88 
89 
90 	/**** �������� ****/
91 
92 extern	int	calendar_stop;			/* ������ߥե饰	*/
93 
94 
95 	/**** ���ꥢ�롢�ѥ��� ****/
96 
97 extern	int	cmt_speed;	/* �ơ���®�� 0�Ǽ�ư   */
98 extern	int	cmt_intr;	/* ����ǥơ��׽������� */
99 extern	int	cmt_wait;	/* ���ǡ��ơ����ɹ��������Ȥ���(T88�Τ�) */
100 
101 
102 	/**** ��® BASIC �⡼�� ****/
103 
104 #define EndofBasicAddr 0xffff
105 #define HS_BASIC_COUNT 50000000	/* �����ߤʤ��Dz����ơ��ȿ� */
106 
107 extern word highspeed_routine[];
108 
109 extern int highspeed_flag;
110 extern int highspeed_mode;	/* ��® BASIC ���� ����ʤ� ��      */
111 
112 
113 	/**** ���ꥢ��ޥ��� ****/
114 
115 extern int use_siomouse;	/* ���ǡ����ꥢ��ޥ�������	*/
116 
117 
118 
119 
120 
121 	/**** �ؿ� ****/
122 
123 void	pc88main_init( int init );
124 void	pc88main_term( void );
125 void	pc88main_bus_setup( void );
126 void	power_on_ram_init( void );
127 
128 byte	main_mem_read( word addr );
129 void	main_mem_write( word addr, byte data );
130 byte	main_io_in( byte port );
131 void	main_io_out( byte port, byte data );
132 
133 
134 int	sio_open_tapeload( const char *filename );
135 void	sio_close_tapeload( void );
136 int	sio_open_tapesave( const char *filename );
137 void	sio_close_tapesave( void );
138 int	sio_open_serialin( const char *filename );
139 void	sio_close_serialin( void );
140 int	sio_open_serialout( const char *filename );
141 void	sio_close_serialout( void );
142 int	printer_open( const char *filename );
143 void	printer_close( void );
144 void	sio_mouse_init(int initial);
145 int	sio_tape_rewind( void );
146 
147 int	sio_tape_pos( long *cur, long *end );
148 int	sio_com_pos( long *cur, long *end );
149 int	sio_intr( void );
150 void	sio_data_clear(void);
151 
152 int	tape_exist( void );
153 int	tape_readable(void);
154 int	tape_writable(void);
155 int	tape_reading( void );
156 int	tape_writing( void );
157 
158 #endif	/* PC88MAIN_H_INCLUDED */
159