Previous 199869 Revisions Next

r33046 Tuesday 28th October, 2014 at 15:25:57 UTC by Miodrag Milanović
Merge pull request #23 from p1pkin/naomi#2

Naomi updates
[src/emu/bus]bus.mak
[src/emu/bus/astrocde]exp.c* exp.h* ram.c* ram.h*
[src/mame/drivers]psychic5.c
[src/mame/includes]psychic5.h
[src/mame/machine]zndip.h
[src/mame/video]psychic5.c
[src/mess/drivers]astrocde.c

trunk/src/emu/bus/astrocde/exp.c
r0r241558
1// license:BSD-3-Clause
2// copyright-holders:etabeta
3/***********************************************************************************************************
4
5    Bally Astrocade Expansion port
6
7 ***********************************************************************************************************/
8
9
10#include "emu.h"
11#include "exp.h"
12
13//**************************************************************************
14//  GLOBAL VARIABLES
15//**************************************************************************
16
17const device_type ASTROCADE_EXP_SLOT = &device_creator<astrocade_exp_device>;
18
19
20device_astrocade_card_interface::device_astrocade_card_interface(const machine_config &mconfig, device_t &device)
21   : device_slot_card_interface(mconfig, device)
22{
23}
24
25
26device_astrocade_card_interface::~device_astrocade_card_interface()
27{
28}
29
30
31//**************************************************************************
32//  LIVE DEVICE
33//**************************************************************************
34
35//-------------------------------------------------
36//  astrocade_exp_device - constructor
37//-------------------------------------------------
38astrocade_exp_device::astrocade_exp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) :
39                  device_t(mconfig, ASTROCADE_EXP_SLOT, "Bally Astrocade expansion", tag, owner, clock, "astrocde_exp", __FILE__),
40                  device_slot_interface(mconfig, *this)
41{
42}
43
44
45//-------------------------------------------------
46//  astrocade_exp_device - destructor
47//-------------------------------------------------
48
49astrocade_exp_device::~astrocade_exp_device()
50{
51}
52
53//-------------------------------------------------
54//  device_start - device-specific startup
55//-------------------------------------------------
56
57void astrocade_exp_device::device_start()
58{
59   m_card = dynamic_cast<device_astrocade_card_interface *>(get_card_device());
60}
61
62/*-------------------------------------------------
63 read
64 -------------------------------------------------*/
65
66READ8_MEMBER(astrocade_exp_device::read)
67{
68   if (m_card)
69      return m_card->read(space, offset);
70   else
71      return 0xff;
72}
73
74/*-------------------------------------------------
75 write
76 -------------------------------------------------*/
77
78WRITE8_MEMBER(astrocade_exp_device::write)
79{
80   if (m_card)
81      m_card->write(space, offset, data);
82}
trunk/src/emu/bus/astrocde/exp.h
r0r241558
1// license:BSD-3-Clause
2// copyright-holders:etabeta
3#ifndef __ASTROCADE_EXP_H
4#define __ASTROCADE_EXP_H
5
6// ======================> device_astrocade_card_interface
7
8class device_astrocade_card_interface : public device_slot_card_interface
9{
10public:
11   // construction/destruction
12   device_astrocade_card_interface(const machine_config &mconfig, device_t &device);
13   virtual ~device_astrocade_card_interface();
14
15   // reading and writing
16   virtual DECLARE_READ8_MEMBER(read) { return 0; }
17   virtual DECLARE_WRITE8_MEMBER(write) {}
18
19protected:
20};
21
22
23// ======================> astrocade_exp_device
24
25class astrocade_exp_device : public device_t,
26                        public device_slot_interface
27{
28public:
29   // construction/destruction
30   astrocade_exp_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
31   virtual ~astrocade_exp_device();
32
33   // device-level overrides
34   virtual void device_start();
35
36   // reading and writing
37   virtual DECLARE_READ8_MEMBER(read);
38   virtual DECLARE_WRITE8_MEMBER(write);
39
40protected:
41
42   device_astrocade_card_interface* m_card;
43};
44
45
46
47// device type definition
48extern const device_type ASTROCADE_EXP_SLOT;
49
50
51#define MCFG_ASTROCADE_EXPANSION_SLOT_ADD(_tag, _slot_intf, _def_slot) \
52   MCFG_DEVICE_ADD(_tag, ASTROCADE_EXP_SLOT, 0) \
53   MCFG_DEVICE_SLOT_INTERFACE(_slot_intf, _def_slot, false)
54
55#endif
trunk/src/emu/bus/astrocde/ram.c
r0r241558
1// license:BSD-3-Clause
2// copyright-holders:etabeta
3/***********************************************************************************************************
4
5
6  Bally Astrocade RAM expansion emulation
7
8      RAM Expansions (info below courtesy of Paul Thacker)
9
10      Several third party RAM expansions have been made for the Astrocade.  These
11      allow access to various ranges of the expansion memory ($5000 to $FFFF).
12      A RAM expansion is required to use extended BASIC programs like Blue RAM BASIC
13      and VIPERSoft BASIC.  All of the expansions also have a RAM protect switch, which
14      can be flipped at any time to make the RAM act like ROM.  Extended BASIC
15      programs need access to the RAM and won't work with RAM protect enabled, but
16      this can be useful with Bally and Astrocade BASIC.  They also have a range switch
17      (not implemented).  The default position is 6K, but it can be switched to
18      2K.  This means that the expanded memory starting at $6000 will instead be
19      mapped to the cartridge memory starting at $2000.  So it would be possible to
20      load a cartridge program from tape into the expansion memory, then flip the range
21      switch and run it as a cartridge.  This is useful for cartridge development.
22     
23      Blue RAM -- available in 4K, 16K, and 32K.  These also use an INS8154 chip,
24      (not yet implemented) which has an additional $80 bytes of RAM mapped
25      immediately after the end of the expansion address space.  This memory
26      can't be write protected.  The INS8154 has I/O features needed for loading
27      tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart.
28      4K:  $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory
29      past this range)
30      16K:  $6000 to $9FFF
31      32K:  $6000 to $DFFF
32     
33      VIPER System 1 -- This is available in 16K only.  It also includes a keyboard (not implemented).
34      16K:  $6000 to $9FFF
35     
36      Lil' WHITE RAM -- This is available in 32K only.  Attempts to read and write
37      to memory outside of its address range ($D000 to $FFFF) are mapped to the expansion
38      memory $5000 to $7FFF.  The current implementation won't allow the shadow RAM area
39      to be accessed when RAM protect is on, but there is no known software that will
40      access the upper range of the expansion RAM when RAM protect is enabled.
41      32K:  $5000 to $CFFF
42     
43      R&L 64K RAM Board -- This is a highly configurable kit.  RAM can be installed in
44      2K increments.  So, the entire 44K expansion memory can be filled.  It is also
45      possible to override the rest of the memory map with RAM (not implemented).
46      There are 32 switches allowing users to activate and deactivate each 2K block (not implemented).
47      RAM write protection can be implemented in three ranges through jumpers or by
48      installing switches.  The ranges are $0000 to $0FFF (first 4K), $0000 to $3FFF (first 16K),
49      and $0000 to $FFFF (all 64K).  The current implementation is for 44K expansion memory mapped from
50      $5000 to $FFFF, with only a single write protect covering this entire range.
51 
52 ***********************************************************************************************************/
53
54
55#include "emu.h"
56#include "ram.h"
57
58
59//-------------------------------------------------
60//  astrocade_rom_device - constructor
61//-------------------------------------------------
62
63const device_type ASTROCADE_BLUERAM_4K  = &device_creator<astrocade_blueram_4k_device>;
64const device_type ASTROCADE_BLUERAM_16K = &device_creator<astrocade_blueram_16k_device>;
65const device_type ASTROCADE_BLUERAM_32K = &device_creator<astrocade_blueram_32k_device>;
66const device_type ASTROCADE_VIPER_SYS1  = &device_creator<astrocade_viper_sys1_device>;
67const device_type ASTROCADE_WHITERAM    = &device_creator<astrocade_whiteram_device>;
68const device_type ASTROCADE_RL64RAM     = &device_creator<astrocade_rl64ram_device>;
69
70
71astrocade_blueram_4k_device::astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source)
72               : device_t(mconfig, type, name, tag, owner, clock, shortname, source),
73                  device_astrocade_card_interface(mconfig, *this),
74                  m_write_prot(*this, "RAM_PROTECT")
75{
76}
77
78astrocade_blueram_4k_device::astrocade_blueram_4k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
79               : device_t(mconfig, ASTROCADE_BLUERAM_4K, "Bally Astrocade Blue RAM 4K", tag, owner, clock, "astrocade_br4", __FILE__),
80                  device_astrocade_card_interface(mconfig, *this),
81                  m_write_prot(*this, "RAM_PROTECT")
82{
83}
84
85astrocade_blueram_16k_device::astrocade_blueram_16k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
86               : astrocade_blueram_4k_device(mconfig, ASTROCADE_BLUERAM_16K, "Bally Astrocade Blue RAM 16K", tag, owner, clock, "astrocade_br16", __FILE__)
87{
88}
89
90astrocade_blueram_32k_device::astrocade_blueram_32k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
91               : astrocade_blueram_4k_device(mconfig, ASTROCADE_BLUERAM_32K, "Bally Astrocade Blue RAM 32K", tag, owner, clock, "astrocade_br32", __FILE__)
92{
93}
94
95astrocade_viper_sys1_device::astrocade_viper_sys1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
96               : device_t(mconfig, ASTROCADE_VIPER_SYS1, "Bally Astrocade Viper System 1", tag, owner, clock, "astrocade_vs1", __FILE__),
97                  device_astrocade_card_interface(mconfig, *this),
98                  m_write_prot(*this, "RAM_PROTECT")
99{
100}
101
102astrocade_whiteram_device::astrocade_whiteram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
103               : device_t(mconfig, ASTROCADE_WHITERAM, "Bally Astrocade Lil' White RAM 32K", tag, owner, clock, "astrocade_lwr", __FILE__),
104                  device_astrocade_card_interface(mconfig, *this),
105                  m_write_prot(*this, "RAM_PROTECT")
106{
107}
108
109astrocade_rl64ram_device::astrocade_rl64ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
110               : device_t(mconfig, ASTROCADE_RL64RAM, "Bally Astrocade R&L RAM 64K", tag, owner, clock, "astrocade_rl64", __FILE__),
111                  device_astrocade_card_interface(mconfig, *this),
112                  m_write_prot(*this, "RAM_PROTECT")
113{
114}
115
116
117//-------------------------------------------------
118//  RAM Write protect switch
119//-------------------------------------------------
120
121static INPUT_PORTS_START( exp_switches )
122   PORT_START("RAM_PROTECT")
123   PORT_CONFNAME( 0x01, 0x00, "Write Protect RAM")
124   PORT_CONFSETTING( 0x00, DEF_STR(Off))
125   PORT_CONFSETTING( 0x01, DEF_STR(On))
126INPUT_PORTS_END
127
128
129ioport_constructor astrocade_blueram_4k_device::device_input_ports() const
130{
131   return INPUT_PORTS_NAME( exp_switches );
132}
133
134ioport_constructor astrocade_viper_sys1_device::device_input_ports() const
135{
136   return INPUT_PORTS_NAME( exp_switches );
137}
138
139ioport_constructor astrocade_whiteram_device::device_input_ports() const
140{
141   return INPUT_PORTS_NAME( exp_switches );
142}
143
144ioport_constructor astrocade_rl64ram_device::device_input_ports() const
145{
146   return INPUT_PORTS_NAME( exp_switches );
147}
148
149/*-------------------------------------------------
150 specific handlers
151 -------------------------------------------------*/
152
153// Blue RAM expansions have RAM starting at 0x6000, up to the RAM size
154READ8_MEMBER(astrocade_blueram_4k_device::read)
155{
156   if (offset >= 0x1000 && offset < 0x1000 + m_ram.bytes())
157      return m_ram[offset - 0x1000];
158   else
159      return 0;
160}
161
162WRITE8_MEMBER(astrocade_blueram_4k_device::write)
163{
164   if (offset >= 0x1000 && offset < 0x1000 + m_ram.bytes() && !m_write_prot->read())
165      m_ram[offset - 0x1000] = data;
166}
167
168
169
170// Viper System 1 expansion has RAM in 0x6000-0x9fff
171READ8_MEMBER(astrocade_viper_sys1_device::read)
172{
173   if (offset >= 0x1000 && offset < 0xa000)
174      return m_ram[offset - 0x1000];
175   else
176      return 0;
177}
178
179WRITE8_MEMBER(astrocade_viper_sys1_device::write)
180{
181   if (offset >= 0x1000 && offset < 0xa000 && !m_write_prot->read())
182      m_ram[offset - 0x1000] = data;
183}
184
185
186
187// Lil' WHITE RAM expansion has RAM in 0x5000-0xcfff + a mirror of the first 0x3000 bytes up to 0xffff
188READ8_MEMBER(astrocade_whiteram_device::read)
189{
190   return m_ram[offset % 0x8000];
191}
192
193WRITE8_MEMBER(astrocade_whiteram_device::write)
194{
195   if (!m_write_prot->read())
196      m_ram[offset % 0x8000] = data;
197}
198
199
200
201// R&L 64K RAM Board (44KB installed) has RAM in 0x5000-0xffff
202READ8_MEMBER(astrocade_rl64ram_device::read)
203{
204   return m_ram[offset];
205}
206
207WRITE8_MEMBER(astrocade_rl64ram_device::write)
208{
209   if (!m_write_prot->read())
210      m_ram[offset] = data;
211}
212
213
trunk/src/emu/bus/astrocde/ram.h
r0r241558
1// license:BSD-3-Clause
2// copyright-holders:etabeta
3#ifndef __ASTROCADE_RAM_H
4#define __ASTROCADE_RAM_H
5
6#include "exp.h"
7
8
9// ======================> astrocade_blueram_4k_device
10
11class astrocade_blueram_4k_device : public device_t,
12                        public device_astrocade_card_interface
13{
14public:
15   // construction/destruction
16   astrocade_blueram_4k_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source);
17   astrocade_blueram_4k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
18
19   // device-level overrides
20   virtual void device_start() { m_ram.resize(0x1000); save_item(NAME(m_ram)); }
21   virtual void device_reset() {}
22   virtual ioport_constructor device_input_ports() const;
23
24   // reading and writing
25   virtual DECLARE_READ8_MEMBER(read);
26   virtual DECLARE_WRITE8_MEMBER(write);
27
28protected:
29   dynamic_buffer m_ram;
30   required_ioport m_write_prot;
31};
32
33// ======================> astrocade_blueram_16k_device
34
35class astrocade_blueram_16k_device : public astrocade_blueram_4k_device
36{
37public:
38   // construction/destruction
39   astrocade_blueram_16k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
40   
41   virtual void device_start() { m_ram.resize(0x4000); save_item(NAME(m_ram)); }
42};
43
44// ======================> astrocade_blueram_32k_device
45
46class astrocade_blueram_32k_device : public astrocade_blueram_4k_device
47{
48public:
49   // construction/destruction
50   astrocade_blueram_32k_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
51   
52   virtual void device_start() { m_ram.resize(0x8000); save_item(NAME(m_ram)); }
53};
54
55// ======================> astrocade_viper_sys1_device
56
57class astrocade_viper_sys1_device : public device_t,
58                        public device_astrocade_card_interface
59{
60public:
61   // construction/destruction
62   astrocade_viper_sys1_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
63   
64   // device-level overrides
65   virtual void device_start() { m_ram.resize(0x4000); save_item(NAME(m_ram)); }
66   virtual void device_reset() {}
67   virtual ioport_constructor device_input_ports() const;
68
69   // reading and writing
70   virtual DECLARE_READ8_MEMBER(read);
71   virtual DECLARE_WRITE8_MEMBER(write);
72   
73private:
74   dynamic_buffer m_ram;
75   required_ioport m_write_prot;
76};
77
78// ======================> astrocade_whiteram_device
79
80class astrocade_whiteram_device : public device_t,
81                        public device_astrocade_card_interface
82{
83public:
84   // construction/destruction
85   astrocade_whiteram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
86   
87   // device-level overrides
88   virtual void device_start() { m_ram.resize(0x8000); save_item(NAME(m_ram)); }
89   virtual void device_reset() {}
90   virtual ioport_constructor device_input_ports() const;
91   
92   // reading and writing
93   virtual DECLARE_READ8_MEMBER(read);
94   virtual DECLARE_WRITE8_MEMBER(write);
95   
96private:
97   dynamic_buffer m_ram;
98   required_ioport m_write_prot;
99};
100
101// ======================> astrocade_rl64ram_device
102
103class astrocade_rl64ram_device : public device_t,
104                     public device_astrocade_card_interface
105{
106public:
107   // construction/destruction
108   astrocade_rl64ram_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
109   
110   // device-level overrides
111   virtual void device_start() { m_ram.resize(0xb000); save_item(NAME(m_ram)); }
112   virtual void device_reset() {}
113   virtual ioport_constructor device_input_ports() const;
114   
115   // reading and writing
116   virtual DECLARE_READ8_MEMBER(read);
117   virtual DECLARE_WRITE8_MEMBER(write);
118   
119private:
120   dynamic_buffer m_ram;
121   required_ioport m_write_prot;
122};
123
124
125
126// device type definition
127extern const device_type ASTROCADE_BLUERAM_4K;
128extern const device_type ASTROCADE_BLUERAM_16K;
129extern const device_type ASTROCADE_BLUERAM_32K;
130extern const device_type ASTROCADE_VIPER_SYS1;
131extern const device_type ASTROCADE_WHITERAM;
132extern const device_type ASTROCADE_RL64RAM;
133
134
135#endif
trunk/src/emu/bus/bus.mak
r241557r241558
129129OBJDIRS += $(BUSOBJ)/astrocde
130130BUSOBJS += $(BUSOBJ)/astrocde/slot.o
131131BUSOBJS += $(BUSOBJ)/astrocde/rom.o
132BUSOBJS += $(BUSOBJ)/astrocde/exp.o
133BUSOBJS += $(BUSOBJ)/astrocde/ram.o
132134endif
133135
134136
trunk/src/mame/drivers/psychic5.c
r241557r241558
408408static ADDRESS_MAP_START( psychic5_main_map, AS_PROGRAM, 8, psychic5_state )
409409   AM_RANGE(0x0000, 0x7fff) AM_ROM
410410   AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1")
411   AM_RANGE(0xc000, 0xdfff) AM_READWRITE(psychic5_paged_ram_r, psychic5_paged_ram_w)
411   AM_RANGE(0xc000, 0xdfff) AM_DEVICE("vrambank", address_map_bank_device, amap8)
412412   AM_RANGE(0xe000, 0xefff) AM_RAM
413413   AM_RANGE(0xf000, 0xf000) AM_WRITE(soundlatch_byte_w)
414414   AM_RANGE(0xf001, 0xf001) AM_READNOP AM_WRITE(psychic5_coin_counter_w)
r241557r241558
421421   AM_RANGE(0xf800, 0xffff) AM_RAM
422422ADDRESS_MAP_END
423423
424
425static ADDRESS_MAP_START( psychic5_vrambank_map, AS_PROGRAM, 8, psychic5_state )
426   AM_RANGE(0x0000, 0x0fff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram")
427   AM_RANGE(0x1000, 0x1fff) AM_RAM
428
429   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SYSTEM")
430   AM_RANGE(0x2001, 0x2001) AM_READ_PORT("P1")
431   AM_RANGE(0x2002, 0x2002) AM_READ_PORT("P2")
432   AM_RANGE(0x2003, 0x2003) AM_READ_PORT("DSW1")
433   AM_RANGE(0x2004, 0x2004) AM_READ_PORT("DSW2")
434
435   AM_RANGE(0x2308, 0x230c) AM_RAM AM_SHARE("bg_control")
436
437   AM_RANGE(0x2400, 0x25ff) AM_RAM_WRITE(sprite_col_w) AM_SHARE("palette_ram_sp")
438   AM_RANGE(0x2800, 0x29ff) AM_RAM_WRITE(bg_col_w) AM_SHARE("palette_ram_bg")
439   AM_RANGE(0x2a00, 0x2bff) AM_RAM_WRITE(tx_col_w) AM_SHARE("palette_ram_tx")
440
441   AM_RANGE(0x3000, 0x37ff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram")
442
443ADDRESS_MAP_END
444
445
424446static ADDRESS_MAP_START( psychic5_sound_map, AS_PROGRAM, 8, psychic5_state )
425447   AM_RANGE(0x0000, 0x7fff) AM_ROM
426448   AM_RANGE(0xc000, 0xc7ff) AM_RAM
r241557r241558
450472   AM_RANGE(0xd200, 0xd7ff) AM_RAM AM_SHARE("spriteram")
451473   AM_RANGE(0xd800, 0xdfff) AM_RAM
452474
453   AM_RANGE(0xe000, 0xffff) AM_READWRITE(psychic5_paged_ram_r, bombsa_paged_ram_w)
475   AM_RANGE(0xe000, 0xffff) AM_DEVICE("vrambank", address_map_bank_device, amap8)
454476ADDRESS_MAP_END
455477
456478static ADDRESS_MAP_START( bombsa_sound_map, AS_PROGRAM, 8, psychic5_state )
r241557r241558
466488   AM_RANGE(0x80, 0x81) AM_DEVREADWRITE("ym2", ym2203_device, read, write)
467489ADDRESS_MAP_END
468490
491static ADDRESS_MAP_START( bombsa_vrambank_map, AS_PROGRAM, 8, psychic5_state )
492   AM_RANGE(0x0000, 0x1fff) AM_RAM_WRITE(bg_videoram_w) AM_SHARE("bg_videoram")
469493
494   AM_RANGE(0x2000, 0x2000) AM_READ_PORT("SYSTEM")
495   AM_RANGE(0x2001, 0x2001) AM_READ_PORT("P1")
496   AM_RANGE(0x2002, 0x2002) AM_READ_PORT("P2")
497   AM_RANGE(0x2003, 0x2003) AM_READ_PORT("DSW1")
498   AM_RANGE(0x2004, 0x2004) AM_READ_PORT("DSW2")
499
500   AM_RANGE(0x2308, 0x230c) AM_RAM AM_SHARE("bg_control")
501
502   AM_RANGE(0x3000, 0x31ff) AM_RAM_WRITE(sprite_col_w) AM_SHARE("palette_ram_sp")
503   AM_RANGE(0x3200, 0x33ff) AM_RAM_WRITE(bg_col_w) AM_SHARE("palette_ram_bg")
504   AM_RANGE(0x3400, 0x35ff) AM_RAM_WRITE(tx_col_w) AM_SHARE("palette_ram_tx")
505
506   AM_RANGE(0x2800, 0x2fff) AM_RAM_WRITE(fg_videoram_w) AM_SHARE("fg_videoram")
507ADDRESS_MAP_END
508
509
470510static INPUT_PORTS_START( psychic5 )
471511   PORT_START("SYSTEM")    /* system control */
472512   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
r241557r241558
655695   MCFG_CPU_PROGRAM_MAP(psychic5_main_map)
656696   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", psychic5_state, psychic5_scanline, "screen", 0, 1)
657697
698   MCFG_DEVICE_ADD("vrambank", ADDRESS_MAP_BANK, 0)
699   MCFG_DEVICE_PROGRAM_MAP(psychic5_vrambank_map)
700   MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE)
701   MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8)
702   MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(14)
703   MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000)
704
658705   MCFG_CPU_ADD("audiocpu", Z80, XTAL_5MHz)
659706   MCFG_CPU_PROGRAM_MAP(psychic5_sound_map)
660707   MCFG_CPU_IO_MAP(psychic5_soundport_map)
r241557r241558
700747   MCFG_CPU_PROGRAM_MAP(bombsa_main_map)
701748   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", psychic5_state, psychic5_scanline, "screen", 0, 1)
702749
750   MCFG_DEVICE_ADD("vrambank", ADDRESS_MAP_BANK, 0)
751   MCFG_DEVICE_PROGRAM_MAP(bombsa_vrambank_map)
752   MCFG_ADDRESS_MAP_BANK_ENDIANNESS(ENDIANNESS_LITTLE)
753   MCFG_ADDRESS_MAP_BANK_DATABUS_WIDTH(8)
754   MCFG_ADDRESS_MAP_BANK_ADDRBUS_WIDTH(14)
755   MCFG_ADDRESS_MAP_BANK_STRIDE(0x2000)
756
703757   MCFG_CPU_ADD("audiocpu", Z80, XTAL_5MHz )
704758   MCFG_CPU_PROGRAM_MAP(bombsa_sound_map)
705759   MCFG_CPU_IO_MAP(bombsa_soundport_map)
r241557r241558
718772   MCFG_PALETTE_ADD("palette", 768)
719773
720774   MCFG_VIDEO_START_OVERRIDE(psychic5_state,bombsa)
721   MCFG_VIDEO_RESET_OVERRIDE(psychic5_state,bombsa)
775   MCFG_VIDEO_RESET_OVERRIDE(psychic5_state,psychic5)
722776
723777   /* sound hardware */
724778   MCFG_SPEAKER_STANDARD_MONO("mono")
trunk/src/mame/includes/psychic5.h
r241557r241558
1#include "machine/bankdev.h"
2
13class psychic5_state : public driver_device
24{
35public:
r241557r241558
79      m_maincpu(*this, "maincpu"),
810      m_audiocpu(*this, "audiocpu"),
911      m_gfxdecode(*this, "gfxdecode"),
10      m_palette(*this, "palette")  { }
12      m_palette(*this, "palette"),
13      m_vrambank(*this, "vrambank"),
14      m_fg_videoram(*this, "fg_videoram"),
15      m_bg_videoram(*this, "bg_videoram"),
16      m_bg_control(*this, "bg_control"),
1117
18      m_ps5_palette_ram_bg(*this, "palette_ram_bg"),
19      m_ps5_palette_ram_sp(*this, "palette_ram_sp"),
20      m_ps5_palette_ram_tx(*this, "palette_ram_tx")
21
22   { }
23
1224   UINT8 m_bank_latch;
1325   UINT8 m_ps5_vram_page;
1426   UINT8 m_bg_clip_mode;
1527   UINT8 m_title_screen;
16   UINT8 m_bg_status;
17   UINT8 *m_ps5_pagedram[2];
18   UINT8 *m_bg_videoram;
19   UINT8 *m_ps5_dummy_bg_ram;
20   UINT8 *m_ps5_io_ram;
21   UINT8 *m_ps5_palette_ram;
22   UINT8 *m_fg_videoram;
28
2329   tilemap_t *m_bg_tilemap;
2430   tilemap_t *m_fg_tilemap;
25   int m_bg_palette_ram_base;
26   int m_bg_palette_base;
2731   UINT16 m_palette_intensity;
2832   UINT8 m_bombsa_unknown;
2933   int m_sx1;
r241557r241558
3842   DECLARE_READ8_MEMBER(psychic5_vram_page_select_r);
3943   DECLARE_WRITE8_MEMBER(psychic5_vram_page_select_w);
4044   DECLARE_WRITE8_MEMBER(psychic5_title_screen_w);
41   DECLARE_READ8_MEMBER(psychic5_paged_ram_r);
42   DECLARE_WRITE8_MEMBER(psychic5_paged_ram_w);
43   DECLARE_WRITE8_MEMBER(bombsa_paged_ram_w);
4445   DECLARE_WRITE8_MEMBER(bombsa_unknown_w);
4546   TILE_GET_INFO_MEMBER(get_bg_tile_info);
4647   TILE_GET_INFO_MEMBER(get_fg_tile_info);
r241557r241558
4849   DECLARE_VIDEO_START(psychic5);
4950   DECLARE_VIDEO_RESET(psychic5);
5051   DECLARE_VIDEO_START(bombsa);
51   DECLARE_VIDEO_RESET(bombsa);
5252   UINT32 screen_update_psychic5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
5353   UINT32 screen_update_bombsa(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
5454   TIMER_DEVICE_CALLBACK_MEMBER(psychic5_scanline);
55   void psychic5_change_palette(int color, int offset);
55   void psychic5_change_palette(int offset, UINT8* palram, int palbase);
5656   void psychic5_change_bg_palette(int color, int lo_offs, int hi_offs);
5757   void set_background_palette_intensity();
5858   void draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
r241557r241558
6262   required_device<cpu_device> m_audiocpu;
6363   required_device<gfxdecode_device> m_gfxdecode;
6464   required_device<palette_device> m_palette;
65   optional_device<address_map_bank_device> m_vrambank;
66   required_shared_ptr<UINT8> m_fg_videoram;
67   required_shared_ptr<UINT8> m_bg_videoram;
68   required_shared_ptr<UINT8> m_bg_control;
69
70   required_shared_ptr<UINT8> m_ps5_palette_ram_bg;
71   required_shared_ptr<UINT8> m_ps5_palette_ram_sp;
72   required_shared_ptr<UINT8> m_ps5_palette_ram_tx;
73
74
75
76   DECLARE_WRITE8_MEMBER(fg_videoram_w);
77   DECLARE_WRITE8_MEMBER(bg_videoram_w);
78   DECLARE_WRITE8_MEMBER(sprite_col_w);
79   DECLARE_WRITE8_MEMBER(bg_col_w);
80   DECLARE_WRITE8_MEMBER(tx_col_w);
81
6582};
trunk/src/mame/machine/zndip.h
r241557r241558
4242
4343   int m_select;
4444   int m_clock;
45   int m_datain;
4645
4746   UINT8 m_bit;
4847   emu_timer *m_dip_timer;
trunk/src/mame/video/psychic5.c
r241557r241558
1010#include "video/jalblend.h"
1111#include "includes/psychic5.h"
1212
13#define BG_SCROLLX_LSB      0x308
14#define BG_SCROLLX_MSB      0x309
15#define BG_SCROLLY_LSB      0x30a
16#define BG_SCROLLY_MSB      0x30b
17#define BG_SCREEN_MODE      0x30c
13
1814#define BG_PAL_INTENSITY_RG 0x1fe
1915#define BG_PAL_INTENSITY_BU 0x1ff
2016
r241557r241558
2319  Palette color
2420***************************************************************************/
2521
26void psychic5_state::psychic5_change_palette(int color, int offset)
22void psychic5_state::psychic5_change_palette(int offset, UINT8* palram, int palbase)
2723{
28   UINT8 lo = m_ps5_palette_ram[offset & ~1];
29   UINT8 hi = m_ps5_palette_ram[offset | 1];
30   jal_blend_set(color, hi & 0x0f);
31   m_palette->set_pen_color(color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
24   UINT8 lo = palram[(offset) & ~1];
25   UINT8 hi = palram[(offset) | 1];
26
27   int color = offset >> 1;
28
29   jal_blend_set(palbase + color, hi & 0x0f);
30   m_palette->set_pen_color(palbase + color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
3231}
3332
3433void psychic5_state::psychic5_change_bg_palette(int color, int lo_offs, int hi_offs)
r241557r241558
4443
4544   irgb = rgb_t(ir,ig,ib);
4645
47   lo = m_ps5_palette_ram[lo_offs];
48   hi = m_ps5_palette_ram[hi_offs];
46   lo = m_ps5_palette_ram_bg[lo_offs];
47   hi = m_ps5_palette_ram_bg[hi_offs];
4948
5049   /* red,green,blue component */
5150   r = pal4bit(lo >> 4);
r241557r241558
5352   b = pal4bit(hi >> 4);
5453
5554   /* Grey background enable */
56   if (m_bg_status & 2)
55   if (m_bg_control[4] & 2)
5756   {
5857      UINT8 val = (r + g + b) / 3;        /* Grey */
5958      /* Just leave plain grey */
r241557r241558
7372void psychic5_state::set_background_palette_intensity()
7473{
7574   int i;
76   m_palette_intensity = m_ps5_palette_ram[BG_PAL_INTENSITY_BU] |
77                  (m_ps5_palette_ram[BG_PAL_INTENSITY_RG]<<8);
75   m_palette_intensity = m_ps5_palette_ram_sp[BG_PAL_INTENSITY_BU] |
76                  (m_ps5_palette_ram_sp[BG_PAL_INTENSITY_RG]<<8);
7877
7978   /* for all of the background palette */
8079   for (i = 0; i < 0x100; i++)
81      psychic5_change_bg_palette(m_bg_palette_base+i,m_bg_palette_ram_base+i*2,m_bg_palette_ram_base+i*2+1);
80      psychic5_change_bg_palette(i+0x100,i*2,i*2+1);
8281}
8382
8483
r241557r241558
9493WRITE8_MEMBER(psychic5_state::psychic5_vram_page_select_w)
9594{
9695   m_ps5_vram_page = data & 1;
96   m_vrambank->set_bank(data);
9797}
9898
9999WRITE8_MEMBER(psychic5_state::psychic5_title_screen_w)
r241557r241558
101101   m_title_screen = data;
102102}
103103
104READ8_MEMBER(psychic5_state::psychic5_paged_ram_r)
105{
106   if (m_ps5_vram_page == 1)
107   {
108      switch (offset)
109      {
110         case 0x00: return ioport("SYSTEM")->read();
111         case 0x01: return ioport("P1")->read();
112         case 0x02: return ioport("P2")->read();
113         case 0x03: return ioport("DSW1")->read();
114         case 0x04: return ioport("DSW2")->read();
115      }
116   }
117104
118   return m_ps5_pagedram[m_ps5_vram_page][offset];
105
106WRITE8_MEMBER(psychic5_state::sprite_col_w)
107{
108   m_ps5_palette_ram_sp[offset] = data;
109   psychic5_change_palette(offset,m_ps5_palette_ram_sp, 0x000);
119110}
120111
121WRITE8_MEMBER(psychic5_state::psychic5_paged_ram_w)
112WRITE8_MEMBER(psychic5_state::bg_col_w)
122113{
123   m_ps5_pagedram[m_ps5_vram_page][offset] = data;
114   m_ps5_palette_ram_bg[offset] = data;
115   psychic5_change_palette(offset,m_ps5_palette_ram_bg, 0x100);
116}
124117
125   if (m_ps5_vram_page == 0)
126   {
127      if (offset <= 0xfff)
128         m_bg_tilemap->mark_tile_dirty(offset >> 1);
129   }
130   else
131   {
132      if (offset == BG_SCROLLX_LSB || offset == BG_SCROLLX_MSB)
133      {
134         UINT16 bg_scrollx = m_ps5_io_ram[BG_SCROLLX_LSB] | (m_ps5_io_ram[BG_SCROLLX_MSB] << 8);
135         m_bg_tilemap->set_scrollx(0, bg_scrollx);
136      }
137      else if (offset == BG_SCROLLY_LSB || offset == BG_SCROLLY_MSB)
138      {
139         UINT16 bg_scrolly = m_ps5_io_ram[BG_SCROLLY_LSB] | (m_ps5_io_ram[BG_SCROLLY_MSB] << 8);
140         m_bg_tilemap->set_scrolly(0, bg_scrolly);
141      }
142      else if (offset == BG_SCREEN_MODE)
143      {
144         m_bg_status = m_ps5_io_ram[BG_SCREEN_MODE];
145      }
146      else if (offset >= 0x400 && offset <= 0x5ff)    /* Sprite color */
147         psychic5_change_palette(((offset >> 1) & 0xff)+0x000,offset-0x400);
148      else if (offset >= 0x800 && offset <= 0x9ff)    /* BG color */
149         psychic5_change_palette(((offset >> 1) & 0xff)+0x100,offset-0x400);
150      else if (offset >= 0xa00 && offset <= 0xbff)    /* Text color */
151         psychic5_change_palette(((offset >> 1) & 0xff)+0x200,offset-0x400);
152      else if (offset >= 0x1000)
153         m_fg_tilemap->mark_tile_dirty((offset-0x1000) >> 1);
154   }
118WRITE8_MEMBER(psychic5_state::tx_col_w)
119{
120   m_ps5_palette_ram_tx[offset] = data;
121   psychic5_change_palette(offset,m_ps5_palette_ram_tx, 0x200);
155122}
156123
157WRITE8_MEMBER(psychic5_state::bombsa_paged_ram_w)
124
125WRITE8_MEMBER(psychic5_state::fg_videoram_w)
158126{
159   m_ps5_pagedram[m_ps5_vram_page][offset] = data;
127   m_fg_videoram[offset] = data;
128   m_fg_tilemap->mark_tile_dirty(offset >> 1);
129}
160130
161   if (m_ps5_vram_page == 0)
162   {
163      m_bg_tilemap->mark_tile_dirty(offset >> 1);
164   }
165   else
166   {
167      if (offset == BG_SCROLLX_LSB || offset == BG_SCROLLX_MSB)
168      {
169         UINT16 bg_scrollx = m_ps5_io_ram[BG_SCROLLX_LSB] | (m_ps5_io_ram[BG_SCROLLX_MSB] << 8);
170         m_bg_tilemap->set_scrollx(0, bg_scrollx);
171      }
172      else if (offset == BG_SCROLLY_LSB || offset == BG_SCROLLY_MSB)
173      {
174         UINT16 bg_scrolly = m_ps5_io_ram[BG_SCROLLY_LSB] | (m_ps5_io_ram[BG_SCROLLY_MSB] << 8);
175         m_bg_tilemap->set_scrolly(0, bg_scrolly);
176      }
177      else if (offset == BG_SCREEN_MODE)
178      {
179         m_bg_status = m_ps5_io_ram[BG_SCREEN_MODE];
180      }
181      else if (offset >= 0x0800 && offset <= 0x0fff)
182         m_fg_tilemap->mark_tile_dirty((offset & 0x7ff) >> 1);
183      else if (offset >= 0x1000 && offset <= 0x15ff)
184         psychic5_change_palette((offset >> 1) & 0x3ff, offset-0x1000);
185   }
131WRITE8_MEMBER( psychic5_state::bg_videoram_w )
132{   
133   m_bg_videoram[offset] = data;
134   m_bg_tilemap->mark_tile_dirty(offset >> 1);
186135}
187136
137
138
188139WRITE8_MEMBER(psychic5_state::bombsa_unknown_w)
189140{
190141   m_bombsa_unknown = data;
r241557r241558
224175
225176VIDEO_START_MEMBER(psychic5_state,psychic5)
226177{
227   /*                          info              offset             w   h  col  row */
228178   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 64, 32);
229179   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,  8,  8, 32, 32);
230
231180   m_fg_tilemap->set_transparent_pen(15);
232
233   m_ps5_pagedram[0] = auto_alloc_array(machine(), UINT8, 0x2000);
234   m_ps5_pagedram[1] = auto_alloc_array(machine(), UINT8, 0x2000);
235
236   m_bg_videoram  = &m_ps5_pagedram[0][0x0000];
237   m_ps5_dummy_bg_ram      = &m_ps5_pagedram[0][0x1000];
238   m_ps5_io_ram            = &m_ps5_pagedram[1][0x0000];
239   m_ps5_palette_ram       = &m_ps5_pagedram[1][0x0400];
240   m_fg_videoram  = &m_ps5_pagedram[1][0x1000];
241
242181   jal_blend_init(machine(), 1);
243182
244   m_bg_palette_ram_base = 0x400;
245   m_bg_palette_base = 0x100;
246183}
247184
248185VIDEO_START_MEMBER(psychic5_state,bombsa)
249186{
250   /*                          info              offset             w   h   col  row */
251187   m_bg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_bg_tile_info),this), TILEMAP_SCAN_COLS, 16, 16, 128, 32);
252188   m_fg_tilemap = &machine().tilemap().create(m_gfxdecode, tilemap_get_info_delegate(FUNC(psychic5_state::get_fg_tile_info),this), TILEMAP_SCAN_COLS,  8,  8,  32, 32);
253
254189   m_fg_tilemap->set_transparent_pen(15);
255
256   m_ps5_pagedram[0] = auto_alloc_array(machine(), UINT8, 0x2000);
257   m_ps5_pagedram[1] = auto_alloc_array(machine(), UINT8, 0x2000);
258
259   m_bg_videoram  = &m_ps5_pagedram[0][0x0000];
260   m_ps5_dummy_bg_ram      = &m_ps5_pagedram[0][0x1000];
261   m_ps5_io_ram            = &m_ps5_pagedram[1][0x0000];
262   m_fg_videoram  = &m_ps5_pagedram[1][0x0800];
263   m_ps5_palette_ram       = &m_ps5_pagedram[1][0x1000];
264
265190   jal_blend_init(machine(), 0);
266
267   m_bg_palette_ram_base = 0x000;
268   m_bg_palette_base = 0x000;
269191}
270192
271193VIDEO_RESET_MEMBER(psychic5_state,psychic5)
272194{
273195   m_bg_clip_mode = 0;
274196   m_ps5_vram_page = 0;
275   m_bg_status = 0;
276   memset(m_ps5_pagedram[0],0,0x2000);
277   memset(m_ps5_pagedram[1],0,0x2000);
278   m_palette_intensity = 0;
279}
280
281VIDEO_RESET_MEMBER(psychic5_state,bombsa)
282{
283   m_ps5_vram_page = 0;
284   m_bg_status = 0;
285197   m_title_screen = 0;
286   memset(m_ps5_pagedram[0],0,0x2000);
287   memset(m_ps5_pagedram[1],0,0x2000);
288198   m_palette_intensity = 0;
289199}
290200
291201
202
292203/***************************************************************************
293204  Screen refresh
294205***************************************************************************/
r241557r241558
406317
407318UINT32 psychic5_state::screen_update_psychic5(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
408319{
320   UINT16 bg_scrollx = m_bg_control[0] | (m_bg_control[1] << 8);
321   m_bg_tilemap->set_scrollx(0, bg_scrollx);
322   UINT16 bg_scrolly = m_bg_control[2] | (m_bg_control[3] << 8);
323   m_bg_tilemap->set_scrolly(0, bg_scrolly);
324
409325   bitmap.fill(m_palette->black_pen(), cliprect);
410   if (m_bg_status & 1)    /* Backgound enable */
326   if (m_bg_control[4] & 1)    /* Backgound enable */
411327      draw_background(screen, bitmap, cliprect);
412328   if (!(m_title_screen & 1))
413329      draw_sprites(bitmap, cliprect);
r241557r241558
417333
418334UINT32 psychic5_state::screen_update_bombsa(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect)
419335{
420   if (m_bg_status & 1)    /* Backgound enable */
336   UINT16 bg_scrollx = m_bg_control[0] | (m_bg_control[1] << 8);
337   m_bg_tilemap->set_scrollx(0, bg_scrollx);
338   UINT16 bg_scrolly = m_bg_control[2] | (m_bg_control[3] << 8);
339   m_bg_tilemap->set_scrolly(0, bg_scrolly);
340   bitmap.fill(m_palette->black_pen(), cliprect);
341
342   if (m_bg_control[4] & 1)    /* Backgound enable */
421343      m_bg_tilemap->draw(screen, bitmap, cliprect, 0, 0);
422344   else
423345      bitmap.fill(m_palette->pen(0x0ff), cliprect);
trunk/src/mess/drivers/astrocde.c
r241557r241558
1414#include "sound/astrocde.h"
1515#include "bus/astrocde/slot.h"
1616#include "bus/astrocde/rom.h"
17#include "bus/astrocde/exp.h"
18#include "bus/astrocde/ram.h"
1719
1820class astrocde_mess_state : public astrocde_state
1921{
r241557r241558
2426      { }
2527
2628   required_device<astrocade_cart_slot_device> m_cart;
27   void get_ram_expansion_settings(int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end);
2829   DECLARE_MACHINE_START(astrocde);
29   DECLARE_MACHINE_RESET(astrocde);
30   DECLARE_INPUT_CHANGED_MEMBER(set_write_protect);
3130};
3231
33/*************************************
32/*********************************************************************************
3433 *
3534 *  Memory maps
3635 *
r241557r241558
4241 * by an extended BASIC program.  Bally and Astrocade BASIC can access from
4342 * $5000 to $7FFF if available.
4443 *
45 *  RAM Expansions
46 *
47 * Several third party RAM expansions have been made for the Astrocade.  These
48 * allow access to various ranges of the expansion memory ($5000 to $FFFF).
49 * A RAM expansion is required to use extended BASIC programs like Blue RAM BASIC
50 * and VIPERSoft BASIC.  All of the expansions also have a RAM protect switch, which
51 * can be flipped at any time to make the RAM act like ROM.  Extended BASIC
52 * programs need access to the RAM and won't work with RAM protect enabled, but
53 * this can be useful with Bally and Astrocade BASIC.  They also have a range switch
54 * (not implemented).  The default position is 6K, but it can be switched to
55 * 2K.  This means that the expanded memory starting at $6000 will instead be
56 * mapped to the cartridge memory starting at $2000.  So it would be possible to
57 * load a cartridge program from tape into the expansion memory, then flip the range
58 * switch and run it as a cartridge.  This is useful for cartridge development.
59 *
60 * NOTE:  If you have any trouble running cartridges with a RAM expansion installed, hit reset.
61 *
62 * Blue RAM -- available in 4K, 16K, and 32K.  These also use an INS8154 chip,
63 * (not yet implemented) which has an additional $80 bytes of RAM mapped
64 * immediately after the end of the expansion address space.  This memory
65 * can't be write protected.  The INS8154 has I/O features needed for loading
66 * tape programs into Blue RAM BASIC, as well as running the Blue RAM Utility cart.
67 * 4K:  $6000 to $6FFF (can't run VIPERSoft BASIC, because this program needs memory
68 * past this range)
69 * 16K:  $6000 to $9FFF
70 * 32K:  $6000 to $DFFF
71 *
72 * VIPER System 1 -- This is available in 16K only.  It also includes a keyboard (not implemented).
73 * 16K:  $6000 to $9FFF
74 *
75 * Lil' WHITE RAM -- This is available in 32K only.  Attempts to read and write
76 * to memory outside of its address range ($D000 to $FFFF) are mapped to the expansion
77 * memory $5000 to $7FFF.  The current implementation won't allow the shadow RAM area
78 * to be accessed when RAM protect is on, but there is no known software that will
79 * access the upper range of the expansion RAM when RAM protect is enabled.
80 * 32K:  $5000 to $CFFF
81 *
82 * R&L 64K RAM Board -- This is a highly configurable kit.  RAM can be installed in
83 * 2K increments.  So, the entire 44K expansion memory can be filled.  It is also
84 * possible to override the rest of the memory map with RAM (not implemented).
85 * There are 32 switches allowing users to activate and deactivate each 2K block (not implemented).
86 * RAM write protection can be implemented in three ranges through jumpers or by
87 * installing switches.  The ranges are $0000 to $0FFF (first 4K), $0000 to $3FFF (first 16K),
88 * and $0000 to $FFFF (all 64K).  The current implementation is for 44K expansion memory mapped from
89 * $5000 to $FFFF, with only a single write protect covering this entire range.
90 *
91 *************************************/
44 *********************************************************************************/
9245
9346static ADDRESS_MAP_START( astrocade_mem, AS_PROGRAM, 8, astrocde_mess_state )
9447   AM_RANGE(0x0000, 0x0fff) AM_ROM AM_WRITE(astrocade_funcgen_w)
9548   AM_RANGE(0x1000, 0x3fff) AM_ROM /* Star Fortress writes in here?? */
9649   AM_RANGE(0x4000, 0x4fff) AM_RAM AM_SHARE("videoram") /* ASG */
50   AM_RANGE(0x5000, 0xffff) AM_DEVREADWRITE("exp", astrocade_exp_device, read, write)
9751ADDRESS_MAP_END
9852
9953
r241557r241558
10155   AM_RANGE(0x00, 0x1f) AM_MIRROR(0xff00) AM_MASK(0xffff) AM_READWRITE(astrocade_data_chip_register_r, astrocade_data_chip_register_w)
10256ADDRESS_MAP_END
10357
104INPUT_CHANGED_MEMBER(astrocde_mess_state::set_write_protect)  // run when RAM expansion write protect switch is changed
105{
106   int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
107   address_space &space = m_maincpu->space(AS_PROGRAM);
108   UINT8 *expram = machine().device<ram_device>("ram_tag")->pointer();
109
110   get_ram_expansion_settings(ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference
111
112   if (ram_expansion_installed == 1)
113   {
114      if (write_protect_on == 0)  // write protect off, so install memory normally
115      {
116         space.install_ram(expansion_ram_start, expansion_ram_end, expram);
117         if (shadow_ram_end > expansion_ram_end)
118            space.install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
119      }
120      else  // write protect on, so make memory read only
121      {
122         space.nop_write(expansion_ram_start, expansion_ram_end);
123      }
124   }
125}
126
12758/*************************************
12859 *
12960 *  Input ports
r241557r241558
227158
228159   PORT_START("P4_KNOB")
229160   PORT_BIT(0xff, 0x00, IPT_PADDLE) PORT_INVERT PORT_SENSITIVITY(85) PORT_KEYDELTA(10) PORT_CENTERDELTA(0) PORT_MINMAX(0,255) PORT_CODE_DEC(KEYCODE_Y) PORT_CODE_INC(KEYCODE_U) PORT_PLAYER(4)
230
231   PORT_START("CFG")   /* machine config */
232   PORT_DIPNAME( 0x3f, 0x00, "RAM Expansion")
233   PORT_DIPSETTING(    0x00, "No RAM Expansion")
234   PORT_DIPSETTING(    0x01, "16KB Viper System 1 RAM Expansion")
235   PORT_DIPSETTING(    0x02, "32KB Lil' WHITE RAM Expansion")
236   PORT_DIPSETTING(    0x04, "R&L 64K RAM Board (44K installed)")
237   PORT_DIPSETTING(    0x08, "4KB Blue RAM Expansion")
238   PORT_DIPSETTING(    0x10, "16KB Blue RAM Expansion")
239   PORT_DIPSETTING(    0x20, "32KB Blue RAM Expansion")
240
241   PORT_START("PROTECT")  /* Write protect RAM */
242   PORT_DIPNAME( 0x01, 0x00, "Write Protect RAM") PORT_CHANGED_MEMBER(DEVICE_SELF, astrocde_mess_state, set_write_protect, 0)
243   PORT_DIPSETTING( 0x00, "Write Protect Off")
244   PORT_DIPSETTING( 0x01, "Write Protect On")
245161INPUT_PORTS_END
246162
247163
r241557r241558
257173   SLOT_INTERFACE_INTERNAL("rom_512k",  ASTROCADE_ROM_512K)
258174SLOT_INTERFACE_END
259175
176static SLOT_INTERFACE_START(astrocade_exp)
177   SLOT_INTERFACE("blue_ram_4k",   ASTROCADE_BLUERAM_4K)
178   SLOT_INTERFACE("blue_ram_16k",  ASTROCADE_BLUERAM_16K)
179   SLOT_INTERFACE("blue_ram_32k",  ASTROCADE_BLUERAM_32K)
180   SLOT_INTERFACE("viper_sys1",    ASTROCADE_VIPER_SYS1)
181   SLOT_INTERFACE("lil_white_ram", ASTROCADE_WHITERAM)
182   SLOT_INTERFACE("rl64_ram",      ASTROCADE_RL64RAM)
183SLOT_INTERFACE_END
260184
185
261186static MACHINE_CONFIG_START( astrocde, astrocde_mess_state )
262187   /* basic machine hardware */
263188   MCFG_CPU_ADD("maincpu", Z80, ASTROCADE_CLOCK/4)        /* 1.789 MHz */
r241557r241558
265190   MCFG_CPU_IO_MAP(astrocade_io)
266191
267192   MCFG_MACHINE_START_OVERRIDE(astrocde_mess_state, astrocde)
268   MCFG_MACHINE_RESET_OVERRIDE(astrocde_mess_state, astrocde)
269193
270194   /* video hardware */
271195   MCFG_SCREEN_ADD("screen", RASTER)
r241557r241558
281205   MCFG_SOUND_ADD("astrocade1", ASTROCADE, ASTROCADE_CLOCK/4)
282206   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 1.00)
283207
284   /* optional expansion ram (installed in machine_reset)*/
285   MCFG_RAM_ADD("ram_tag")
286   MCFG_RAM_DEFAULT_SIZE("32k")
208   /* expansion port */
209   MCFG_ASTROCADE_EXPANSION_SLOT_ADD("exp", astrocade_exp, NULL)
287210
288211   /* cartridge */
289212   MCFG_ASTROCADE_CARTRIDGE_ADD("cartslot", astrocade_cart, NULL)
r241557r241558
331254      m_maincpu->space(AS_PROGRAM).install_read_handler(0x2000, 0x3fff, read8_delegate(FUNC(astrocade_cart_slot_device::read_rom),(astrocade_cart_slot_device*)m_cart));
332255}
333256
334MACHINE_RESET_MEMBER(astrocde_mess_state, astrocde)
335{
336   int ram_expansion_installed = 0, write_protect_on = 0, expansion_ram_start = 0, expansion_ram_end = 0, shadow_ram_end = 0;
337   address_space &space = m_maincpu->space(AS_PROGRAM);
338   UINT8 *expram = machine().device<ram_device>("ram_tag")->pointer();
339   space.unmap_readwrite(0x5000, 0xffff);  // unmap any previously installed expansion RAM
340
341   get_ram_expansion_settings(ram_expansion_installed, write_protect_on, expansion_ram_start, expansion_ram_end, shadow_ram_end);  // passing by reference
342
343   if (ram_expansion_installed == 1)
344   {
345      if (write_protect_on == 0)  // write protect off, so install memory normally
346      {
347         space.install_ram(expansion_ram_start, expansion_ram_end, expram);
348         if (shadow_ram_end > expansion_ram_end)
349            space.install_ram(expansion_ram_end + 1, shadow_ram_end, expram);
350      }
351      else  // write protect on, so make memory read only
352      {
353         space.nop_write(expansion_ram_start, expansion_ram_end);
354      }
355   }
356}
357
358void astrocde_mess_state::get_ram_expansion_settings(int &ram_expansion_installed, int &write_protect_on, int &expansion_ram_start, int &expansion_ram_end, int &shadow_ram_end)
359{
360   if (ioport("PROTECT")->read() == 0x01)
361      write_protect_on = 1;
362   else
363      write_protect_on = 0;
364
365   ram_expansion_installed = 1;
366
367   switch(ioport("CFG")->read())  // check RAM expansion configuration and set address ranges
368   {
369      case 0x00:  // No RAM Expansion
370            ram_expansion_installed = 0;
371            break;
372      case 0x01:  // 16KB Viper System 1 RAM Expansion
373            expansion_ram_start = 0x6000;
374            expansion_ram_end = 0x9fff;
375            shadow_ram_end = 0;
376            break;
377      case 0x02:  // "32KB Lil' WHITE RAM Expansion
378            expansion_ram_start = 0x5000;
379            expansion_ram_end = 0xcfff;
380            shadow_ram_end = 0xffff;
381            break;
382      case 0x04:  // R&L 64K RAM Board (44KB installed)
383            expansion_ram_start = 0x5000;
384            expansion_ram_end = 0xffff;
385            shadow_ram_end = 0;
386            break;
387      case 0x08:  // 4KB Blue RAM Expansion
388            expansion_ram_start = 0x6000;
389            expansion_ram_end = 0x6fff;
390            shadow_ram_end = 0;
391            break;
392      case 0x10:  // 16KB Blue RAM Expansion
393            expansion_ram_start = 0x6000;
394            expansion_ram_end = 0x9fff;
395            shadow_ram_end = 0;
396            break;
397      case 0x20:  // 32KB Blue RAM Expansion
398            expansion_ram_start = 0x6000;
399            expansion_ram_end = 0xdfff;
400            shadow_ram_end = 0;
401            break;
402      default:
403         break;
404   }
405}
406
407
408257/*************************************
409258 *
410259 *  Driver definitions


Previous 199869 Revisions Next


© 1997-2024 The MAME Team