Previous 15994 Revisions Next

r6510 Thursday 3rd December, 2009 at 09:51:02 UTC by Curt Coder
[XOR100] Added floppy and centronics interfaces. Floppy is not working yet.
[src/mess/drivers]xor100.c
[src/mess/includes]xor100.h

src/mess/includes/xor100.h
r6509r6510
1010#define Z80CTC_TAG      "11b"
1111#define WD1795_TAG      "wd1795"
1212#define CASSETTE_TAG   "cassette"
13#define CENTRONICS_TAG   "centronics"
1314
1415typedef struct _xor100_state xor100_state;
1516struct _xor100_state
1617{
18   /* floppy state */
19   int fdc_irq;
20   int fdc_drq;
21
1722   /* devices */
1823   const device_config *i8251_a;
1924   const device_config *i8251_b;
25   const device_config *wd1795;
2026   const device_config *cassette;
27   const device_config *centronics;
2128};
2229
2330#endif
src/mess/drivers/xor100.c
r6509r6510
88
99    TODO:
1010
11    - floppy
1112    - ROM should be mirrored every 2K at boot
12    - 2/4 MHz jumper J2
13    - floppy
13    - honor jumpers
1414    - memory expansion
15    - COM5016
1615    - CTC signals
16   - serial printer
1717
1818*/
1919
r6509r6510
2222#include "cpu/z80/z80.h"
2323#include "formats/basicdsk.h"
2424#include "devices/flopdrv.h"
25#include "devices/cassette.h"
2625#include "machine/com8116.h"
26#include "machine/ctronics.h"
2727#include "machine/i8255a.h"
2828#include "machine/msm8251.h"
2929#include "machine/terminal.h"
r6509r6510
4141
4242        0       A16
4343        1       A17
44      2      A18
45      3      A19
46      4
47      5
48      6
49      7
4450
4551    */
4652}
r6509r6510
7480   terminal_write(terminal, 0, data);
7581}
7682
83static READ8_HANDLER( fdc_irq_r )
84{
85   /*
86
87      bit      description
88
89      0     
90      1     
91      2     
92      3     
93      4
94      5
95      6
96      7      FDC IRQ
97
98   */
99
100   xor100_state *state = space->machine->driver_data;
101
102   return state->fdc_irq << 7;
103}
104
105static WRITE8_HANDLER( floppy_select_w )
106{
107   /*
108
109      bit      description
110
111      0      DS0
112      1      DS1
113      2      DS2
114      3      DS3
115      4
116      5
117      6
118      7      _HLSTB
119
120   */
121
122   xor100_state *state = space->machine->driver_data;
123
124   if (!BIT(data, 0)) wd17xx_set_drive(state->wd1795, 0);
125   if (!BIT(data, 1)) wd17xx_set_drive(state->wd1795, 1);
126
127   floppy_drive_set_motor_state(floppy_get_device(space->machine, 0), 1);
128   floppy_drive_set_motor_state(floppy_get_device(space->machine, 1), 1);
129   floppy_drive_set_ready_state(floppy_get_device(space->machine, 0), 1, 1);
130   floppy_drive_set_ready_state(floppy_get_device(space->machine, 1), 1, 1);
131}
132
77133/* Memory Maps */
78134
79135static ADDRESS_MAP_START( xor100_mem, ADDRESS_SPACE_PROGRAM, 8 )
r6509r6510
95151   AM_RANGE(0x0a, 0x0a) AM_READ(prom_disable_r)
96152   AM_RANGE(0x0b, 0x0b) AM_READ_PORT("DSW0") AM_DEVWRITE(COM5016_TAG, baud_w)
97153   AM_RANGE(0x0c, 0x0f) AM_DEVREADWRITE(Z80CTC_TAG, z80ctc_r, z80ctc_w)
154   AM_RANGE(0xf8, 0xfb) AM_DEVREADWRITE(WD1795_TAG, wd17xx_r, wd17xx_w)
155   AM_RANGE(0xfc, 0xfc) AM_READ(fdc_irq_r)
156   AM_RANGE(0xfd, 0xfd) AM_WRITE(floppy_select_w)
98157ADDRESS_MAP_END
99158
100159/* Input Ports */
r6509r6510
137196   PORT_DIPSETTING(    0xd0, "7200 baud" )
138197   PORT_DIPSETTING(    0xe0, "9600 baud" )
139198   PORT_DIPSETTING(    0xf0, "19200 baud" )
199
200   PORT_START("J1")
201   PORT_CONFNAME( 0x01, 0x01, "J1 Wait State")
202   PORT_CONFSETTING( 0x00, "No Wait States" )
203   PORT_CONFSETTING( 0x01, "1 M1 Wait State" )
204
205   PORT_START("J2")
206   PORT_CONFNAME( 0x01, 0x01, "J2 CPU Speed")
207   PORT_CONFSETTING( 0x00, "2 MHz" )
208   PORT_CONFSETTING( 0x01, "4 MHz" )
209
210   PORT_START("J3")
211   PORT_CONFNAME( 0x01, 0x00, "J3")
212   PORT_CONFSETTING( 0x00, "" )
213   PORT_CONFSETTING( 0x01, "" )
214
215   PORT_START("J4-J5")
216   PORT_CONFNAME( 0x01, 0x01, "J4/J5 EPROM Type")
217   PORT_CONFSETTING( 0x00, "2708" )
218   PORT_CONFSETTING( 0x01, "2716" )
219
220   PORT_START("J6")
221   PORT_CONFNAME( 0x01, 0x01, "J6 EPROM")
222   PORT_CONFSETTING( 0x00, "Disabled" )
223   PORT_CONFSETTING( 0x01, "Enabled" )
224
225   PORT_START("J7")
226   PORT_CONFNAME( 0x01, 0x00, "J7 I/O Port Addresses")
227   PORT_CONFSETTING( 0x00, "00-0F" )
228   PORT_CONFSETTING( 0x01, "10-1F" )
229
230   PORT_START("J8")
231   PORT_CONFNAME( 0x01, 0x00, "J8")
232   PORT_CONFSETTING( 0x00, "" )
233   PORT_CONFSETTING( 0x01, "" )
234
235   PORT_START("J9")
236   PORT_CONFNAME( 0x01, 0x01, "J9 Power On RAM")
237   PORT_CONFSETTING( 0x00, "Enabled" )
238   PORT_CONFSETTING( 0x01, "Disabled" )
140239INPUT_PORTS_END
141240
142241/* COM5016 Interface */
r6509r6510
162261   DEVCB_NULL,               /* fX/4 output */
163262   DEVCB_LINE(com5016_fr_w),   /* fR output */
164263   DEVCB_LINE(com5016_ft_w),   /* fT output */
165   { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 },   // WRONG
166   { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 },   // WRONG
264   { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 },   // WRONG?
265   { 101376, 67584, 46080, 37686, 33792, 16896, 8448, 4224, 2816, 2534, 2112, 1408, 1056, 704, 528, 264 },   // WRONG?
167266};
168267
169268/* Printer 8251A Interface */
r6509r6510
186285
187286/* Printer 8255A Interface */
188287
288static READ8_DEVICE_HANDLER( i8255_pc_r )
289{
290   /*
291
292      bit      description
293
294      PC0
295      PC1
296      PC2
297      PC3
298      PC4      ON LINE
299      PC5      BUSY
300      PC6      _ACK
301      PC7
302
303   */
304
305   xor100_state *driver_state = device->machine->driver_data;
306   UINT8 data = 0;
307
308   /* on line */
309   data |= centronics_vcc_r(driver_state->centronics) << 4;
310
311   /* busy */
312   data |= centronics_busy_r(driver_state->centronics) << 5;
313
314   return data;
315}
316
189317static I8255A_INTERFACE( printer_8255_intf )
190318{
191   DEVCB_NULL,      // Port A read
192   DEVCB_NULL,      // Port B read
193   DEVCB_NULL,      // Port C read
194   DEVCB_NULL,      // Port A write
195   DEVCB_NULL,      // Port B write
196   DEVCB_NULL      // Port C write
319   DEVCB_NULL,
320   DEVCB_NULL,
321   DEVCB_HANDLER(i8255_pc_r),
322   DEVCB_DEVICE_HANDLER(CENTRONICS_TAG, centronics_data_w),
323   DEVCB_DEVICE_LINE(CENTRONICS_TAG, centronics_strobe_w),
324   DEVCB_NULL
197325};
198326
327static centronics_interface xor100_centronics_intf =
328{
329   0,
330   DEVCB_DEVICE_LINE(I8255A_TAG, i8255a_pc4_w),
331   DEVCB_NULL,
332   DEVCB_NULL
333};
334
199335/* Z80-CTC Interface */
200336
201337static WRITE_LINE_DEVICE_HANDLER( ctc_z0_w )
r6509r6510
221357
222358/* WD1795-02 Interface */
223359
360static WRITE_LINE_DEVICE_HANDLER( fdc_irq_w )
361{
362   xor100_state *driver_state = device->machine->driver_data;
363
364   driver_state->fdc_irq = state;
365}
366
367static WRITE_LINE_DEVICE_HANDLER( fdc_drq_w )
368{
369   xor100_state *driver_state = device->machine->driver_data;
370
371   driver_state->fdc_drq = state;
372}
373
224374static const wd17xx_interface wd1795_intf =
225375{
226   DEVCB_NULL,
227   DEVCB_NULL,
376   DEVCB_LINE(fdc_irq_w),
377   DEVCB_LINE(fdc_drq_w),
228378   { FLOPPY_0, FLOPPY_1, NULL, NULL }
229379};
230380
r6509r6510
253403   /* find devices */
254404   state->i8251_a = devtag_get_device(machine, I8251_A_TAG);
255405   state->i8251_b = devtag_get_device(machine, I8251_B_TAG);
406   state->wd1795 = devtag_get_device(machine, WD1795_TAG);
256407   state->cassette = devtag_get_device(machine, CASSETTE_TAG);
257408
258409   /* setup memory banking */
r6509r6510
283434
284435/* Machine Driver */
285436
286static const cassette_config xor100_cassette_config =
287{
288   cassette_default_formats,
289   NULL,
290   CASSETTE_STOPPED | CASSETTE_MOTOR_ENABLED | CASSETTE_SPEAKER_MUTED
291};
292
293static FLOPPY_OPTIONS_START( xor100 )
294   FLOPPY_OPTION( xor100, "dsk", "XOR-100-12 disk image", basicdsk_identify_default, basicdsk_construct_default, // WRONG
295      HEADS([1])
296      TRACKS([80])
297      SECTORS([10])
298      SECTOR_LENGTH([512])
299      FIRST_SECTOR_ID([1]))
300FLOPPY_OPTIONS_END
301
302437static const floppy_config xor100_floppy_config =
303438{
304439   DEVCB_NULL,
r6509r6510
307442   DEVCB_NULL,
308443   DEVCB_NULL,
309444   FLOPPY_DRIVE_DS_80,
310   FLOPPY_OPTIONS_NAME(xor100),
445   FLOPPY_OPTIONS_NAME(default),
311446   DO_NOT_KEEP_GEOMETRY
312447};
313448
r6509r6510
333468   MDRV_COM8116_ADD(COM5016_TAG, 5000000, com5016_intf) // COM5016
334469   MDRV_WD179X_ADD(WD1795_TAG, /*XTAL_8MHz/8,*/ wd1795_intf) // WD1795-02
335470   MDRV_FLOPPY_2_DRIVES_ADD(xor100_floppy_config)
336   MDRV_CASSETTE_ADD(CASSETTE_TAG, xor100_cassette_config)
337471   MDRV_GENERIC_TERMINAL_ADD("terminal", xor100_terminal_intf) 
472   MDRV_CENTRONICS_ADD(CENTRONICS_TAG, xor100_centronics_intf)
338473   
339474   /* internal ram */
340475   MDRV_RAM_ADD("messram")

Previous 15994 Revisions Next


© 1998-2018 The MESS Team