Previous 199869 Revisions Next

r21094 Friday 15th February, 2013 at 18:54:26 UTC by Curt Coder
(MESS) vic20/c64: Added VIC-1011A/B RS-232C adapter emulation. [Curt Coder]
(MESS) cbm2: Connected RS-232 port to ACIA. (nw)
(MESS) Modernization and cleanup. (nw)
[src/mess]mess.mak
[src/mess/drivers]c128.c c64.c cbm2.c plus4.c vic10.c vic20.c
[src/mess/includes]c64.h plus4.h vic10.h vic20.h
[src/mess/machine]c1551.c c1551.h c64_4dxh.c c64_4ksa.c c64_4tba.c c64_bn1541.c c64_geocable.c c64_swiftlink.c c64_swiftlink.h c64_turbo232.c c64_vic1011.c* c64_vic1011.h* c64exp.h c64user.c c64user.h cbm2exp.c cbm2exp.h cbm2user.c cbm2user.h cbmipt.c cbmipt.h petuser.c petuser.h plus4exp.c plus4exp.h serial.c serial.h vic1010.c vic1010.h vic1011.c* vic1011.h* vic10exp.c vic10exp.h vic20exp.c vic20exp.h vic20user.c vic20user.h

trunk/src/mess/drivers/cbm2.c
r21093r21094
18881888//  rs232_port_interface rs232_intf
18891889//-------------------------------------------------
18901890
1891static SLOT_INTERFACE_START( rs232_devices )
1892SLOT_INTERFACE_END
1893
18941891static const rs232_port_interface rs232_intf =
18951892{
1893   DEVCB_DEVICE_LINE_MEMBER(MOS6551A_TAG, mos6551_device, rxd_w),
1894   DEVCB_DEVICE_LINE_MEMBER(MOS6551A_TAG, mos6551_device, dcd_w),
1895   DEVCB_DEVICE_LINE_MEMBER(MOS6551A_TAG, mos6551_device, dsr_w),
18961896   DEVCB_NULL,
1897   DEVCB_NULL,
1898   DEVCB_NULL,
1899   DEVCB_NULL,
1900   DEVCB_NULL
1897   DEVCB_DEVICE_LINE_MEMBER(MOS6551A_TAG, mos6551_device, cts_w)
19011898};
19021899
19031900
r21093r21094
21482145   MCFG_TPI6525_ADD(MOS6525_1_TAG, p500_tpi1_intf)
21492146   MCFG_TPI6525_ADD(MOS6525_2_TAG, p500_tpi2_intf)
21502147   MCFG_MOS6551_ADD(MOS6551A_TAG, XTAL_1_8432MHz, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w))
2148   MCFG_MOS6551_RXD_TXD_CALLBACKS(NULL, DEVWRITELINE(RS232_TAG, rs232_port_device, tx))
21512149   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6567_CLOCK, 60, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w))
21522150   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
21532151   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pa_r), DEVWRITE8(DEVICE_SELF, cbm2_state, cia_pa_w))
r21093r21094
21622160   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL, NULL)
21632161   MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, VIC6567_CLOCK, cbm2_expansion_cards, NULL, NULL)
21642162   MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, p500_user_intf, cbm2_user_port_cards, NULL, NULL)
2165   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, rs232_devices, NULL, NULL)
2163   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL, NULL)
21662164   MCFG_QUICKLOAD_ADD("quickload", p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
21672165
21682166   // internal ram
r21093r21094
22042202   MCFG_TPI6525_ADD(MOS6525_1_TAG, p500_tpi1_intf)
22052203   MCFG_TPI6525_ADD(MOS6525_2_TAG, p500_tpi2_intf)
22062204   MCFG_MOS6551_ADD(MOS6551A_TAG, XTAL_1_8432MHz, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w))
2205   MCFG_MOS6551_RXD_TXD_CALLBACKS(NULL, DEVWRITELINE(RS232_TAG, rs232_port_device, tx))
22072206   MCFG_MOS6526_ADD(MOS6526_TAG, VIC6569_CLOCK, 50, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w))
22082207   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
22092208   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pa_r), DEVWRITE8(DEVICE_SELF, cbm2_state, cia_pa_w))
r21093r21094
22182217   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL, NULL)
22192218   MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, VIC6569_CLOCK, cbm2_expansion_cards, NULL, NULL)
22202219   MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, p500_user_intf, cbm2_user_port_cards, NULL, NULL)
2221   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, rs232_devices, NULL, NULL)
2220   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL, NULL)
22222221   MCFG_QUICKLOAD_ADD("quickload", p500, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
22232222
22242223   // internal ram
r21093r21094
22672266   MCFG_TPI6525_ADD(MOS6525_1_TAG, tpi1_intf)
22682267   MCFG_TPI6525_ADD(MOS6525_2_TAG, tpi2_intf)
22692268   MCFG_MOS6551_ADD(MOS6551A_TAG, XTAL_1_8432MHz, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i4_w))
2269   MCFG_MOS6551_RXD_TXD_CALLBACKS(NULL, DEVWRITELINE(RS232_TAG, rs232_port_device, tx))
22702270   MCFG_MOS6526_ADD(MOS6526_TAG, XTAL_18MHz/9, 60, DEVWRITELINE(MOS6525_1_TAG, tpi6525_device, i2_w))
22712271   MCFG_MOS6526_SERIAL_CALLBACKS(DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, cnt_w), DEVWRITELINE(CBM2_USER_PORT_TAG, cbm2_user_port_device, sp_w))
22722272   MCFG_MOS6526_PORT_A_CALLBACKS(DEVREAD8(DEVICE_SELF, cbm2_state, cia_pa_r), DEVWRITE8(DEVICE_SELF, cbm2_state, cia_pa_w))
r21093r21094
22802280   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, NULL, NULL)
22812281   MCFG_CBM2_EXPANSION_SLOT_ADD(CBM2_EXPANSION_SLOT_TAG, XTAL_18MHz/9, cbm2_expansion_cards, NULL, NULL)
22822282   MCFG_CBM2_USER_PORT_ADD(CBM2_USER_PORT_TAG, user_intf, cbm2_user_port_cards, NULL, NULL)
2283   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, rs232_devices, NULL, NULL)
2283   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL, NULL)
22842284   MCFG_QUICKLOAD_ADD("quickload", cbmb, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)
22852285
22862286   // software list
trunk/src/mess/drivers/c64.c
r21093r21094
4747   //int rdy = m_exp_dma && m_vic_ba;
4848
4949   m_maincpu->set_input_line(M6510_IRQ_LINE, irq);
50   m_maincpu->set_input_line(INPUT_LINE_NMI, nmi);
50   m_maincpu->set_input_line(M6510_NMI_LINE, nmi);
5151}
5252
5353
r21093r21094
947947//  C64_EXPANSION_INTERFACE( expansion_intf )
948948//-------------------------------------------------
949949
950READ8_MEMBER( c64_state::exp_dma_cd_r )
951{
952   return m_maincpu->space(AS_PROGRAM).read_byte(offset);
953}
954
955WRITE8_MEMBER( c64_state::exp_dma_cd_w )
956{
957   m_maincpu->space(AS_PROGRAM).write_byte(offset, data);
958}
959
960950WRITE_LINE_MEMBER( c64_state::exp_irq_w )
961951{
962952   m_exp_irq = state;
r21093r21094
11071097   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
11081098   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6567_CLOCK, c64_expansion_cards, NULL, NULL)
11091099   MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c64_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_nmi_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_reset_w))
1110   MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, exp_dma_cd_r), DEVWRITE8(DEVICE_SELF, c64_state, exp_dma_cd_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w))
1100   MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, read), DEVWRITE8(DEVICE_SELF, c64_state, write), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w))
11111101   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
11121102   MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)
11131103
r21093r21094
12181208   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
12191209   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, c64_expansion_cards, NULL, NULL)
12201210   MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c64_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_nmi_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_reset_w))
1221   MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, exp_dma_cd_r), DEVWRITE8(DEVICE_SELF, c64_state, exp_dma_cd_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w))
1211   MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, read), DEVWRITE8(DEVICE_SELF, c64_state, write), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w))
12221212   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
12231213   MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)
12241214
r21093r21094
13071297   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
13081298   MCFG_C64_EXPANSION_SLOT_ADD(C64_EXPANSION_SLOT_TAG, VIC6569_CLOCK, c64_expansion_cards, NULL, NULL)
13091299   MCFG_C64_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, c64_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_nmi_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_reset_w))
1310   MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, exp_dma_cd_r), DEVWRITE8(DEVICE_SELF, c64_state, exp_dma_cd_w), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w))
1300   MCFG_C64_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, c64_state, read), DEVWRITE8(DEVICE_SELF, c64_state, write), DEVWRITELINE(DEVICE_SELF, c64_state, exp_dma_w))
13111301   MCFG_C64_USER_PORT_ADD(C64_USER_PORT_TAG, user_intf, c64_user_port_cards, NULL, NULL)
13121302   MCFG_QUICKLOAD_ADD("quickload", cbm_c64, "p00,prg,t64", CBM_QUICKLOAD_DELAY_SECONDS)
13131303
trunk/src/mess/drivers/c128.c
r21093r21094
4949   m_maincpu->set_input_line(INPUT_LINE_IRQ0, irq);
5050
5151   m_subcpu->set_input_line(M8502_IRQ_LINE, irq);
52   m_subcpu->set_input_line(INPUT_LINE_NMI, nmi);
52   m_subcpu->set_input_line(M8502_NMI_LINE, nmi);
5353}
5454
5555
trunk/src/mess/drivers/vic10.c
r21093r21094
2323
2424void vic10_state::check_interrupts()
2525{
26   m_maincpu->set_input_line(INPUT_LINE_IRQ0, m_cia_irq || m_vic_irq || m_exp_irq);
26   m_maincpu->set_input_line(M6502_IRQ_LINE, m_cia_irq || m_vic_irq || m_exp_irq);
2727}
2828
2929
30
3031//**************************************************************************
3132//  MEMORY MANAGEMENT
3233//**************************************************************************
r21093r21094
529530
530531
531532//-------------------------------------------------
532//  C64_EXPANSION_INTERFACE( expansion_intf )
533//  VIC10_EXPANSION_INTERFACE( expansion_intf )
533534//-------------------------------------------------
534535
535536WRITE_LINE_MEMBER( vic10_state::exp_irq_w )
r21093r21094
539540   check_interrupts();
540541}
541542
542static VIC10_EXPANSION_INTERFACE( expansion_intf )
543WRITE_LINE_MEMBER( vic10_state::exp_reset_w )
543544{
544   DEVCB_DRIVER_LINE_MEMBER(vic10_state, exp_irq_w),
545   DEVCB_DEVICE_LINE_MEMBER(MOS6526_TAG, mos6526_device, sp_w),
546   DEVCB_DEVICE_LINE_MEMBER(MOS6526_TAG, mos6526_device, cnt_w),
547   DEVCB_CPU_INPUT_LINE(M6510_TAG, INPUT_LINE_RESET)
548};
545   if (state == ASSERT_LINE)
546   {
547      machine_reset();
548   }
549}
549550
550551
551552
r21093r21094
629630   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
630631   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(MOS6566_TAG, mos6566_device, lp_w))
631632   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
632   MCFG_VIC10_EXPANSION_SLOT_ADD(VIC10_EXPANSION_SLOT_TAG, VIC6566_CLOCK, expansion_intf, vic10_expansion_cards, NULL, NULL)
633   MCFG_VIC10_EXPANSION_SLOT_ADD(VIC10_EXPANSION_SLOT_TAG, VIC6566_CLOCK, vic10_expansion_cards, NULL, NULL)
634   MCFG_VIC10_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF, vic10_state, exp_irq_w), DEVWRITELINE(DEVICE_SELF, vic10_state, exp_reset_w))
635   MCFG_VIC10_EXPANSION_SLOT_SERIAL_CALLBACKS(DEVWRITELINE(MOS6526_TAG, mos6526_device, cnt_w), DEVWRITELINE(MOS6526_TAG, mos6526_device, sp_w))
633636
634637   // software list
635638   MCFG_SOFTWARE_LIST_ADD("cart_list", "vic10")
trunk/src/mess/drivers/vic20.c
r21093r21094
11/*
2
3[CBM systems which belong to this driver (info to be moved to sysinfo.dat soon)]
4(most of the informations are taken from http://www.zimmers.net/cbmpics/ )
5
6
7* VIC-1001 (1981, Japan)
8
9  The first model released was the Japanese one. It featured support for the
10Japanese katakana character.
11
12CPU: MOS Technology 6502 (1.01 MHz)
13RAM: 5 kilobytes (Expanded to 21k though an external 16k unit)
14ROM: 20 kilobytes
15Video: MOS Technology 6560 "VIC"(Text: 22 columns, 23 rows; Hires: 176x184
16pixels bitmapped; 8 text colors, 16 background colors)
17Sound: MOS Technology 6560 "VIC" (3 voices -square wave-, noise and volume)
18Ports: 6522 VIA x2 (1 Joystick/Mouse port; CBM Serial port; 'Cartridge /
19    Game / Expansion' port; CBM Monitor port; CBM 'USER' port; Power and
20    reset switches; Power connector)
21Keyboard: Full-sized QWERTY 66 key (8 programmable function keys; 2 sets of
22    Keyboardable graphic characters; 2 key direction cursor-pad)
23
24
25* VIC 20 (1981)
26
27  This system was the first computer to sell more than one million units
28worldwide. It was sold both in Europe and in the US. In Germany the
29computer was renamed as VC 20 (apparently, it stands for 'VolksComputer'
30
31CPU: MOS Technology 6502A (1.01 MHz)
32RAM: 5 kilobytes (Expanded to 32k)
33ROM: 20 kilobytes
34Video: MOS Technology 6560 "VIC"(Text: 22 columns, 23 rows; Hires: 176x184
35pixels bitmapped; 8 text colors, 16 background colors)
36Sound: MOS Technology 6560 "VIC" (3 voices -square wave-, noise and volume)
37Ports: 6522 VIA x2 (1 Joystick/Mouse port; CBM Serial port; 'Cartridge /
38    Game / Expansion' port; CBM Monitor port; CBM 'USER' port; Power and
39    reset switches; Power connector)
40Keyboard: Full-sized QWERTY 66 key (8 programmable function keys; 2 sets of
41    Keyboardable graphic characters; 2 key direction cursor-pad)
42
43
44* VIC 21 (1983)
45
46  It consists of a VIC 20 with built-in RAM expansion, to reach a RAM
47  capability of 21 kilobytes.
48
49
50* VIC 20CR
51
52  CR stands for Cost Reduced, as it consisted of a board with only 2 (larger)
53block of RAM instead of 8.
54
55*******************************************************************************
56
572    TODO:
583
594    - C1540 is not working currently
60    - access violation in mos6560.c
61        * In the Chips (Japan, USA).60
62        * K-Star Patrol (Europe).60
63        * Seafox (Japan, USA).60
645    - mos6560_port_r/w should respond at 0x1000-0x100f
656    - VIC21 (built in 21K ram)
667
r21093r21094
11960      case IO0:
12061         if (BIT(offset, 4))
12162         {
122            data = m_via0->read(space, offset & 0x0f);
63            data = m_via1->read(space, offset & 0x0f);
12364         }
12465         else if (BIT(offset, 5))
12566         {
126            data = m_via1->read(space, offset & 0x0f);
67            data = m_via2->read(space, offset & 0x0f);
12768         }
12869         else if (offset >= 0x9000 && offset < 0x9010)
12970         {
r21093r21094
194135      case IO0:
195136         if (BIT(offset, 4))
196137         {
197            m_via0->write(space, offset & 0x0f, data);
138            m_via1->write(space, offset & 0x0f, data);
198139         }
199140         else if (BIT(offset, 5))
200141         {
201            m_via1->write(space, offset & 0x0f, data);
142            m_via2->write(space, offset & 0x0f, data);
202143         }
203144         else if (offset >= 0x9000 && offset < 0x9010)
204145         {
r21093r21094
383324   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_CODE(KEYCODE_2)              PORT_CHAR('2') PORT_CHAR('"')
384325
385326   PORT_START( "RESTORE" )
386   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(M6522_0_TAG, via6522_device, write_ca1)
327   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("RESTORE") PORT_CODE(KEYCODE_PRTSCR) PORT_WRITE_LINE_DEVICE_MEMBER(M6522_1_TAG, via6522_device, write_ca1)
387328
388329   PORT_START( "LOCK" )
389330   PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_KEYBOARD ) PORT_NAME("SHIFT LOCK") PORT_CODE(KEYCODE_CAPSLOCK) PORT_TOGGLE PORT_CHAR(UCHAR_MAMEKEY(CAPSLOCK))
r21093r21094
438379//**************************************************************************
439380
440381//-------------------------------------------------
441//  via6522_interface via0_intf
382//  via6522_interface via1_intf
442383//-------------------------------------------------
443384
444READ8_MEMBER( vic20_state::via0_pa_r )
385READ8_MEMBER( vic20_state::via1_pa_r )
445386{
446387   /*
447388
r21093r21094
480421   return data;
481422}
482423
483WRITE8_MEMBER( vic20_state::via0_pa_w )
424WRITE8_MEMBER( vic20_state::via1_pa_w )
484425{
485426   /*
486427
r21093r21094
504445   m_iec->atn_w(!BIT(data, 7));
505446}
506447
507READ_LINE_MEMBER( vic20_state::via0_ca1_r )
448READ_LINE_MEMBER( vic20_state::via1_ca1_r )
508449{
509450   return m_restore->read();
510451}
511452
512static const via6522_interface via0_intf =
453static const via6522_interface via1_intf =
513454{
514   DEVCB_DRIVER_MEMBER(vic20_state, via0_pa_r),
455   DEVCB_DRIVER_MEMBER(vic20_state, via1_pa_r),
515456   DEVCB_DEVICE_MEMBER(VIC20_USER_PORT_TAG, vic20_user_port_device, pb_r),
516   DEVCB_DRIVER_LINE_MEMBER(vic20_state, via0_ca1_r),
457   DEVCB_DRIVER_LINE_MEMBER(vic20_state, via1_ca1_r),
517458   DEVCB_NULL,
518459   DEVCB_NULL,
519460   DEVCB_NULL,
520   DEVCB_DRIVER_MEMBER(vic20_state, via0_pa_w),
461   DEVCB_DRIVER_MEMBER(vic20_state, via1_pa_w),
521462   DEVCB_DEVICE_MEMBER(VIC20_USER_PORT_TAG, vic20_user_port_device, pb_w),
522463   DEVCB_NULL,
523464   DEVCB_DEVICE_LINE_MEMBER(VIC20_USER_PORT_TAG, vic20_user_port_device, cb1_w),
r21093r21094
528469
529470
530471//-------------------------------------------------
531//  via6522_interface via1_intf
472//  via6522_interface via2_intf
532473//-------------------------------------------------
533474
534READ8_MEMBER( vic20_state::via1_pa_r )
475READ8_MEMBER( vic20_state::via2_pa_r )
535476{
536477   /*
537478
r21093r21094
562503   return data;
563504}
564505
565READ8_MEMBER( vic20_state::via1_pb_r )
506READ8_MEMBER( vic20_state::via2_pb_r )
566507{
567508   /*
568509
r21093r21094
589530   return data;
590531}
591532
592WRITE8_MEMBER( vic20_state::via1_pb_w )
533WRITE8_MEMBER( vic20_state::via2_pb_w )
593534{
594535   /*
595536
r21093r21094
613554   m_key_col = data;
614555}
615556
616WRITE_LINE_MEMBER( vic20_state::via1_ca2_w )
557WRITE_LINE_MEMBER( vic20_state::via2_ca2_w )
617558{
618559   // serial clock out
619560   m_iec->clk_w(!state);
620561}
621562
622WRITE_LINE_MEMBER( vic20_state::via1_cb2_w )
563WRITE_LINE_MEMBER( vic20_state::via2_cb2_w )
623564{
624565   // serial data out
625566   m_iec->data_w(!state);
626567}
627568
628static const via6522_interface via1_intf =
569static const via6522_interface via2_intf =
629570{
630   DEVCB_DRIVER_MEMBER(vic20_state, via1_pa_r),
631   DEVCB_DRIVER_MEMBER(vic20_state, via1_pb_r),
571   DEVCB_DRIVER_MEMBER(vic20_state, via2_pa_r),
572   DEVCB_DRIVER_MEMBER(vic20_state, via2_pb_r),
632573   DEVCB_DEVICE_LINE_MEMBER(PET_DATASSETTE_PORT_TAG, pet_datassette_port_device, read),
633574   DEVCB_NULL,
634575   DEVCB_NULL,
635576   DEVCB_NULL,
636577
637578   DEVCB_NULL,
638   DEVCB_DRIVER_MEMBER(vic20_state, via1_pb_w),
579   DEVCB_DRIVER_MEMBER(vic20_state, via2_pb_w),
639580   DEVCB_NULL,
640581   DEVCB_NULL,
641   DEVCB_DRIVER_LINE_MEMBER(vic20_state, via1_ca2_w),
642   DEVCB_DRIVER_LINE_MEMBER(vic20_state, via1_cb2_w),
582   DEVCB_DRIVER_LINE_MEMBER(vic20_state, via2_ca2_w),
583   DEVCB_DRIVER_LINE_MEMBER(vic20_state, via2_cb2_w),
643584
644585   DEVCB_CPU_INPUT_LINE(M6502_TAG, M6502_IRQ_LINE)
645586};
r21093r21094
657598   }
658599}
659600
660static VIC20_EXPANSION_INTERFACE( expansion_intf )
661{
662   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_IRQ0),
663   DEVCB_CPU_INPUT_LINE(M6502_TAG, INPUT_LINE_NMI),
664   DEVCB_DRIVER_LINE_MEMBER(vic20_state, exp_reset_w)
665};
666601
667
668602//-------------------------------------------------
669603//  VIC20_USER_PORT_INTERFACE( user_intf )
670604//-------------------------------------------------
r21093r21094
672606static VIC20_USER_PORT_INTERFACE( user_intf )
673607{
674608   DEVCB_DEVICE_LINE_MEMBER(M6560_TAG, mos6560_device, lp_w),
675   DEVCB_DEVICE_LINE_MEMBER(M6522_0_TAG, via6522_device, write_cb1),
676   DEVCB_DEVICE_LINE_MEMBER(M6522_0_TAG, via6522_device, write_cb2),
609   DEVCB_DEVICE_LINE_MEMBER(M6522_1_TAG, via6522_device, write_cb1),
610   DEVCB_DEVICE_LINE_MEMBER(M6522_1_TAG, via6522_device, write_cb2),
677611   DEVCB_DRIVER_LINE_MEMBER(vic20_state, exp_reset_w)
678612};
679613
r21093r21094
712646   m_maincpu->reset();
713647
714648   m_vic->reset();
715   m_via0->reset();
716649   m_via1->reset();
650   m_via2->reset();
717651
718652   m_iec->reset();
719653   m_exp->reset();
r21093r21094
732666
733667static MACHINE_CONFIG_START( vic20, vic20_state )
734668   // devices
735   MCFG_VIA6522_ADD(M6522_0_TAG, 0, via0_intf)
736669   MCFG_VIA6522_ADD(M6522_1_TAG, 0, via1_intf)
737   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", NULL, DEVWRITELINE(M6522_1_TAG, via6522_device, write_ca1))
670   MCFG_VIA6522_ADD(M6522_2_TAG, 0, via2_intf)
671   MCFG_PET_DATASSETTE_PORT_ADD(PET_DATASSETTE_PORT_TAG, cbm_datassette_devices, "c1530", NULL, DEVWRITELINE(M6522_2_TAG, via6522_device, write_ca1))
738672   MCFG_CBM_IEC_ADD("c1541")
739   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(M6522_1_TAG, via6522_device, write_cb1))
673   MCFG_CBM_IEC_BUS_SRQ_CALLBACK(DEVWRITELINE(M6522_2_TAG, via6522_device, write_cb1))
740674   MCFG_VIC20_USER_PORT_ADD(VIC20_USER_PORT_TAG, user_intf, vic20_user_port_cards, NULL, NULL)
741675   MCFG_QUICKLOAD_ADD("quickload", cbm_vc20, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
742676
r21093r21094
766700   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
767701
768702   // devices
769   MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, MOS6560_CLOCK, expansion_intf, vic20_expansion_cards, NULL, NULL)
703   MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, MOS6560_CLOCK, vic20_expansion_cards, NULL, NULL)
704   MCFG_VIC20_EXPANSION_SLOT_IRQ_CALLBACKS(INPUTLINE(M6502_TAG, M6502_IRQ_LINE), INPUTLINE(M6502_TAG, M6502_NMI_LINE), DEVWRITELINE(DEVICE_SELF, vic20_state, exp_reset_w))
770705   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, "joy", NULL)
771706   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(M6560_TAG, mos6560_device, lp_w))
772707
r21093r21094
792727   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.25)
793728
794729   // devices
795   MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, MOS6561_CLOCK, expansion_intf, vic20_expansion_cards, NULL, NULL)
730   MCFG_VIC20_EXPANSION_SLOT_ADD(VIC20_EXPANSION_SLOT_TAG, MOS6561_CLOCK, vic20_expansion_cards, NULL, NULL)
731   MCFG_VIC20_EXPANSION_SLOT_IRQ_CALLBACKS(INPUTLINE(M6502_TAG, M6502_IRQ_LINE), INPUTLINE(M6502_TAG, M6502_NMI_LINE), DEVWRITELINE(DEVICE_SELF, vic20_state, exp_reset_w))
796732   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, "joy", NULL)
797733   MCFG_VCS_CONTROL_PORT_TRIGGER_HANDLER(DEVWRITELINE(M6561_TAG, mos6561_device, lp_w))
798734
trunk/src/mess/drivers/plus4.c
r21093r21094
641641//  PLUS4_EXPANSION_INTERFACE( expansion_intf )
642642//-------------------------------------------------
643643
644READ8_MEMBER( plus4_state::exp_dma_r )
645{
646   return m_maincpu->space(AS_PROGRAM).read_byte(offset);
647}
648
649WRITE8_MEMBER( plus4_state::exp_dma_w )
650{
651   m_maincpu->space(AS_PROGRAM).write_byte(offset, data);
652}
653
654644WRITE_LINE_MEMBER( plus4_state::exp_irq_w )
655645{
656646   m_exp_irq = state;
r21093r21094
658648   check_interrupts();
659649}
660650
661static PLUS4_EXPANSION_INTERFACE( expansion_intf )
662{
663   DEVCB_DRIVER_MEMBER(plus4_state, exp_dma_r),
664   DEVCB_DRIVER_MEMBER(plus4_state, exp_dma_w),
665   DEVCB_DRIVER_LINE_MEMBER(plus4_state, exp_irq_w),
666   DEVCB_CPU_INPUT_LINE(MOS7501_TAG, INPUT_LINE_HALT)
667};
668651
669652
670
671653//**************************************************************************
672654//  MACHINE INITIALIZATION
673655//**************************************************************************
r21093r21094
754736   MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PLUS4_USER_PORT_TAG, plus4_user_port_device, atn_w))
755737   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
756738   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
757   MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, expansion_intf, plus4_expansion_cards, "c1551", NULL)
739   MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_14_31818MHz/16, plus4_expansion_cards, "c1551", NULL, DEVWRITELINE(DEVICE_SELF, plus4_state, exp_irq_w))
740   MCFG_PLUS4_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, plus4_state, read), DEVWRITE8(DEVICE_SELF, plus4_state, write), INPUTLINE(MOS7501_TAG, INPUT_LINE_HALT))
758741   MCFG_PLUS4_USER_PORT_ADD(PLUS4_USER_PORT_TAG, plus4_user_port_cards, NULL, NULL)
759742   MCFG_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
760743
r21093r21094
799782   MCFG_CBM_IEC_BUS_ATN_CALLBACK(DEVWRITELINE(PLUS4_USER_PORT_TAG, plus4_user_port_device, atn_w))
800783   MCFG_VCS_CONTROL_PORT_ADD(CONTROL1_TAG, vcs_control_port_devices, NULL, NULL)
801784   MCFG_VCS_CONTROL_PORT_ADD(CONTROL2_TAG, vcs_control_port_devices, "joy", NULL)
802   MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_17_73447MHz/20, expansion_intf, plus4_expansion_cards, "c1551", NULL)
785   MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, XTAL_17_73447MHz/20, plus4_expansion_cards, "c1551", NULL, DEVWRITELINE(DEVICE_SELF, plus4_state, exp_irq_w))
786   MCFG_PLUS4_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF, plus4_state, read), DEVWRITE8(DEVICE_SELF, plus4_state, write), INPUTLINE(MOS7501_TAG, INPUT_LINE_HALT))
803787   MCFG_PLUS4_USER_PORT_ADD(PLUS4_USER_PORT_TAG, plus4_user_port_cards, NULL, NULL)
804788   MCFG_QUICKLOAD_ADD("quickload", cbm_c16, "p00,prg", CBM_QUICKLOAD_DELAY_SECONDS)
805789
trunk/src/mess/mess.mak
r21093r21094
894894   $(MESS_MACHINE)/c64_system3.o   \
895895   $(MESS_MACHINE)/c64_tdos.o  \
896896   $(MESS_MACHINE)/c64_turbo232.o  \
897   $(MESS_MACHINE)/c64_vic1011.o  \
897898   $(MESS_MACHINE)/c64_vizastar.o  \
898899   $(MESS_MACHINE)/c64_vw64.o  \
899900   $(MESS_MACHINE)/c64_warp_speed.o    \
r21093r21094
910911   $(MESS_MACHINE)/vic20user.o \
911912   $(MESS_MACHINE)/vic20_megacart.o    \
912913   $(MESS_MACHINE)/vic1010.o   \
914   $(MESS_MACHINE)/vic1011.o   \
913915   $(MESS_MACHINE)/vic1110.o   \
914916   $(MESS_MACHINE)/vic1111.o   \
915917   $(MESS_MACHINE)/vic1112.o   \
trunk/src/mess/machine/c64_bn1541.c
r21093r21094
116116{
117117   if (LOG) logerror("1541 parallel strobe %u\n", state);
118118
119   m_slot->flag2_w(state);
119   m_slot->cia_flag2_w(state);
120120}
121121
122122
trunk/src/mess/machine/vic1010.c
r21093r21094
1919
2020
2121//-------------------------------------------------
22//  VIC20_EXPANSION_INTERFACE( expansion_intf )
23//-------------------------------------------------
24
25WRITE_LINE_MEMBER( vic1010_device::irq_w )
26{
27   m_slot->irq_w(state);
28}
29
30WRITE_LINE_MEMBER( vic1010_device::nmi_w )
31{
32   m_slot->nmi_w(state);
33}
34
35WRITE_LINE_MEMBER( vic1010_device::res_w )
36{
37   m_slot->res_w(state);
38}
39
40static VIC20_EXPANSION_INTERFACE( expansion_intf )
41{
42   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vic1010_device, irq_w),
43   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vic1010_device, nmi_w),
44   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vic1010_device, res_w)
45};
46
47
48//-------------------------------------------------
4922//  MACHINE_DRIVER( vic1010 )
5023//-------------------------------------------------
5124
5225static MACHINE_CONFIG_FRAGMENT( vic1010 )
53   MCFG_VIC20_EXPANSION_SLOT_ADD("slot1", 0, expansion_intf, vic20_expansion_cards, NULL, NULL)
54   MCFG_VIC20_EXPANSION_SLOT_ADD("slot2", 0, expansion_intf, vic20_expansion_cards, NULL, NULL)
55   MCFG_VIC20_EXPANSION_SLOT_ADD("slot3", 0, expansion_intf, vic20_expansion_cards, NULL, NULL)
56   MCFG_VIC20_EXPANSION_SLOT_ADD("slot4", 0, expansion_intf, vic20_expansion_cards, NULL, NULL)
57   MCFG_VIC20_EXPANSION_SLOT_ADD("slot5", 0, expansion_intf, vic20_expansion_cards, NULL, NULL)
58   MCFG_VIC20_EXPANSION_SLOT_ADD("slot6", 0, expansion_intf, vic20_expansion_cards, NULL, NULL)
26   MCFG_VIC20_PASSTHRU_EXPANSION_SLOT_ADD("slot1")
27   MCFG_VIC20_PASSTHRU_EXPANSION_SLOT_ADD("slot2")
28   MCFG_VIC20_PASSTHRU_EXPANSION_SLOT_ADD("slot3")
29   MCFG_VIC20_PASSTHRU_EXPANSION_SLOT_ADD("slot4")
30   MCFG_VIC20_PASSTHRU_EXPANSION_SLOT_ADD("slot5")
31   MCFG_VIC20_PASSTHRU_EXPANSION_SLOT_ADD("slot6")
5932MACHINE_CONFIG_END
6033
6134
r21093r21094
8154
8255vic1010_device::vic1010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
8356   : device_t(mconfig, VIC1010, "VIC1010", tag, owner, clock),
84      device_vic20_expansion_card_interface(mconfig, *this)
57      device_vic20_expansion_card_interface(mconfig, *this),
58      m_slot1(*this, "slot1"),
59      m_slot2(*this, "slot2"),
60      m_slot3(*this, "slot3"),
61      m_slot4(*this, "slot4"),
62      m_slot5(*this, "slot5"),
63      m_slot6(*this, "slot6")
8564{
8665}
8766
r21093r21094
9372void vic1010_device::device_start()
9473{
9574   // find devices
96   m_expansion_slot[0] = dynamic_cast<vic20_expansion_slot_device *>(subdevice("slot1"));
97   m_expansion_slot[1] = dynamic_cast<vic20_expansion_slot_device *>(subdevice("slot2"));
98   m_expansion_slot[2] = dynamic_cast<vic20_expansion_slot_device *>(subdevice("slot3"));
99   m_expansion_slot[3] = dynamic_cast<vic20_expansion_slot_device *>(subdevice("slot4"));
100   m_expansion_slot[4] = dynamic_cast<vic20_expansion_slot_device *>(subdevice("slot5"));
101   m_expansion_slot[5] = dynamic_cast<vic20_expansion_slot_device *>(subdevice("slot6"));
75   m_expansion_slot[0] = m_slot1;
76   m_expansion_slot[1] = m_slot2;
77   m_expansion_slot[2] = m_slot3;
78   m_expansion_slot[3] = m_slot4;
79   m_expansion_slot[4] = m_slot5;
80   m_expansion_slot[5] = m_slot6;
10281}
10382
10483
10584//-------------------------------------------------
85//  device_reset - device-specific reset
86//-------------------------------------------------
87
88void vic1010_device::device_reset()
89{
90   for (int i = 0; i < MAX_SLOTS; i++)
91   {
92      m_expansion_slot[i]->reset();
93   }
94}
95
96
97//-------------------------------------------------
10698//  vic20_cd_r - cartridge data read
10799//-------------------------------------------------
108100
r21093r21094
133125      m_expansion_slot[i]->cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
134126   }
135127}
136
137
138//-------------------------------------------------
139//  vic20_res_w - reset write
140//-------------------------------------------------
141
142void vic1010_device::vic20_res_w(int state)
143{
144   for (int i = 0; i < MAX_SLOTS; i++)
145   {
146      m_expansion_slot[i]->reset();
147   }
148}
trunk/src/mess/machine/vic1010.h
r21093r21094
4040   // construction/destruction
4141   vic1010_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
4242
43   // not really public
44   DECLARE_WRITE_LINE_MEMBER( irq_w );
45   DECLARE_WRITE_LINE_MEMBER( nmi_w );
46   DECLARE_WRITE_LINE_MEMBER( res_w );
43   // optional information overrides
44   virtual machine_config_constructor device_mconfig_additions() const;
4745
4846protected:
4947   // device-level overrides
48   virtual void device_config_complete() { m_shortname = "vic1010"; }
5049   virtual void device_start();
51   virtual void device_config_complete() { m_shortname = "vic1010"; }
50   virtual void device_reset();
5251
53   // optional information overrides
54   virtual machine_config_constructor device_mconfig_additions() const;
55
5652   // device_vic20_expansion_card_interface overrides
5753   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
5854   virtual void vic20_cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
59   virtual void vic20_res_w(int state);
6055
6156private:
57   required_device<vic20_expansion_slot_device> m_slot1;
58   required_device<vic20_expansion_slot_device> m_slot2;
59   required_device<vic20_expansion_slot_device> m_slot3;
60   required_device<vic20_expansion_slot_device> m_slot4;
61   required_device<vic20_expansion_slot_device> m_slot5;
62   required_device<vic20_expansion_slot_device> m_slot6;
63
6264   vic20_expansion_slot_device *m_expansion_slot[MAX_SLOTS];
6365};
6466
trunk/src/mess/machine/c64_vic1011.c
r0r21094
1/**********************************************************************
2
3    Commodore VIC-1011A/B RS-232C Adapter emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "c64_vic1011.h"
11
12
13
14//**************************************************************************
15//  MACROS/CONSTANTS
16//**************************************************************************
17
18#define RS232_TAG       "rs232"
19
20
21
22//**************************************************************************
23//  DEVICE DEFINITIONS
24//**************************************************************************
25
26const device_type C64_VIC1011 = &device_creator<c64_vic1011_device>;
27
28
29//-------------------------------------------------
30//  rs232_port_interface rs232_intf
31//-------------------------------------------------
32
33static const rs232_port_interface rs232_intf =
34{
35   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c64_vic1011_device, rxd_w),
36   DEVCB_NULL,
37   DEVCB_NULL,
38   DEVCB_NULL,
39   DEVCB_NULL
40};
41
42
43//-------------------------------------------------
44//  MACHINE_DRIVER( vic1011 )
45//-------------------------------------------------
46
47static MACHINE_CONFIG_FRAGMENT( vic1011 )
48   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL, NULL)
49MACHINE_CONFIG_END
50
51
52//-------------------------------------------------
53//  machine_config_additions - device-specific
54//  machine configurations
55//-------------------------------------------------
56
57machine_config_constructor c64_vic1011_device::device_mconfig_additions() const
58{
59   return MACHINE_CONFIG_NAME( vic1011 );
60}
61
62
63
64//**************************************************************************
65//  LIVE DEVICE
66//**************************************************************************
67
68//-------------------------------------------------
69//  c64_vic1011_device - constructor
70//-------------------------------------------------
71
72c64_vic1011_device::c64_vic1011_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
73   : device_t(mconfig, C64_VIC1011, "C64 VIC1011", tag, owner, clock),
74      device_c64_user_port_interface(mconfig, *this),
75      m_rs232(*this, RS232_TAG)
76{
77}
78
79
80//-------------------------------------------------
81//  device_start - device-specific startup
82//-------------------------------------------------
83
84void c64_vic1011_device::device_start()
85{
86}
87
88
89//-------------------------------------------------
90//  c64_pb_r - port B read
91//-------------------------------------------------
92
93UINT8 c64_vic1011_device::c64_pb_r(address_space &space, offs_t offset)
94{
95   /*
96   
97       bit     description
98   
99       0       Sin
100       1       
101       2       
102       3       
103       4       DCDin
104       5       
105       6       CTS
106       7       DSR
107   
108   */
109
110   UINT8 data = 0;
111
112   data |= !m_rs232->rx();
113   data |= m_rs232->dcd_r() << 4;
114   data |= m_rs232->cts_r() << 6;
115   data |= m_rs232->dsr_r() << 7;
116
117   return data;
118}
119
120
121//-------------------------------------------------
122//  c64_pb_w - port B write
123//-------------------------------------------------
124
125void c64_vic1011_device::c64_pb_w(address_space &space, offs_t offset, UINT8 data)
126{
127   /*
128   
129       bit     description
130   
131       0       
132       1       RTS
133       2       DTR
134       3       
135       4       
136       5       DCDout
137       6       
138       7       
139   
140   */
141
142   m_rs232->rts_w(BIT(data, 1));
143   m_rs232->dtr_w(BIT(data, 2));
144}
145
146
147//-------------------------------------------------
148//  c64_pa2_w - PA2 write
149//-------------------------------------------------
150
151void c64_vic1011_device::c64_pa2_w(int state)
152{
153   m_rs232->tx(!state);
154}
155
156
157//-------------------------------------------------
158//  rxd_w -
159//-------------------------------------------------
160
161WRITE_LINE_MEMBER( c64_vic1011_device::rxd_w )
162{
163   m_slot->cia_flag2_w(!state);
164}
Property changes on: trunk/src/mess/machine/c64_vic1011.c
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/machine/c64_vic1011.h
r0r21094
1/**********************************************************************
2
3    Commodore VIC-1011A/B RS-232C Adapter emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __C64_VIC1011__
13#define __C64_VIC1011__
14
15#include "emu.h"
16#include "machine/c64user.h"
17#include "machine/serial.h"
18
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> c64_vic1011_device
26
27class c64_vic1011_device :  public device_t,
28                     public device_c64_user_port_interface
29{
30public:
31   // construction/destruction
32   c64_vic1011_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34   // optional information overrides
35   virtual machine_config_constructor device_mconfig_additions() const;
36
37   DECLARE_WRITE_LINE_MEMBER( rxd_w );
38
39protected:
40   // device-level overrides
41   virtual void device_config_complete() { m_shortname = "c64_vic1011"; }
42   virtual void device_start();
43
44   // device_c64_user_port_interface overrides
45   virtual UINT8 c64_pb_r(address_space &space, offs_t offset);
46   virtual void c64_pb_w(address_space &space, offs_t offset, UINT8 data);
47   virtual void c64_pa2_w(int state);
48
49private:
50   required_device<rs232_port_device> m_rs232;
51};
52
53
54// device type definition
55extern const device_type C64_VIC1011;
56
57
58
59#endif
Property changes on: trunk/src/mess/machine/c64_vic1011.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/machine/c64exp.h
r21093r21094
9090
9191   template<class _irq, class _nmi, class _reset> void set_irq_callbacks(_irq irq, _nmi nmi, _reset reset) {
9292      m_write_irq.set_callback(irq);
93      m_write_dma_cd.set_callback(nmi);
93      m_write_nmi.set_callback(nmi);
9494      m_write_reset.set_callback(reset);
9595   }
9696
trunk/src/mess/machine/vic1011.c
r0r21094
1/**********************************************************************
2
3    Commodore VIC-1011A/B RS-232C Adapter emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#include "vic1011.h"
11
12
13
14//**************************************************************************
15//  MACROS/CONSTANTS
16//**************************************************************************
17
18#define RS232_TAG       "rs232"
19
20
21
22//**************************************************************************
23//  DEVICE DEFINITIONS
24//**************************************************************************
25
26const device_type VIC1011 = &device_creator<vic1011_device>;
27
28
29//-------------------------------------------------
30//  rs232_port_interface rs232_intf
31//-------------------------------------------------
32
33static const rs232_port_interface rs232_intf =
34{
35   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, vic1011_device, rxd_w),
36   DEVCB_NULL,
37   DEVCB_NULL,
38   DEVCB_NULL,
39   DEVCB_NULL
40};
41
42
43//-------------------------------------------------
44//  MACHINE_DRIVER( vic1011 )
45//-------------------------------------------------
46
47static MACHINE_CONFIG_FRAGMENT( vic1011 )
48   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL, NULL)
49MACHINE_CONFIG_END
50
51
52//-------------------------------------------------
53//  machine_config_additions - device-specific
54//  machine configurations
55//-------------------------------------------------
56
57machine_config_constructor vic1011_device::device_mconfig_additions() const
58{
59   return MACHINE_CONFIG_NAME( vic1011 );
60}
61
62
63
64//**************************************************************************
65//  LIVE DEVICE
66//**************************************************************************
67
68//-------------------------------------------------
69//  vic1011_device - constructor
70//-------------------------------------------------
71
72vic1011_device::vic1011_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
73   : device_t(mconfig, VIC1011, "VIC1011", tag, owner, clock),
74      device_vic20_user_port_interface(mconfig, *this),
75      m_rs232(*this, RS232_TAG)
76{
77}
78
79
80//-------------------------------------------------
81//  device_start - device-specific startup
82//-------------------------------------------------
83
84void vic1011_device::device_start()
85{
86}
87
88
89//-------------------------------------------------
90//  vic20_pb_r - port B read
91//-------------------------------------------------
92
93UINT8 vic1011_device::vic20_pb_r(address_space &space, offs_t offset)
94{
95   /*
96   
97       bit     description
98   
99       0       Sin
100       1       
101       2       
102       3       
103       4       DCDin
104       5       
105       6       CTS
106       7       DSR
107   
108   */
109
110   UINT8 data = 0;
111
112   data |= !m_rs232->rx();
113   data |= m_rs232->dcd_r() << 4;
114   data |= m_rs232->cts_r() << 6;
115   data |= m_rs232->dsr_r() << 7;
116
117   return data;
118}
119
120
121//-------------------------------------------------
122//  vic20_pb_w - port B write
123//-------------------------------------------------
124
125void vic1011_device::vic20_pb_w(address_space &space, offs_t offset, UINT8 data)
126{
127   /*
128   
129       bit     description
130   
131       0       
132       1       RTS
133       2       DTR
134       3       
135       4       
136       5       DCDout
137       6       
138       7       
139   
140   */
141
142   m_rs232->rts_w(BIT(data, 1));
143   m_rs232->dtr_w(BIT(data, 2));
144}
145
146
147//-------------------------------------------------
148//  vic20_cb2_w - CB2 write
149//-------------------------------------------------
150
151void vic1011_device::vic20_cb2_w(int state)
152{
153   m_rs232->tx(!state);
154}
155
156
157//-------------------------------------------------
158//  rxd_w -
159//-------------------------------------------------
160
161WRITE_LINE_MEMBER( vic1011_device::rxd_w )
162{
163   m_slot->via_cb1_w(!state);
164}
Property changes on: trunk/src/mess/machine/vic1011.c
Added: svn:mime-type
   + text/plain
