Previous 199869 Revisions Next

r19198 Wednesday 28th November, 2012 at 15:58:47 UTC by Curt Coder
(MESS) comx35: Floppy modernization and expansion interface cleanup. (nw)
[src/lib/formats]comx35_dsk.c comx35_dsk.h
[src/mess/drivers]comx35.c
[src/mess/includes]comx35.h
[src/mess/machine]comx_clm.c comx_clm.h comx_eb.c comx_eb.h comx_epr.c comx_epr.h comx_fd.c comx_fd.h comx_joy.c comx_joy.h comx_prn.c comx_prn.h comx_ram.c comx_ram.h comx_thm.c comx_thm.h comxexp.c comxexp.h comxpl80.c comxpl80.h
[src/mess/video]comx35.c

trunk/src/lib/formats/comx35_dsk.c
r19197r19198
1/***************************************************************************
2
3    Copyright Olivier Galibert
4    All rights reserved.
5
6    Redistribution and use in source and binary forms, with or without
7    modification, are permitted provided that the following conditions are
8    met:
9
10        * Redistributions of source code must retain the above copyright
11          notice, this list of conditions and the following disclaimer.
12        * Redistributions in binary form must reproduce the above copyright
13          notice, this list of conditions and the following disclaimer in
14          the documentation and/or other materials provided with the
15          distribution.
16        * Neither the name 'MAME' nor the names of its contributors may be
17          used to endorse or promote products derived from this software
18          without specific prior written permission.
19
20    THIS SOFTWARE IS PROVIDED BY AARON GILES ''AS IS'' AND ANY EXPRESS OR
21    IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
22    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23    DISCLAIMED. IN NO EVENT SHALL AARON GILES BE LIABLE FOR ANY DIRECT,
24    INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
25    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
28    STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
29    IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30    POSSIBILITY OF SUCH DAMAGE.
31
32****************************************************************************/
33
134/*********************************************************************
235
336    formats/comx35_dsk.c
r19197r19198
235
36    COMX-35 disk image format
37
38*********************************************************************/
39
40/*
41
42    TODO:
43
44    - implement 70 track image detection
45
46*/
47
48#include "emu.h"
49#include "formats/comx35_dsk.h"
50
51comx35_format::comx35_format() : wd177x_format(formats)
52{
53}
54
55const char *comx35_format::name() const
56{
57   return "comx35";
58}
59
60const char *comx35_format::description() const
61{
62   return "COMX-35 disk image";
63}
64
65const char *comx35_format::extensions() const
66{
67   return "img";
68}
69
70// Unverified gap sizes
71const comx35_format::format comx35_format::formats[] = {
72   {   //  70K 5 1/4 inch single density single sided 35 tracks
73      floppy_image::FF_525, floppy_image::SSSD,
74      2000, 16, 35, 1, 128, {}, 0, {}, 100, 22, 84
75   },
76   {   //  140K 5 1/4 inch single density double sided 35 tracks
77      floppy_image::FF_525, floppy_image::DSSD,
78      2000, 16, 35, 2, 128, {}, 0, {}, 100, 22, 84
79   },
80   /*{   //  140K 5 1/4 inch quad density single sided 70 tracks
81       floppy_image::FF_525, floppy_image::SSQD,
82       2000, 16, 70, 1, 128, {}, 0, {}, 100, 22, 84
83   },*/
84   {}
85};
86
87const floppy_format_type FLOPPY_COMX35_FORMAT = &floppy_image_format_creator<comx35_format>;
88
89
90#ifdef UNUSED_CODE
91
92/*********************************************************************
93
94    formats/comx35_dsk.c
95
396    COMX35 disk images
r19197r19198
76169LEGACY_FLOPPY_OPTIONS_START( comx35 )
77170   LEGACY_FLOPPY_OPTION( comx35, "img", "COMX35 floppy disk image", comx35_dsk_identify, comx35_dsk_construct, NULL, NULL )
78171LEGACY_FLOPPY_OPTIONS_END
172
173#endif
trunk/src/lib/formats/comx35_dsk.h
r19197r19198
22
33    formats/comx35_dsk.h
44
5    COMX35 disk images
5    COMX-35 disk image format
66
77*********************************************************************/
88
9#ifndef COMX35_DSK_H
10#define COMX35_DSK_H
9#ifndef COMX35_DSK_H_
10#define COMX35_DSK_H_
1111
12#include "flopimg.h"
12#include "wd177x_dsk.h"
1313
14/**************************************************************************/
14class comx35_format : public wd177x_format {
15public:
16   comx35_format();
1517
16LEGACY_FLOPPY_OPTIONS_EXTERN(comx35);
18   virtual const char *name() const;
19   virtual const char *description() const;
20   virtual const char *extensions() const;
1721
18#endif /* COMX35_DSK_H */
22private:
23   static const format formats[];
24};
25
26extern const floppy_format_type FLOPPY_COMX35_FORMAT;
27
28#endif
trunk/src/mess/drivers/comx35.c
r19197r19198
2424
2525READ8_MEMBER( comx35_state::mem_r )
2626{
27   UINT8 *rom = memregion(CDP1802_TAG)->base();
28   UINT8 *ram = m_ram->pointer();
2927   int extrom = 1;
3028
31   UINT8 data = m_expansion->mrd_r(offset, &extrom);
29   UINT8 data = m_exp->mrd_r(space, offset, &extrom);
3230
3331   if (offset < 0x4000)
3432   {
35      if (extrom) data = rom[offset & 0x3fff];
33      if (extrom) data = m_rom[offset & 0x3fff];
3634   }
3735   else if (offset >= 0x4000 && offset < 0xc000)
3836   {
39      data = ram[offset - 0x4000];
37      data = m_ram->pointer()[offset - 0x4000];
4038   }
4139   else if (offset >= 0xf400 && offset < 0xf800)
4240   {
r19197r19198
5351
5452WRITE8_MEMBER( comx35_state::mem_w )
5553{
56   UINT8 *ram = m_ram->pointer();
54   m_exp->mwr_w(space, offset, data);
5755
58   m_expansion->mwr_w(offset, data);
59
6056   if (offset >= 0x4000 && offset < 0xc000)
6157   {
62      ram[offset - 0x4000] = data;
58      m_ram->pointer()[offset - 0x4000] = data;
6359   }
6460   else if (offset >= 0xf400 && offset < 0xf800)
6561   {
r19197r19198
7874
7975READ8_MEMBER( comx35_state::io_r )
8076{
81   UINT8 data = m_expansion->io_r(offset);
77   UINT8 data = m_exp->io_r(space, offset);
8278
8379   if (offset == 3)
8480   {
r19197r19198
9591
9692WRITE8_MEMBER( comx35_state::io_w )
9793{
98   m_expansion->io_w(offset, data);
94   m_exp->io_w(space, offset, data);
9995
10096   if (offset >= 3)
10197   {
r19197r19198
279275
280276READ_LINE_MEMBER( comx35_state::ef4_r )
281277{
282   return m_ef4; // | (m_cassette->input() > 0.0f);
278   return m_exp->ef4_r(); // | (m_cassette->input() > 0.0f);
283279}
284280
285281static COSMAC_SC_WRITE( comx35_sc_w )
r19197r19198
335331   m_cassette->output(state ? +1.0 : -1.0);
336332
337333   // expansion bus
338   m_expansion->q_w(state);
334   m_exp->q_w(state);
339335}
340336
341337static COSMAC_INTERFACE( cosmac_intf )
342338{
343   DEVCB_LINE_VCC,                           // wait
339   DEVCB_LINE_VCC,                                 // wait
344340   DEVCB_DRIVER_LINE_MEMBER(comx35_state, clear_r),// clear
345   DEVCB_NULL,                              // EF1
346   DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef2_r),   // EF2
347   DEVCB_NULL,                              // EF3
348   DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef4_r),   // EF4
349   DEVCB_DRIVER_LINE_MEMBER(comx35_state, q_w),   // Q
350   DEVCB_NULL,                              // DMA in
351   DEVCB_NULL,                              // DMA out
352   comx35_sc_w,                           // SC
353   DEVCB_NULL,                              // TPA
354   DEVCB_NULL                              // TPB
341   DEVCB_NULL,                                     // EF1
342   DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef2_r),  // EF2
343   DEVCB_NULL,                                     // EF3
344   DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef4_r),  // EF4
345   DEVCB_DRIVER_LINE_MEMBER(comx35_state, q_w),    // Q
346   DEVCB_NULL,                                     // DMA in
347   DEVCB_NULL,                                     // DMA out
348   comx35_sc_w,                                    // SC
349   DEVCB_NULL,                                     // TPA
350   DEVCB_NULL                                      // TPB
355351};
356352
357353
r19197r19198
414410   check_interrupt();
415411}
416412
417WRITE_LINE_MEMBER( comx35_state::ef4_w )
418{
419   m_ef4 = state;
420}
421
422413static COMX_EXPANSION_INTERFACE( expansion_intf )
423414{
424415   DEVCB_DRIVER_LINE_MEMBER(comx35_state, int_w),
425   DEVCB_DRIVER_LINE_MEMBER(comx35_state, ef4_w),
426416   DEVCB_NULL,
427417   DEVCB_NULL
428418};
r19197r19198
469459   UINT8 *ram = m_ram->pointer();
470460   memset(ram, 0, 0x8000);
471461
462   // find memory regions
463   m_rom = memregion(CDP1802_TAG)->base();
464
472465   // register for state saving
473466   save_item(NAME(m_clear));
474467   save_item(NAME(m_q));
475   save_item(NAME(m_ef4));
476468   save_item(NAME(m_iden));
477469   save_item(NAME(m_dma));
478470   save_item(NAME(m_int));
r19197r19198
487479
488480void comx35_state::machine_reset()
489481{
482   m_exp->reset();
483
490484   int t = RES_K(27) * CAP_U(1) * 1000; // t = R1 * C1
491485
492486   m_clear = 0;
493487   m_iden = 1;
494488   m_cr1 = 1;
495   m_ef4 = CLEAR_LINE;
496489   m_int = CLEAR_LINE;
497490   m_prd = CLEAR_LINE;
498491
r19197r19198
523516   MCFG_CDP1871_ADD(CDP1871_TAG, kbc_intf, CDP1869_CPU_CLK_PAL / 8)
524517   MCFG_QUICKLOAD_ADD("quickload", comx35_comx, "comx", 0)
525518   MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf)
526   MCFG_PRINTER_ADD("printer")
527519
528   MCFG_COMXPL80_ADD()
529
530520   // expansion bus
531521   MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, expansion_intf, comx_expansion_cards, "eb", NULL)
532522
533523   // internal ram
534524   MCFG_RAM_ADD(RAM_TAG)
535525   MCFG_RAM_DEFAULT_SIZE("32K")
526
527   // software lists
528   MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop")
536529MACHINE_CONFIG_END
537530
538531
r19197r19198
554547   MCFG_CDP1871_ADD(CDP1871_TAG, kbc_intf, CDP1869_CPU_CLK_NTSC / 8)
555548   MCFG_QUICKLOAD_ADD("quickload", comx35_comx, "comx", 0)
556549   MCFG_CASSETTE_ADD(CASSETTE_TAG, cassette_intf)
557   MCFG_PRINTER_ADD("printer")
558550
559   MCFG_COMXPL80_ADD()
560
561551   // expansion bus
562552   MCFG_COMX_EXPANSION_SLOT_ADD(EXPANSION_TAG, expansion_intf, comx_expansion_cards, "eb", NULL)
563553
564554   // internal ram
565555   MCFG_RAM_ADD(RAM_TAG)
566556   MCFG_RAM_DEFAULT_SIZE("32K")
557
558   // software lists
559   MCFG_SOFTWARE_LIST_ADD("flop_list", "comx35_flop")
567560MACHINE_CONFIG_END
568561
569562
r19197r19198
577570//-------------------------------------------------
578571
579572ROM_START( comx35p )
580   ROM_REGION( 0x10000, CDP1802_TAG, 0 )
573   ROM_REGION( 0x4000, CDP1802_TAG, 0 )
581574   ROM_DEFAULT_BIOS( "basic100" )
582575   ROM_SYSTEM_BIOS( 0, "basic100", "COMX BASIC V1.00" )
583576   ROMX_LOAD( "comx_10.u21", 0x0000, 0x4000, CRC(68d0db2d) SHA1(062328361629019ceed9375afac18e2b7849ce47), ROM_BIOS(1) )
r19197r19198
599592//**************************************************************************
600593
601594//    YEAR  NAME        PARENT  COMPAT  MACHINE     INPUT     INIT  COMPANY                         FULLNAME            FLAGS
602COMP( 1983, comx35p,   0,      0,      pal,      comx35, driver_device,   0,   "Comx World Operations Ltd",   "COMX 35 (PAL)",   GAME_IMPERFECT_SOUND )
603COMP( 1983, comx35n,   comx35p,0,      ntsc,      comx35, driver_device,   0,   "Comx World Operations Ltd",   "COMX 35 (NTSC)",   GAME_IMPERFECT_SOUND )
595COMP( 1983, comx35p,    0,      0,      pal,        comx35, driver_device,   0, "Comx World Operations Ltd",    "COMX 35 (PAL)",    GAME_IMPERFECT_SOUND )
596COMP( 1983, comx35n,    comx35p,0,      ntsc,       comx35, driver_device,   0, "Comx World Operations Ltd",    "COMX 35 (NTSC)",   GAME_IMPERFECT_SOUND )
trunk/src/mess/machine/comx_prn.c
r19197r19198
1515//  MACROS/CONSTANTS
1616//**************************************************************************
1717
18#define CENTRONICS_TAG  "centronics"
1819
1920
21
2022//**************************************************************************
2123//  DEVICE DEFINITIONS
2224//**************************************************************************
r19197r19198
3032
3133ROM_START( comx_prn )
3234   ROM_REGION( 0x2000, "c000", 0 )
33   ROM_LOAD( "printer.bin",         0x0000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8) )
34
35   ROM_REGION( 0x2000, "printer_fm", 0 )
36   ROM_LOAD( "f&m.printer.1.2.bin",   0x0000, 0x1000, CRC(2feb997d) SHA1(ee9cb91042696c88ff5f2f44d2f702dc93369ba0) )
37
38   ROM_REGION( 0x2000, "rs232", 0 )
39   ROM_LOAD( "rs232.bin",            0x0000, 0x0800, CRC(926ff2d1) SHA1(be02bd388bba0211ea72d4868264a63308e4318d) )
35   ROM_SYSTEM_BIOS( 0, "comx", "COMX" )
36   ROMX_LOAD( "printer.bin",           0x0000, 0x0800, CRC(3bbc2b2e) SHA1(08bf7ea4174713ab24969c553affd5c1401876b8), ROM_BIOS(1) )
37   ROM_SYSTEM_BIOS( 1, "fm12", "F&M v1.2" )
38   ROMX_LOAD( "f&m.printer.1.2.bin",   0x0000, 0x1000, CRC(2feb997d) SHA1(ee9cb91042696c88ff5f2f44d2f702dc93369ba0), ROM_BIOS(2) )
39   ROM_LOAD( "rs232.bin",              0x1000, 0x0800, CRC(926ff2d1) SHA1(be02bd388bba0211ea72d4868264a63308e4318d) )
4040ROM_END
4141
4242
r19197r19198
5050}
5151
5252
53//-------------------------------------------------
54//  SLOT_INTERFACE( comx_centronics_printer )
55//-------------------------------------------------
56
57SLOT_INTERFACE_START(comx_centronics_printer)
58   SLOT_INTERFACE("printer", CENTRONICS_PRINTER)
59   SLOT_INTERFACE("pl80", COMX_PL80)
60SLOT_INTERFACE_END
61
62
63//-------------------------------------------------
64//  MACHINE_CONFIG_FRAGMENT( comx_prn )
65//-------------------------------------------------
66
67static MACHINE_CONFIG_FRAGMENT( comx_prn )
68   MCFG_CENTRONICS_ADD(CENTRONICS_TAG, standard_centronics, comx_centronics_printer, "pl80", NULL)
69MACHINE_CONFIG_END
70
71
72//-------------------------------------------------
73//  machine_config_additions - device-specific
74//  machine configurations
75//-------------------------------------------------
76
77machine_config_constructor comx_prn_device::device_mconfig_additions() const
78{
79   return MACHINE_CONFIG_NAME( comx_prn );
80}
81
82
83
5384//**************************************************************************
5485//  LIVE DEVICE
5586//**************************************************************************
r19197r19198
5990//-------------------------------------------------
6091
6192comx_prn_device::comx_prn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
62   device_t(mconfig, COMX_PRN, "COMX-35 F&M Printer Card", tag, owner, clock),
63   device_comx_expansion_card_interface(mconfig, *this)
93   device_t(mconfig, COMX_PRN, "COMX-35 Printer Card", tag, owner, clock),
94   device_comx_expansion_card_interface(mconfig, *this),
95   m_centronics(*this, CENTRONICS_TAG)
6496{
6597}
6698
r19197r19198
88120//  comx_mrd_r - memory read
89121//-------------------------------------------------
90122
91UINT8 comx_prn_device::comx_mrd_r(offs_t offset, int *extrom)
123UINT8 comx_prn_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
92124{
93125   UINT8 data = 0;
94126
95   if (offset >= 0xc000 && offset < 0xd000)
127   if (offset >= 0xc000 && offset < 0xe000)
96128   {
97      data = m_rom[offset & 0xfff];
129      data = m_rom[offset & 0x1fff];
98130   }
99131
100132   return data;
r19197r19198
105137//  comx_io_r - I/O read
106138//-------------------------------------------------
107139
108UINT8 comx_prn_device::comx_io_r(offs_t offset)
140UINT8 comx_prn_device::comx_io_r(address_space &space, offs_t offset)
109141{
110142   /*
111        Parallel:
143       Parallel:
112144
113        INP 2 for the printer status, where:
114        b0=1: Acknowledge Fault
115        b1=0: Device Busy
116        b2=0: Paper Empty
117        b3=1: Device Not Selected
145       INP 2 for the printer status, where:
146       b0=1: Acknowledge Fault
147       b1=0: Device Busy
148       b2=0: Paper Empty
149       b3=1: Device Not Selected
118150
119        Serial:
151       Serial:
120152
121        INP 2 for the printer status and to start a new range of bits for the next byte.
122    */
153       INP 2 for the printer status and to start a new range of bits for the next byte.
154   */
123155
124   return 0;
156   /*
157
158       bit     description
159
160       0       Acknowledge Fault
161       1       Device Busy
162       2       Paper Empty
163       3       Device Not Selected
164       4
165       5
166       6
167       7
168
169   */
170
171   UINT8 data = 0;
172
173   data |= m_centronics->ack_r();
174   data |= m_centronics->not_busy_r() << 1;
175   data |= m_centronics->pe_r() << 2;
176   data |= m_centronics->vcc_r() << 3;
177
178   return data;
125179}
126180
127181
r19197r19198
129183//  comx_io_w - I/O write
130184//-------------------------------------------------
131185
132void comx_prn_device::comx_io_w(offs_t offset, UINT8 data)
186void comx_prn_device::comx_io_w(address_space &space, offs_t offset, UINT8 data)
133187{
134188   /*
135        Parallel:
189       Parallel:
136190
137        OUT 2 is used to send a byte to the printer
191       OUT 2 is used to send a byte to the printer
138192
139        Serial:
193       Serial:
140194
141        OUT 2 is used to send a bit to the printer
142    */
195       OUT 2 is used to send a bit to the printer
196   */
197
198   m_centronics->write(data);
143199}
trunk/src/mess/machine/comx_prn.h
r19197r19198
1515
1616#include "emu.h"
1717#include "machine/comxexp.h"
18#include "machine/comxpl80.h"
19#include "machine/ctronics.h"
1820
1921
2022
r19197r19198
2527// ======================> comx_prn_device
2628
2729class comx_prn_device : public device_t,
28                   public device_comx_expansion_card_interface
30                  public device_comx_expansion_card_interface
2931{
3032public:
3133   // construction/destruction
r19197r19198
3335
3436   // optional information overrides
3537   virtual const rom_entry *device_rom_region() const;
38   virtual machine_config_constructor device_mconfig_additions() const;
3639
3740protected:
3841   // device-level overrides
3942   virtual void device_start();
4043   virtual void device_reset();
41    virtual void device_config_complete() { m_shortname = "comx_prn"; }
44   virtual void device_config_complete() { m_shortname = "comx_prn"; }
4245
4346   // device_comx_expansion_card_interface overrides
44   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom);
45   virtual UINT8 comx_io_r(offs_t offset);
46   virtual void comx_io_w(offs_t offset, UINT8 data);
47   virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
48   virtual UINT8 comx_io_r(address_space &space, offs_t offset);
49   virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
4750
4851private:
49   UINT8 *m_rom;            // program ROM
52   required_device<centronics_device> m_centronics;
53
54   UINT8 *m_rom;               // program ROM
5055};
5156
5257
trunk/src/mess/machine/comxexp.c
r19197r19198
2828//-------------------------------------------------
2929
3030device_comx_expansion_card_interface::device_comx_expansion_card_interface(const machine_config &mconfig, device_t &device)
31   : device_slot_card_interface(mconfig,device)
31   : device_slot_card_interface(mconfig, device),
32      m_ds(1)
3233{
3334   m_slot = dynamic_cast<comx_expansion_slot_device *>(device.owner());
3435}
r19197r19198
5354//-------------------------------------------------
5455
5556comx_expansion_slot_device::comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
56        device_t(mconfig, COMX_EXPANSION_SLOT, "COMX-35 expansion slot", tag, owner, clock),
57      device_t(mconfig, COMX_EXPANSION_SLOT, "COMX-35 expansion slot", tag, owner, clock),
5758      device_slot_interface(mconfig, *this)
5859{
5960}
r19197r19198
8687   // or initialize to defaults if none provided
8788   else
8889   {
89       memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
90       memset(&m_out_ef4_cb, 0, sizeof(m_out_ef4_cb));
91       memset(&m_out_wait_cb, 0, sizeof(m_out_wait_cb));
92       memset(&m_out_clear_cb, 0, sizeof(m_out_clear_cb));
90      memset(&m_out_int_cb, 0, sizeof(m_out_int_cb));
91      memset(&m_out_wait_cb, 0, sizeof(m_out_wait_cb));
92      memset(&m_out_clear_cb, 0, sizeof(m_out_clear_cb));
9393   }
9494}
9595
r19197r19198
104104
105105   // resolve callbacks
106106   m_out_int_func.resolve(m_out_int_cb, *this);
107   m_out_ef4_func.resolve(m_out_ef4_cb, *this);
108107   m_out_wait_func.resolve(m_out_wait_cb, *this);
109108   m_out_clear_func.resolve(m_out_clear_cb, *this);
110109}
r19197r19198
123122//  mrd_r - memory read
124123//-------------------------------------------------
125124
126UINT8 comx_expansion_slot_device::mrd_r(offs_t offset, int *extrom)
125UINT8 comx_expansion_slot_device::mrd_r(address_space &space, offs_t offset, int *extrom)
127126{
128127   UINT8 data = 0;
129128
130129   if (m_card != NULL)
131130   {
132      data = m_card->comx_mrd_r(offset, extrom);
131      data = m_card->comx_mrd_r(space, offset, extrom);
133132   }
134133
135134   return data;
r19197r19198
140139//  mwr_w - memory write
141140//-------------------------------------------------
142141
143void comx_expansion_slot_device::mwr_w(offs_t offset, UINT8 data)
142void comx_expansion_slot_device::mwr_w(address_space &space, offs_t offset, UINT8 data)
144143{
145144   if (m_card != NULL)
146145   {
147      m_card->comx_mwr_w(offset, data);
146      m_card->comx_mwr_w(space, offset, data);
148147   }
149148}
150149
r19197r19198
153152//  io_r - I/O read
154153//-------------------------------------------------
155154
156UINT8 comx_expansion_slot_device::io_r(offs_t offset)
155UINT8 comx_expansion_slot_device::io_r(address_space &space, offs_t offset)
157156{
158157   UINT8 data = 0;
159158
160159   if (m_card != NULL)
161160   {
162      data = m_card->comx_io_r(offset);
161      data = m_card->comx_io_r(space, offset);
163162   }
164163
165164   return data;
r19197r19198
170169//  sout_w - I/O write
171170//-------------------------------------------------
172171
173void comx_expansion_slot_device::io_w(offs_t offset, UINT8 data)
172void comx_expansion_slot_device::io_w(address_space &space, offs_t offset, UINT8 data)
174173{
175174   if (m_card != NULL)
176175   {
177      m_card->comx_io_w(offset, data);
176      m_card->comx_io_w(space, offset, data);
178177   }
179178}
180179
r19197r19198
204203   }
205204}
206205
206READ_LINE_MEMBER( comx_expansion_slot_device::ef4_r )
207{
208   int state = CLEAR_LINE;
207209
210   if (m_card != NULL)
211   {
212      state = m_card->comx_ef4_r();
213   }
214
215   return state;
216}
217
208218WRITE_LINE_MEMBER( comx_expansion_slot_device::int_w ) { m_out_int_func(state); }
209WRITE_LINE_MEMBER( comx_expansion_slot_device::ef4_w ) { m_out_ef4_func(state); }
210219WRITE_LINE_MEMBER( comx_expansion_slot_device::wait_w ) { m_out_wait_func(state); }
211220WRITE_LINE_MEMBER( comx_expansion_slot_device::clear_w ) { m_out_clear_func(state); }
trunk/src/mess/machine/comxexp.h
r19197r19198
4545//  CONSTANTS
4646//**************************************************************************
4747
48#define COMX_EXPANSION_BUS_TAG      "comxexp"
48#define COMX_EXPANSION_BUS_TAG      "comxexp"
4949
5050
5151
r19197r19198
5858
5959
6060#define MCFG_COMX_EXPANSION_SLOT_ADD(_tag, _config, _slot_intf, _def_slot, _def_inp) \
61    MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \
62    MCFG_DEVICE_CONFIG(_config) \
61   MCFG_DEVICE_ADD(_tag, COMX_EXPANSION_SLOT, 0) \
62   MCFG_DEVICE_CONFIG(_config) \
6363   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
6464
6565
r19197r19198
7272
7373struct comx_expansion_slot_interface
7474{
75    devcb_write_line   m_out_int_cb;
76    devcb_write_line   m_out_ef4_cb;
77    devcb_write_line   m_out_wait_cb;
78    devcb_write_line   m_out_clear_cb;
75   devcb_write_line    m_out_int_cb;
76   devcb_write_line    m_out_wait_cb;
77   devcb_write_line    m_out_clear_cb;
7978};
8079
8180
r19197r19198
8483class device_comx_expansion_card_interface;
8584
8685class comx_expansion_slot_device : public device_t,
87                           public comx_expansion_slot_interface,
88                           public device_slot_interface
86                           public comx_expansion_slot_interface,
87                           public device_slot_interface
8988{
9089public:
9190   // construction/destruction
9291   comx_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9392   virtual ~comx_expansion_slot_device();
9493
95   UINT8 mrd_r(offs_t offset, int *extrom);
96   void mwr_w(offs_t offset, UINT8 data);
94   UINT8 mrd_r(address_space &space, offs_t offset, int *extrom);
95   void mwr_w(address_space &space, offs_t offset, UINT8 data);
9796
98   UINT8 io_r(offs_t offset);
99   void io_w(offs_t offset, UINT8 data);
97   UINT8 io_r(address_space &space, offs_t offset);
98   void io_w(address_space &space, offs_t offset, UINT8 data);
10099
100   DECLARE_READ_LINE_MEMBER( ef4_r );
101
101102   DECLARE_WRITE_LINE_MEMBER( ds_w );
102103   DECLARE_WRITE_LINE_MEMBER( q_w );
103104
104105   DECLARE_WRITE_LINE_MEMBER( int_w );
105   DECLARE_WRITE_LINE_MEMBER( ef4_w );
106106   DECLARE_WRITE_LINE_MEMBER( wait_w );
107107   DECLARE_WRITE_LINE_MEMBER( clear_w );
108108
r19197r19198
114114   virtual void device_reset();
115115   virtual void device_config_complete();
116116
117   devcb_resolved_write_line   m_out_int_func;
118   devcb_resolved_write_line   m_out_ef4_func;
119   devcb_resolved_write_line   m_out_wait_func;
120   devcb_resolved_write_line   m_out_clear_func;
117   devcb_resolved_write_line   m_out_int_func;
118   devcb_resolved_write_line   m_out_wait_func;
119   devcb_resolved_write_line   m_out_clear_func;
121120
122121   device_comx_expansion_card_interface *m_card;
123122};
r19197r19198
137136
138137protected:
139138   // signals
140   virtual void comx_ds_w(int state) { };
139   virtual int comx_ef4_r() { return CLEAR_LINE; }
140   virtual void comx_ds_w(int state) { m_ds = state; };
141141   virtual void comx_q_w(int state) { };
142142
143143   // memory access
144   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom) { return 0; };
145   virtual void comx_mwr_w(offs_t offset, UINT8 data) { };
144   virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom) { return 0; };
145   virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data) { };
146146
147147   // I/O access
148   virtual UINT8 comx_io_r(offs_t offset) { return 0; };
149   virtual void comx_io_w(offs_t offset, UINT8 data) { };
148   virtual UINT8 comx_io_r(address_space &space, offs_t offset) { return 0; };
149   virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data) { };
150150
151151   comx_expansion_slot_device *m_slot;
152
153   int m_ds;
152154};
153155
154156
trunk/src/mess/machine/comx_thm.c
r19197r19198
8282//  comx_mrd_r - memory read
8383//-------------------------------------------------
8484
85UINT8 comx_thm_device::comx_mrd_r(offs_t offset, int *extrom)
85UINT8 comx_thm_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
8686{
8787   UINT8 data = 0;
8888
r19197r19198
9999//  comx_io_r - I/O read
100100//-------------------------------------------------
101101
102UINT8 comx_thm_device::comx_io_r(offs_t offset)
102UINT8 comx_thm_device::comx_io_r(address_space &space, offs_t offset)
103103{
104104   /*
105        INP 2 is used for the printer status, where:
106        b0=1: Printer Not Ready
107        b1=1: Energizing Head
108        b2=1: Head At Position 0
109    */
105       INP 2 is used for the printer status, where:
106       b0=1: Printer Not Ready
107       b1=1: Energizing Head
108       b2=1: Head At Position 0
109   */
110110
111111   return 0;
112112}
r19197r19198
116116//  comx_io_w - I/O write
117117//-------------------------------------------------
118118
119void comx_thm_device::comx_io_w(offs_t offset, UINT8 data)
119void comx_thm_device::comx_io_w(address_space &space, offs_t offset, UINT8 data)
120120{
121121   /*
122        OUT 2 is used to control the thermal printer where:
123        Q = 0, b0-7: Pixel 1 to 8
124        Q = 1, b7: Pixel 9 (if b0-6=#21)
125        Q = 1, b3=1: Move head right
126        Q = 1, b0-7=#12: Move head left
127    */
122       OUT 2 is used to control the thermal printer where:
123       Q = 0, b0-7: Pixel 1 to 8
124       Q = 1, b7: Pixel 9 (if b0-6=#21)
125       Q = 1, b3=1: Move head right
126       Q = 1, b0-7=#12: Move head left
127   */
128128}
trunk/src/mess/machine/comx_thm.h
r19197r19198
2525// ======================> comx_thm_device
2626
2727class comx_thm_device : public device_t,
28                   public device_comx_expansion_card_interface
28                  public device_comx_expansion_card_interface
2929{
3030public:
3131   // construction/destruction
r19197r19198
3838   // device-level overrides
3939   virtual void device_start();
4040   virtual void device_reset();
41    virtual void device_config_complete() { m_shortname = "comx_thm"; }
41   virtual void device_config_complete() { m_shortname = "comx_thm"; }
4242
4343   // device_comx_expansion_card_interface overrides
44   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom);
45   virtual UINT8 comx_io_r(offs_t offset);
46   virtual void comx_io_w(offs_t offset, UINT8 data);
44   virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
45   virtual UINT8 comx_io_r(address_space &space, offs_t offset);
46   virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
4747
4848private:
49   UINT8 *m_rom;            // program ROM
49   UINT8 *m_rom;               // program ROM
5050};
5151
5252
trunk/src/mess/machine/comx_ram.c
r19197r19198
1515//  MACROS/CONSTANTS
1616//**************************************************************************
1717
18#define RAM_SIZE   0x8000
18#define RAM_SIZE    0x8000
1919
2020
2121
r19197r19198
6767//  comx_mrd_r - memory read
6868//-------------------------------------------------
6969
70UINT8 comx_ram_device::comx_mrd_r(offs_t offset, int *extrom)
70UINT8 comx_ram_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
7171{
7272   UINT8 data = 0;
7373
r19197r19198
8484//  comx_mwr_w - memory write
8585//-------------------------------------------------
8686
87void comx_ram_device::comx_mwr_w(offs_t offset, UINT8 data)
87void comx_ram_device::comx_mwr_w(address_space &space, offs_t offset, UINT8 data)
8888{
8989   if (offset >= 0xc000 && offset < 0xd000)
9090   {
r19197r19198
9797//  comx_io_w - I/O write
9898//-------------------------------------------------
9999
100void comx_ram_device::comx_io_w(offs_t offset, UINT8 data)
100void comx_ram_device::comx_io_w(address_space &space, offs_t offset, UINT8 data)
101101{
102102   if (offset == 1)
103103   {
trunk/src/mess/machine/comx_ram.h
r19197r19198
2525// ======================> comx_ram_device
2626
2727class comx_ram_device : public device_t,
28                   public device_comx_expansion_card_interface
28                  public device_comx_expansion_card_interface
2929{
3030public:
3131   // construction/destruction
r19197r19198
3838   virtual void device_config_complete() { m_shortname = "comx_ram"; }
3939
4040   // device_comx_expansion_card_interface overrides
41   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom);
42   virtual void comx_mwr_w(offs_t offset, UINT8 data);
43   virtual void comx_io_w(offs_t offset, UINT8 data);
41   virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
42   virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data);
43   virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
4444
4545private:
4646   UINT8 *m_ram;
trunk/src/mess/machine/comx_eb.c
r19197r19198
5555//  MACROS/CONSTANTS
5656//**************************************************************************
5757
58#define SLOT1_TAG         "slot1"
59#define SLOT2_TAG         "slot2"
60#define SLOT3_TAG         "slot3"
61#define SLOT4_TAG         "slot4"
58#define SLOT1_TAG           "slot1"
59#define SLOT2_TAG           "slot2"
60#define SLOT3_TAG           "slot3"
61#define SLOT4_TAG           "slot4"
6262
6363
6464
r19197r19198
7676ROM_START( comx_eb )
7777   ROM_REGION( 0x1000, "e000", 0 )
7878   ROM_SYSTEM_BIOS( 0, "comx", "Original" )
79   ROMX_LOAD( "expansion.e5",         0x0000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9), ROM_BIOS(1) )
79   ROMX_LOAD( "expansion.e5",         0x0000, 0x1000, CRC(52cb44e2) SHA1(3f9a3d9940b36d4fee5eca9f1359c99d7ed545b9), ROM_BIOS(1) )
8080   ROM_SYSTEM_BIOS( 1, "fm31", "F&M 3.1" )
8181   ROMX_LOAD( "f&m.expansion.3.1.e5", 0x0000, 0x1000, CRC(818ca2ef) SHA1(ea000097622e7fd472d53e7899e3c83773433045), ROM_BIOS(2) )
8282   ROM_SYSTEM_BIOS( 2, "fm32", "F&M 3.2" )
r19197r19198
114114   eb->set_int(device->tag(), state);
115115}
116116
117WRITE_LINE_DEVICE_HANDLER( ef4_w )
118{
119   comx_eb_device *eb = downcast<comx_eb_device *>(device->owner());
120   eb->set_ef4(device->tag(), state);
121}
122
123117WRITE_LINE_DEVICE_HANDLER( wait_w )
124118{
125119   comx_expansion_slot_device *slot = dynamic_cast<comx_expansion_slot_device *>(device->owner()->owner());
r19197r19198
135129static COMX_EXPANSION_INTERFACE( expansion_intf )
136130{
137131   DEVCB_LINE(int_w),
138   DEVCB_LINE(ef4_w),
139132   DEVCB_LINE(wait_w),
140133   DEVCB_LINE(clear_w)
141134};
r19197r19198
197190}
198191
199192
200//-------------------------------------------------
201//  set_ef4 - set EF4 line state
202//-------------------------------------------------
203193
204void comx_eb_device::set_ef4(const char *tag, int state)
205{
206   int slot = 0;
207
208   for (slot = 0; slot < MAX_EB_SLOTS; slot++)
209   {
210      if (!strcmp(tag, m_expansion_slot[slot]->tag())) break;
211   }
212
213   assert(slot < MAX_EB_SLOTS);
214
215   m_ef4[slot] = state;
216
217   int ef4 = CLEAR_LINE;
218
219   for (slot = 0; slot < MAX_EB_SLOTS; slot++)
220   {
221      ef4 |= m_ef4[slot];
222   }
223
224   m_slot->ef4_w(ef4);
225}
226
227
228
229194//**************************************************************************
230195//  LIVE DEVICE
231196//**************************************************************************
r19197r19198
256221   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
257222   {
258223      m_int[slot] = CLEAR_LINE;
259      m_ef4[slot] = CLEAR_LINE;
260224   }
261225
262226   m_rom = memregion("e000")->base();
r19197r19198
269233
270234void comx_eb_device::device_reset()
271235{
236   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
237   {
238      if (m_expansion_slot[slot] != NULL)
239      {
240         m_expansion_slot[slot]->device().reset();
241         m_expansion_slot[slot]->ds_w(0);
242      }
243   }
272244}
273245
274246
275247//-------------------------------------------------
248//  comx_ef4_r - external flag 4 read
249//-------------------------------------------------
250
251int comx_eb_device::comx_ef4_r()
252{
253   int state = CLEAR_LINE;
254
255   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
256   {
257      if (m_expansion_slot[slot] != NULL)
258      {
259         if (m_expansion_slot[slot]->ef4_r() == ASSERT_LINE)
260         {
261            state = ASSERT_LINE;
262            break;
263         }
264      }
265   }
266
267   return state;
268}
269
270
271//-------------------------------------------------
276272//  comx_q_w - Q write
277273//-------------------------------------------------
278274
r19197r19198
292288//  comx_mrd_r - memory read
293289//-------------------------------------------------
294290
295UINT8 comx_eb_device::comx_mrd_r(offs_t offset, int *extrom)
291UINT8 comx_eb_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
296292{
297293   UINT8 data = 0;
298294
r19197r19198
311307      {
312308         if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
313309         {
314            data |= m_expansion_slot[slot]->mrd_r(offset, extrom);
310            data |= m_expansion_slot[slot]->mrd_r(space, offset, extrom);
315311         }
316312      }
317313   }
r19197r19198
324320//  comx_mwr_w - memory write
325321//-------------------------------------------------
326322
327void comx_eb_device::comx_mwr_w(offs_t offset, UINT8 data)
323void comx_eb_device::comx_mwr_w(address_space &space, offs_t offset, UINT8 data)
328324{
329325   for (int slot = 0; slot < MAX_EB_SLOTS; slot++)
330326   {
331327      if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
332328      {
333         m_expansion_slot[slot]->mwr_w(offset, data);
329         m_expansion_slot[slot]->mwr_w(space, offset, data);
334330      }
335331   }
336332}
r19197r19198
340336//  comx_io_r - I/O read
341337//-------------------------------------------------
342338
343UINT8 comx_eb_device::comx_io_r(offs_t offset)
339UINT8 comx_eb_device::comx_io_r(address_space &space, offs_t offset)
344340{
345341   UINT8 data = 0;
346342
r19197r19198
348344   {
349345      if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
350346      {
351         data |= m_expansion_slot[slot]->io_r(offset);
347         data |= m_expansion_slot[slot]->io_r(space, offset);
352348      }
353349   }
354350
r19197r19198
360356//  comx_io_w - I/O write
361357//-------------------------------------------------
362358
363void comx_eb_device::comx_io_w(offs_t offset, UINT8 data)
359void comx_eb_device::comx_io_w(address_space &space, offs_t offset, UINT8 data)
364360{
365   if (offset == 1)
361   if (offset == 1 && !(BIT(data, 0)))
366362   {
367363      m_select = data >> 1;
368364
r19197r19198
379375   {
380376      if (BIT(m_select, slot) && m_expansion_slot[slot] != NULL)
381377      {
382         m_expansion_slot[slot]->io_w(offset, data);
378         m_expansion_slot[slot]->io_w(space, offset, data);
383379      }
384380   }
385381}
trunk/src/mess/machine/comx_eb.h
r19197r19198
2929//  CONSTANTS
3030//**************************************************************************
3131
32#define MAX_EB_SLOTS   4
32#define MAX_EB_SLOTS    4
3333
3434
3535
r19197r19198
4040// ======================> comx_eb_device
4141
4242class comx_eb_device : public device_t,
43                  public device_comx_expansion_card_interface
43                  public device_comx_expansion_card_interface
4444{
4545public:
4646   // construction/destruction
r19197r19198
5252
5353   // not really public
5454   void set_int(const char *tag, int state);
55   void set_ef4(const char *tag, int state);
5655
5756protected:
5857   // device-level overrides
5958   virtual void device_start();
6059   virtual void device_reset();
61    virtual void device_config_complete() { m_shortname = "comx_eb"; }
60   virtual void device_config_complete() { m_shortname = "comx_eb"; }
6261
6362   // device_comx_expansion_card_interface overrides
63   virtual int comx_ef4_r();
6464   virtual void comx_q_w(int state);
65   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom);
66   virtual void comx_mwr_w(offs_t offset, UINT8 data);
67   virtual UINT8 comx_io_r(offs_t offset);
68   virtual void comx_io_w(offs_t offset, UINT8 data);
65   virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
66   virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data);
67   virtual UINT8 comx_io_r(address_space &space, offs_t offset);
68   virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
6969
7070private:
71   UINT8 *m_rom;            // program ROM
71   UINT8 *m_rom;               // program ROM
7272
73   comx_expansion_slot_device   *m_expansion_slot[MAX_EB_SLOTS];
73   comx_expansion_slot_device  *m_expansion_slot[MAX_EB_SLOTS];
7474   int m_int[MAX_EB_SLOTS];
75   int m_ef4[MAX_EB_SLOTS];
7675
7776   UINT8 m_select;
7877};
trunk/src/mess/machine/comx_joy.c
r19197r19198
9696//  comx_mrd_r - I/O read
9797//-------------------------------------------------
9898
99UINT8 comx_joy_device::comx_io_r(offs_t offset)
99UINT8 comx_joy_device::comx_io_r(address_space &space, offs_t offset)
100100{
101101   UINT8 data = 0;
102102
trunk/src/mess/machine/comx_joy.h
r19197r19198
4141   virtual void device_config_complete() { m_shortname = "comx_joy"; }
4242
4343   // device_comx_expansion_card_interface overrides
44   virtual UINT8 comx_io_r(offs_t offset);
44   virtual UINT8 comx_io_r(address_space &space, offs_t offset);
4545};
4646
4747
trunk/src/mess/machine/comx_epr.c
r19197r19198
9292//  comx_mrd_r - memory read
9393//-------------------------------------------------
9494
95UINT8 comx_epr_device::comx_mrd_r(offs_t offset, int *extrom)
95UINT8 comx_epr_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
9696{
9797   UINT8 data = 0;
9898
r19197r19198
114114//  comx_io_w - I/O write
115115//-------------------------------------------------
116116
117void comx_epr_device::comx_io_w(offs_t offset, UINT8 data)
117void comx_epr_device::comx_io_w(address_space &space, offs_t offset, UINT8 data)
118118{
119119   if (offset == 1)
120120   {
trunk/src/mess/machine/comx_epr.h
r19197r19198
4141    virtual void device_config_complete() { m_shortname = "comx_epr"; }
4242
4343   // device_comx_expansion_card_interface overrides
44   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom);
45   virtual void comx_io_w(offs_t offset, UINT8 data);
44   virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
45   virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
4646
4747private:
4848   UINT8 m_select;
trunk/src/mess/machine/comx_clm.c
r19197r19198
5353//  MACROS/CONSTANTS
5454//**************************************************************************
5555
56#define MC6845_TAG         "mc6845"
57#define MC6845_SCREEN_TAG   "screen80"
58#define VIDEORAM_SIZE      0x800
56#define MC6845_TAG          "mc6845"
57#define MC6845_SCREEN_TAG   "screen80"
58#define VIDEORAM_SIZE       0x800
5959
6060
6161
r19197r19198
7272
7373ROM_START( comx_clm )
7474   ROM_REGION( 0x2000, "c000", 0 )
75   ROM_LOAD( "p 1.0.cl1", 0x0000, 0x0800, CRC(b417d30a) SHA1(d428b0467945ecb9aec884211d0f4b1d8d56d738) ) // V1.0
76   ROM_LOAD( "p 1.1.cl1", 0x0000, 0x0800, CRC(0a2eaf19) SHA1(3f1f640caef964fb47aaa147cab6d215c2b30e9d) ) // V1.1
75   ROM_DEFAULT_BIOS( "v11" )
76   ROM_SYSTEM_BIOS( 0, "v10", "v1.0" )
77   ROMX_LOAD( "p 1.0.cl1", 0x0000, 0x0800, CRC(b417d30a) SHA1(d428b0467945ecb9aec884211d0f4b1d8d56d738), ROM_BIOS(1) )
78   ROM_SYSTEM_BIOS( 1, "v11", "v1.1" )
79   ROMX_LOAD( "p 1.1.cl1", 0x0000, 0x0800, CRC(0a2eaf19) SHA1(3f1f640caef964fb47aaa147cab6d215c2b30e9d), ROM_BIOS(2) )
7780
7881   ROM_REGION( 0x800, MC6845_TAG, 0 )
79   ROM_LOAD( "c 1.0.cl4", 0x0000, 0x0800, CRC(69dd7b07) SHA1(71d368adbb299103d165eab8359a97769e463e26) ) // V1.0
80   ROM_LOAD( "c 1.1.cl4", 0x0000, 0x0800, CRC(dc9b5046) SHA1(4e041cec03dda6dba5e2598d060c49908a4fab2a) ) // V1.1
82   ROMX_LOAD( "c 1.0.cl4", 0x0000, 0x0800, CRC(69dd7b07) SHA1(71d368adbb299103d165eab8359a97769e463e26), ROM_BIOS(1) )
83   ROMX_LOAD( "c 1.1.cl4", 0x0000, 0x0800, CRC(dc9b5046) SHA1(4e041cec03dda6dba5e2598d060c49908a4fab2a), ROM_BIOS(2) )
8184ROM_END
8285
8386
r19197r19198
97100
98101void comx_clm_device::crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param)
99102{
100   const rgb_t *palette = palette_entry_list_raw(bitmap.palette());
101103   for (int column = 0; column < x_count; column++)
102104   {
103105      UINT8 code = m_video_ram[((ma + column) & 0x7ff)];
r19197r19198
114116         int x = (column * 8) + bit;
115117         int color = BIT(data, 7) ? 7 : 0;
116118
117         bitmap.pix32(y, x) = palette[color];
119         bitmap.pix32(y, x) = RGB_MONOCHROME_WHITE[color];
118120
119121         data <<= 1;
120122      }
r19197r19198
127129   clm->crtc_update_row(device,bitmap,cliprect,ma,ra,y,x_count,cursor_x,param);
128130}
129131
130WRITE_LINE_MEMBER( comx_clm_device::hsync_w )
131{
132   if (m_ds)
133   {
134      m_slot->ef4_w(state);
135   }
136   else
137   {
138      m_slot->ef4_w(CLEAR_LINE);
139   }
140}
141
142132static const mc6845_interface crtc_intf =
143133{
144134   MC6845_SCREEN_TAG,
r19197r19198
148138   NULL,
149139   DEVCB_NULL,
150140   DEVCB_NULL,
151   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_clm_device, hsync_w),
152141   DEVCB_NULL,
142   DEVCB_NULL,
153143   NULL
154144};
155145
r19197r19198
205195   device_t(mconfig, COMX_CLM, "COMX 80 Column Card", tag, owner, clock),
206196   device_comx_expansion_card_interface(mconfig, *this),
207197   m_crtc(*this, MC6845_TAG),
208   m_ds(0)
198   m_video_ram(*this, "video_ram")
209199{
210200}
211201
r19197r19198
216206
217207void comx_clm_device::device_start()
218208{
209   // find memory regions
219210   m_rom = memregion("c000")->base();
220211   m_char_rom = memregion(MC6845_TAG)->base();
221   m_video_ram = auto_alloc_array(machine(), UINT8, VIDEORAM_SIZE);
222212
213   // allocate memory
214   m_video_ram.allocate(VIDEORAM_SIZE);
215
223216   // state saving
224217   save_item(NAME(m_ds));
225   save_pointer(NAME(m_video_ram), VIDEORAM_SIZE);
226218}
227219
228220
r19197r19198
236228
237229
238230//-------------------------------------------------
239//  comx_ds_w - device select write
231//  comx_ef4_r - external flag 4 read
240232//-------------------------------------------------
241233
242void comx_clm_device::comx_ds_w(int state)
234int comx_clm_device::comx_ef4_r()
243235{
244   m_ds = state;
236   return m_ds ? m_crtc->hsync_r() : CLEAR_LINE;
245237}
246238
247239
r19197r19198
249241//  comx_mrd_r - memory read
250242//-------------------------------------------------
251243
252UINT8 comx_clm_device::comx_mrd_r(offs_t offset, int *extrom)
244UINT8 comx_clm_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
253245{
254   address_space &space = machine().firstcpu->space(AS_PROGRAM);
255
256246   UINT8 data = 0xff;
257247
258248   if (offset >= 0xc000 && offset < 0xc800)
r19197r19198
276266//  comx_mwr_w - memory write
277267//-------------------------------------------------
278268
279void comx_clm_device::comx_mwr_w(offs_t offset, UINT8 data)
269void comx_clm_device::comx_mwr_w(address_space &space, offs_t offset, UINT8 data)
280270{
281   address_space &space = machine().firstcpu->space(AS_PROGRAM);
282
283271   if (offset >= 0xd000 && offset < 0xd800)
284272   {
285273      m_video_ram[offset & 0x7ff] = data;
trunk/src/mess/machine/comx_clm.h
r19197r19198
2626// ======================> comx_clm_device
2727
2828class comx_clm_device : public device_t,
29                   public device_comx_expansion_card_interface
29                  public device_comx_expansion_card_interface
3030{
3131public:
3232   // construction/destruction
r19197r19198
3838
3939   // not really public
4040   void crtc_update_row(mc6845_device *device, bitmap_rgb32 &bitmap, const rectangle &cliprect, UINT16 ma, UINT8 ra, UINT16 y, UINT8 x_count, INT8 cursor_x, void *param);
41   DECLARE_WRITE_LINE_MEMBER( hsync_w );
4241
4342protected:
4443   // device-level overrides
4544   virtual void device_start();
4645   virtual void device_reset();
47    virtual void device_config_complete() { m_shortname = "comx_clm"; }
46   virtual void device_config_complete() { m_shortname = "comx_clm"; }
4847
4948   // device_comx_expansion_card_interface overrides
50   virtual void comx_ds_w(int state);
51   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom);
52   virtual void comx_mwr_w(offs_t offset, UINT8 data);
49   virtual int comx_ef4_r();
50   virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
51   virtual void comx_mwr_w(address_space &space, offs_t offset, UINT8 data);
5352
5453private:
5554   required_device<mc6845_device> m_crtc;
55   optional_shared_ptr<UINT8> m_video_ram;
5656
57   int m_ds;            // device select
58   UINT8 *m_rom;         // program ROM
59   UINT8 *m_char_rom;      // character ROM
60   UINT8 *m_video_ram;      // video RAM
57   UINT8 *m_rom;           // program ROM
58   UINT8 *m_char_rom;      // character ROM
6159};
6260
6361
trunk/src/mess/machine/comxpl80.c
r19197r19198
3131//  DEVICE DEFINITIONS
3232//**************************************************************************
3333
34const device_type COMXPL80 = &device_creator<comxpl80_device>;
34const device_type COMX_PL80 = &device_creator<comx_pl80_device>;
3535
36//-------------------------------------------------
37//  device_config_complete - perform any
38//  operations now that the configuration is
39//  complete
40//-------------------------------------------------
4136
42void comxpl80_device::device_config_complete()
43{
44   // inherit a copy of the static data
45   const comxpl80_interface *intf = reinterpret_cast<const comxpl80_interface *>(static_config());
46   if (intf != NULL)
47      *static_cast<comxpl80_interface *>(this) = *intf;
48
49   // or initialize to defaults if none provided
50   else
51   {
52   }
53
54   m_shortname = "comxpl80";
55}
56
57
5837//-------------------------------------------------
5938//  ROM( comxpl80 )
6039//-------------------------------------------------
r19197r19198
7352//  rom_region - device-specific ROM region
7453//-------------------------------------------------
7554
76const rom_entry *comxpl80_device::device_rom_region() const
55const rom_entry *comx_pl80_device::device_rom_region() const
7756{
7857   return ROM_NAME( comxpl80 );
7958}
r19197r19198
8362//  ADDRESS_MAP( comxpl80_mem )
8463//-------------------------------------------------
8564
86static ADDRESS_MAP_START( comxpl80_mem, AS_PROGRAM, 8, comxpl80_device )
65static ADDRESS_MAP_START( comxpl80_mem, AS_PROGRAM, 8, comx_pl80_device )
8766/*  AM_RANGE(0x000, 0x000) AM_READWRITE(cx005_port_a_r, cx005_port_a_w)
8867    AM_RANGE(0x001, 0x001) AM_READWRITE(cx005_port_b_r, cx005_port_b_w)
8968    AM_RANGE(0x002, 0x002) AM_READWRITE(cx005_port_c_r, cx005_port_c_w)
r19197r19198
10685//  ADDRESS_MAP( comxpl80_io )
10786//-------------------------------------------------
10887
109static ADDRESS_MAP_START( comxpl80_io, AS_IO, 8, comxpl80_device )
88static ADDRESS_MAP_START( comxpl80_io, AS_IO, 8, comx_pl80_device )
11089   ADDRESS_MAP_UNMAP_HIGH
11190   AM_RANGE(0x00, 0x00) AM_WRITE(pa_w)
11291   AM_RANGE(0x01, 0x01) AM_WRITE(pb_w)
r19197r19198
132111//  machine configurations
133112//-------------------------------------------------
134113
135machine_config_constructor comxpl80_device::device_mconfig_additions() const
114machine_config_constructor comx_pl80_device::device_mconfig_additions() const
136115{
137116   return MACHINE_CONFIG_NAME( comxpl80 );
138117}
r19197r19198
165144//  input_ports - device-specific input ports
166145//-------------------------------------------------
167146
168ioport_constructor comxpl80_device::device_input_ports() const
147ioport_constructor comx_pl80_device::device_input_ports() const
169148{
170149   return INPUT_PORTS_NAME( comxpl80 );
171150}
r19197r19198
177156//**************************************************************************
178157
179158//-------------------------------------------------
180//  comxpl80_device - constructor
159//  comx_pl80_device - constructor
181160//-------------------------------------------------
182161
183comxpl80_device::comxpl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
184    : device_t(mconfig, COMXPL80, "COMX PL-80", tag, owner, clock)
162comx_pl80_device::comx_pl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
163    : device_t(mconfig, COMX_PL80, "COMX PL-80", tag, owner, clock),
164      device_centronics_peripheral_interface(mconfig, *this)
185165{
186166}
187167
r19197r19198
190170//  device_start - device-specific startup
191171//-------------------------------------------------
192172
193void comxpl80_device::device_start()
173void comx_pl80_device::device_start()
194174{
195175   // state saving
196   save_item(NAME(m_centronics_data));
197176   save_item(NAME(m_font_addr));
198177   save_item(NAME(m_x_motor_phase));
199178   save_item(NAME(m_y_motor_phase));
r19197r19198
208187//  device_reset - device-specific reset
209188//-------------------------------------------------
210189
211void comxpl80_device::device_reset()
190void comx_pl80_device::device_reset()
212191{
213192}
214193
r19197r19198
217196//  pa_w -
218197//-------------------------------------------------
219198
220WRITE8_MEMBER( comxpl80_device::pa_w )
199WRITE8_MEMBER( comx_pl80_device::pa_w )
221200{
222201   /*
223202
r19197r19198
254233   if (!BIT(data, 6))
255234   {
256235      // read data from Centronics bus
257      m_plotter_data = m_centronics_data;
236      m_plotter_data = m_data;
258237   }
259238
260239   if (BIT(data, 7))
r19197r19198
269248//  pb_w -
270249//-------------------------------------------------
271250
272WRITE8_MEMBER( comxpl80_device::pb_w )
251WRITE8_MEMBER( comx_pl80_device::pb_w )
273252{
274253   /*
275254
r19197r19198
296275//  pc_w -
297276//-------------------------------------------------
298277
299WRITE8_MEMBER( comxpl80_device::pc_w )
278WRITE8_MEMBER( comx_pl80_device::pc_w )
300279{
301280   /*
302281
r19197r19198
326305//  pd_r -
327306//-------------------------------------------------
328307
329READ8_MEMBER( comxpl80_device::pd_r )
308READ8_MEMBER( comx_pl80_device::pd_r )
330309{
331310   /*
332311
trunk/src/mess/machine/comxpl80.h
r19197r19198
99
1010#pragma once
1111
12#ifndef __COMXPL80__
13#define __COMXPL80__
12#ifndef __COMX_PL80__
13#define __COMX_PL80__
1414
1515#include "emu.h"
1616#include "cpu/m6805/m6805.h"
17#include "machine/ctronics.h"
1718
1819
1920
2021//**************************************************************************
21//  MACROS / CONSTANTS
22//**************************************************************************
23
24#define COMXPL80_TAG   "comxpl80"
25
26
27
28//**************************************************************************
29//  INTERFACE CONFIGURATION MACROS
30//**************************************************************************
31
32#define MCFG_COMXPL80_ADD() \
33    MCFG_DEVICE_ADD(COMXPL80_TAG, COMXPL80, 0)
34
35
36#define COMXPL80_INTERFACE(_name) \
37   const comxpl80_interface (_name) =
38
39
40
41//**************************************************************************
4222//  TYPE DEFINITIONS
4323//**************************************************************************
4424
45// ======================> comxpl80_interface
25// ======================> comx_pl80_device
4626
47struct comxpl80_interface
27class comx_pl80_device :  public device_t,
28                          public device_centronics_peripheral_interface
4829{
49   devcb_write_line   m_out_txd_cb;
50   devcb_write_line   m_out_clock_cb;
51   devcb_write_line   m_out_keydown_cb;
52};
53
54// ======================> comxpl80_device
55
56class comxpl80_device :  public device_t,
57                         public comxpl80_interface
58{
5930public:
6031    // construction/destruction
61    comxpl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32    comx_pl80_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33   
6234   // optional information overrides
6335   virtual const rom_entry *device_rom_region() const;
6436   virtual machine_config_constructor device_mconfig_additions() const;
6537   virtual ioport_constructor device_input_ports() const;
6638
39   // not really public
6740   DECLARE_WRITE8_MEMBER( pa_w );
6841   DECLARE_WRITE8_MEMBER( pb_w );
6942   DECLARE_WRITE8_MEMBER( pc_w );
r19197r19198
7144
7245protected:
7346    // device-level overrides
47    virtual void device_config_complete() { m_shortname = "comx_pl80"; }
7448    virtual void device_start();
7549   virtual void device_reset();
76    virtual void device_config_complete();
7750
7851private:
79   // printer state
80   UINT8 m_centronics_data;   // centronics data
81
8252   // PL-80 plotter state
8353   UINT16 m_font_addr;         // font ROM pack address latch
8454   UINT8 m_x_motor_phase;      // X motor phase
r19197r19198
9161
9262
9363// device type definition
94extern const device_type COMXPL80;
64extern const device_type COMX_PL80;
9565
9666
9767
trunk/src/mess/machine/comx_fd.c
r19197r19198
5050//  MACROS/CONSTANTS
5151//**************************************************************************
5252
53#define WD1770_TAG         "wd1770"
53#define WD1770_TAG          "wd1770"
5454
5555
5656
r19197r19198
6767
6868ROM_START( comx_fd )
6969   ROM_REGION( 0x2000, "c000", 0 )
70   ROM_LOAD( "d.o.s. v1.2.f4",   0x0000, 0x2000, CRC(cf4ecd2e) SHA1(290e19bdc89e3c8059e63d5ae3cca4daa194e1fe) )
70   ROM_LOAD( "d.o.s. v1.2.f4", 0x0000, 0x2000, CRC(cf4ecd2e) SHA1(290e19bdc89e3c8059e63d5ae3cca4daa194e1fe) )
7171ROM_END
7272
7373
r19197r19198
8585//  wd17xx_interface fdc_intf
8686//-------------------------------------------------
8787
88static const floppy_interface floppy_intf =
89{
90   DEVCB_NULL,
91   DEVCB_NULL,
92   DEVCB_NULL,
93   DEVCB_NULL,
94   DEVCB_NULL,
95   FLOPPY_STANDARD_5_25_DSSD,
96   LEGACY_FLOPPY_OPTIONS_NAME(comx35),
97   "floppy_5_25",
98   NULL
99};
88FLOPPY_FORMATS_MEMBER( comx_fd_device::floppy_formats )
89   FLOPPY_COMX35_FORMAT
90FLOPPY_FORMATS_END
10091
101WRITE_LINE_MEMBER( comx_fd_device::intrq_w )
92static SLOT_INTERFACE_START( comx_fd_floppies )
93   SLOT_INTERFACE( "525sd35t", FLOPPY_525_SD_35T )
94   SLOT_INTERFACE( "525qd", FLOPPY_525_QD )
95SLOT_INTERFACE_END
96
97void comx_fd_device::intrq_w(bool state)
10298{
10399   m_intrq = state;
104100}
105101
106WRITE_LINE_MEMBER( comx_fd_device::drq_w )
102void comx_fd_device::drq_w(bool state)
107103{
108104   m_drq = state;
109
110   update_ef4();
111105}
112106
113static const wd17xx_interface fdc_intf =
114{
115   DEVCB_LINE_VCC,
116   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_fd_device, intrq_w),
117   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, comx_fd_device, drq_w),
118   { FLOPPY_0, FLOPPY_1, NULL, NULL }
119};
120107
121
122108//-------------------------------------------------
123109//  MACHINE_CONFIG_FRAGMENT( comx_fd )
124110//-------------------------------------------------
125111
126112static MACHINE_CONFIG_FRAGMENT( comx_fd )
127   MCFG_WD1770_ADD(WD1770_TAG, fdc_intf)
128   MCFG_LEGACY_FLOPPY_2_DRIVES_ADD(floppy_intf)
113   MCFG_WD1770x_ADD(WD1770_TAG, XTAL_8MHz)
114
115   MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":0", comx_fd_floppies, "525sd35t", NULL, comx_fd_device::floppy_formats)
116   MCFG_FLOPPY_DRIVE_ADD(WD1770_TAG":1", comx_fd_floppies, NULL,       NULL, comx_fd_device::floppy_formats)
129117MACHINE_CONFIG_END
130118
131119
r19197r19198
142130
143131
144132//**************************************************************************
145//  INLINE HELPERS
146//**************************************************************************
147
148//-------------------------------------------------
149//  update_ef4 -
150//-------------------------------------------------
151
152inline void comx_fd_device::update_ef4()
153{
154   if (m_ds && !m_disb)
155   {
156      m_slot->ef4_w(!m_drq);
157   }
158   else
159   {
160      m_slot->ef4_w(CLEAR_LINE);
161   }
162}
163
164
165
166//**************************************************************************
167133//  LIVE DEVICE
168134//**************************************************************************
169135
r19197r19198
175141   device_t(mconfig, COMX_FD, "COMX FD", tag, owner, clock),
176142   device_comx_expansion_card_interface(mconfig, *this),
177143   m_fdc(*this, WD1770_TAG),
178   m_floppy0(*this, FLOPPY_0),
179   m_floppy1(*this, FLOPPY_1),
144   m_floppy0(*this, WD1770_TAG":0"),
145   m_floppy1(*this, WD1770_TAG":1"),
180146   m_ds(0),
181147   m_q(0),
182148   m_addr(0),
183   m_intrq(0),
184   m_drq(0),
149   m_intrq(false),
150   m_drq(false),
185151   m_disb(1)
186152{
187153}
r19197r19198
193159
194160void comx_fd_device::device_start()
195161{
162   // find memory regions
196163   m_rom = memregion("c000")->base();
197164
165   // initialize floppy controller
166   m_fdc->setup_intrq_cb(wd1770_t::line_cb(FUNC(comx_fd_device::intrq_w), this));
167   m_fdc->setup_drq_cb(wd1770_t::line_cb(FUNC(comx_fd_device::drq_w), this));
168   m_fdc->dden_w(1);
169
198170   // state saving
199171   save_item(NAME(m_ds));
200172   save_item(NAME(m_q));
r19197r19198
211183
212184void comx_fd_device::device_reset()
213185{
214   wd17xx_reset(m_fdc);
186   m_fdc->reset();
215187}
216188
217189
218190//-------------------------------------------------
219//  comx_q_w - Q write
191//  comx_ef4_r - external flag 4 read
220192//-------------------------------------------------
221193
222void comx_fd_device::comx_q_w(int state)
194int comx_fd_device::comx_ef4_r()
223195{
224   m_q = state;
196   int state = CLEAR_LINE;
197
198   if (m_ds && !m_disb)
199   {
200      state = m_drq ? ASSERT_LINE : CLEAR_LINE;
201   }
202
203   return state;
225204}
226205
227206
228207//-------------------------------------------------
229//  comx_ds_w - device select write
208//  comx_q_w - Q write
230209//-------------------------------------------------
231210
232void comx_fd_device::comx_ds_w(int state)
211void comx_fd_device::comx_q_w(int state)
233212{
234   m_ds = state;
235
236   update_ef4();
213   m_q = state;
237214}
238215
239216
r19197r19198
241218//  comx_mrd_r - memory read
242219//-------------------------------------------------
243220
244UINT8 comx_fd_device::comx_mrd_r(offs_t offset, int *extrom)
221UINT8 comx_fd_device::comx_mrd_r(address_space &space, offs_t offset, int *extrom)
245222{
246223   UINT8 data = 0xff;
247224
r19197r19198
263240//  comx_io_r - I/O read
264241//-------------------------------------------------
265242
266UINT8 comx_fd_device::comx_io_r(offs_t offset)
243UINT8 comx_fd_device::comx_io_r(address_space &space, offs_t offset)
267244{
268245   UINT8 data = 0xff;
269246
r19197r19198
271248   {
272249      if (m_q)
273250      {
274         data = m_intrq;
251         data = m_intrq ? 1 : 0;
275252      }
276253      else
277254      {
278         data = wd17xx_r(m_fdc, machine().driver_data()->generic_space(), m_addr);
255         data = m_fdc->gen_r(m_addr);
279256      }
280257   }
281258
r19197r19198
287264//  comx_io_w - I/O write
288265//-------------------------------------------------
289266
290void comx_fd_device::comx_io_w(offs_t offset, UINT8 data)
267void comx_fd_device::comx_io_w(address_space &space, offs_t offset, UINT8 data)
291268{
292269   if (offset == 2)
293270   {
r19197r19198
295272      {
296273         /*
297274
298                bit     description
275             bit     description
299276
300                0       A0
301                1       A1
302                2       DRIVE0
303                3       DRIVE1
304                4       F9 DISB
305                5       SIDE SELECT
277             0       FDC A0
278             1       FDC A1
279             2       DRIVE0
280             3       DRIVE1
281             4       F9 DISB
282             5       SIDE SELECT
306283
307            */
284         */
308285
309286         // latch data to F3
310287         m_addr = data & 0x03;
311288
312         if (BIT(data, 2))
313         {
314            wd17xx_set_drive(m_fdc, 0);
315         }
316         else if (BIT(data, 3))
317         {
318            wd17xx_set_drive(m_fdc, 1);
319         }
289         // drive select
290         floppy_image_device *floppy = NULL;
320291
321         m_disb = !BIT(data, 4);
322         update_ef4();
292         if (BIT(data, 2)) floppy = m_floppy0->get_device();
293         if (BIT(data, 3)) floppy = m_floppy1->get_device();
323294
324         wd17xx_set_side(m_fdc, BIT(data, 5));
295         m_fdc->set_floppy(floppy);
296
297         if (floppy) floppy->ss_w(BIT(data, 5));
298
299         m_disb = !BIT(data, 4);
325300      }
326301      else
327302      {
328303         // write data to WD1770
329         wd17xx_w(m_fdc, machine().driver_data()->generic_space(), m_addr, data);
304         m_fdc->gen_w(m_addr, data);
330305      }
331306   }
332307}
trunk/src/mess/machine/comx_fd.h
r19197r19198
1414
1515
1616#include "emu.h"
17#include "formats/basicdsk.h"
1817#include "formats/comx35_dsk.h"
19#include "imagedev/flopdrv.h"
2018#include "machine/comxexp.h"
21#include "machine/wd17xx.h"
19#include "machine/wd_fdc.h"
2220
2321
2422
r19197r19198
2927// ======================> comx_fd_device
3028
3129class comx_fd_device : public device_t,
32                  public device_comx_expansion_card_interface
30                  public device_comx_expansion_card_interface
3331{
3432public:
3533   // construction/destruction
r19197r19198
4038   virtual machine_config_constructor device_mconfig_additions() const;
4139
4240   // not really public
43   DECLARE_WRITE_LINE_MEMBER( intrq_w );
44   DECLARE_WRITE_LINE_MEMBER( drq_w );
41   void intrq_w(bool state);
42   void drq_w(bool state);
4543
44   DECLARE_FLOPPY_FORMATS( floppy_formats );
45
4646protected:
4747   // device-level overrides
4848   virtual void device_start();
4949   virtual void device_reset();
50    virtual void device_config_complete() { m_shortname = "comx_fd"; }
50   virtual void device_config_complete() { m_shortname = "comx_fd"; }
5151
5252   // device_comx_expansion_card_interface overrides
53   virtual void comx_ds_w(int state);
53   virtual int comx_ef4_r();
5454   virtual void comx_q_w(int state);
55   virtual UINT8 comx_mrd_r(offs_t offset, int *extrom);
56   virtual UINT8 comx_io_r(offs_t offset);
57   virtual void comx_io_w(offs_t offset, UINT8 data);
55   virtual UINT8 comx_mrd_r(address_space &space, offs_t offset, int *extrom);
56   virtual UINT8 comx_io_r(address_space &space, offs_t offset);
57   virtual void comx_io_w(address_space &space, offs_t offset, UINT8 data);
5858
5959private:
6060   inline void update_ef4();
6161
6262   // internal state
63   required_device<wd1770_device> m_fdc;
64   required_device<legacy_floppy_image_device> m_floppy0;
65   required_device<legacy_floppy_image_device> m_floppy1;
63   required_device<wd1770_t> m_fdc;
64   required_device<floppy_connector> m_floppy0;
65   required_device<floppy_connector> m_floppy1;
6666
6767   // floppy state
68   int m_ds;            // device select
68   int m_ds;               // device select
6969   UINT8 *m_rom;
70   int m_q;            // FDC register select
71   int m_addr;            // FDC address
72   int m_intrq;         // interrupt request
73   int m_drq;            // data request
74   int m_disb;            // data request disable
70   int m_q;                // FDC register select
71   int m_addr;             // FDC address
72   bool m_intrq;           // interrupt request
73   bool m_drq;             // data request
74   int m_disb;             // data request disable
7575};
7676
7777
trunk/src/mess/includes/comx35.h
r19197r19198
66
77#include "emu.h"
88#include "cpu/cosmac/cosmac.h"
9#include "sound/cdp1869.h"
10#include "sound/wave.h"
119#include "formats/comx35_comx.h"
1210#include "imagedev/cassette.h"
1311#include "imagedev/printer.h"
r19197r19198
2523#include "machine/comx_thm.h"
2624#include "machine/ram.h"
2725#include "machine/rescap.h"
26#include "sound/cdp1869.h"
27#include "sound/wave.h"
2828
29#define SCREEN_TAG         "screen"
29#define SCREEN_TAG          "screen"
3030
31#define CDP1870_TAG         "u1"
32#define CDP1869_TAG         "u2"
33#define CDP1802_TAG         "u3"
34#define CDP1871_TAG         "u4"
35#define EXPANSION_TAG      "slot"
31#define CDP1870_TAG         "u1"
32#define CDP1869_TAG         "u2"
33#define CDP1802_TAG         "u3"
34#define CDP1871_TAG         "u4"
35#define EXPANSION_TAG       "exp"
3636
3737#define COMX35_CHARRAM_SIZE 0x800
3838#define COMX35_CHARRAM_MASK 0x7ff
r19197r19198
4242public:
4343   comx35_state(const machine_config &mconfig, device_type type, const char *tag)
4444      : driver_device(mconfig, type, tag),
45        m_maincpu(*this, CDP1802_TAG),
46        m_vis(*this, CDP1869_TAG),
47        m_kbe(*this, CDP1871_TAG),
48        m_cassette(*this, CASSETTE_TAG),
49        m_ram(*this, RAM_TAG),
50        m_expansion(*this, EXPANSION_TAG),
51        m_ef4(0)
45         m_maincpu(*this, CDP1802_TAG),
46         m_vis(*this, CDP1869_TAG),
47         m_kbe(*this, CDP1871_TAG),
48         m_cassette(*this, CASSETTE_TAG),
49         m_ram(*this, RAM_TAG),
50         m_exp(*this, EXPANSION_TAG),
51         m_char_ram(*this, "char_ram")
5252   { }
5353
5454   required_device<cosmac_device> m_maincpu;
r19197r19198
5656   required_device<cdp1871_device> m_kbe;
5757   required_device<cassette_image_device> m_cassette;
5858   required_device<ram_device> m_ram;
59   required_device<comx_expansion_slot_device> m_expansion;
59   required_device<comx_expansion_slot_device> m_exp;
60   optional_shared_ptr<UINT8> m_char_ram;
6061
6162   virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr);
6263   virtual void machine_start();
r19197r19198
8283   DECLARE_WRITE_LINE_MEMBER( q_w );
8384   DECLARE_READ_LINE_MEMBER( shift_r );
8485   DECLARE_READ_LINE_MEMBER( control_r );
85   DECLARE_WRITE_LINE_MEMBER( ef4_w );
8686   DECLARE_WRITE_LINE_MEMBER( int_w );
8787   DECLARE_WRITE_LINE_MEMBER( prd_w );
8888   DECLARE_INPUT_CHANGED_MEMBER( trigger_reset );
8989
9090   // processor state
91   int m_clear;            // CPU mode
92   int m_q;               // Q flag
93   int m_ef4;               // EF4 flag
94   int m_iden;               // interrupt/DMA enable
95   int m_dma;               // memory refresh DMA
96   int m_int;               // interrupt request
97   int m_prd;               // predisplay
98   int m_cr1;               // interrupt enable
91   int m_clear;                // CPU mode
92   int m_q;                    // Q flag
93   int m_iden;                 // interrupt/DMA enable
94   int m_dma;                  // memory refresh DMA
95   int m_int;                  // interrupt request
96   int m_prd;                  // predisplay
97   int m_cr1;                  // interrupt enable
9998
100   // video state
101   UINT8 *m_charram;         // character memory
99   const UINT8 *m_rom;
102100};
103101
104102// ---------- defined in video/comx35.c ----------
trunk/src/mess/video/comx35.c
r19197r19198
4747   UINT8 column = pmd & 0x7f;
4848   UINT16 charaddr = (column << 4) | cma;
4949
50   return state->m_charram[charaddr];
50   return state->m_char_ram[charaddr];
5151}
5252
5353static CDP1869_CHAR_RAM_WRITE( comx35_charram_w )
r19197r19198
5757   UINT8 column = pmd & 0x7f;
5858   UINT16 charaddr = (column << 4) | cma;
5959
60   state->m_charram[charaddr] = data;
60   state->m_char_ram[charaddr] = data;
6161}
6262
6363static CDP1869_PCB_READ( comx35_pcb_r )
r19197r19198
103103void comx35_state::video_start()
104104{
105105   // allocate memory
106   m_charram = auto_alloc_array(machine(), UINT8, COMX35_CHARRAM_SIZE);
107
108   // register for save state
109   save_pointer(NAME(m_charram), COMX35_CHARRAM_SIZE);
106   m_char_ram.allocate(COMX35_CHARRAM_SIZE);
110107}
111108
112109/* Machine Drivers */

Previous 199869 Revisions Next


© 1997-2024 The MAME Team