Previous 199869 Revisions Next

r26099 Monday 11th November, 2013 at 05:37:32 UTC by Jürgen Buchmüller
Dirty hack which memcpy()s the cpu_device's memory region to a driver's view on the same memory map (ucode).
[/branches/alto2/src/emu/cpu/alto2]alto2.c
[/branches/alto2/src/mess/drivers]alto2.c

branches/alto2/src/mess/drivers/alto2.c
r26098r26099
1010#include "cpu/alto2/alto2.h"
1111#include "cpu/alto2/a2roms.h"
1212
13// FIXME: Is this required? How to access the address space words?
14// This has to somehow be mapped to the a2mem half DWORD accesses
15// and (optionally) Hamming code and parity flag updating
13// FIXME: Is this required? The driver does not have/need access to RAM
1614READ16_MEMBER( alto2_state::alto2_ram_r )
1715{
1816   return downcast<alto2_cpu_device *>(m_maincpu.target())->read_ram(offset);
1917}
2018
21// FIXME: Is this required? How to access the address space words?
22// This has to somehow be mapped to the a2mem half DWORD accesses
23// and (optionally) Hamming code and parity flag updating
19// FIXME: Is this required? The driver does not have/need access to RAM
2420WRITE16_MEMBER( alto2_state::alto2_ram_w )
2521{
2622   downcast<alto2_cpu_device *>(m_maincpu.target())->write_ram(offset, data);
r26098r26099
2824
2925/* Memory Maps */
3026
27ADDRESS_MAP_EXTERN( alto2_ucode_map, 32 );
28
3129/* main memory and memory mapped i/o in range ALTO2_IO_PAGE_BASE ... ALTO2_IO_PAGE_BASE + ALTO2_IO_PAGE_SIZE - 1 */
3230ADDRESS_MAP_START( alto2_ram_map, AS_2, 16, alto2_state )
3331   ADDRESS_MAP_UNMAP_HIGH
r26098r26099
234232   PORT_CONFSETTING(    0x40, "PAL")
235233INPUT_PORTS_END
236234
235/* ROM */
236ROM_START( alto2 )
237   // decoded micro code region - driver side view on the memory
238   ROM_REGION32_BE( sizeof(UINT32)*ALTO2_UCODE_SIZE, "maincpu", 0 )
239   ROM_FILL(0, sizeof(UINT32)*ALTO2_UCODE_SIZE, ALTO2_UCODE_INVERTED)
240ROM_END
241
237242/* Palette Initialization */
238243
239244void alto2_state::palette_init()
r26098r26099
245250static MACHINE_CONFIG_START( alto2, alto2_state )
246251   /* basic machine hardware */
247252   MCFG_CPU_ADD("maincpu", ALTO2, XTAL_20_16MHz)
253   MCFG_CPU_PROGRAM_MAP(alto2_ucode_map)
248254   MCFG_CPU_IO_MAP(alto2_ram_map)
249255
250256   /* video hardware */
r26098r26099
256262   MCFG_PALETTE_LENGTH(2)
257263MACHINE_CONFIG_END
258264
259/* ROM */
260ROM_START( alto2 )
261ROM_END
262
263265/* Driver Init */
264266
265267DRIVER_INIT_MEMBER( alto2_state, alto2 )
266268{
269   // make a copy for the front end, i.e. the driver view on the micro code
270   memcpy(memregion("maincpu"), memregion("maincpu:ucode"), sizeof(UINT32)*ALTO2_UCODE_SIZE);
267271}
268272
269273/* Game Drivers */
branches/alto2/src/emu/cpu/alto2/alto2.c
r26098r26099
1010#include "alto2.h"
1111#include "a2roms.h"
1212
13#define   DEBUG_UCODE_CONST_DATA   0   //!< define to 1 to dump decoded micro code and constants
14
1315//**************************************************************************
1416//  DEVICE DEFINITIONS
1517//**************************************************************************
r26098r26099
3638   m_log_level(9),
3739   m_log_newline(true),
3840#endif
39   m_ucode_config("maincpu", ENDIANNESS_BIG, 32, 14, -2, ADDRESS_MAP_NAME(alto2_ucode_map)),
40   m_ucode_map(*this, "maincpu"),
41   m_ucode_config("alto2", ENDIANNESS_BIG, 32, 14, -2, ADDRESS_MAP_NAME(alto2_ucode_map)),
42   m_ucode_map(*this, ":maincpu:ucode"),
4143   m_ucode(0),
4244   m_ucode_proms(0),
4345   m_const_proms(0),
r26098r26099
124126
125127ROM_START( alto2_cpu )
126128   // decoded micro code region
127   ROM_REGION32_BE( sizeof(UINT32)*ALTO2_UCODE_SIZE, "maincpu", 0 )
129   ROM_REGION32_BE( sizeof(UINT32)*ALTO2_UCODE_SIZE, "ucode", 0 )
128130   ROM_FILL(0, sizeof(UINT32)*ALTO2_UCODE_SIZE, ALTO2_UCODE_INVERTED)
129131
130132   ROM_REGION( 16 * 02000, "ucode_proms", 0 )
r26098r26099
156158   ROM_LOAD( "madr.a3",   3*00400, 00400, CRC(e0992757) SHA1(5c45ea824970663cb9ee672dc50861539c860249) )   //!< 0000-0377 C(12)',C(13)',C(14)',C(15)'
157159
158160   // extended memory Mesa 4.1 (?) micro code PROMs, 8 x 4bit (unused)
159   ROM_REGION32_BE( 8 * 02000, "xm_mesa_4.1", ROMREGION_INVERT )
161   ROM_REGION( 8 * 02000, "xm_mesa_4.1", 0 )
160162   ROM_LOAD( "xm654.41",  0*02000, 02000, CRC(beace302) SHA1(0002fea03a0261f57365095c4b87385d833f7063) )   //!< 00000-01777 RSEL(0)',RSEL(1)',RSEL(2)',RSEL(3)'
161163   ROM_LOAD( "xm674.41",  1*02000, 02000, CRC(7db5c097) SHA1(364bc41951baa3ad274031bd49abec1cf5b7a980) )   //!< 00000-01777 RSEL(4)',ALUF(0)',ALUF(1)',ALUF(2)'
162164   ROM_LOAD( "xm675.41",  2*02000, 02000, CRC(26eac1e7) SHA1(9220a1386afae8de96bdb2cf084afbadeeb61d42) )   //!< 00000-01777 ALUF(3)',BS(0)',BS(1)',BS(2)'
r26098r26099
845847{
846848   m_ucode = &space(AS_0);
847849   m_ucode_proms = prom_load(pl_ucode, memregion("ucode_proms")->base(), ALTO2_UCODE_ROM_PAGES, 8);
848   UINT32* p_ucode = reinterpret_cast<UINT32 *>(memregion("maincpu")->base());
850   UINT32* p_ucode = reinterpret_cast<UINT32 *>(memregion(":maincpu:ucode")->base());
849851   for (offs_t offs = 0; offs < ALTO2_UCODE_RAM_BASE; offs++) {
850852      UINT32 data = (m_ucode_proms[4*offs+0] << 0) | (m_ucode_proms[4*offs+1] << 8) |
851853             (m_ucode_proms[4*offs+2] << 16) | (m_ucode_proms[4*offs+3] << 24);
854#if   DEBUG_UCODE_CONST_DATA
852855      if (0 == offs % 8)
853856         printf("%04x:", offs);
854857      printf(" %08x",  data);
855858      if (7 == offs % 8)
856859         printf("\n");
860#endif
857861      p_ucode[offs] = data;
858862   }
863   for (offs_t offs = ALTO2_UCODE_RAM_BASE; offs < ALTO2_UCODE_SIZE; offs++) {
864      p_ucode[offs] = ALTO2_UCODE_INVERTED;
865   }
859866
860867   m_const_proms = prom_load(pl_const, memregion("const_proms")->base(), 1, 4);
861868   m_const = reinterpret_cast<UINT16 *>(global_alloc_array(UINT16, ALTO2_CONST_SIZE));
862869   for (offs_t offs = 0; offs < ALTO2_CONST_SIZE; offs++) {
863870      UINT16 data = (m_const_proms[2*offs+0] << 0) | (m_const_proms[2*offs+1] << 8);
871#if   DEBUG_UCODE_CONST_DATA
864872      if (0 == offs % 8)
865873         printf("%04x:", offs);
866874      printf(" %04x",  data);
867875      if (7 == offs % 8)
868876         printf("\n");
877#endif
869878      m_const[offs] = data;
870879   }
871880

Previous 199869 Revisions Next


© 1997-2024 The MAME Team