Added: svn:eol-style
   + native
trunk/src/mess/machine/petuser.c
r21093r21094
6060
6161
6262//-------------------------------------------------
63//  pet_user_port_device - destructor
64//-------------------------------------------------
65
66pet_user_port_device::~pet_user_port_device()
67{
68}
69
70
71//-------------------------------------------------
7263//  device_config_complete - perform any
7364//  operations now that the configuration is
7465//  complete
r21093r21094
9889
9990void pet_user_port_device::device_start()
10091{
101   m_cart = dynamic_cast<device_pet_user_port_interface *>(get_card_device());
92   m_card = dynamic_cast<device_pet_user_port_interface *>(get_card_device());
10293
10394   // resolve callbacks
10495   m_out_ca1_func.resolve(m_out_ca1_cb, *this);
r21093r21094
115106}
116107
117108
118READ8_MEMBER( pet_user_port_device::pa_r ) { UINT8 data = 0xff; if (m_cart != NULL) data = m_cart->pet_pa_r(space, offset); return data; }
119WRITE8_MEMBER( pet_user_port_device::pa_w ) { if (m_cart != NULL) m_cart->pet_pa_w(space, offset, data); }
120READ_LINE_MEMBER( pet_user_port_device::ca1_r ) { int state = 1; if (m_cart != NULL) state = m_cart->pet_ca1_r(); return state; }
121WRITE_LINE_MEMBER( pet_user_port_device::ca1_w ) { if (m_cart != NULL) m_cart->pet_ca1_w(state); }
122READ_LINE_MEMBER( pet_user_port_device::cb2_r ) { int state = 1; if (m_cart != NULL) state = m_cart->pet_cb2_r(); return state; }
123WRITE_LINE_MEMBER( pet_user_port_device::cb2_w ) { if (m_cart != NULL) m_cart->pet_cb2_w(state); }
109READ8_MEMBER( pet_user_port_device::pa_r ) { UINT8 data = 0xff; if (m_card != NULL) data = m_card->pet_pa_r(space, offset); return data; }
110WRITE8_MEMBER( pet_user_port_device::pa_w ) { if (m_card != NULL) m_card->pet_pa_w(space, offset, data); }
111READ_LINE_MEMBER( pet_user_port_device::ca1_r ) { int state = 1; if (m_card != NULL) state = m_card->pet_ca1_r(); return state; }
112WRITE_LINE_MEMBER( pet_user_port_device::ca1_w ) { if (m_card != NULL) m_card->pet_ca1_w(state); }
113READ_LINE_MEMBER( pet_user_port_device::cb2_r ) { int state = 1; if (m_card != NULL) state = m_card->pet_cb2_r(); return state; }
114WRITE_LINE_MEMBER( pet_user_port_device::cb2_w ) { if (m_card != NULL) m_card->pet_cb2_w(state); }
trunk/src/mess/machine/vic1011.h
r0r21094
1/**********************************************************************
2
3    Commodore VIC-1011A/B RS-232C Adapter emulation
4
5    Copyright MESS Team.
6    Visit http://mamedev.org for licensing and usage restrictions.
7
8**********************************************************************/
9
10#pragma once
11
12#ifndef __VIC1011__
13#define __VIC1011__
14
15#include "emu.h"
16#include "machine/vic20user.h"
17#include "machine/serial.h"
18
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> vic1011_device
26
27class vic1011_device :  public device_t,
28                  public device_vic20_user_port_interface
29{
30public:
31   // construction/destruction
32   vic1011_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
33
34   // optional information overrides
35   virtual machine_config_constructor device_mconfig_additions() const;
36
37   DECLARE_WRITE_LINE_MEMBER( rxd_w );
38
39protected:
40   // device-level overrides
41   virtual void device_config_complete() { m_shortname = "vic1011"; }
42   virtual void device_start();
43
44   // device_vic20_user_port_interface overrides
45   virtual UINT8 vic20_pb_r(address_space &space, offs_t offset);
46   virtual void vic20_pb_w(address_space &space, offs_t offset, UINT8 data);
47   virtual void vic20_cb2_w(int state);
48
49private:
50   required_device<rs232_port_device> m_rs232;
51};
52
53
54// device type definition
55extern const device_type VIC1011;
56
57
58
59#endif
Property changes on: trunk/src/mess/machine/vic1011.h
Added: svn:eol-style
   + native
