Previous 199869 Revisions Next

r19232 Friday 30th November, 2012 at 16:53:35 UTC by Angelo Salese
Made various changes for PC-9821, now it boots into BASIC like the other systems
[src/mess/drivers]pc9801.c

trunk/src/mess/drivers/pc9801.c
r19231r19232
420420   DECLARE_WRITE8_MEMBER(sdip_b_w);
421421
422422   DECLARE_READ8_MEMBER(pc9821_ide_r);
423   DECLARE_READ8_MEMBER(pc9821_unkrom_r);
423424   DECLARE_READ8_MEMBER(pc9821_ideram_r);
424425   DECLARE_WRITE8_MEMBER(pc9821_ideram_w);
425426   DECLARE_READ8_MEMBER(pc9821_ext_gvram_r);
r19231r19232
446447   DECLARE_MACHINE_RESET(pc9801);
447448   DECLARE_MACHINE_RESET(pc9801f);
448449   DECLARE_MACHINE_RESET(pc9801rs);
450   DECLARE_MACHINE_RESET(pc9821);
449451
450452   DECLARE_PALETTE_INIT(pc9801);
451453   INTERRUPT_GEN_MEMBER(pc9801_vrtc_irq);
r19231r19232
13551357   return ROM[(offset & 0x1ffff)+(m_rom_bank*0x20000)];
13561358}
13571359
1360/* TODO: it's possible that the offset calculation is actually linear. */
1361/* TODO: having this non-linear makes the system to boot in BASIC for PC-9821. Perhaps it stores settings? How to change these? */
13581362READ8_MEMBER(pc9801_state::pc9801rs_knjram_r)
13591363{
1360   UINT8 *KNJRAM = memregion("kanji")->base();
1364   UINT8 *pcg = memregion("pcg")->base();
13611365
1362   return KNJRAM[offset];
1366   return pcg[((m_font_addr & 0x7f7f) << 4) | m_font_lr | ((offset >> 1) & 0x0f)];
13631367}
13641368
13651369WRITE8_MEMBER(pc9801_state::pc9801rs_knjram_w)
13661370{
1367   UINT8 *KNJRAM = memregion("kanji")->base();
1371   UINT8 *pcg = memregion("pcg")->base();
13681372
1369   KNJRAM[offset] = data;
1373   pcg[((m_font_addr & 0x7f7f) << 4) | m_font_lr | ((offset >> 1) & 0x0f)] = data;
13701374}
13711375
13721376/* FF-based */
r19231r19232
17701774   m_ext_gvram[offset] = data;
17711775}
17721776
1777READ8_MEMBER(pc9801_state::pc9821_unkrom_r)
1778{
1779   UINT8 *UNKROM = memregion("unkrom")->base();
17731780
1781   return UNKROM[offset];
1782}
1783
17741784READ8_MEMBER(pc9801_state::pc9821_memory_r)
17751785{
17761786   if(m_gate_a20 == 0)
r19231r19232
17841794   else if(offset >= 0x000a0000 && offset <= 0x000a3fff)                   { return pc9801_tvram_r(space,offset-0xa0000);        }
17851795   else if(offset >= 0x000a4000 && offset <= 0x000a4fff)                   { return pc9801rs_knjram_r(space,offset & 0xfff);     }
17861796   else if(offset >= 0x000a8000 && offset <= 0x000bffff)                   { return pc9801_gvram_r(space,offset-0xa8000);        }
1797   else if(offset >= 0x000cc000 && offset <= 0x000cffff)               { return pc9821_unkrom_r(space,offset & 0x3fff);      }
17871798   else if(offset >= 0x000d8000 && offset <= 0x000d9fff)               { return pc9821_ide_r(space,offset & 0x1fff);         }
17881799   else if(offset >= 0x000da000 && offset <= 0x000dbfff)               { return pc9821_ideram_r(space,offset & 0x1fff);      }
17891800   else if(offset >= 0x000e0000 && offset <= 0x000e7fff)                   { return pc9821_vram256_r(space,offset & 0x1ffff);    }
r19231r19232
17921803   else if(offset >= 0x00f00000 && offset <= 0x00f9ffff)               { return pc9821_ext_gvram_r(space,offset-0x00f00000); }
17931804   else if(offset >= 0xfffe0000 && offset <= 0xffffffff)                   { return pc9801rs_ipl_r(space,offset & 0x1ffff);      }
17941805
1795   //printf("%08x\n",offset);
1806   printf("%08x\n",offset);
17961807   return 0x00;
17971808}
17981809
r19231r19232
18101821   else if(offset >= 0x000a0000 && offset <= 0x000a3fff)                   { pc9801_tvram_w(space,offset-0xa0000,data);           }
18111822   else if(offset >= 0x000a4000 && offset <= 0x000a4fff)                   { pc9801rs_knjram_w(space,offset & 0xfff,data);        }
18121823   else if(offset >= 0x000a8000 && offset <= 0x000bffff)                   { pc9801_gvram_w(space,offset-0xa8000,data);           }
1824   else if(offset >= 0x000cc000 && offset <= 0x000cffff)               { /* TODO: shadow ROM */                               }
1825   else if(offset >= 0x000d8000 && offset <= 0x000d9fff)               { /* TODO: shadow ROM */                               }
18131826   else if(offset >= 0x000da000 && offset <= 0x000dbfff)               { pc9821_ideram_w(space,offset & 0x1fff,data);         }
18141827   else if(offset >= 0x000e0000 && offset <= 0x000e7fff)                   { pc9821_vram256_w(space,offset & 0x1ffff,data);       }
1815   else if(offset >= 0x000e8000 && offset <= 0x000fffff)               { /* TODO: shadow ROM */ }
1828   else if(offset >= 0x000e8000 && offset <= 0x000fffff)               { /* TODO: shadow ROM */                               }
18161829   else if(offset >= 0x00100000 && offset <= 0x00100000+m_ram_size-1)      { pc9801rs_ex_wram_w(space,offset-0x00100000,data);    }
18171830   else if(offset >= 0x00f00000 && offset <= 0x00f9ffff)               { pc9821_ext_gvram_w(space,offset-0x00f00000,data);    }
1818   //else
1819   //  printf("%08x %08x\n",offset,data);
1831   else
1832      printf("%08x %08x\n",offset,data);
18201833
18211834}
18221835
r19231r19232
19241937{
19251938   if(offset == 1)
19261939      m_pc9821_window_bank = data & 0xfe;
1940   else
1941      printf("PC-9821 $f0000 window bank %02x\n",data);
19271942}
19281943
19291944UINT8 pc9801_state::m_sdip_read(UINT16 port, UINT8 sdip_offset)
r19231r19232
28572872   state_save_register_global_pointer(machine(), m_ext_gvram, 0xa0000);
28582873}
28592874
2875MACHINE_RESET_MEMBER(pc9801_state,pc9821)
2876{
2877   MACHINE_RESET_CALL_MEMBER(pc9801rs);
2878
2879   m_pc9821_window_bank = 0x08;
2880}
2881
28602882INTERRUPT_GEN_MEMBER(pc9801_state::pc9801_vrtc_irq)
28612883{
28622884   #if 0
r19231r19232
30193041   MCFG_CPU_VBLANK_INT_DRIVER("screen", pc9801_state, pc9801_vrtc_irq)
30203042
30213043   MCFG_MACHINE_START_OVERRIDE(pc9801_state,pc9821)
3022   MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9801rs)
3044   MCFG_MACHINE_RESET_OVERRIDE(pc9801_state,pc9821)
30233045
30243046   MCFG_PIT8253_ADD( "pit8253", pc9801rs_pit8253_config )
30253047   MCFG_I8237_ADD("i8237", 16000000, dmac_intf) // unknown clock
r19231r19232
32453267   ROM_LOAD( "ide.rom",  0x00000, 0x02000, NO_DUMP )
32463268   ROM_FILL( 0x0000, 0x2000, 0xcb )
32473269
3270   ROM_REGION( 0x4000, "unkrom", ROMREGION_ERASEFF ) // pnp?
3271   ROM_LOAD( "unk.rom",  0x00000, 0x04000, NO_DUMP )
3272   ROM_FILL( 0x0000, 0x4000, 0xcb )
3273
32483274   ROM_REGION( 0x0a0000, "wram", ROMREGION_ERASE00 )
32493275
32503276   ROM_REGION( 0x700000, "ex_wram", ROMREGION_ERASE00 )
r19231r19232
32753301
32763302   ROM_REGION( 0x2000, "ide", ROMREGION_ERASEFF )
32773303   ROM_LOAD( "ide.rom",  0x00000, 0x02000, NO_DUMP )
3304   ROM_FILL( 0x0000, 0x2000, 0xcb )
32783305
3306   ROM_REGION( 0x4000, "unkrom", ROMREGION_ERASEFF ) // pnp?
3307   ROM_LOAD( "unk.rom",  0x00000, 0x04000, NO_DUMP )
3308   ROM_FILL( 0x0000, 0x4000, 0xcb )
3309
32793310   ROM_REGION( 0x0a0000, "wram", ROMREGION_ERASE00 )
32803311
32813312   ROM_REGION( 0x700000, "ex_wram", ROMREGION_ERASE00 )
r19231r19232
33043335
33053336   ROM_REGION( 0x2000, "ide", ROMREGION_ERASEFF )
33063337   ROM_LOAD( "ide.rom",  0x00000, 0x02000, NO_DUMP )
3338   ROM_FILL( 0x0000, 0x2000, 0xcb )
33073339
3340   ROM_REGION( 0x4000, "unkrom", ROMREGION_ERASEFF ) // pnp?
3341   ROM_LOAD( "unk.rom",  0x00000, 0x04000, NO_DUMP )
3342   ROM_FILL( 0x0000, 0x4000, 0xcb )
3343
33083344   ROM_REGION( 0x0a0000, "wram", ROMREGION_ERASE00 )
33093345
33103346   ROM_REGION( 0x700000, "ex_wram", ROMREGION_ERASE00 )
r19231r19232
33323368
33333369   ROM_REGION( 0x2000, "ide", ROMREGION_ERASEFF )
33343370   ROM_LOAD( "ide.rom",  0x00000, 0x02000, NO_DUMP )
3371   ROM_FILL( 0x0000, 0x2000, 0xcb )
33353372
3373   ROM_REGION( 0x4000, "unkrom", ROMREGION_ERASEFF ) // pnp?
3374   ROM_LOAD( "unk.rom",  0x00000, 0x04000, NO_DUMP )
3375   ROM_FILL( 0x0000, 0x4000, 0xcb )
3376
33363377   ROM_REGION( 0x0a0000, "wram", ROMREGION_ERASE00 )
33373378
33383379   ROM_REGION( 0x700000, "ex_wram", ROMREGION_ERASE00 )
r19231r19232
33603401
33613402   ROM_REGION( 0x2000, "ide", ROMREGION_ERASEFF )
33623403   ROM_LOAD( "ide.rom",  0x00000, 0x02000, NO_DUMP )
3404   ROM_FILL( 0x0000, 0x2000, 0xcb )
33633405
3406   ROM_REGION( 0x4000, "unkrom", ROMREGION_ERASEFF ) // pnp?
3407   ROM_LOAD( "unk.rom",  0x00000, 0x04000, NO_DUMP )
3408   ROM_FILL( 0x0000, 0x4000, 0xcb )
3409
33643410   ROM_REGION( 0x0a0000, "wram", ROMREGION_ERASE00 )
33653411
33663412   ROM_REGION( 0x700000, "ex_wram", ROMREGION_ERASE00 )
r19231r19232
33883434
33893435   ROM_REGION( 0x2000, "ide", ROMREGION_ERASEFF )
33903436   ROM_LOAD( "ide.rom",  0x00000, 0x02000, NO_DUMP )
3437   ROM_FILL( 0x0000, 0x2000, 0xcb )
33913438
3439   ROM_REGION( 0x4000, "unkrom", ROMREGION_ERASEFF ) // pnp?
3440   ROM_LOAD( "unk.rom",  0x00000, 0x04000, NO_DUMP )
3441   ROM_FILL( 0x0000, 0x4000, 0xcb )
3442
33923443   ROM_REGION( 0x0a0000, "wram", ROMREGION_ERASE00 )
33933444
33943445   ROM_REGION( 0x700000, "ex_wram", ROMREGION_ERASE00 )
r19231r19232
34173468
34183469   ROM_REGION( 0x2000, "ide", ROMREGION_ERASEFF )
34193470   ROM_LOAD( "ide.rom",  0x00000, 0x02000, NO_DUMP )
3471   ROM_FILL( 0x0000, 0x2000, 0xcb )
34203472
3473   ROM_REGION( 0x4000, "unkrom", ROMREGION_ERASEFF ) // pnp?
3474   ROM_LOAD( "unk.rom",  0x00000, 0x04000, NO_DUMP )
3475   ROM_FILL( 0x0000, 0x4000, 0xcb )
3476
34213477   ROM_REGION( 0x0a0000, "wram", ROMREGION_ERASE00 )
34223478
34233479   ROM_REGION( 0x700000, "ex_wram", ROMREGION_ERASE00 )
r19231r19232
34453501
34463502   ROM_REGION( 0x2000, "ide", ROMREGION_ERASEFF )
34473503   ROM_LOAD( "ide.rom",  0x00000, 0x02000, NO_DUMP )
3504   ROM_FILL( 0x0000, 0x2000, 0xcb )
34483505
3506   ROM_REGION( 0x4000, "unkrom", ROMREGION_ERASEFF ) // pnp?
3507   ROM_LOAD( "unk.rom",  0x00000, 0x04000, NO_DUMP )
3508   ROM_FILL( 0x0000, 0x4000, 0xcb )
3509
34493510   ROM_REGION( 0x0a0000, "wram", ROMREGION_ERASE00 )
34503511
34513512   ROM_REGION( 0x700000, "ex_wram", ROMREGION_ERASE00 )

Previous 199869 Revisions Next


© 1997-2024 The MAME Team