Previous 15994 Revisions Next

r15900 Tuesday 14th August, 2012 at 21:28:42 UTC by Angelo Salese
Added boundary limits to EMM RAM and made sound board to switch at reset time
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r15899r15900
1717    - dipswitches needs to be controlled;
1818    - below notes states that plain PC-8801 doesn't have a disk CPU, but the BIOS clearly checks the floppy ports. Wrong info?
1919   - clean-ups, banking and video in particular (i.e. hook-ups with memory region should go away and device models should be used instead)
20   - OPNA needs dumping of YM2608 deltat ROM
21   - YMF288 support;
2220
2321    per-game specific TODO:
2422    - 100yen Soft 8 Revival Special: tight loop with vblank bit, but vblank irq takes too much time to execute its code;
r15899r15900
9290   - Explosion (fails to load ADPCM data?)
9391   - F-15 Strike Eagle
9492   - F2 Grand Prix ("Boot dekimasen")
95   (Fancy Promenade)
93   - Fangs - The Saga of Wolf Blood (Crashes at the first random battle)
9694
9795    - Harakiri
9896    - Kaseijin (app) (code snippet is empty at some point)
r15899r15900
324322   struct { UINT8 r, g, b; } m_palram[8];
325323   UINT8 m_dmac_ff;
326324   UINT32 m_knj_addr[2];
325   UINT32 m_extram_size;
326   UINT8 m_has_opna;
327327
328328   DECLARE_READ8_MEMBER(pc8801_alu_r);
329329   DECLARE_WRITE8_MEMBER(pc8801_alu_w);
r15899r15900
375375   DECLARE_WRITE8_MEMBER(pc8801_alu_ctrl1_w);
376376   DECLARE_WRITE8_MEMBER(pc8801_alu_ctrl2_w);
377377   DECLARE_WRITE8_MEMBER(pc8801_pcg8100_w);
378   DECLARE_READ8_MEMBER(sio_status_r);
379378   DECLARE_WRITE8_MEMBER(pc8801_txt_cmt_ctrl_w);
380379   DECLARE_READ8_MEMBER(pc8801_kanji_r);
381380   DECLARE_WRITE8_MEMBER(pc8801_kanji_w);
r15899r15900
401400   DECLARE_WRITE8_MEMBER(pc8801_sound_board_w);
402401   DECLARE_READ8_MEMBER(pc8801_opna_r);
403402   DECLARE_WRITE8_MEMBER(pc8801_opna_w);
403   DECLARE_READ8_MEMBER(pc8801_unk_r);
404   DECLARE_WRITE8_MEMBER(pc8801_unk_w);
404405
405406   UINT8 pc8801_pixel_clock(void);
406407   void pc8801_dynamic_res_change(void);
r15899r15900
899900{
900901   UINT8 *ext_work_ram = memregion("ewram")->base();
901902
902   /* TODO: check max range here */
903   if(offset < m_extram_size)
904      return ext_work_ram[offset];
903905
904   return ext_work_ram[offset];
906   return 0xff;
905907}
906908
907909WRITE8_MEMBER(pc8801_state::pc8801_ext_wram_w)
908910{
909911   UINT8 *ext_work_ram = memregion("ewram")->base();
910912
911   /* TODO: check max range here */
912
913   ext_work_ram[offset] = data;
913   if(offset < m_extram_size)
914      ext_work_ram[offset] = data;
914915}
915916
916917READ8_MEMBER(pc8801_state::pc8801_nbasic_rom_r)
r15899r15900
15411542      printf("Write to PCG-8100 %02x %02x\n",offset,data);
15421543}
15431544
1544/* Balance of Power temp work-around */
1545READ8_MEMBER(pc8801_state::sio_status_r)
1546{
1547   return 0;
1548}
1549
15501545WRITE8_MEMBER(pc8801_state::pc8801_txt_cmt_ctrl_w)
15511546{
15521547   /* bits 2 to 5 are cmt related */
r15899r15900
16591654
16601655READ8_MEMBER(pc8801_state::pc8801_sound_board_r)
16611656{
1662   UINT8 has_opna = machine().root_device().ioport("BOARD_CONFIG")->read() & 1;
1663
1664   if(has_opna)
1657   if(m_has_opna)
16651658      return ym2608_r(machine().device("opna"), offset);
16661659
16671660   return (offset & 2) ? 0xff : ym2203_r(machine().device("opn"), offset);
r15899r15900
16691662
16701663WRITE8_MEMBER(pc8801_state::pc8801_sound_board_w)
16711664{
1672   UINT8 has_opna = machine().root_device().ioport("BOARD_CONFIG")->read() & 1;
1673
1674   if(has_opna)
1665   if(m_has_opna)
16751666      ym2608_w(machine().device("opna"), offset,data);
16761667   else if((offset & 2) == 0)
16771668      ym2203_w(machine().device("opn"), offset,data);
r15899r15900
16791670
16801671READ8_MEMBER(pc8801_state::pc8801_opna_r)
16811672{
1682   UINT8 has_opna = machine().root_device().ioport("BOARD_CONFIG")->read() & 1;
1683
1684   if(has_opna && (offset & 2) == 0)
1673   if(m_has_opna && (offset & 2) == 0)
16851674      return ym2608_r(machine().device("opna"), (offset & 1) | ((offset & 4) >> 1));
16861675
16871676   return 0xff;
r15899r15900
16891678
16901679WRITE8_MEMBER(pc8801_state::pc8801_opna_w)
16911680{
1692   UINT8 has_opna = machine().root_device().ioport("BOARD_CONFIG")->read() & 1;
1693
1694   if(has_opna && (offset & 2) == 0)
1681   if(m_has_opna && (offset & 2) == 0)
16951682      ym2608_w(machine().device("opna"), (offset & 1) | ((offset & 4) >> 1),data);
1696   else if(has_opna && offset == 2)
1683   else if(m_has_opna && offset == 2)
16971684   {
16981685      m_sound_irq_mask = ((data & 0x80) == 0);
16991686
r15899r15900
17121699   }
17131700}
17141701
1702READ8_MEMBER(pc8801_state::pc8801_unk_r)
1703{
1704   printf("Read port 0x33\n");
1705   return 0xff;
1706}
1707
1708WRITE8_MEMBER(pc8801_state::pc8801_unk_w)
1709{
1710   printf("Write port 0x33\n");
1711}
1712
17151713static ADDRESS_MAP_START( pc8801_io, AS_IO, 8, pc8801_state )
17161714   ADDRESS_MAP_GLOBAL_MASK(0xff)
17171715   ADDRESS_MAP_UNMAP_HIGH
r15899r15900
17381736   AM_RANGE(0x30, 0x30) AM_READ_PORT("DSW1") AM_WRITE(pc8801_txt_cmt_ctrl_w)
17391737   AM_RANGE(0x31, 0x31) AM_READ_PORT("DSW2") AM_WRITE(pc8801_gfx_ctrl_w)
17401738   AM_RANGE(0x32, 0x32) AM_READWRITE(pc8801_misc_ctrl_r, pc8801_misc_ctrl_w)
1741   //0x33, 0x33 sets something kanji related
1739   AM_RANGE(0x33, 0x33) AM_READWRITE(pc8801_unk_r,pc8801_unk_w)
17421740   AM_RANGE(0x34, 0x34) AM_WRITE(pc8801_alu_ctrl1_w)
17431741   AM_RANGE(0x35, 0x35) AM_WRITE(pc8801_alu_ctrl2_w)
17441742   AM_RANGE(0x40, 0x40) AM_READWRITE(pc8801_ctrl_r, pc8801_ctrl_w)
r15899r15900
20922090   PORT_DIPNAME( 0x20, 0x20, "Duplex" )
20932091   PORT_DIPSETTING(    0x20, "Half" )
20942092   PORT_DIPSETTING(    0x00, "Full" )
2095/*  PORT_DIPNAME( 0x80, 0x80, "Disable floppy" )
2096    PORT_DIPSETTING(    0x80, DEF_STR( Off ) )
2097    PORT_DIPSETTING(    0x00, DEF_STR( On ) )*/
20982093   PORT_DIPNAME( 0xc0, 0x40, "Basic mode" )
2099   PORT_DIPSETTING(    0x80, "N-BASIC" )
2100   PORT_DIPSETTING(    0xc0, "N88-BASIC (V1)" )
2094   PORT_DIPSETTING(    0x80, "N88-BASIC (V1L)" )
2095   PORT_DIPSETTING(    0xc0, "N88-BASIC (V1H)" )
21012096   PORT_DIPSETTING(    0x40, "N88-BASIC (V2)" )
2097//   PORT_DIPSETTING(    0x00, "N88-BASIC (V2)" )
21022098
21032099   PORT_START("CTRL")
21042100   PORT_DIPNAME( 0x02, 0x02, "Monitor Type" )
r15899r15900
21522148   PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y ) PORT_RESET PORT_REVERSE PORT_SENSITIVITY(5) PORT_KEYDELTA(5) PORT_PLAYER(1) PORT_CONDITION("BOARD_CONFIG", 0x02, EQUALS, 0x02)
21532149
21542150   PORT_START("MEM")
2155   PORT_CONFNAME( 0x1f, 0x00, "Extension memory" )
2151   PORT_CONFNAME( 0x0f, 0x0a, "Extension memory" )
21562152   PORT_CONFSETTING(    0x00, DEF_STR( None ) )
21572153   PORT_CONFSETTING(    0x01, "32KB (PC-8012-02 x 1)" )
21582154   PORT_CONFSETTING(    0x02, "64KB (PC-8012-02 x 2)" )
r15899r15900
21692165   PORT_CONFSETTING(    0x0d, "4.1M (PIO-8234H-2M x 2 + PC-8801-02N x 1)" )
21702166
21712167   PORT_START("BOARD_CONFIG")
2172   PORT_CONFNAME( 0x01, 0x00, "Sound Board" ) /* TODO: is it possible to have BOTH sound chips in there? */
2168   PORT_CONFNAME( 0x01, 0x01, "Sound Board" ) /* TODO: is it possible to have BOTH sound chips in there? */
21732169   PORT_CONFSETTING(    0x00, "OPN (YM2203)" )
21742170   PORT_CONFSETTING(    0x01, "OPNA (YM2608)" )
21752171   PORT_CONFNAME( 0x02, 0x00, "Port 1 Connection" )
r15899r15900
24072403static MACHINE_RESET( pc8801 )
24082404{
24092405   pc8801_state *state = machine.driver_data<pc8801_state>();
2406   #define kB 1024
2407   #define MB 1024*1024
2408   const UINT32 extram_type[] = { 0*kB, 32*kB,64*kB,128*kB,128*kB,256*kB,512*kB,1*MB,2*MB,4*MB,8*MB,1*MB+128*kB,2*MB+128*kB,4*MB+128*kB, 0*kB, 0*kB };
2409   #undef kB
2410   #undef MB
2411
24102412   state->m_ext_rom_bank = 0xff;
24112413   state->m_gfx_ctrl = 0x31;
24122414   state->m_window_offset_bank = 0x80;
r15899r15900
24802482   state->m_has_dictionary = 0;
24812483   state->m_has_cdrom = 0;
24822484
2485   state->m_extram_size = extram_type[machine.root_device().ioport("MEM")->read() & 0x0f];
2486   state->m_has_opna = machine.root_device().ioport("BOARD_CONFIG")->read() & 1;
24832487}
24842488
24852489static MACHINE_RESET( pc8801_clock_speed )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team