Added: svn:mime-type
   + text/plain
trunk/src/mess/machine/petuser.h
r21093r21094
7878public:
7979   // construction/destruction
8080   pet_user_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
81   virtual ~pet_user_port_device();
8281
8382   // computer interface
8483   DECLARE_READ8_MEMBER( pa_r );
r21093r21094
8887   DECLARE_READ_LINE_MEMBER( cb2_r );
8988   DECLARE_WRITE_LINE_MEMBER( cb2_w );
9089
90   // cartridge interface
91   DECLARE_WRITE_LINE_MEMBER( via_ca1_w ) { m_out_ca1_func(state); }
92   DECLARE_WRITE_LINE_MEMBER( via_cb2_w ) { m_out_cb2_func(state); }
93
9194protected:
9295   // device-level overrides
9396   virtual void device_config_complete();
r21093r21094
97100   devcb_resolved_write_line   m_out_ca1_func;
98101   devcb_resolved_write_line   m_out_cb2_func;
99102
100   device_pet_user_port_interface *m_cart;
103   device_pet_user_port_interface *m_card;
101104};
102105
103106
trunk/src/mess/machine/vic10exp.c
r21093r21094
108108vic10_expansion_slot_device::vic10_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
109109      device_t(mconfig, VIC10_EXPANSION_SLOT, "VIC-10 expansion port", tag, owner, clock),
110110      device_slot_interface(mconfig, *this),
111      device_image_interface(mconfig, *this)
111      device_image_interface(mconfig, *this),
112      m_write_irq(*this),
113      m_write_res(*this),
114      m_write_cnt(*this),
115      m_write_sp(*this)
112116{
113117}
114118
115119
116120//-------------------------------------------------
117//  device_config_complete - perform any
118//  operations now that the configuration is
119//  complete
120//-------------------------------------------------
121
122void vic10_expansion_slot_device::device_config_complete()
123{
124   // inherit a copy of the static data
125   const vic10_expansion_slot_interface *intf = reinterpret_cast<const vic10_expansion_slot_interface *>(static_config());
126   if (intf != NULL)
127   {
128      *static_cast<vic10_expansion_slot_interface *>(this) = *intf;
129   }
130
131   // or initialize to defaults if none provided
132   else
133   {
134      memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
135      memset(&m_out_sp_cb, 0, sizeof(m_out_sp_cb));
136      memset(&m_out_cnt_cb, 0, sizeof(m_out_cnt_cb));
137      memset(&m_out_res_cb, 0, sizeof(m_out_res_cb));
138   }
139
140   // set brief and instance name
141   update_names();
142}
143
144
145//-------------------------------------------------
146121//  device_start - device-specific startup
147122//-------------------------------------------------
148123
r21093r21094
151126   m_card = dynamic_cast<device_vic10_expansion_card_interface *>(get_card_device());
152127
153128   // resolve callbacks
154   m_out_irq_func.resolve(m_out_irq_cb, *this);
155   m_out_sp_func.resolve(m_out_sp_cb, *this);
156   m_out_cnt_func.resolve(m_out_cnt_cb, *this);
157   m_out_res_func.resolve(m_out_res_cb, *this);
129   m_write_irq.resolve_safe();
130   m_write_res.resolve_safe();
131   m_write_cnt.resolve_safe();
132   m_write_sp.resolve_safe();
158133
159134   // inherit bus clock
160135   if (clock() == 0)
r21093r21094
300275
301276READ_LINE_MEMBER( vic10_expansion_slot_device::p0_r ) { int state = 0; if (m_card != NULL) state = m_card->vic10_p0_r(); return state; }
302277WRITE_LINE_MEMBER( vic10_expansion_slot_device::p0_w ) { if (m_card != NULL) m_card->vic10_p0_w(state); }
303WRITE_LINE_MEMBER( vic10_expansion_slot_device::irq_w ) { m_out_irq_func(state); }
304WRITE_LINE_MEMBER( vic10_expansion_slot_device::sp_w ) { m_out_sp_func(state); if (m_card != NULL) m_card->vic10_sp_w(state); }
305WRITE_LINE_MEMBER( vic10_expansion_slot_device::cnt_w ) { m_out_cnt_func(state); if (m_card != NULL) m_card->vic10_cnt_w(state); }
306WRITE_LINE_MEMBER( vic10_expansion_slot_device::res_w ) { m_out_res_func(state); }
trunk/src/mess/machine/vic10exp.h
r21093r21094
5454//  INTERFACE CONFIGURATION MACROS
5555//**************************************************************************
5656
57#define VIC10_EXPANSION_INTERFACE(_name) \
58   const vic10_expansion_slot_interface (_name) =
59
60
61#define MCFG_VIC10_EXPANSION_SLOT_ADD(_tag, _clock, _config, _slot_intf, _def_slot, _def_inp) \
57#define MCFG_VIC10_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot, _def_inp) \
6258   MCFG_DEVICE_ADD(_tag, VIC10_EXPANSION_SLOT, _clock) \
63   MCFG_DEVICE_CONFIG(_config) \
6459   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
6560
6661
62#define MCFG_VIC10_EXPANSION_SLOT_IRQ_CALLBACKS(_irq, _res) \
63   downcast<vic10_expansion_slot_device *>(device)->set_irq_callbacks(DEVCB2_##_irq, DEVCB2_##_res);
6764
65#define MCFG_VIC10_EXPANSION_SLOT_SERIAL_CALLBACKS(_cnt, _sp) \
66   downcast<vic10_expansion_slot_device *>(device)->set_serial_callbacks(DEVCB2_##_cnt, DEVCB2_##_sp);
67
68
69
6870//**************************************************************************
6971//  TYPE DEFINITIONS
7072//**************************************************************************
7173
72// ======================> vic10_expansion_slot_interface
73
74struct vic10_expansion_slot_interface
75{
76   devcb_write_line    m_out_irq_cb;
77   devcb_write_line    m_out_sp_cb;
78   devcb_write_line    m_out_cnt_cb;
79   devcb_write_line    m_out_res_cb;
80};
81
82
8374// ======================> vic10_expansion_slot_device
8475
8576class device_vic10_expansion_card_interface;
8677
8778class vic10_expansion_slot_device : public device_t,
88                           public vic10_expansion_slot_interface,
8979                           public device_slot_interface,
9080                           public device_image_interface
9181{
r21093r21094
9383   // construction/destruction
9484   vic10_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9585
86   template<class _irq, class _res> void set_irq_callbacks(_irq irq, _res res) {
87      m_write_irq.set_callback(irq);
88      m_write_res.set_callback(res);
89   }
90
91   template<class _cnt, class _sp> void set_serial_callbacks(_cnt cnt, _sp sp) {
92      m_write_cnt.set_callback(cnt);
93      m_write_sp.set_callback(sp);
94   }
95
9696   // computer interface
9797   UINT8 cd_r(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram);
9898   void cd_w(address_space &space, offs_t offset, UINT8 data, int lorom, int uprom, int exram);
r21093r21094
100100   DECLARE_WRITE_LINE_MEMBER( p0_w );
101101
102102   // cartridge interface
103   DECLARE_WRITE_LINE_MEMBER( irq_w );
104   DECLARE_WRITE_LINE_MEMBER( sp_w );
105   DECLARE_WRITE_LINE_MEMBER( cnt_w );
106   DECLARE_WRITE_LINE_MEMBER( res_w );
103   DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
104   DECLARE_WRITE_LINE_MEMBER( res_w ) { m_write_res(state); }
105   DECLARE_WRITE_LINE_MEMBER( cnt_w ) { m_write_cnt(state); }
106   DECLARE_WRITE_LINE_MEMBER( sp_w ) { m_write_sp(state); }
107107
108108protected:
109109   // device-level overrides
110   virtual void device_config_complete();
110   virtual void device_config_complete() { update_names(); }
111111   virtual void device_start();
112112   virtual void device_reset();
113113
r21093r21094
129129   // slot interface overrides
130130   virtual const char * get_default_card_software(const machine_config &config, emu_options &options);
131131
132   devcb_resolved_write_line   m_out_irq_func;
133   devcb_resolved_write_line   m_out_sp_func;
134   devcb_resolved_write_line   m_out_cnt_func;
135   devcb_resolved_write_line   m_out_res_func;
132   devcb2_write_line   m_write_irq;
133   devcb2_write_line   m_write_res;
134   devcb2_write_line   m_write_cnt;
135   devcb2_write_line   m_write_sp;
136136
137137   device_vic10_expansion_card_interface *m_card;
138138};
trunk/src/mess/machine/plus4exp.c
r21093r21094
178178plus4_expansion_slot_device::plus4_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
179179      device_t(mconfig, PLUS4_EXPANSION_SLOT, "Expansion Port", tag, owner, clock),
180180      device_slot_interface(mconfig, *this),
181      device_image_interface(mconfig, *this)
181      device_image_interface(mconfig, *this),
182      m_write_irq(*this),
183      m_read_dma_cd(*this),
184      m_write_dma_cd(*this),
185      m_write_aec(*this)
182186{
183187}
184188
185189
186190//-------------------------------------------------
187//  device_config_complete - perform any
188//  operations now that the configuration is
189//  complete
190//-------------------------------------------------
191
192void plus4_expansion_slot_device::device_config_complete()
193{
194   // inherit a copy of the static data
195   const plus4_expansion_slot_interface *intf = reinterpret_cast<const plus4_expansion_slot_interface *>(static_config());
196   if (intf != NULL)
197   {
198      *static_cast<plus4_expansion_slot_interface *>(this) = *intf;
199   }
200
201   // or initialize to defaults if none provided
202   else
203   {
204      memset(&m_in_dma_cd_cb, 0, sizeof(m_in_dma_cd_cb));
205      memset(&m_out_dma_cd_cb, 0, sizeof(m_out_dma_cd_cb));
206      memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
207      memset(&m_out_aec_cb, 0, sizeof(m_out_aec_cb));
208   }
209
210   // set brief and instance name
211   update_names();
212}
213
214
215//-------------------------------------------------
216191//  device_start - device-specific startup
217192//-------------------------------------------------
218193
r21093r21094
221196   m_card = dynamic_cast<device_plus4_expansion_card_interface *>(get_card_device());
222197
223198   // resolve callbacks
224   m_in_dma_cd_func.resolve(m_in_dma_cd_cb, *this);
225   m_out_dma_cd_func.resolve(m_out_dma_cd_cb, *this);
226   m_out_irq_func.resolve(m_out_irq_cb, *this);
227   m_out_aec_func.resolve(m_out_aec_cb, *this);
199   m_write_irq.resolve_safe();
200   m_read_dma_cd.resolve_safe(0xff);
201   m_write_dma_cd.resolve_safe();
202   m_write_aec.resolve_safe();
228203
229204   // inherit bus clock
230205   if (clock() == 0)
trunk/src/mess/machine/plus4exp.h
r21093r21094
5656//  INTERFACE CONFIGURATION MACROS
5757//**************************************************************************
5858
59#define PLUS4_EXPANSION_INTERFACE(_name) \
60   const plus4_expansion_slot_interface (_name) =
61
62
63#define MCFG_PLUS4_EXPANSION_SLOT_ADD(_tag, _clock, _config, _slot_intf, _def_slot, _def_inp) \
59#define MCFG_PLUS4_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot, _def_inp, _irq) \
6460   MCFG_DEVICE_ADD(_tag, PLUS4_EXPANSION_SLOT, _clock) \
65   MCFG_DEVICE_CONFIG(_config) \
61   downcast<plus4_expansion_slot_device *>(device)->set_irq_callback(DEVCB2_##_irq); \
6662   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
6763
64#define MCFG_PLUS4_PASSTHRU_EXPANSION_SLOT_ADD() \
65   MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, 0, plus4_expansion_cards, NULL, NULL, DEVWRITELINE(DEVICE_SELF_OWNER, plus4_expansion_slot_device, irq_w)) \
66   MCFG_PLUS4_EXPANSION_SLOT_DMA_CALLBACKS(DEVREAD8(DEVICE_SELF_OWNER, plus4_expansion_slot_device, dma_cd_r), DEVWRITE8(DEVICE_SELF_OWNER, plus4_expansion_slot_device, dma_cd_w), DEVWRITELINE(DEVICE_SELF_OWNER, plus4_expansion_slot_device, aec_w))
6867
6968
69#define MCFG_PLUS4_EXPANSION_SLOT_DMA_CALLBACKS(_read, _write, _aec) \
70   downcast<plus4_expansion_slot_device *>(device)->set_dma_callbacks(DEVCB2_##_read, DEVCB2_##_write, DEVCB2_##_aec);
71
72
73
7074//**************************************************************************
7175//  TYPE DEFINITIONS
7276//**************************************************************************
7377
74// ======================> plus4_expansion_slot_interface
75
76struct plus4_expansion_slot_interface
77{
78   devcb_read8         m_in_dma_cd_cb;
79   devcb_write8        m_out_dma_cd_cb;
80   devcb_write_line    m_out_irq_cb;
81   devcb_write_line    m_out_aec_cb;
82};
83
84
8578// ======================> plus4_expansion_slot_device
8679
8780class device_plus4_expansion_card_interface;
8881
8982class plus4_expansion_slot_device : public device_t,
90                           public plus4_expansion_slot_interface,
9183                           public device_slot_interface,
9284                           public device_image_interface
9385{
r21093r21094
9587   // construction/destruction
9688   plus4_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9789
90   template<class _irq> void set_irq_callback(_irq irq) { m_write_irq.set_callback(irq); }
91
92   template<class _read, class _write, class _aec> void set_dma_callbacks(_read read, _write write, _aec aec) {
93      m_read_dma_cd.set_callback(read);
94      m_write_dma_cd.set_callback(write);
95      m_write_aec.set_callback(aec);
96   }
97
9898   // computer interface
9999   UINT8 cd_r(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h);
100100   void cd_w(address_space &space, offs_t offset, UINT8 data, int ba, int cs0, int c1l, int c2l, int cs1, int c1h, int c2h);
101   UINT32 screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
102101
103102   // cartridge interface
104   DECLARE_READ8_MEMBER( dma_cd_r ) { return m_in_dma_cd_func(offset); }
105   DECLARE_WRITE8_MEMBER( dma_cd_w ) { m_out_dma_cd_func(offset, data); }
106   DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_out_irq_func(state); }
107   DECLARE_WRITE_LINE_MEMBER( aec_w ) { m_out_aec_func(state); }
103   DECLARE_READ8_MEMBER( dma_cd_r ) { return m_read_dma_cd(offset); }
104   DECLARE_WRITE8_MEMBER( dma_cd_w ) { m_write_dma_cd(offset, data); }
105   DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
106   DECLARE_WRITE_LINE_MEMBER( aec_w ) { m_write_aec(state); }
108107   int phi2() { return clock(); }
109108
110109protected:
111110   // device-level overrides
112   virtual void device_config_complete();
111   virtual void device_config_complete() { update_names(); }
113112   virtual void device_start();
114113   virtual void device_reset();
115114
r21093r21094
131130   // slot interface overrides
132131   virtual const char * get_default_card_software(const machine_config &config, emu_options &options);
133132
134   devcb_resolved_read8        m_in_dma_cd_func;
135   devcb_resolved_write8       m_out_dma_cd_func;
136   devcb_resolved_write_line   m_out_irq_func;
137   devcb_resolved_write_line   m_out_aec_func;
133   devcb2_write_line   m_write_irq;
134   devcb2_read8        m_read_dma_cd;
135   devcb2_write8       m_write_dma_cd;
136   devcb2_write_line   m_write_aec;
138137
139138   device_plus4_expansion_card_interface *m_card;
140139};
trunk/src/mess/machine/cbm2exp.c
r21093r21094
165165
166166
167167//-------------------------------------------------
168//  cbm2_expansion_slot_device - destructor
169//-------------------------------------------------
170
171cbm2_expansion_slot_device::~cbm2_expansion_slot_device()
172{
173}
174
175
176//-------------------------------------------------
177//  device_config_complete - perform any
178//  operations now that the configuration is
179//  complete
180//-------------------------------------------------
181
182void cbm2_expansion_slot_device::device_config_complete()
183{
184   // set brief and instance name
185   update_names();
186}
187
188
189//-------------------------------------------------
190168//  device_start - device-specific startup
191169//-------------------------------------------------
192170
193171void cbm2_expansion_slot_device::device_start()
194172{
195   m_cart = dynamic_cast<device_cbm2_expansion_card_interface *>(get_card_device());
173   m_card = dynamic_cast<device_cbm2_expansion_card_interface *>(get_card_device());
196174
197175   // inherit bus clock
198176   if (clock() == 0)
r21093r21094
221199{
222200   size_t size = 0;
223201
224   if (m_cart)
202   if (m_card)
225203   {
226204      if (software_entry() == NULL)
227205      {
r21093r21094
229207
230208         if (!mame_stricmp(filetype(), "20"))
231209         {
232            fread(m_cart->cbm2_bank1_pointer(machine(), size), size);
210            fread(m_card->cbm2_bank1_pointer(machine(), size), size);
233211         }
234212         else if (!mame_stricmp(filetype(), "40"))
235213         {
236            fread(m_cart->cbm2_bank2_pointer(machine(), size), size);
214            fread(m_card->cbm2_bank2_pointer(machine(), size), size);
237215         }
238216         else if (!mame_stricmp(filetype(), "60"))
239217         {
240            fread(m_cart->cbm2_bank3_pointer(machine(), size), size);
218            fread(m_card->cbm2_bank3_pointer(machine(), size), size);
241219         }
242220      }
243221      else
244222      {
245223         size = get_software_region_length("bank1");
246         if (size) memcpy(m_cart->cbm2_bank1_pointer(machine(), size), get_software_region("bank1"), size);
224         if (size) memcpy(m_card->cbm2_bank1_pointer(machine(), size), get_software_region("bank1"), size);
247225
248226         size = get_software_region_length("bank2");
249         if (size) memcpy(m_cart->cbm2_bank2_pointer(machine(), size), get_software_region("bank2"), size);
227         if (size) memcpy(m_card->cbm2_bank2_pointer(machine(), size), get_software_region("bank2"), size);
250228
251229         size = get_software_region_length("bank3");
252         if (size) memcpy(m_cart->cbm2_bank3_pointer(machine(), size), get_software_region("bank3"), size);
230         if (size) memcpy(m_card->cbm2_bank3_pointer(machine(), size), get_software_region("bank3"), size);
253231
254232         size = get_software_region_length("ram");
255         if (size) memset(m_cart->cbm2_ram_pointer(machine(), size), 0, size);
233         if (size) memset(m_card->cbm2_ram_pointer(machine(), size), 0, size);
256234
257235         size = get_software_region_length("nvram");
258         if (size) memset(m_cart->cbm2_nvram_pointer(machine(), size), 0, size);
236         if (size) memset(m_card->cbm2_nvram_pointer(machine(), size), 0, size);
259237      }
260238   }
261239
r21093r21094
291269
292270UINT8 cbm2_expansion_slot_device::read(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3)
293271{
294   if (m_cart != NULL)
272   if (m_card != NULL)
295273   {
296      data = m_cart->cbm2_bd_r(space, offset, data, csbank1, csbank2, csbank3);
274      data = m_card->cbm2_bd_r(space, offset, data, csbank1, csbank2, csbank3);
297275   }
298276
299277   return data;
r21093r21094
306284
307285void cbm2_expansion_slot_device::write(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3)
308286{
309   if (m_cart != NULL)
287   if (m_card != NULL)
310288   {
311      m_cart->cbm2_bd_w(space, offset, data, csbank1, csbank2, csbank3);
289      m_card->cbm2_bd_w(space, offset, data, csbank1, csbank2, csbank3);
312290   }
313291}
314
315
316//-------------------------------------------------
317//  phi2 - system clock frequency
318//-------------------------------------------------
319
320int cbm2_expansion_slot_device::phi2()
321{
322   return clock();
323}
trunk/src/mess/machine/cbm2exp.h
r21093r21094
6767public:
6868   // construction/destruction
6969   cbm2_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
70   virtual ~cbm2_expansion_slot_device();
7170
7271   // computer interface
7372   UINT8 read(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3);
7473   void write(address_space &space, offs_t offset, UINT8 data, int csbank1, int csbank2, int csbank3);
7574
7675   // cartridge interface
77   int phi2();
76   int phi2() { return clock(); }
7877
7978protected:
8079   // device-level overrides
81   virtual void device_config_complete();
80   virtual void device_config_complete() { update_names(); }
8281   virtual void device_start();
8382   virtual void device_reset();
8483
r21093r21094
10099   // slot interface overrides
101100   virtual const char * get_default_card_software(const machine_config &config, emu_options &options);
102101
103   device_cbm2_expansion_card_interface *m_cart;
102   device_cbm2_expansion_card_interface *m_card;
104103};
105104
106105
trunk/src/mess/machine/serial.c
r21093r21094
133133      out_cts(state);
134134   }
135135}
136
137#include "machine/null_modem.h"
138#include "machine/terminal.h"
139
140SLOT_INTERFACE_START( default_rs232_devices )
141   SLOT_INTERFACE("serial_terminal", SERIAL_TERMINAL)
142   SLOT_INTERFACE("null_modem", NULL_MODEM)
143SLOT_INTERFACE_END
trunk/src/mess/machine/serial.h
r21093r21094
120120
121121extern const device_type RS232_PORT;
122122
123SLOT_INTERFACE_EXTERN( default_rs232_devices );
124
123125#endif
trunk/src/mess/machine/c64_4ksa.c
r21093r21094
2626
2727static INPUT_PORTS_START( c64_4ksa )
2828   PORT_START("SP2")
29   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, sp2_w)
29   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, cia_sp2_w)
3030
3131   PORT_START("PB")
3232   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
r21093r21094
106106
107107void c64_4ksa_device::c64_cnt1_w(int level)
108108{
109   m_slot->cnt2_w(level);
109   m_slot->cia_cnt2_w(level);
110110}
trunk/src/mess/machine/cbmipt.c
r21093r21094
11081108SLOT_INTERFACE_END
11091109
11101110SLOT_INTERFACE_START( vic20_user_port_cards )
1111   SLOT_INTERFACE("rs232", VIC1011)
11111112SLOT_INTERFACE_END
11121113
11131114SLOT_INTERFACE_START( vic10_expansion_cards )
r21093r21094
11911192   SLOT_INTERFACE("4tba", C64_4TBA)
11921193   SLOT_INTERFACE("bn1541", C64_BN1541)
11931194   SLOT_INTERFACE("geocable", C64_GEOCABLE)
1195   SLOT_INTERFACE("rs232", C64_VIC1011)
11941196SLOT_INTERFACE_END
11951197
11961198SLOT_INTERFACE_START( plus4_datassette_devices )
trunk/src/mess/machine/cbmipt.h
r21093r21094
6666#include "machine/c64_tdos.h"
6767#include "machine/c64_turbo232.h"
6868#include "machine/c64_vizastar.h"
69#include "machine/c64_vic1011.h"
6970#include "machine/c64_vw64.h"
7071#include "machine/c64_warp_speed.h"
7172#include "machine/c64_westermann.h"
r21093r21094
9596#include "machine/softbox.h"
9697#include "machine/superpet.h"
9798#include "machine/vic1010.h"
99#include "machine/vic1011.h"
98100#include "machine/vic1110.h"
99101#include "machine/vic1111.h"
100102#include "machine/vic1112.h"
trunk/src/mess/machine/c64_4dxh.c
r21093r21094
2626
2727static INPUT_PORTS_START( c64_4dxh )
2828   PORT_START("SP2")
29   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, sp2_w)
29   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, cia_sp2_w)
3030
3131   PORT_START("PB")
3232   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
r21093r21094
106106
107107void c64_4dxh_device::c64_cnt1_w(int level)
108108{
109   m_slot->cnt2_w(level);
109   m_slot->cia_cnt2_w(level);
110110}
trunk/src/mess/machine/vic20exp.c
r21093r21094
2222const device_type VIC20_EXPANSION_SLOT = &device_creator<vic20_expansion_slot_device>;
2323
2424
25
2526//**************************************************************************
2627//  DEVICE VIC20_EXPANSION CARD INTERFACE
2728//**************************************************************************
r21093r21094
158159vic20_expansion_slot_device::vic20_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
159160      device_t(mconfig, VIC20_EXPANSION_SLOT, "VIC-20 expansion port", tag, owner, clock),
160161      device_slot_interface(mconfig, *this),
161      device_image_interface(mconfig, *this)
162      device_image_interface(mconfig, *this),
163      m_write_irq(*this),
164      m_write_nmi(*this),
165      m_write_res(*this)
162166{
163167}
164168
165169
166170//-------------------------------------------------
167//  device_config_complete - perform any
168//  operations now that the configuration is
169//  complete
170//-------------------------------------------------
171
172void vic20_expansion_slot_device::device_config_complete()
173{
174   // inherit a copy of the static data
175   const vic20_expansion_slot_interface *intf = reinterpret_cast<const vic20_expansion_slot_interface *>(static_config());
176   if (intf != NULL)
177   {
178      *static_cast<vic20_expansion_slot_interface *>(this) = *intf;
179   }
180
181   // or initialize to defaults if none provided
182   else
183   {
184      memset(&m_out_irq_cb, 0, sizeof(m_out_irq_cb));
185      memset(&m_out_nmi_cb, 0, sizeof(m_out_nmi_cb));
186      memset(&m_out_res_cb, 0, sizeof(m_out_res_cb));
187   }
188
189   // set brief and instance name
190   update_names();
191}
192
193
194//-------------------------------------------------
195171//  device_start - device-specific startup
196172//-------------------------------------------------
197173
r21093r21094
200176   m_card = dynamic_cast<device_vic20_expansion_card_interface *>(get_card_device());
201177
202178   // resolve callbacks
203   m_out_irq_func.resolve(m_out_irq_cb, *this);
204   m_out_nmi_func.resolve(m_out_nmi_cb, *this);
205   m_out_res_func.resolve(m_out_res_cb, *this);
179   m_write_irq.resolve_safe();
180   m_write_nmi.resolve_safe();
181   m_write_res.resolve_safe();
206182
207183   // inherit bus clock
208184   if (clock() == 0)
r21093r21094
339315      m_card->vic20_cd_w(space, offset, data, ram1, ram2, ram3, blk1, blk2, blk3, blk5, io2, io3);
340316   }
341317}
342
343WRITE_LINE_MEMBER( vic20_expansion_slot_device::irq_w ) { m_out_irq_func(state); }
344WRITE_LINE_MEMBER( vic20_expansion_slot_device::nmi_w ) { m_out_nmi_func(state); }
345WRITE_LINE_MEMBER( vic20_expansion_slot_device::res_w ) { m_out_res_func(state); }
trunk/src/mess/machine/vic20exp.h
r21093r21094
5353//  INTERFACE CONFIGURATION MACROS
5454//**************************************************************************
5555
56#define VIC20_EXPANSION_INTERFACE(_name) \
57   const vic20_expansion_slot_interface (_name) =
58
59
60#define MCFG_VIC20_EXPANSION_SLOT_ADD(_tag, _clock, _config, _slot_intf, _def_slot, _def_inp) \
56#define MCFG_VIC20_EXPANSION_SLOT_ADD(_tag, _clock, _slot_intf, _def_slot, _def_inp) \
6157   MCFG_DEVICE_ADD(_tag, VIC20_EXPANSION_SLOT, _clock) \
62   MCFG_DEVICE_CONFIG(_config) \
6358   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
6459
60#define MCFG_VIC20_PASSTHRU_EXPANSION_SLOT_ADD(_tag) \
61   MCFG_VIC20_EXPANSION_SLOT_ADD(_tag, 0, vic20_expansion_cards, NULL, NULL) \
62   MCFG_VIC20_EXPANSION_SLOT_IRQ_CALLBACKS(DEVWRITELINE(DEVICE_SELF_OWNER, vic20_expansion_slot_device, irq_w), DEVWRITELINE(DEVICE_SELF_OWNER, vic20_expansion_slot_device, nmi_w), DEVWRITELINE(DEVICE_SELF_OWNER, vic20_expansion_slot_device, res_w))
6563
6664
65#define MCFG_VIC20_EXPANSION_SLOT_IRQ_CALLBACKS(_irq, _nmi, _res) \
66   downcast<vic20_expansion_slot_device *>(device)->set_irq_callbacks(DEVCB2_##_irq, DEVCB2_##_nmi, DEVCB2_##_res);
67
68
69
6770//**************************************************************************
6871//  TYPE DEFINITIONS
6972//**************************************************************************
7073
71// ======================> vic20_expansion_slot_interface
72
73struct vic20_expansion_slot_interface
74{
75   devcb_write_line    m_out_irq_cb;
76   devcb_write_line    m_out_nmi_cb;
77   devcb_write_line    m_out_res_cb;
78};
79
80
8174// ======================> vic20_expansion_slot_device
8275
8376class device_vic20_expansion_card_interface;
8477
8578class vic20_expansion_slot_device : public device_t,
86                           public vic20_expansion_slot_interface,
8779                           public device_slot_interface,
8880                           public device_image_interface
8981{
r21093r21094
9183   // construction/destruction
9284   vic20_expansion_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
9385
86   template<class _irq, class _nmi, class _res> void set_irq_callbacks(_irq irq, _nmi nmi, _res res) {
87      m_write_irq.set_callback(irq);
88      m_write_nmi.set_callback(nmi);
89      m_write_res.set_callback(res);
90   }
91
9492   // computer interface
9593   UINT8 cd_r(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
9694   void cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3);
9795
9896   // cartridge interface
99   DECLARE_WRITE_LINE_MEMBER( irq_w );
100   DECLARE_WRITE_LINE_MEMBER( nmi_w );
101   DECLARE_WRITE_LINE_MEMBER( res_w );
97   DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_write_irq(state); }
98   DECLARE_WRITE_LINE_MEMBER( nmi_w ) { m_write_nmi(state); }
99   DECLARE_WRITE_LINE_MEMBER( res_w ) { m_write_res(state); }
102100
103101protected:
104102   // device-level overrides
105   virtual void device_config_complete();
103   virtual void device_config_complete() { update_names(); }
106104   virtual void device_start();
107105   virtual void device_reset();
108106
r21093r21094
124122   // slot interface overrides
125123   virtual const char * get_default_card_software(const machine_config &config, emu_options &options);
126124
127   devcb_resolved_write_line   m_out_irq_func;
128   devcb_resolved_write_line   m_out_nmi_func;
129   devcb_resolved_write_line   m_out_res_func;
125   devcb2_write_line   m_write_irq;
126   devcb2_write_line   m_write_nmi;
127   devcb2_write_line   m_write_res;
130128
131129   device_vic20_expansion_card_interface *m_card;
132130};
r21093r21094
156154   // runtime
157155   virtual UINT8 vic20_cd_r(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { return data; };
158156   virtual void vic20_cd_w(address_space &space, offs_t offset, UINT8 data, int ram1, int ram2, int ram3, int blk1, int blk2, int blk3, int blk5, int io2, int io3) { };
159   virtual void vic20_res_w(int state) { };
160157
161158   vic20_expansion_slot_device *m_slot;
162159
trunk/src/mess/machine/cbm2user.c
r21093r21094
100100
101101void cbm2_user_port_device::device_start()
102102{
103   m_cart = dynamic_cast<device_cbm2_user_port_interface *>(get_card_device());
103   m_card = dynamic_cast<device_cbm2_user_port_interface *>(get_card_device());
104104
105105   // resolve callbacks
106106   m_out_irq_func.resolve(m_out_irq_cb, *this);
r21093r21094
110110}
111111
112112
113//-------------------------------------------------
114//  device_reset - device-specific reset
115//-------------------------------------------------
116
117void cbm2_user_port_device::device_reset()
118{
119}
120
121
122READ8_MEMBER( cbm2_user_port_device::d1_r ) { UINT8 data = 0xff; if (m_cart != NULL) data = m_cart->cbm2_d1_r(space, offset); return data; }
123WRITE8_MEMBER( cbm2_user_port_device::d1_w ) { if (m_cart != NULL) m_cart->cbm2_d1_w(space, offset, data); }
124READ8_MEMBER( cbm2_user_port_device::d2_r ) { UINT8 data = 0xff; if (m_cart != NULL) data = m_cart->cbm2_d2_r(space, offset); return data; }
125WRITE8_MEMBER( cbm2_user_port_device::d2_w ) { if (m_cart != NULL) m_cart->cbm2_d2_w(space, offset, data); }
126READ_LINE_MEMBER( cbm2_user_port_device::pb2_r ) { return m_cart ? m_cart->cbm2_pb2_r() : 1; }
127WRITE_LINE_MEMBER( cbm2_user_port_device::pb2_w ) { if (m_cart != NULL) m_cart->cbm2_pb2_w(state); }
128READ_LINE_MEMBER( cbm2_user_port_device::pb3_r ) { return m_cart ? m_cart->cbm2_pb3_r() : 1; }
129WRITE_LINE_MEMBER( cbm2_user_port_device::pb3_w ) { if (m_cart != NULL) m_cart->cbm2_pb3_w(state); }
130WRITE_LINE_MEMBER( cbm2_user_port_device::pc_w ) { if (m_cart != NULL) m_cart->cbm2_pc_w(state); }
131WRITE_LINE_MEMBER( cbm2_user_port_device::cnt_w ) { if (m_cart != NULL) m_cart->cbm2_cnt_w(state); }
132WRITE_LINE_MEMBER( cbm2_user_port_device::sp_w ) { if (m_cart != NULL) m_cart->cbm2_sp_w(state); }
113READ8_MEMBER( cbm2_user_port_device::d1_r ) { UINT8 data = 0xff; if (m_card != NULL) data = m_card->cbm2_d1_r(space, offset); return data; }
114WRITE8_MEMBER( cbm2_user_port_device::d1_w ) { if (m_card != NULL) m_card->cbm2_d1_w(space, offset, data); }
115READ8_MEMBER( cbm2_user_port_device::d2_r ) { UINT8 data = 0xff; if (m_card != NULL) data = m_card->cbm2_d2_r(space, offset); return data; }
116WRITE8_MEMBER( cbm2_user_port_device::d2_w ) { if (m_card != NULL) m_card->cbm2_d2_w(space, offset, data); }
117READ_LINE_MEMBER( cbm2_user_port_device::pb2_r ) { return m_card ? m_card->cbm2_pb2_r() : 1; }
118WRITE_LINE_MEMBER( cbm2_user_port_device::pb2_w ) { if (m_card != NULL) m_card->cbm2_pb2_w(state); }
119READ_LINE_MEMBER( cbm2_user_port_device::pb3_r ) { return m_card ? m_card->cbm2_pb3_r() : 1; }
120WRITE_LINE_MEMBER( cbm2_user_port_device::pb3_w ) { if (m_card != NULL) m_card->cbm2_pb3_w(state); }
121WRITE_LINE_MEMBER( cbm2_user_port_device::pc_w ) { if (m_card != NULL) m_card->cbm2_pc_w(state); }
122WRITE_LINE_MEMBER( cbm2_user_port_device::cnt_w ) { if (m_card != NULL) m_card->cbm2_cnt_w(state); }
123WRITE_LINE_MEMBER( cbm2_user_port_device::sp_w ) { if (m_card != NULL) m_card->cbm2_sp_w(state); }
trunk/src/mess/machine/cbm2user.h
r21093r21094
8282   DECLARE_WRITE_LINE_MEMBER( cnt_w );
8383   DECLARE_WRITE_LINE_MEMBER( sp_w );
8484
85   // cartridge interface
86   DECLARE_WRITE_LINE_MEMBER( irq_w ) { m_out_irq_func(state); }
87   DECLARE_WRITE_LINE_MEMBER( cia_sp_w ) { m_out_sp_func(state); }
88   DECLARE_WRITE_LINE_MEMBER( cia_cnt_w ) { m_out_cnt_func(state); }
89   DECLARE_WRITE_LINE_MEMBER( flag_w ) { m_out_flag_func(state); }
90
8591protected:
8692   // device-level overrides
8793   virtual void device_config_complete();
8894   virtual void device_start();
89   virtual void device_reset();
9095
9196   devcb_resolved_write_line   m_out_irq_func;
9297   devcb_resolved_write_line   m_out_sp_func;
9398   devcb_resolved_write_line   m_out_cnt_func;
9499   devcb_resolved_write_line   m_out_flag_func;
95100
96   device_cbm2_user_port_interface *m_cart;
101   device_cbm2_user_port_interface *m_card;
97102};
98103
99104
trunk/src/mess/machine/c1551.c
r21093r21094
367367
368368
369369//-------------------------------------------------
370//  PLUS4_EXPANSION_INTERFACE( expansion_intf )
371//-------------------------------------------------
372
373READ8_MEMBER( c1551_device::exp_dma_r )
374{
375   return m_slot->dma_cd_r(space, offset);
376}
377
378WRITE8_MEMBER( c1551_device::exp_dma_w )
379{
380   m_slot->dma_cd_w(space, offset, data);
381}
382
383WRITE_LINE_MEMBER( c1551_device::exp_irq_w )
384{
385   m_slot->irq_w(state);
386}
387
388WRITE_LINE_MEMBER( c1551_device::exp_aec_w )
389{
390   m_slot->aec_w(state);
391}
392
393static PLUS4_EXPANSION_INTERFACE( expansion_intf )
394{
395   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1551_device, exp_dma_r),
396   DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, c1551_device, exp_dma_w),
397   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1551_device, exp_irq_w),
398   DEVCB_DEVICE_LINE_MEMBER(DEVICE_SELF_OWNER, c1551_device, exp_aec_w)
399};
400
401
402//-------------------------------------------------
403370//  MACHINE_DRIVER( c1551 )
404371//-------------------------------------------------
405372
r21093r21094
416383   MCFG_LEGACY_FLOPPY_DRIVE_ADD(FLOPPY_0, c1541_floppy_interface)
417384   MCFG_64H156_ADD(C64H156_TAG, XTAL_16MHz, ga_intf)
418385
419   MCFG_PLUS4_EXPANSION_SLOT_ADD(PLUS4_EXPANSION_SLOT_TAG, 0, expansion_intf, plus4_expansion_cards, NULL, NULL)
386   MCFG_PLUS4_PASSTHRU_EXPANSION_SLOT_ADD()
420387MACHINE_CONFIG_END
421388
422389
trunk/src/mess/machine/c1551.h
r21093r21094
6363   DECLARE_READ8_MEMBER( tpi1_pc_r );
6464   DECLARE_WRITE8_MEMBER( tpi1_pc_w );
6565
66   DECLARE_READ8_MEMBER( exp_dma_r );
67   DECLARE_WRITE8_MEMBER( exp_dma_w );
68   DECLARE_WRITE_LINE_MEMBER( exp_irq_w );
69   DECLARE_WRITE_LINE_MEMBER( exp_aec_w );
70
7166protected:
7267   // device-level overrides
7368   virtual void device_config_complete() { m_shortname = "c1551"; }
trunk/src/mess/machine/vic20user.c
r21093r21094
6060
6161
6262//-------------------------------------------------
63//  vic20_user_port_device - destructor
64//-------------------------------------------------
65
66vic20_user_port_device::~vic20_user_port_device()
67{
68}
69
70
71//-------------------------------------------------
7263//  device_config_complete - perform any
7364//  operations now that the configuration is
7465//  complete
r21093r21094
9990
10091void vic20_user_port_device::device_start()
10192{
102   m_cart = dynamic_cast<device_vic20_user_port_interface *>(get_card_device());
93   m_card = dynamic_cast<device_vic20_user_port_interface *>(get_card_device());
10394
10495   // resolve callbacks
10596   m_out_light_pen_func.resolve(m_out_light_pen_cb, *this);
r21093r21094
115106
116107void vic20_user_port_device::device_reset()
117108{
118   port_reset_w(ASSERT_LINE);
119   port_reset_w(CLEAR_LINE);
109   if (get_card_device())
110   {
111      get_card_device()->reset();
112   }
120113}
121114
122115
123READ8_MEMBER( vic20_user_port_device::pb_r ) { UINT8 data = 0xff; if (m_cart != NULL) data = m_cart->vic20_pb_r(space, offset); return data; }
124WRITE8_MEMBER( vic20_user_port_device::pb_w ) { if (m_cart != NULL) m_cart->vic20_pb_w(space, offset, data); }
125READ_LINE_MEMBER( vic20_user_port_device::joy0_r ) { int state = 1; if (m_cart != NULL) state = m_cart->vic20_joy0_r(); return state; }
126READ_LINE_MEMBER( vic20_user_port_device::joy1_r ) { int state = 1; if (m_cart != NULL) state = m_cart->vic20_joy1_r(); return state; }
127READ_LINE_MEMBER( vic20_user_port_device::joy2_r ) { int state = 1; if (m_cart != NULL) state = m_cart->vic20_joy2_r(); return state; }
128READ_LINE_MEMBER( vic20_user_port_device::light_pen_r ) { int state = 1; if (m_cart != NULL) state = m_cart->vic20_light_pen_r(); return state; }
129READ_LINE_MEMBER( vic20_user_port_device::cassette_switch_r ) { int state = 1; if (m_cart != NULL) state = m_cart->vic20_cassette_switch_r(); return state; }
130WRITE_LINE_MEMBER( vic20_user_port_device::cb1_w ) { if (m_cart != NULL) m_cart->vic20_cb1_w(state); }
131WRITE_LINE_MEMBER( vic20_user_port_device::cb2_w ) { if (m_cart != NULL) m_cart->vic20_cb2_w(state); }
132WRITE_LINE_MEMBER( vic20_user_port_device::atn_w ) { if (m_cart != NULL) m_cart->vic20_atn_w(state); }
133WRITE_LINE_MEMBER( vic20_user_port_device::port_reset_w ) { if (m_cart != NULL) m_cart->vic20_reset_w(state); }
134
135WRITE_LINE_MEMBER( vic20_user_port_device::light_pen_w ) { m_out_light_pen_func(state); }
136WRITE_LINE_MEMBER( vic20_user_port_device::via_cb1_w ) { m_out_cb1_func(state); }
137WRITE_LINE_MEMBER( vic20_user_port_device::via_cb2_w ) { m_out_cb2_func(state); }
138WRITE_LINE_MEMBER( vic20_user_port_device::reset_w ) { m_out_reset_func(state); }
116READ8_MEMBER( vic20_user_port_device::pb_r ) { UINT8 data = 0xff; if (m_card != NULL) data = m_card->vic20_pb_r(space, offset); return data; }
117WRITE8_MEMBER( vic20_user_port_device::pb_w ) { if (m_card != NULL) m_card->vic20_pb_w(space, offset, data); }
118READ_LINE_MEMBER( vic20_user_port_device::joy0_r ) { int state = 1; if (m_card != NULL) state = m_card->vic20_joy0_r(); return state; }
119READ_LINE_MEMBER( vic20_user_port_device::joy1_r ) { int state = 1; if (m_card != NULL) state = m_card->vic20_joy1_r(); return state; }
120READ_LINE_MEMBER( vic20_user_port_device::joy2_r ) { int state = 1; if (m_card != NULL) state = m_card->vic20_joy2_r(); return state; }
121READ_LINE_MEMBER( vic20_user_port_device::light_pen_r ) { int state = 1; if (m_card != NULL) state = m_card->vic20_light_pen_r(); return state; }
122READ_LINE_MEMBER( vic20_user_port_device::cassette_switch_r ) { int state = 1; if (m_card != NULL) state = m_card->vic20_cassette_switch_r(); return state; }
123WRITE_LINE_MEMBER( vic20_user_port_device::cb1_w ) { if (m_card != NULL) m_card->vic20_cb1_w(state); }
124WRITE_LINE_MEMBER( vic20_user_port_device::cb2_w ) { if (m_card != NULL) m_card->vic20_cb2_w(state); }
125WRITE_LINE_MEMBER( vic20_user_port_device::atn_w ) { if (m_card != NULL) m_card->vic20_atn_w(state); }
trunk/src/mess/machine/vic20user.h
r21093r21094
8080public:
8181   // construction/destruction
8282   vic20_user_port_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
83   virtual ~vic20_user_port_device();
8483
8584   // computer interface
8685   DECLARE_READ8_MEMBER( pb_r );
r21093r21094
9695   DECLARE_WRITE_LINE_MEMBER( port_reset_w );
9796
9897   // cartridge interface
99   DECLARE_WRITE_LINE_MEMBER( light_pen_w );
100   DECLARE_WRITE_LINE_MEMBER( via_cb1_w );
101   DECLARE_WRITE_LINE_MEMBER( via_cb2_w );
102   DECLARE_WRITE_LINE_MEMBER( reset_w );
98   DECLARE_WRITE_LINE_MEMBER( light_pen_w ) { m_out_light_pen_func(state); }
99   DECLARE_WRITE_LINE_MEMBER( via_cb1_w ) { m_out_cb1_func(state); }
100   DECLARE_WRITE_LINE_MEMBER( via_cb2_w ) { m_out_cb2_func(state); }
101   DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_out_reset_func(state); }
103102
104103protected:
105104   // device-level overrides
105   virtual void device_config_complete();
106106   virtual void device_start();
107107   virtual void device_reset();
108   virtual void device_config_complete();
109108
110109   devcb_resolved_write_line   m_out_light_pen_func;
111110   devcb_resolved_write_line   m_out_cb1_func;
112111   devcb_resolved_write_line   m_out_cb2_func;
113112   devcb_resolved_write_line   m_out_reset_func;
114113
115   device_vic20_user_port_interface *m_cart;
114   device_vic20_user_port_interface *m_card;
116115};
117116
118117
r21093r21094
138137   virtual void vic20_cb2_w(int state) { };
139138   virtual void vic20_atn_w(int state) { };
140139
141   // reset
142   virtual void vic20_reset_w(int state) { };
143
144140protected:
145141   vic20_user_port_device *m_slot;
146142};
trunk/src/mess/machine/c64user.c
r21093r21094
124124WRITE_LINE_MEMBER( c64_user_port_device::pa2_w ) { if (m_card != NULL) m_card->c64_pa2_w(state); }
125125WRITE_LINE_MEMBER( c64_user_port_device::pc2_w ) { if (m_card != NULL) m_card->c64_pc2_w(state); }
126126WRITE_LINE_MEMBER( c64_user_port_device::atn_w ) { if (m_card != NULL) m_card->c64_atn_w(state); }
127WRITE_LINE_MEMBER( c64_user_port_device::cnt1_w ) { if (m_card != NULL) m_card->c64_cnt1_w(state); }
128WRITE_LINE_MEMBER( c64_user_port_device::sp1_w ) { if (m_card != NULL) m_card->c64_sp1_w(state); }
129WRITE_LINE_MEMBER( c64_user_port_device::cnt2_w ) { if (m_card != NULL) m_card->c64_cnt2_w(state); }
130WRITE_LINE_MEMBER( c64_user_port_device::sp2_w ) { if (m_card != NULL) m_card->c64_sp2_w(state); }
trunk/src/mess/machine/c64_turbo232.c
r21093r21094
3737//  rs232_port_interface rs232_intf
3838//-------------------------------------------------
3939
40static SLOT_INTERFACE_START( rs232_devices )
41   SLOT_INTERFACE("serial_terminal", SERIAL_TERMINAL)
42   SLOT_INTERFACE("null_modem", NULL_MODEM)
43SLOT_INTERFACE_END
44
4540static const rs232_port_interface rs232_intf =
4641{
4742   DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, rxd_w),
r21093r21094
6055   MCFG_MOS6551_ADD(MOS6551_TAG, XTAL_3_6864MHz, DEVWRITELINE(DEVICE_SELF, c64_turbo232_cartridge_device, acia_irq_w))
6156   MCFG_MOS6551_RXD_TXD_CALLBACKS(NULL, DEVWRITELINE(RS232_TAG, rs232_port_device, tx))
6257
63   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, rs232_devices, NULL, NULL)
58   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL, NULL)
6459MACHINE_CONFIG_END
6560
6661
trunk/src/mess/machine/c64user.h
r21093r21094
9090   DECLARE_WRITE_LINE_MEMBER( pa2_w );
9191   DECLARE_WRITE_LINE_MEMBER( pc2_w );
9292   DECLARE_WRITE_LINE_MEMBER( atn_w );
93   DECLARE_WRITE_LINE_MEMBER( cnt1_w );
94   DECLARE_WRITE_LINE_MEMBER( sp1_w );
95   DECLARE_WRITE_LINE_MEMBER( cnt2_w );
96   DECLARE_WRITE_LINE_MEMBER( sp2_w );
9397
9498   // cartridge interface
95   DECLARE_WRITE_LINE_MEMBER( cnt1_w ) { m_out_cnt1_func(state); }
96   DECLARE_WRITE_LINE_MEMBER( sp1_w ) { m_out_sp1_func(state); }
97   DECLARE_WRITE_LINE_MEMBER( cnt2_w ) { m_out_cnt2_func(state); }
98   DECLARE_WRITE_LINE_MEMBER( sp2_w ) { m_out_sp2_func(state); }
99   DECLARE_WRITE_LINE_MEMBER( flag2_w ) { m_out_flag2_func(state); }
99   DECLARE_WRITE_LINE_MEMBER( cia_cnt1_w ) { m_out_cnt1_func(state); }
100   DECLARE_WRITE_LINE_MEMBER( cia_sp1_w ) { m_out_sp1_func(state); }
101   DECLARE_WRITE_LINE_MEMBER( cia_cnt2_w ) { m_out_cnt2_func(state); }
102   DECLARE_WRITE_LINE_MEMBER( cia_sp2_w ) { m_out_sp2_func(state); }
103   DECLARE_WRITE_LINE_MEMBER( cia_flag2_w ) { m_out_flag2_func(state); }
100104   DECLARE_WRITE_LINE_MEMBER( reset_w ) { m_out_reset_func(state); }
101105
102106protected:
trunk/src/mess/machine/c64_swiftlink.c
r21093r21094
3737//  rs232_port_interface rs232_intf
3838//-------------------------------------------------
3939
40static SLOT_INTERFACE_START( rs232_devices )
41   SLOT_INTERFACE("serial_terminal", SERIAL_TERMINAL)
42   SLOT_INTERFACE("null_modem", NULL_MODEM)
43SLOT_INTERFACE_END
44
4540static const rs232_port_interface rs232_intf =
4641{
4742   DEVCB_DEVICE_LINE_MEMBER(MOS6551_TAG, mos6551_device, rxd_w),
r21093r21094
6055   MCFG_MOS6551_ADD(MOS6551_TAG, XTAL_3_6864MHz, DEVWRITELINE(DEVICE_SELF, c64_swiftlink_cartridge_device, acia_irq_w))
6156   MCFG_MOS6551_RXD_TXD_CALLBACKS(NULL, DEVWRITELINE(RS232_TAG, rs232_port_device, tx))
6257
63   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, rs232_devices, NULL, NULL)
58   MCFG_RS232_PORT_ADD(RS232_TAG, rs232_intf, default_rs232_devices, NULL, NULL)
6459MACHINE_CONFIG_END
6560
6661
trunk/src/mess/machine/c64_swiftlink.h
r21093r21094
1616#include "emu.h"
1717#include "machine/c64exp.h"
1818#include "machine/mos6551.h"
19#include "machine/null_modem.h"
2019#include "machine/serial.h"
21#include "machine/terminal.h"
2220
2321
2422
trunk/src/mess/machine/c64_geocable.c
r21093r21094
3232
3333WRITE_LINE_MEMBER( c64_geocable_device::busy_w )
3434{
35   m_slot->flag2_w(state);
35   m_slot->cia_flag2_w(state);
3636}
3737
3838static const centronics_interface centronics_intf =
trunk/src/mess/machine/c64_4tba.c
r21093r21094
2626
2727static INPUT_PORTS_START( c64_4tba )
2828   PORT_START("SP2")
29   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, sp2_w)
29   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_WRITE_LINE_DEVICE_MEMBER(DEVICE_SELF_OWNER, c64_user_port_device, cia_sp2_w)
3030
3131   PORT_START("PB")
3232   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
r21093r21094
106106
107107void c64_4tba_device::c64_cnt1_w(int level)
108108{
109   m_slot->cnt2_w(level);
109   m_slot->cia_cnt2_w(level);
110110}
trunk/src/mess/includes/c64.h
r21093r21094
132132   DECLARE_READ8_MEMBER( cpu_r );
133133   DECLARE_WRITE8_MEMBER( cpu_w );
134134
135   DECLARE_READ8_MEMBER( exp_dma_cd_r );
136   DECLARE_WRITE8_MEMBER( exp_dma_cd_w );
137135   DECLARE_WRITE_LINE_MEMBER( exp_irq_w );
138136   DECLARE_WRITE_LINE_MEMBER( exp_nmi_w );
139137   DECLARE_WRITE_LINE_MEMBER( exp_dma_w );
trunk/src/mess/includes/vic10.h
r21093r21094
103103   DECLARE_WRITE8_MEMBER( cpu_w );
104104
105105   DECLARE_WRITE_LINE_MEMBER( exp_irq_w );
106   DECLARE_WRITE_LINE_MEMBER( exp_reset_w );
106107
107108   // interrupt state
108109   int m_cia_irq;
trunk/src/mess/includes/vic20.h
r21093r21094
2222#include "sound/mos6560.h"
2323
2424#define M6502_TAG       "ue10"
25#define M6522_0_TAG     "uab3"
26#define M6522_1_TAG     "uab1"
25#define M6522_1_TAG     "uab3"
26#define M6522_2_TAG     "uab1"
2727#define M6560_TAG       "ub7"
2828#define M6561_TAG       "ub7"
2929#define IEC_TAG         "iec"
r21093r21094
3636   vic20_state(const machine_config &mconfig, device_type type, const char *tag)
3737      : driver_device(mconfig, type, tag),
3838         m_maincpu(*this, M6502_TAG),
39         m_via0(*this, M6522_0_TAG),
4039         m_via1(*this, M6522_1_TAG),
40         m_via2(*this, M6522_2_TAG),
4141         m_vic(*this, M6560_TAG),
4242         m_iec(*this, CBM_IEC_TAG),
4343         m_joy1(*this, CONTROL1_TAG),
r21093r21094
6262   { }
6363
6464   required_device<m6502_device> m_maincpu;
65   required_device<via6522_device> m_via0;
6665   required_device<via6522_device> m_via1;
66   required_device<via6522_device> m_via2;
6767   required_device<mos6560_device> m_vic;
6868   required_device<cbm_iec_device> m_iec;
6969   required_device<vcs_control_port_device> m_joy1;
r21093r21094
9797   DECLARE_READ8_MEMBER( vic_lighty_cb );
9898   DECLARE_READ8_MEMBER( vic_lightbut_cb );
9999
100   DECLARE_READ8_MEMBER( via0_pa_r );
101   DECLARE_WRITE8_MEMBER( via0_pa_w );
102   DECLARE_READ_LINE_MEMBER( via0_ca1_r );
103
104100   DECLARE_READ8_MEMBER( via1_pa_r );
105   DECLARE_READ8_MEMBER( via1_pb_r );
106   DECLARE_WRITE8_MEMBER( via1_pb_w );
107   DECLARE_WRITE_LINE_MEMBER( via1_ca2_w );
108   DECLARE_WRITE_LINE_MEMBER( via1_cb2_w );
101   DECLARE_WRITE8_MEMBER( via1_pa_w );
102   DECLARE_READ_LINE_MEMBER( via1_ca1_r );
109103
104   DECLARE_READ8_MEMBER( via2_pa_r );
105   DECLARE_READ8_MEMBER( via2_pb_r );
106   DECLARE_WRITE8_MEMBER( via2_pb_w );
107   DECLARE_WRITE_LINE_MEMBER( via2_ca2_w );
108   DECLARE_WRITE_LINE_MEMBER( via2_cb2_w );
109
110110   DECLARE_WRITE_LINE_MEMBER( exp_reset_w );
111111
112112   // keyboard state
trunk/src/mess/includes/plus4.h
r21093r21094
119119
120120   DECLARE_WRITE_LINE_MEMBER( acia_irq_w );
121121
122   DECLARE_READ8_MEMBER( exp_dma_r );
123   DECLARE_WRITE8_MEMBER( exp_dma_w );
124122   DECLARE_WRITE_LINE_MEMBER( exp_irq_w );
125123
126124   enum

Previous 199869 Revisions Next


© 1997-2024 The MAME Team