Previous 199869 Revisions Next

r19637 Tuesday 18th December, 2012 at 00:40:17 UTC by Angelo Salese
Preliminary slot interface for PC-9801, added support for PC-9801-26 sound board as an example
[src/mess]mess.mak
[src/mess/drivers]pc9801.c
[src/mess/machine]pc9801_26.c* pc9801_26.h* pc9801_slot.c* pc9801_slot.h*

trunk/src/mess/drivers/pc9801.c
r19636r19637
5454    - Beast (keeps reading command sense)
5555    - Beast 2
5656    - Bells Avenue (disk swap?)
57   - Bible Master 2 (at new game loading)
58   - Birdy World
5759
5860    - Bokosuka Wars
5961    - Dokkin Minako Sensei (2dd image)
r19636r19637
8284    - Bakasuka Wars: drawing seems busted (either mouse or upd7220)
8385    - Band-Kun: (how to run this without installing?)
8486    - Battle Chess: wants some dip-switches to be on in DSW4, too slow during IA thinking?
87   - Bishoujo Audition: Moans with a "(program) ended. remove the floppy disk and turn off the poewr."
88   - Bishoujo Hunter ZX: Doesn't color cycle at intro (seems stuck?), doesn't clear text selection at new game screen;
89   - Bishoujo Shanshinkan: has white rectangles all over the place;
8590
8691    - Dragon Buster: slight issue with window masking;
8792    - Far Side Moon: doesn't detect sound board (tied to 0x00ec ports)
r19636r19637
318323#include "machine/i8251.h"
319324#include "sound/beep.h"
320325#include "sound/speaker.h"
321#include "sound/2203intf.h"
322326#include "sound/2608intf.h"
323327#include "video/upd7220.h"
324328#include "machine/ram.h"
325329#include "formats/pc98fdi_dsk.h"
330#include "machine/pc9801_26.h"
331#include "machine/pc9801_slot.h"
326332
333
327334#define UPD1990A_TAG "upd1990a"
328335#define UPD8251_TAG  "upd8251"
329336
r19636r19637
340347      m_sio(*this, UPD8251_TAG),
341348      m_hgdc1(*this, "upd7220_chr"),
342349      m_hgdc2(*this, "upd7220_btm"),
343      m_opn(*this, "opn"),
350//      m_opn(*this, "opn"),
344351//      m_opna(*this, "opna"),
345352      m_video_ram_1(*this, "video_ram_1"),
346353      m_video_ram_2(*this, "video_ram_2"){ }
r19636r19637
353360   required_device<i8251_device> m_sio;
354361   required_device<upd7220_device> m_hgdc1;
355362   required_device<upd7220_device> m_hgdc2;
356   required_device<ym2203_device> m_opn;
363//   required_device<ym2203_device> m_opn;
357364//  optional_device<ym2608_device> m_opna;
358365
359366   required_shared_ptr<UINT8> m_video_ram_1;
r19636r19637
412419      UINT8 mode;
413420      UINT8 tile[4], tile_index;
414421   }m_grcg;
415   UINT8 m_has_opna;
416422
417423   /* PC9821 specific */
418424   UINT8 m_sdip[24], m_sdip_bank;
r19636r19637
15911597}
15921598
15931599
1594READ8_MEMBER(pc9801_state::pc9801_opn_r)
1595{
1596   if((offset & 1) == 0)
1597   {
1598      //if(m_has_opna)
1599      //  return ym2608_r(m_opna, space, offset >> 1);
1600
1601      return offset & 4 ? 0xff : ym2203_r(m_opn,space, offset >> 1);
1602   }
1603   else // odd
1604   {
1605      printf("Read to undefined port [%02x]\n",offset+0x188);
1606      return 0xff;
1607   }
1608}
1609
1610WRITE8_MEMBER(pc9801_state::pc9801_opn_w)
1611{
1612   if((offset & 1) == 0)
1613   {
1614      /*if(m_has_opna)
1615            ym2608_w(m_opna,space, offset >> 1,data);
1616        else */
1617      if((offset & 4) == 0)
1618         ym2203_w(m_opn,space, offset >> 1,data);
1619   }
1620   else // odd
1621   {
1622      printf("Write to undefined port [%02x] %02x\n",offset+0x188,data);
1623   }
1624}
1625
16261600READ8_MEMBER(pc9801_state::pc9801_mouse_r)
16271601{
16281602   if((offset & 1) == 0)
r19636r19637
16581632
16591633/* first device is even offsets, second one is odd offsets */
16601634static ADDRESS_MAP_START( pc9801_io, AS_IO, 16, pc9801_state )
1635   ADDRESS_MAP_UNMAP_HIGH
16611636   AM_RANGE(0x0000, 0x001f) AM_READWRITE8(pc9801_00_r,pc9801_00_w,0xffff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA
16621637   AM_RANGE(0x0020, 0x0027) AM_READWRITE8(pc9801_20_r,pc9801_20_w,0xffff) // RTC / DMA registers (LS244)
16631638   AM_RANGE(0x0030, 0x0037) AM_READWRITE8(pc9801_30_r,pc9801_30_w,0xffff) //i8251 RS232c / i8255 system port
r19636r19637
16721647   AM_RANGE(0x0090, 0x0097) AM_READWRITE8(pc9801_fdc_2hd_r,pc9801_fdc_2hd_w,0xffff) //upd765a 2hd / cmt
16731648   AM_RANGE(0x00a0, 0x00af) AM_READWRITE8(pc9801_a0_r,pc9801_a0_w,0xffff) //upd7220 bitmap ports / display registers
16741649   AM_RANGE(0x00c8, 0x00cd) AM_READWRITE8(pc9801_fdc_2dd_r,pc9801_fdc_2dd_w,0xffff) //upd765a 2dd / <undefined>
1675   AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,pc9801_opn_w,0xffff) //ym2203 opn / <undefined>
1650//   AM_RANGE(0x0188, 0x018b) AM_READWRITE8(pc9801_opn_r,pc9801_opn_w,0xffff) //ym2203 opn / <undefined>
16761651   AM_RANGE(0x7fd8, 0x7fdf) AM_READWRITE8(pc9801_mouse_r,pc9801_mouse_w,0xffff) // <undefined> / mouse ppi8255 ports
16771652ADDRESS_MAP_END
16781653
r19636r19637
20972072ADDRESS_MAP_END
20982073
20992074static ADDRESS_MAP_START( pc9801rs_io, AS_IO, 32, pc9801_state )
2075   ADDRESS_MAP_UNMAP_HIGH
21002076   AM_RANGE(0x0000, 0x001f) AM_READWRITE8(pc9801_00_r,        pc9801_00_w,        0xffffffff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA
21012077   AM_RANGE(0x0020, 0x0027) AM_READWRITE8(pc9801_20_r,        pc9801_20_w,        0xffffffff) // RTC / DMA registers (LS244)
21022078   AM_RANGE(0x0030, 0x0037) AM_READWRITE8(pc9801rs_30_r,      pc9801_30_w,        0xffffffff) //i8251 RS232c / i8255 system port
r19636r19637
21142090   AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r,     pc9801rs_2hd_w,     0xffffffff)
21152091//  AM_RANGE(0x00ec, 0x00ef) PC-9801-86 sound board
21162092   AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r,      pc9801rs_f0_w,      0xffffffff)
2117   AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffffffff) //ym2203 opn / <undefined>
2093//   AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffffffff) //ym2203 opn / <undefined>
21182094   AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffffffff)
21192095   AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w,    0xffffffff) //ROM/RAM bank
21202096   AM_RANGE(0x7fd8, 0x7fdf) AM_READWRITE8(pc9801_mouse_r,     pc9801_mouse_w,     0xffffffff) // <undefined> / mouse ppi8255 ports
r19636r19637
21622138ADDRESS_MAP_END
21632139
21642140static ADDRESS_MAP_START( pc9801ux_io, AS_IO, 16, pc9801_state )
2141   ADDRESS_MAP_UNMAP_HIGH
21652142   AM_RANGE(0x0000, 0x001f) AM_READWRITE8(pc9801_00_r,        pc9801_00_w,        0xffff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA
21662143   AM_RANGE(0x0020, 0x0027) AM_READWRITE8(pc9801_20_r,        pc9801_20_w,        0xffff) // RTC / DMA registers (LS244)
21672144   AM_RANGE(0x0030, 0x0037) AM_READWRITE8(pc9801rs_30_r,      pc9801_30_w,        0xffff) //i8251 RS232c / i8255 system port
r19636r19637
21762153   AM_RANGE(0x00bc, 0x00bf) AM_READWRITE8(pc9810rs_fdc_ctrl_r,pc9810rs_fdc_ctrl_w,0xffff)
21772154   AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r,     pc9801rs_2hd_w,     0xffff)
21782155   AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r,      pc9801rs_f0_w,      0xffff)
2179   AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffff) //ym2203 opn / <undefined>
2156//   AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffff) //ym2203 opn / <undefined>
21802157   AM_RANGE(0x0438, 0x043b) AM_READWRITE8(pc9801rs_access_ctrl_r,pc9801rs_access_ctrl_w,0xffff)
21812158   AM_RANGE(0x043c, 0x043f) AM_WRITE8(pc9801rs_bank_w,    0xffff) //ROM/RAM bank
21822159   AM_RANGE(0x7fd8, 0x7fdf) AM_READWRITE8(pc9801_mouse_r,     pc9801_mouse_w,     0xffff) // <undefined> / mouse ppi8255 ports
r19636r19637
24622439ADDRESS_MAP_END
24632440
24642441static ADDRESS_MAP_START( pc9821_io, AS_IO, 32, pc9801_state )
2442   ADDRESS_MAP_UNMAP_HIGH
24652443   AM_RANGE(0x0000, 0x001f) AM_READWRITE8(pc9801_00_r,        pc9801_00_w,        0xffffffff) // i8259 PIC (bit 3 ON slave / master) / i8237 DMA
24662444   AM_RANGE(0x0020, 0x0027) AM_READWRITE8(pc9801_20_r,        pc9801_20_w,        0xffffffff) // RTC / DMA registers (LS244)
24672445   AM_RANGE(0x0030, 0x0037) AM_READWRITE8(pc9801rs_30_r,      pc9801_30_w,        0xffffffff) //i8251 RS232c / i8255 system port
r19636r19637
24822460   AM_RANGE(0x00c8, 0x00cf) AM_READWRITE8(pc9801rs_2hd_r,     pc9801rs_2hd_w,     0xffffffff)
24832461//  AM_RANGE(0x00d8, 0x00df) AMD98 (sound?) board
24842462   AM_RANGE(0x00f0, 0x00ff) AM_READWRITE8(pc9801rs_f0_r,      pc9801rs_f0_w,      0xffffffff)
2485   AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffffffff) //ym2203 opn / <undefined>
2463//   AM_RANGE(0x0188, 0x018f) AM_READWRITE8(pc9801_opn_r,       pc9801_opn_w,       0xffffffff) //ym2203 opn / <undefined>
24862464//  AM_RANGE(0x018c, 0x018f) YM2203 OPN extended ports / <undefined>
24872465//  AM_RANGE(0x0430, 0x0430) IDE bank register
24882466//  AM_RANGE(0x0432, 0x0432) IDE bank register (mirror)
r19636r19637
28662844   PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
28672845   PORT_DIPSETTING(    0x00, DEF_STR( On ) )
28682846
2869   PORT_START("OPN_PA1")
2870   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1)
2871   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1)
2872   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1)
2873   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1)
2874   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1")
2875   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2")
2876   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
2877
2878   PORT_START("OPN_PA2")
2879   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2)
2880   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2)
2881   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2)
2882   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2)
2883   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1")
2884   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2")
2885   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
2886
28872847   PORT_START("MOUSE_X")
28882848   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X ) PORT_RESET PORT_SENSITIVITY(30) PORT_KEYDELTA(30)
28892849
r19636r19637
33383298   SLOT_INTERFACE( "525hd", FLOPPY_525_HD )
33393299SLOT_INTERFACE_END
33403300
3301static SLOT_INTERFACE_START( pc9801_sound )
3302//   PC-9801-14
3303   SLOT_INTERFACE( "pc9801_26", PC9801_26 )
3304//   PC-9801-86
3305//   PC-9801-26 + PC-9801-86 (?)
3306//   PC-9801-86 + Chibi-Oto
3307//   PC-9801-118
3308//   Speak Board
3309//   Spark Board
3310//   AMD-98 (AmuseMent boarD)
3311SLOT_INTERFACE_END
3312
3313//   Jast Sound, could be put independently
3314
33413315void pc9801_state::fdc_2hd_irq(bool state)
33423316{
33433317//  printf("IRQ 2HD %d\n",state);
r19636r19637
35933567//      pic8259_ir2_w(machine().device("pic8259_master"), 0);
35943568}
35953569
3596static void pc9801_sound_irq( device_t *device, int irq )
3597{
3598//  pc9801_state *state = device->machine().driver_data<pc9801_state>();
3599
3600   /* TODO: seems to die very often */
3601   pic8259_ir4_w(device->machine().device("pic8259_slave"), irq);
3602}
3603
3604READ8_MEMBER(pc9801_state::opn_porta_r)
3605{
3606   if(m_joy_sel == 0x80)
3607      return machine().root_device().ioport("OPN_PA1")->read();
3608
3609   if(m_joy_sel == 0xc0)
3610      return machine().root_device().ioport("OPN_PA2")->read();
3611
3612//  0x81?
3613//  printf("%02x\n",m_joy_sel);
3614   return 0xff;
3615}
3616
3617WRITE8_MEMBER(pc9801_state::opn_portb_w){ m_joy_sel = data; }
3618
3619
3620static const ym2203_interface pc98_ym2203_intf =
3621{
3622   {
3623      AY8910_LEGACY_OUTPUT,
3624      AY8910_DEFAULT_LOADS,
3625      DEVCB_DRIVER_MEMBER(pc9801_state,opn_porta_r),
3626      DEVCB_NULL,//(pc9801_state,opn_portb_r),
3627      DEVCB_NULL,//(pc9801_state,opn_porta_w),
3628      DEVCB_DRIVER_MEMBER(pc9801_state,opn_portb_w),
3629   },
3630   DEVCB_LINE(pc9801_sound_irq)
3631};
3632
36333570#if 0
36343571static const ym2608_interface pc98_ym2608_intf =
36353572{
r19636r19637
37023639
37033640   MCFG_SOFTWARE_LIST_ADD("disk_list","pc98")
37043641
3642   MCFG_PC9801BUS_SLOT_ADD("sound_bus", pc9801_sound, NULL, NULL)
3643
37053644   #if 0
37063645   MCFG_RAM_ADD(RAM_TAG)
37073646   MCFG_RAM_DEFAULT_SIZE("128K")
r19636r19637
37253664
37263665   MCFG_SPEAKER_STANDARD_MONO("mono")
37273666
3728   MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider
3729   MCFG_SOUND_CONFIG(pc98_ym2203_intf)
3730   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
3731
37323667   MCFG_SOUND_ADD(BEEPER_TAG, BEEP, 0)
37333668   MCFG_SOUND_ROUTE(ALL_OUTPUTS,"mono",0.15)
37343669MACHINE_CONFIG_END
r19636r19637
37673702   MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats)
37683703   MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats)
37693704
3705   MCFG_PC9801BUS_SLOT_ADD("sound_bus", pc9801_sound, NULL, NULL)
3706
37703707   MCFG_RAM_ADD(RAM_TAG)
37713708   MCFG_RAM_DEFAULT_SIZE("1664K")
37723709   MCFG_RAM_EXTRA_OPTIONS("640K,3712K,7808K")
r19636r19637
37873724
37883725   MCFG_SPEAKER_STANDARD_MONO("mono")
37893726
3790   MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider
3791   MCFG_SOUND_CONFIG(pc98_ym2203_intf)
3792   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
3793
37943727//  MCFG_SOUND_ADD("opna", YM2608, MAIN_CLOCK_X1*4) // unknown clock / divider
37953728//  MCFG_SOUND_CONFIG(pc98_ym2608_intf)
37963729//  MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
r19636r19637
38343767   MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:0", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats)
38353768   MCFG_FLOPPY_DRIVE_ADD("upd765_2hd:1", pc9801_floppies, "525hd", 0, pc9801_state::floppy_formats)
38363769
3770   MCFG_PC9801BUS_SLOT_ADD("sound_bus", pc9801_sound, NULL, NULL)
3771
38373772   MCFG_RAM_ADD(RAM_TAG)
38383773   MCFG_RAM_DEFAULT_SIZE("1664K")
38393774   MCFG_RAM_EXTRA_OPTIONS("3712K,7808K")
r19636r19637
38543789
38553790   MCFG_SPEAKER_STANDARD_MONO("mono")
38563791
3857   MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider
3858   MCFG_SOUND_CONFIG(pc98_ym2203_intf)
3859   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
3860
38613792//  MCFG_SOUND_ADD("opna", YM2608, MAIN_CLOCK_X1*4) // unknown clock / divider
38623793//  MCFG_SOUND_CONFIG(pc98_ym2608_intf)
38633794//  MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
trunk/src/mess/mess.mak
r19636r19637
350350   $(MESSOBJ)/palm.a \
351351   $(MESSOBJ)/parker.a \
352352   $(MESSOBJ)/pc.a \
353   $(MESSOBJ)/pc9801.a \
353354   $(MESSOBJ)/pcshare.a \
354355   $(MESSOBJ)/pdp1.a \
355356   $(MESSOBJ)/pel.a \
r19636r19637
14581459$(MESSOBJ)/pitronic.a:         \
14591460   $(MESS_DRIVERS)/beta.o      \
14601461
1461$(MESSOBJ)/pc.a:            \
1462$(MESSOBJ)/pc.a:         \
14621463   $(MESS_VIDEO)/pc_aga.o      \
14631464   $(MESS_MACHINE)/tandy1t.o   \
14641465   $(MESS_MACHINE)/europc.o   \
r19636r19637
14691470   $(MESS_DRIVERS)/ibmpc.o      \
14701471   $(MESS_VIDEO)/pc_t1t.o      \
14711472
1473$(MESSOBJ)/pc9801.a:         \
1474   $(MESS_MACHINE)/pc9801_26.o   \
1475   $(MESS_MACHINE)/pc9801_slot.o   \
1476
14721477$(MESSOBJ)/pcshare.a:         \
14731478   $(MESS_MACHINE)/pc_turbo.o   \
14741479   $(MESS_MACHINE)/pc_fdc.o   \
trunk/src/mess/machine/pc9801_slot.c
r0r19637
1/**********************************************************************
2
3   Slot interface for PC-98xx family
4
5**********************************************************************/
6
7#include "pc9801_slot.h"
8
9
10
11//**************************************************************************
12//  GLOBAL VARIABLES
13//**************************************************************************
14
15const device_type PC9801BUS_SLOT = &device_creator<pc9801_slot_device>;
16
17
18
19//**************************************************************************
20//  DEVICE PC9801 CARD INTERFACE
21//**************************************************************************
22
23#if 0
24//-------------------------------------------------
25//  device_abc1600bus_card_interface - constructor
26//-------------------------------------------------
27
28device_pc9801bus_card_interface::device_pc9801bus_card_interface(const machine_config &mconfig, device_t &device)
29   : device_slot_card_interface(mconfig, device)
30{
31}
32
33
34//-------------------------------------------------
35//  ~device_abc1600bus_card_interface - destructor
36//-------------------------------------------------
37
38device_pc9801bus_card_interface::~device_pc9801bus_card_interface()
39{
40}
41#endif
42
43
44//**************************************************************************
45//  LIVE DEVICE
46//**************************************************************************
47
48//-------------------------------------------------
49//  pc9801_slot_device - constructor
50//-------------------------------------------------
51
52pc9801_slot_device::pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
53        device_t(mconfig, PC9801BUS_SLOT, "PC-9801 sound bus slot", tag, owner, clock),
54      device_slot_interface(mconfig, *this)
55{
56}
57
58
59//-------------------------------------------------
60//  device_config_complete - perform any
61//  operations now that the configuration is
62//  complete
63//-------------------------------------------------
64
65void pc9801_slot_device::device_config_complete()
66{
67   // ...
68}
69
70
71//-------------------------------------------------
72//  device_start - device-specific startup
73//-------------------------------------------------
74
75void pc9801_slot_device::device_start()
76{
77//   m_card = dynamic_cast<device_pc9801_slot_card_interface *>(get_card_device());
78}
79
80
81
trunk/src/mess/machine/pc9801_slot.h
r0r19637
1/**********************************************************************
2
3
4**********************************************************************/
5
6#pragma once
7
8#ifndef __PC9801_SLOTBUS__
9#define __PC9801_SLOTBUS__
10
11#include "emu.h"
12
13
14//**************************************************************************
15//  CONSTANTS
16//**************************************************************************
17
18
19
20//**************************************************************************
21//  INTERFACE CONFIGURATION MACROS
22//**************************************************************************
23
24
25#define MCFG_PC9801BUS_SLOT_ADD(_tag, _slot_intf, _def_slot, _def_inp) \
26    MCFG_DEVICE_ADD(_tag, PC9801BUS_SLOT, 0) \
27   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
28
29
30
31//**************************************************************************
32//  TYPE DEFINITIONS
33//**************************************************************************
34
35
36
37
38//class pc9801_slot_device;
39
40#if 0
41class device_pc9801_slot_card_interface : public device_slot_card_interface
42{
43   friend class pc9801_slot_device;
44
45public:
46   // construction/destruction
47   device_pc9801_slot_card_interface(const machine_config &mconfig, device_t &device);
48   virtual ~device_pc9801_card_interface();
49};
50#endif
51
52// ======================> pc9801_slot_device
53
54class pc9801_slot_device : public device_t,
55                        public device_slot_interface
56{
57public:
58   // construction/destruction
59   pc9801_slot_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
60
61   // device-level overrides
62   virtual void device_start();
63   virtual void device_config_complete();
64//private:
65//   device_pc9801_slot_card_interface *m_card;
66
67};
68
69
70// device type definition
71extern const device_type PC9801BUS_SLOT;
72
73
74
75#endif
trunk/src/mess/machine/pc9801_26.c
r0r19637
1/***************************************************************************
2
3   NEC PC-9801-26 sound card
4
5   The legacy sound card, composed by a single YM2203
6
7***************************************************************************/
8
9#include "emu.h"
10#include "machine/pc9801_26.h"
11#include "machine/pic8259.h"
12#include "sound/2203intf.h"
13
14#define MAIN_CLOCK_X1 XTAL_1_9968MHz
15
16//**************************************************************************
17//  GLOBAL VARIABLES
18//**************************************************************************
19
20// device type definition
21const device_type PC9801_26 = &device_creator<pc9801_26_device>;
22
23
24READ8_MEMBER(pc9801_26_device::opn_porta_r)
25{
26   if(m_joy_sel == 0x80)
27      return ioport("OPN_PA1")->read();
28
29   if(m_joy_sel == 0xc0)
30      return ioport("OPN_PA2")->read();
31
32//  0x81?
33//  printf("%02x\n",m_joy_sel);
34   return 0xff;
35}
36
37WRITE8_MEMBER(pc9801_26_device::opn_portb_w){ m_joy_sel = data; }
38
39static void pc9801_sound_irq( device_t *device, int irq )
40{
41//  pc9801_state *state = device->machine().driver_data<pc9801_state>();
42
43   /* TODO: seems to die very often */
44   pic8259_ir4_w(device->machine().device("pic8259_slave"), irq);
45}
46
47static const ym2203_interface pc98_ym2203_intf =
48{
49   {
50      AY8910_LEGACY_OUTPUT,
51      AY8910_DEFAULT_LOADS,
52      DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, pc9801_26_device,opn_porta_r),
53      DEVCB_NULL,//(pc9801_state,opn_portb_r),
54      DEVCB_NULL,//(pc9801_state,opn_porta_w),
55      DEVCB_DEVICE_MEMBER(DEVICE_SELF_OWNER, pc9801_26_device,opn_portb_w),
56   },
57   DEVCB_LINE(pc9801_sound_irq)
58};
59
60static MACHINE_CONFIG_FRAGMENT( pc9801_26_config )
61   MCFG_SPEAKER_STANDARD_MONO("mono")
62   MCFG_SOUND_ADD("opn", YM2203, MAIN_CLOCK_X1*2) // unknown clock / divider
63   MCFG_SOUND_CONFIG(pc98_ym2203_intf)
64   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
65MACHINE_CONFIG_END
66
67//-------------------------------------------------
68//  machine_config_additions - device-specific
69//  machine configurations
70//-------------------------------------------------
71
72machine_config_constructor pc9801_26_device::device_mconfig_additions() const
73{
74   return MACHINE_CONFIG_NAME( pc9801_26_config );
75}
76
77
78//-------------------------------------------------
79//  input_ports - device-specific input ports
80//-------------------------------------------------
81
82static INPUT_PORTS_START( pc9801_26 )
83   PORT_START("OPN_PA1")
84   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Up")
85   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Down")
86   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Left")
87   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(1) PORT_NAME("P1 Joystick Right")
88   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 1")
89   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Joystick Button 2")
90   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
91
92   PORT_START("OPN_PA2")
93   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Up")
94   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Down")
95   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Left")
96   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_8WAY PORT_PLAYER(2) PORT_NAME("P2 Joystick Right")
97   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 1")
98   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P2 Joystick Button 2")
99   PORT_BIT( 0xc0, IP_ACTIVE_LOW, IPT_UNUSED )
100INPUT_PORTS_END
101
102ioport_constructor pc9801_26_device::device_input_ports() const
103{
104   return INPUT_PORTS_NAME( pc9801_26 );
105}
106
107//**************************************************************************
108//  LIVE DEVICE
109//**************************************************************************
110
111//-------------------------------------------------
112//  pc9801_26_device - constructor
113//-------------------------------------------------
114
115pc9801_26_device::pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
116   : device_t(mconfig, PC9801_26, "pc9801_26", tag, owner, clock),
117//      m_maincpu(*owner, "maincpu"),
118      m_opn(*this, "opn")
119{
120
121}
122
123
124//-------------------------------------------------
125//  device_validity_check - perform validity checks
126//  on this device
127//-------------------------------------------------
128
129void pc9801_26_device::device_validity_check(validity_checker &valid) const
130{
131}
132
133//-------------------------------------------------
134//  device_start - device-specific startup
135//-------------------------------------------------
136
137void pc9801_26_device::install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler)
138{
139   int buswidth = machine().firstcpu->space_config(AS_IO)->m_databus_width;
140   switch(buswidth)
141   {
142      case 8:
143         machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0);
144         break;
145      case 16:
146         machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffff);
147         break;
148      case 32:
149         machine().firstcpu->space(AS_IO).install_readwrite_handler(start, end, mask, mirror, rhandler, whandler, 0xffffffff);
150         break;
151      default:
152         fatalerror("IBM5160_MOTHERBOARD: Bus width %d not supported\n", buswidth);
153         break;
154   }
155}
156
157
158void pc9801_26_device::device_start()
159{
160   install_device(0x0188, 0x018b, 0, 0, read8_delegate(FUNC(pc9801_26_device::pc9801_26_r), this), write8_delegate(FUNC(pc9801_26_device::pc9801_26_w), this) );
161}
162
163
164//-------------------------------------------------
165//  device_reset - device-specific reset
166//-------------------------------------------------
167
168void pc9801_26_device::device_reset()
169{
170}
171
172
173//**************************************************************************
174//  READ/WRITE HANDLERS
175//**************************************************************************
176
177
178READ8_MEMBER(pc9801_26_device::pc9801_26_r)
179{
180   if((offset & 1) == 0)
181   {
182      //if(m_has_opna)
183      //  return ym2608_r(m_opna, space, offset >> 1);
184
185      return offset & 4 ? 0xff : ym2203_r(m_opn,space, offset >> 1);
186   }
187   else // odd
188   {
189      printf("Read to undefined port [%02x]\n",offset+0x188);
190      return 0xff;
191   }
192}
193
194
195WRITE8_MEMBER(pc9801_26_device::pc9801_26_w)
196{
197   if((offset & 1) == 0)
198   {
199      /*if(m_has_opna)
200            ym2608_w(m_opna,space, offset >> 1,data);
201        else */
202      if((offset & 4) == 0)
203         ym2203_w(m_opn,space, offset >> 1,data);
204   }
205   else // odd
206   {
207      printf("PC9801-26: Write to undefined port [%02x] %02x\n",offset+0x188,data);
208   }
209}
No newline at end of file
trunk/src/mess/machine/pc9801_26.h
r0r19637
1/***************************************************************************
2
3Template for skeleton device
4
5***************************************************************************/
6
7
8#pragma once
9
10#ifndef __PC9801_26DEV_H__
11#define __PC9801_26DEV_H__
12
13#include "machine/pic8259.h"
14#include "sound/2203intf.h"
15
16#define MCFG_PC9801_26_SLOT_ADD(_tag, _slot_intf, _def_slot, _def_inp) \
17    MCFG_DEVICE_ADD(_tag, PC9801_26, 0) \
18   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, _def_inp, false)
19
20
21//**************************************************************************
22//  TYPE DEFINITIONS
23//**************************************************************************
24
25// ======================> pc9801_26_device
26
27class pc9801_26_device : public device_t
28{
29public:
30   // construction/destruction
31   pc9801_26_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
32
33   // optional information overrides
34   virtual machine_config_constructor device_mconfig_additions() const;
35   virtual ioport_constructor device_input_ports() const;
36
37   DECLARE_READ8_MEMBER(opn_porta_r);
38   DECLARE_WRITE8_MEMBER(opn_portb_w);
39   DECLARE_READ8_MEMBER(pc9801_26_r);
40   DECLARE_WRITE8_MEMBER(pc9801_26_w);
41
42//   required_device<cpu_device>  m_maincpu;
43   required_device<ym2203_device>  m_opn;
44protected:
45   // device-level overrides
46   virtual void device_validity_check(validity_checker &valid) const;
47   virtual void device_start();
48   virtual void device_reset();
49   virtual void device_config_complete() { m_shortname = "pc9801_26"; }
50   void install_device(offs_t start, offs_t end, offs_t mask, offs_t mirror, read8_delegate rhandler, write8_delegate whandler);
51
52private:
53   UINT8 m_joy_sel;
54
55};
56
57
58// device type definition
59extern const device_type PC9801_26;
60
61
62
63//**************************************************************************
64//  GLOBAL VARIABLES
65//**************************************************************************
66
67
68
69#endif

Previous 199869 Revisions Next


© 1997-2024 The MAME Team