Previous 15994 Revisions Next

r8466 Saturday 10th July, 2010 at 18:05:58 UTC by Angelo Salese
[PASOPIA7]: More accurate bankswitch model
[src/mess/drivers]pasopia.c

src/mess/drivers/pasopia.c
r8465r8466
5757      p7_vram[offset] = data;
5858}
5959
60// sketchy port 0x3c implementation to see what the CPU does...
61// however, it writes 0x11 - in theory setting BASIC+BIOS in the lower banks
62// and then it writes at 0x0000... maybe bank1 should be RAM? or
63// should we have writes to RAM and only reads to BIOS/BASIC?
6460static WRITE8_HANDLER( paso7_bankswitch )
6561{
6662   UINT8 *cpu = memory_region(space->machine, "maincpu");
6763   UINT8 *basic = memory_region(space->machine, "basic");
6864
69   if (BIT(data, 0))
65   switch(data & 3)
7066   {
71      memory_set_bankptr(space->machine, "bank1", basic);
72      memory_set_bankptr(space->machine, "bank2", cpu + 0x10000);
73      memory_unmap_write(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0);
67      case 0:
68      case 3: //select Basic ROM
69         memory_set_bankptr(space->machine, "bank1", basic + 0x00000);
70         memory_set_bankptr(space->machine, "bank2", basic + 0x04000);
71         break;
72      case 1: //select Basic ROM + BIOS ROM
73         memory_set_bankptr(space->machine, "bank1", basic + 0x00000);
74         memory_set_bankptr(space->machine, "bank2", cpu   + 0x10000);
75         break;
76      case 2: //select Work RAM
77         memory_set_bankptr(space->machine, "bank1", cpu   + 0x00000);
78         memory_set_bankptr(space->machine, "bank2", cpu   + 0x04000);
79         break;
7480   }
75   else if (BIT(data, 1))
76   {
77      memory_set_bankptr(space->machine, "bank1", cpu);
78      memory_set_bankptr(space->machine, "bank2", cpu + 0x4000);
79      memory_install_write_bank(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x3fff, 0, 0, "bank1");
80      memory_install_write_bank(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x4000, 0x7fff, 0, 0, "bank2");
81   }
82   else
83   {
84      memory_set_bankptr(space->machine, "bank1", cpu + 0x10000);
85      memory_set_bankptr(space->machine, "bank2", cpu + 0x10000);
86      memory_unmap_write(cputag_get_address_space(space->machine, "maincpu", ADDRESS_SPACE_PROGRAM), 0x0000, 0x7fff, 0, 0);
87   }
8881
8982   vram_sel = data & 4;
9083
r8465r8466
147140   return 0xff;
148141}
149142
143/* writes always occurs to the RAM banks, even if the ROMs are selected. */
144static WRITE8_HANDLER( ram_bank1_w )
145{
146   UINT8 *cpu = memory_region(space->machine, "maincpu");
147
148   cpu[offset] = data;
149}
150
151static WRITE8_HANDLER( ram_bank2_w )
152{
153   UINT8 *cpu = memory_region(space->machine, "maincpu");
154
155   cpu[offset+0x4000] = data;
156}
157
150158static ADDRESS_MAP_START(paso7_mem, ADDRESS_SPACE_PROGRAM, 8)
151159   ADDRESS_MAP_UNMAP_HIGH
152   AM_RANGE( 0x0000, 0x3fff ) AM_RAMBANK("bank1")
153   AM_RANGE( 0x4000, 0x7fff ) AM_RAMBANK("bank2")
160   AM_RANGE( 0x0000, 0x3fff ) AM_ROMBANK("bank1") AM_WRITE( ram_bank1_w )
161   AM_RANGE( 0x4000, 0x7fff ) AM_ROMBANK("bank2") AM_WRITE( ram_bank2_w )
154162   AM_RANGE( 0x8000, 0xbfff ) AM_READWRITE(vram_r, vram_w ) AM_BASE(&p7_vram)
155163   AM_RANGE( 0xc000, 0xffff ) AM_RAMBANK("bank4")
156164ADDRESS_MAP_END

Previous 15994 Revisions Next


© 1998-2018 The MESS Team