Previous 199869 Revisions Next

r26096 Sunday 10th November, 2013 at 23:55:20 UTC by Jürgen Buchmüller
Got rid of the memory region for constants. maincpu memory region copying still broken.
[/branches/alto2/src/emu/cpu/alto2]alto2.c alto2.h
[/branches/alto2/src/mess/drivers]alto2.c
[/branches/alto2/src/mess/includes]alto2.h

branches/alto2/src/emu/cpu/alto2/alto2.c
r26095r26096
1616
1717const device_type ALTO2 = &device_creator<alto2_cpu_device>;
1818
19/***************************************************************************
20   ADDRESS MAPS
21***************************************************************************/
19ADDRESS_MAP_START( alto2_ucode_map, AS_0, 32, alto2_cpu_device )
20   AM_RANGE(0,                    ALTO2_UCODE_RAM_BASE-1) AM_ROM
21   AM_RANGE(ALTO2_UCODE_RAM_BASE, ALTO2_UCODE_SIZE-1)     AM_RAM
22ADDRESS_MAP_END
2223
23
24// FIXME: Is this required? How to access the address space words?
25// This has to somehow be mapped to the a2mem half DWORD accesses
26// and (optionally) Hamming code and parity flag updating
27READ16_MEMBER( alto2_cpu_device::alto2_ram_r )
28{
29   return 0;
30}
31
32// FIXME: Is this required? How to access the address space words?
33// This has to somehow be mapped to the a2mem half DWORD accesses
34// and (optionally) Hamming code and parity flag updating
35WRITE16_MEMBER( alto2_cpu_device::alto2_ram_w )
36{
37
38}
39
40// FIXME: Dispatch to the a2mem mmio handlers
41READ16_MEMBER( alto2_cpu_device::alto2_mmio_r )
42{
43   return 0;
44}
45
46// FIXME: Dispatch to the a2mem mmio handlers
47WRITE16_MEMBER( alto2_cpu_device::alto2_mmio_w )
48{
49
50}
51
5224//**************************************************************************
5325//  LIVE DEVICE
5426//**************************************************************************
r26095r26096
6436   m_log_level(9),
6537   m_log_newline(true),
6638#endif
67   m_ucode_config("maincpu", ENDIANNESS_BIG, 32, 14, -2),
68   m_const_config("const", ENDIANNESS_BIG, 16, 8, -1),
39   m_ucode_config("maincpu", ENDIANNESS_BIG, 32, 14, -2, ADDRESS_MAP_NAME(alto2_ucode_map)),
40   m_ucode_map(*this, "maincpu"),
6941   m_ucode(0),
70   m_const(0),
71   m_ucode_map(*this, "^maincpu"),
72   m_const_map(*this, "^const"),
42   m_ucode_proms(0),
43   m_const_proms(0),
7344   m_icount(0),
7445   m_task_mpc(),
7546   m_task_next2(),
r26095r26096
152123//-------------------------------------------------
153124
154125ROM_START( alto2_cpu )
126   // decoded micro code region
127   ROM_REGION32_BE( sizeof(UINT32)*ALTO2_UCODE_SIZE, "maincpu", 0 )
128   ROM_FILL(0, sizeof(UINT32)*ALTO2_UCODE_SIZE, ALTO2_UCODE_INVERTED)
129
155130   ROM_REGION( 16 * 02000, "ucode_proms", 0 )
156131   ROM_LOAD( "55x.3",     0*02000, 0x400, CRC(de870d75) SHA1(2b98cc769d8302cb39948711424d987d94e4159b) )   //!< 00000-01777 RSEL(0)',RSEL(1)',RSEL(2)',RSEL(3)'
157132   ROM_LOAD( "64x.3",     1*02000, 0x400, CRC(51b444c0) SHA1(8756e51f7f3253a55d75886465beb7ee1be6e1c4) )   //!< 00000-01777 RSEL(4)',ALUF(0)',ALUF(1)',ALUF(2)'
r26095r26096
249224// device_memory_interface overrides
250225//-------------------------------------------------
251226
252bool alto2_cpu_device::memory_read(address_spacenum spacenum, offs_t offset, int size, UINT64 &value)
227const address_space_config*alto2_cpu_device::memory_space_config(address_spacenum spacenum) const
253228{
254//   printf("%s: spacenum=%d offset=%#x size=%d\n", __FUNCTION__, int(spacenum), unsigned(offset), size);
255   switch (spacenum) {
256   case AS_0:
257      switch (size) {
258      case 1:
259         value = m_ucode_proms[offset];
260         return true;
261      case 2:
262         value = m_ucode_proms[offset+0] | (m_ucode_proms[offset+1] << 8);
263         return true;
264      case 4:
265         value = m_ucode_proms[offset+0] |
266               (m_ucode_proms[offset+1] << 8) |
267               (m_ucode_proms[offset+2] << 16) |
268               (m_ucode_proms[offset+3] << 24);
269         return true;
270      }
271      return false;
272   case AS_1:
273      switch (size) {
274      case 1:
275         value = m_const_proms[offset];
276         return true;
277      case 2:
278         value = m_const_proms[offset+0] | (m_ucode_proms[offset+1] << 8);
279         return true;
280      }
281      return false;
282   default:
283      return false;
284   }
229   if (AS_0 == spacenum)
230      return &m_ucode_config;
231   return NULL;
285232}
286233
287bool alto2_cpu_device::memory_write(address_spacenum spacenum, offs_t offset, int size, UINT64 value)
234UINT16 alto2_cpu_device::read_ram(offs_t offset)
288235{
289//   printf("%s: spacenum=%d offset=%#x size=%d\n", __FUNCTION__, int(spacenum), unsigned(offset), size);
290   switch (spacenum) {
291   case AS_0:
292      switch (size) {
293      case 1:
294         m_ucode_proms[offset] = value;
295         return true;
296      case 2:
297         m_ucode_proms[offset+0] = value;
298         m_ucode_proms[offset+1] = value >> 8;
299         return true;
300      case 4:
301         m_ucode_proms[offset+0] = value;
302         m_ucode_proms[offset+1] = value >> 8;
303         m_ucode_proms[offset+2] = value >> 16;
304         m_ucode_proms[offset+3] = value >> 24;
305         return true;
306      }
307      return false;
308   case AS_1:
309      switch (size) {
310      case 1:
311         m_const_proms[offset] = value;
312         return true;
313      case 2:
314         m_const_proms[offset+0] = value;
315         m_ucode_proms[offset+1] = value >> 8;
316         return true;
317      }
318      return false;
319   default:
320      return false;
321   }
236   return debug_read_mem(offset);
322237}
323238
239void alto2_cpu_device::write_ram(offs_t offset, UINT16 data)
240{
241   debug_write_mem(offset, data);
242}
324243
325244/**
326245 * @brief list of microcode PROM loading options
327246 */
328static const prom_load_t ucode_prom_list[] = {
247static const prom_load_t pl_ucode[] = {
329248   {   // 0000-01777 RSEL(0)',RSEL(1)',RSEL(2)',RSEL(3)'
330249      "55x.3",
331250      0,
r26095r26096
575494/**
576495 * @brief list of constant PROM loading options
577496 */
578static const prom_load_t const_prom_list[] = {
497static const prom_load_t pl_const[] = {
579498   {   // constant prom D0-D3
580499      "madr.a6",
581500      "c3.3",
r26095r26096
925844void alto2_cpu_device::device_start()
926845{
927846   m_ucode = &space(AS_0);
928   m_const = &space(AS_1);
847   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());
849   for (offs_t offs = 0; offs < ALTO2_UCODE_RAM_BASE; offs++) {
850      UINT32 data = (m_ucode_proms[4*offs+0] << 0) | (m_ucode_proms[4*offs+1] << 8) |
851             (m_ucode_proms[4*offs+2] << 16) | (m_ucode_proms[4*offs+3] << 24);
852      if (0 == offs % 8)
853         printf("%04x:", offs);
854      printf(" %08x",  data);
855      if (7 == offs % 8)
856         printf("\n");
857      p_ucode[offs] = data;
858   }
929859
930   m_ucode_proms = prom_load(ucode_prom_list, memregion("ucode_proms")->base(), ALTO2_UCODE_ROM_PAGES, 8);
931   m_const_proms = prom_load(const_prom_list, memregion("const_proms")->base(), 1, 4);
860   m_const_proms = prom_load(pl_const, memregion("const_proms")->base(), 1, 4);
861   m_const = reinterpret_cast<UINT16 *>(global_alloc_array(UINT16, ALTO2_CONST_SIZE));
862   for (offs_t offs = 0; offs < ALTO2_CONST_SIZE; offs++) {
863      UINT16 data = (m_const_proms[2*offs+0] << 0) | (m_const_proms[2*offs+1] << 8);
864      if (0 == offs % 8)
865         printf("%04x:", offs);
866      printf(" %04x",  data);
867      if (7 == offs % 8)
868         printf("\n");
869      m_const[offs] = data;
870   }
871
932872   m_disp_a38 = prom_load(&pl_displ_a38, memregion("displ_a38")->base());
933873   m_disp_a63 = prom_load(&pl_displ_a63, memregion("displ_a63")->base());
934874   m_disp_a66 = prom_load(&pl_displ_a66, memregion("displ_a66")->base());
r26095r26096
11591099// FIXME
11601100void alto2_cpu_device::device_reset()
11611101{
1162   for (offs_t offs = 0; offs < ALTO2_UCODE_RAM_BASE; offs++) {
1163      UINT32 data = (m_ucode_proms[4*offs+0] << 0) | (m_ucode_proms[4*offs+1] << 8) |
1164             (m_ucode_proms[4*offs+2] << 16) | (m_ucode_proms[4*offs+3] << 24);
1165      if (0 == offs % 8)
1166         printf("%04x:", offs);
1167      printf(" %08x",  data);
1168      if (7 == offs % 8)
1169         printf("\n");
1170   }
1171   for (offs_t offs = 0; offs < ALTO2_CONST_SIZE; offs++) {
1172      UINT32 data = (m_const_proms[2*offs+0] << 0) | (m_const_proms[2*offs+1] << 8);
1173      if (0 == offs % 8)
1174         printf("%04x:", offs);
1175      printf(" %04x",  data);
1176      if (7 == offs % 8)
1177         printf("\n");
1178   }
1179
11801102   soft_reset();
11811103}
11821104
r26095r26096
25352457       */
25362458      if (!do_bs || bs >= 4) {
25372459         int addr = 8 * m_rsel + bs;
2538         UINT16 data = m_const->read_word(addr);
2460         UINT16 data = m_const[addr];
25392461         LOG((LOG_CPU,2,"   %#o; BUS &= CONST[%03o]\n", data, addr));
25402462         m_bus &= data;
25412463      }
branches/alto2/src/emu/cpu/alto2/alto2.h
r26095r26096
207207   // construction/destruction
208208   alto2_cpu_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
209209
210   //! driver interface to RAM
211   UINT16 read_ram(offs_t offset);
212   void write_ram(offs_t offset, UINT16 data);
213
210214protected:
211215   //! device-level override for start
212216   virtual void device_start();
r26095r26096
221225   virtual void execute_set_input(int inputnum, int state);
222226
223227   //! device_memory_interface overrides
224   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const
225   {
226      switch (spacenum) {
227      case AS_0:
228         return &m_ucode_config;
229      case AS_1:
230         return &m_const_config;
231      default:
232         return NULL;
233      }
234   }
228   virtual const address_space_config *memory_space_config(address_spacenum spacenum = AS_0) const;
235229
236230   //! device (P)ROMs
237231   virtual const rom_entry *device_rom_region() const;
238   //! device_memory_interface overrides
239   virtual bool memory_read(address_spacenum spacenum, offs_t offset, int size, UINT64 &value);
240   virtual bool memory_write(address_spacenum spacenum, offs_t offset, int size, UINT64 value);
241232   //! device_state_interface overrides
242233   void state_string_export(const device_state_entry &entry, astring &string);
243234
r26095r26096
245236   virtual UINT32 disasm_min_opcode_bytes() const { return 4; }
246237   virtual UINT32 disasm_max_opcode_bytes() const { return 4; }
247238   virtual offs_t disasm_disassemble(char *buffer, offs_t pc, const UINT8 *oprom, const UINT8 *opram, UINT32 options);
239
248240private:
249241#if   ALTO2_DEBUG
250242   enum {
r26095r26096
286278   void fatal(int level, const char *format, ...);
287279
288280   address_space_config m_ucode_config;
289   address_space_config m_const_config;
290281
291   address_space *m_ucode;
292   address_space *m_const;
293
294282   required_memory_region m_ucode_map;
295   required_memory_region m_const_map;
296283
284   address_space *m_ucode;
285   UINT16* m_const;
286
297287   UINT8* m_ucode_proms;
298288   UINT8* m_const_proms;
299289
300290   int m_icount;
301291
302   DECLARE_READ16_MEMBER ( alto2_ram_r );
303   DECLARE_WRITE16_MEMBER( alto2_ram_w );
304   DECLARE_READ16_MEMBER ( alto2_mmio_r );
305   DECLARE_WRITE16_MEMBER( alto2_mmio_w );
306
307292   static const UINT8 m_ether_id = 0121;
308293
309294   typedef void (alto2_cpu_device::*a2func)();
branches/alto2/src/mess/drivers/alto2.c
r26095r26096
1// license:MAME
2// copyright-holders:Juergen Buchmueller
31/***************************************************************************
4 *    alto2.c
2 *   Portable Xerox AltoII driver for MESS
53 *
6 *    Original driver by:
7 *    Juergen Buchmueller, Nov 2013
4 *   Copyright: Juergen Buchmueller <pullmoll@t-online.de>
85 *
6 *   Licenses: MAME, GPLv2
97 ***************************************************************************/
108
119#include "includes/alto2.h"
r26095r26096
1715// and (optionally) Hamming code and parity flag updating
1816READ16_MEMBER( alto2_state::alto2_ram_r )
1917{
20   return 0;
18   return downcast<alto2_cpu_device *>(m_maincpu.target())->read_ram(offset);
2119}
2220
2321// FIXME: Is this required? How to access the address space words?
r26095r26096
2523// and (optionally) Hamming code and parity flag updating
2624WRITE16_MEMBER( alto2_state::alto2_ram_w )
2725{
28
26   downcast<alto2_cpu_device *>(m_maincpu.target())->write_ram(offset, data);
2927}
3028
31// FIXME: Dispatch to the a2mem mmio handlers
32READ16_MEMBER( alto2_state::alto2_mmio_r )
33{
34   return 0;
35}
36
37// FIXME: Dispatch to the a2mem mmio handlers
38WRITE16_MEMBER( alto2_state::alto2_mmio_w )
39{
40
41}
42
4329/* Memory Maps */
4430
45static ADDRESS_MAP_START( alto2_ucode_map, AS_PROGRAM, 32, alto2_state )
46   ADDRESS_MAP_UNMAP_HIGH
47   AM_RANGE(0,                    ALTO2_UCODE_RAM_BASE-1) AM_ROM
48   AM_RANGE(ALTO2_UCODE_RAM_BASE, ALTO2_UCODE_SIZE-1)     AM_RAM
49ADDRESS_MAP_END
50
51static ADDRESS_MAP_START( alto2_const_map, AS_DATA, 16, alto2_state )
52   ADDRESS_MAP_UNMAP_HIGH
53   AM_RANGE(0,                    ALTO2_CONST_SIZE-1)     AM_ROM
54ADDRESS_MAP_END
55
5631/* main memory and memory mapped i/o in range ALTO2_IO_PAGE_BASE ... ALTO2_IO_PAGE_BASE + ALTO2_IO_PAGE_SIZE - 1 */
57static ADDRESS_MAP_START( alto2_ram_map, AS_IO, 16, alto2_state )
32ADDRESS_MAP_START( alto2_ram_map, AS_2, 16, alto2_state )
5833   ADDRESS_MAP_UNMAP_HIGH
59   AM_RANGE(0,                    ALTO2_IO_PAGE_BASE - 1) AM_READWRITE(alto2_ram_r,  alto2_ram_w)
60   AM_RANGE(ALTO2_IO_PAGE_BASE,   0177777)                AM_READWRITE(alto2_mmio_r, alto2_mmio_w)
34   AM_RANGE(0, ALTO2_RAM_SIZE-1) AM_READWRITE(alto2_ram_r,  alto2_ram_w)
6135ADDRESS_MAP_END
6236
6337
r26095r26096
260234   PORT_CONFSETTING(    0x40, "PAL")
261235INPUT_PORTS_END
262236
263/* ROM */
264ROM_START( alto2 )
265   // decoded micro code region
266   ROM_REGION( sizeof(UINT32)*ALTO2_UCODE_SIZE, "maincpu", 0 )
267   // decoded constant PROMs region
268   ROM_REGION( sizeof(UINT16)*ALTO2_CONST_SIZE, "const", 0 )
269ROM_END
270
271237/* Palette Initialization */
272238
273239void alto2_state::palette_init()
r26095r26096
279245static MACHINE_CONFIG_START( alto2, alto2_state )
280246   /* basic machine hardware */
281247   MCFG_CPU_ADD("maincpu", ALTO2, XTAL_20_16MHz)
282   MCFG_CPU_PROGRAM_MAP(alto2_ucode_map)
283   MCFG_CPU_DATA_MAP(alto2_const_map)
284248   MCFG_CPU_IO_MAP(alto2_ram_map)
285249
286250   /* video hardware */
r26095r26096
290254   MCFG_SCREEN_VBLANK_DRIVER(alto2_state, screen_eof_alto2)
291255
292256   MCFG_PALETTE_LENGTH(2)
293
294   // internal ram
295   MCFG_RAM_ADD(RAM_TAG)
296   MCFG_RAM_DEFAULT_SIZE("128K")
297257MACHINE_CONFIG_END
298258
259/* ROM */
260ROM_START( alto2 )
261ROM_END
262
299263/* Driver Init */
300264
301265DRIVER_INIT_MEMBER( alto2_state, alto2 )
branches/alto2/src/mess/includes/alto2.h
r26095r26096
99
1010#include "emu.h"
1111#include "cpu/alto2/alto2.h"
12#include "machine/ram.h"
1312
1413class alto2_state : public driver_device
1514{
r26095r26096
3837
3938   DECLARE_READ16_MEMBER(alto2_ram_r);
4039   DECLARE_WRITE16_MEMBER(alto2_ram_w);
41   DECLARE_READ16_MEMBER(alto2_mmio_r);
42   DECLARE_WRITE16_MEMBER(alto2_mmio_w);
4340   DECLARE_DRIVER_INIT(alto2);
4441
4542   virtual void palette_init();

Previous 199869 Revisions Next


© 1997-2024 The MAME Team