Previous 15994 Revisions Next

r11073 Sunday 3rd April, 2011 at 21:25:15 UTC by R. Belmont
apple2gs: fix ram sizes to reflect reality, fixed ram mapping to match real system, added readback of bank number from unpopulated RAM areas.
[src/mess/drivers]apple2gs.c
[src/mess/includes]apple2gs.h
[src/mess/machine]apple2gs.c

src/mess/machine/apple2gs.c
r11072r11073
16851685   }
16861686}
16871687
1688// Because the bank address multiplexes on the 65816 data bus, reading a memory area
1689// which doesn't drive the bus results in reading back the bank number.
1690static READ8_HANDLER(apple2gs_bank_echo_r)
1691{
1692   apple2gs_state *state = space->machine().driver_data<apple2gs_state>();
16881693
1694   return state->m_echo_bank + (offset>>16);
1695}
1696
16891697static void apple2gs_setup_memory(running_machine &machine)
16901698{
16911699   apple2gs_state *state = machine.driver_data<apple2gs_state>();
r11072r11073
16971705   state->m_slowmem = auto_alloc_array_clear(machine, UINT8, 128*1024);
16981706   state_save_register_item_pointer(machine, "APPLE2GS_SLOWMEM", NULL, 0, state->m_slowmem, 128*1024);
16991707
1700   /* install expanded memory */
1701   if (ram_get_size(machine.device(RAM_TAG))> 0x010000) {
1702      space->install_readwrite_bank(0x010000, ram_get_size(machine.device(RAM_TAG)) - 1, "bank1");
1708   // install expanded memory
1709   // fair warning: other code assumes banks 0 and 1 are the first 128k of the RAM device, so you must install bank 1 at 0x10000
1710   // otherwise nothing works :)
1711   if (state->m_is_rom3)
1712   {
1713      int ramsize = ram_get_size(machine.device(RAM_TAG));
1714
1715      // ROM 03 hardware: the quoted "1 MB" for a base machine doesn't include banks e0/e1, so map accordingly
1716      space->install_readwrite_bank(0x010000, ramsize - 1, "bank1");
17031717      memory_set_bankptr(machine,"bank1", ram_get_ptr(machine.device(RAM_TAG)) + 0x010000);
1718
1719      space->install_legacy_read_handler( ramsize, 0x7fffff, FUNC(apple2gs_bank_echo_r));
1720      state->m_echo_bank = (ramsize >> 16);
17041721   }
1722   else
1723   {
1724      int ramsize = ram_get_size(machine.device(RAM_TAG))-0x30000;
17051725
1726      // ROM 00/01 hardware: the quoted "256K" for a base machine *does* include banks e0/e1.
1727      space->install_readwrite_bank(0x010000, ramsize - 1 + 0x10000, "bank1");
1728      memory_set_bankptr(machine,"bank1", ram_get_ptr(machine.device(RAM_TAG)) + 0x010000);
1729
1730      space->install_legacy_read_handler( ramsize + 0x10000, 0x7fffff, FUNC(apple2gs_bank_echo_r));
1731      state->m_echo_bank = (ramsize+0x10000) >> 16;
1732   }
1733
17061734   /* install hi memory */
17071735   space->install_read_bank(0xe00000, 0xe1ffff, "bank2");
17081736   space->install_legacy_write_handler(0xe00000, 0xe1ffff, FUNC(apple2gs_slowmem_w));
r11072r11073
17611789    When F3 pressed, the video mode changes and the machine goes into Basic */
17621790}
17631791
1764MACHINE_START( apple2gs )
1792MACHINE_START( apple2gscommon )
17651793{
17661794   apple2gs_state *state = machine.driver_data<apple2gs_state>();
17671795   apple2_init_common(machine);
r11072r11073
18121840   state->m_sndglu_addr = 0;
18131841   state->m_sndglu_dummy_read = 0;
18141842
1815   /* init the various subsystems */
1816   apple2gs_setup_memory(machine);
1843   state->m_is_rom3 = true;
18171844
18181845   /* save state stuff.  note that the driver takes care of docram. */
18191846   UINT8* ram = ram_get_ptr(machine.device(RAM_TAG));
r11072r11073
18741901   // fire on scanline zero
18751902   state->m_scanline_timer->adjust(machine.primary_screen->time_until_pos(0, 0));
18761903}
1904
1905MACHINE_START( apple2gs )
1906{
1907   MACHINE_START_NAME(apple2gscommon)(machine);
1908   apple2gs_setup_memory(machine);
1909}
1910
1911MACHINE_START( apple2gsr1 )
1912{
1913   MACHINE_START_NAME(apple2gscommon)(machine);
1914
1915   apple2gs_state *state = machine.driver_data<apple2gs_state>();
1916   state->m_is_rom3 = false;
1917   apple2gs_setup_memory(machine);
1918}
src/mess/includes/apple2gs.h
r11072r11073
9292   int m_sndglu_addr;
9393   int m_sndglu_dummy_read;
9494   bitmap_t *m_legacy_gfx;
95    bool m_is_rom3;
96    UINT8 m_echo_bank;
9597};
9698
9799
98100/*----------- defined in machine/apple2gs.c -----------*/
99101
100102MACHINE_START( apple2gs );
103MACHINE_START( apple2gsr1 );
101104MACHINE_RESET( apple2gs );
102105
103106NVRAM_HANDLER( apple2gs );
src/mess/drivers/apple2gs.c
r11072r11073
300300
301301   /* internal ram */
302302   MCFG_RAM_ADD(RAM_TAG)
303   MCFG_RAM_DEFAULT_SIZE("2M")
304   MCFG_RAM_EXTRA_OPTIONS("64K")
303   MCFG_RAM_DEFAULT_SIZE("2M")      // 1M on board + 1M in the expansion slot was common for ROM 03
304   MCFG_RAM_EXTRA_OPTIONS("1M,3M,4M,5M,6M,7M,8M")
305305   MCFG_RAM_DEFAULT_VALUE(0x00)
306306MACHINE_CONFIG_END
307307
308static MACHINE_CONFIG_DERIVED( apple2gsr1, apple2gs )
309   MCFG_MACHINE_START( apple2gsr1 )
308310
311    MCFG_RAM_MODIFY(RAM_TAG)
312   MCFG_RAM_DEFAULT_SIZE("1280K")  // 256K on board + 1M in the expansion slot was common for ROM 01
313   MCFG_RAM_EXTRA_OPTIONS("256K,512K,768K,1M,2M,3M,4M,5M,6M,7M,8M")
314   MCFG_RAM_DEFAULT_VALUE(0x00)
315MACHINE_CONFIG_END
309316
310317/***************************************************************************
311318
r11072r11073
386393COMP( 1989, apple2gs, 0,        apple2, apple2gs, apple2gs,   apple2gs, "Apple Computer", "Apple IIgs (ROM03)", 0 )
387394COMP( 198?, apple2gsr3p, apple2gs, 0,   apple2gs, apple2gs,   apple2gs, "Apple Computer", "Apple IIgs (ROM03 prototype)", GAME_NOT_WORKING )
388395COMP( 1989, apple2gsr3lp, apple2gs, 0,  apple2gs, apple2gs,   apple2gs, "Apple Computer", "Apple IIgs (ROM03 late prototype?)", GAME_NOT_WORKING )
389COMP( 1987, apple2gsr1, apple2gs, 0,    apple2gs, apple2gs,   apple2gs, "Apple Computer", "Apple IIgs (ROM01)", 0 )
390COMP( 1986, apple2gsr0, apple2gs, 0,    apple2gs, apple2gs,   apple2gs, "Apple Computer", "Apple IIgs (ROM00)", 0 )
396COMP( 1987, apple2gsr1, apple2gs, 0,    apple2gsr1, apple2gs,   apple2gs, "Apple Computer", "Apple IIgs (ROM01)", 0 )
397COMP( 1986, apple2gsr0, apple2gs, 0,    apple2gsr1, apple2gs,   apple2gs, "Apple Computer", "Apple IIgs (ROM00)", 0 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team