Previous 199869 Revisions Next

r24070 Thursday 4th July, 2013 at 15:22:57 UTC by Tafoid
Modernization of decocomn device  [Osso]
[src/mame/drivers]boogwing.c cninja.c dassault.c dietgo.c pktgaldx.c rohga.c
[src/mame/includes]boogwing.h dietgo.h pktgaldx.h
[src/mame/video]boogwing.c cninja.c dassault.c decocomn.c decocomn.h rohga.c

trunk/src/mame/drivers/dietgo.c
r24069r24070
2626#include "includes/decocrpt.h"
2727#include "includes/decoprot.h"
2828#include "includes/dietgo.h"
29#include "video/decocomn.h"
3029
3130static ADDRESS_MAP_START( dietgo_map, AS_PROGRAM, 16, dietgo_state )
3231   AM_RANGE(0x000000, 0x07ffff) AM_ROM
r24069r24070
3635   AM_RANGE(0x220000, 0x2207ff) AM_WRITEONLY AM_SHARE("pf1_rowscroll")
3736   AM_RANGE(0x222000, 0x2227ff) AM_WRITEONLY AM_SHARE("pf2_rowscroll")
3837   AM_RANGE(0x280000, 0x2807ff) AM_RAM AM_SHARE("spriteram")
39   AM_RANGE(0x300000, 0x300bff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram")
38   AM_RANGE(0x300000, 0x300bff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
4039   AM_RANGE(0x340000, 0x3407ff) AM_READWRITE_LEGACY(dietgo_104_prot_r, dietgo_104_prot_w)
4140   AM_RANGE(0x380000, 0x38ffff) AM_RAM // mainram
4241ADDRESS_MAP_END
trunk/src/mame/drivers/dassault.c
r24069r24070
134134#include "sound/2203intf.h"
135135#include "sound/2151intf.h"
136136#include "sound/okim6295.h"
137#include "video/decocomn.h"
138137
139138/**********************************************************************************/
140139
r24069r24070
216215static ADDRESS_MAP_START( dassault_map, AS_PROGRAM, 16, dassault_state )
217216   AM_RANGE(0x000000, 0x07ffff) AM_ROM
218217
219   AM_RANGE(0x100000, 0x103fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram")
218   AM_RANGE(0x100000, 0x103fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
220219
221220   AM_RANGE(0x140004, 0x140007) AM_WRITENOP /* ? */
222221   AM_RANGE(0x180000, 0x180001) AM_WRITE(dassault_sound_w)
223222
224223   AM_RANGE(0x1c0000, 0x1c000f) AM_READ(dassault_control_r)
225   AM_RANGE(0x1c000a, 0x1c000b) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w)
224   AM_RANGE(0x1c000a, 0x1c000b) AM_DEVWRITE("deco_common", decocomn_device, priority_w)
226225   AM_RANGE(0x1c000c, 0x1c000d) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write)
227226   AM_RANGE(0x1c000e, 0x1c000f) AM_WRITE(dassault_control_w)
228227
trunk/src/mame/drivers/boogwing.c
r24069r24070
8686#include "includes/decoprot.h"
8787#include "sound/2151intf.h"
8888#include "sound/okim6295.h"
89#include "video/decocomn.h"
9089
9190
9291static ADDRESS_MAP_START( boogwing_map, AS_PROGRAM, 16, boogwing_state )
9392   AM_RANGE(0x000000, 0x0fffff) AM_ROM
9493   AM_RANGE(0x200000, 0x20ffff) AM_RAM
9594
96   AM_RANGE(0x220000, 0x220001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w)
95   AM_RANGE(0x220000, 0x220001) AM_DEVWRITE("deco_common", decocomn_device, priority_w)
9796   AM_RANGE(0x220002, 0x22000f) AM_NOP
9897
9998   AM_RANGE(0x240000, 0x240001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write)
r24069r24070
120119
121120   AM_RANGE(0x280000, 0x28000f) AM_NOP // ?
122121   AM_RANGE(0x282000, 0x282001) AM_NOP // Palette setup?
123   AM_RANGE(0x282008, 0x282009) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w)
124   AM_RANGE(0x284000, 0x285fff) AM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram")
122   AM_RANGE(0x282008, 0x282009) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w)
123   AM_RANGE(0x284000, 0x285fff) AM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram")
125124
126125   AM_RANGE(0x3c0000, 0x3c004f) AM_RAM // ?
127126ADDRESS_MAP_END
trunk/src/mame/drivers/cninja.c
r24069r24070
5050#include "sound/2203intf.h"
5151#include "sound/2151intf.h"
5252#include "sound/okim6295.h"
53#include "video/decocomn.h"
5453
5554WRITE16_MEMBER(cninja_state::cninja_sound_w)
5655{
r24069r24070
175174
176175   AM_RANGE(0x184000, 0x187fff) AM_RAM AM_SHARE("ram")
177176   AM_RANGE(0x190000, 0x190007) AM_READWRITE(cninja_irq_r, cninja_irq_w)
178   AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram")
177   AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
179178
180179   AM_RANGE(0x1a4000, 0x1a47ff) AM_RAM AM_SHARE("spriteram")           /* Sprites */
181180   AM_RANGE(0x1b4000, 0x1b4001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* DMA flag */
r24069r24070
210209   AM_RANGE(0x180000, 0x187fff) AM_RAM // more ram on bootleg?
211210
212211   AM_RANGE(0x190000, 0x190007) AM_READWRITE(cninja_irq_r, cninja_irq_w)
213   AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram")
212   AM_RANGE(0x19c000, 0x19dfff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
214213
215214   AM_RANGE(0x1b4000, 0x1b4001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* DMA flag */
216215ADDRESS_MAP_END
r24069r24070
230229   AM_RANGE(0x15c000, 0x15c7ff) AM_RAM AM_SHARE("pf3_rowscroll")
231230   AM_RANGE(0x15e000, 0x15e7ff) AM_RAM AM_SHARE("pf4_rowscroll")
232231
233   AM_RANGE(0x188000, 0x189fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram")
232   AM_RANGE(0x188000, 0x189fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
234233   AM_RANGE(0x194000, 0x197fff) AM_RAM AM_SHARE("ram") /* Main ram */
235234   AM_RANGE(0x198000, 0x1987ff) AM_READWRITE_LEGACY(deco16_60_prot_r, deco16_60_prot_w) AM_SHARE("prot16ram") /* Protection device */
236235   AM_RANGE(0x199550, 0x199551) AM_WRITENOP /* Looks like a bug in game code, a protection write is referenced off a5 instead of a6 and ends up here */
r24069r24070
263262   AM_RANGE(0x18c000, 0x18c7ff) AM_READ(robocop2_prot_r) /* Protection device */
264263   AM_RANGE(0x18c064, 0x18c065) AM_WRITE(cninja_sound_w)
265264   AM_RANGE(0x198000, 0x198001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) /* DMA flag */
266   AM_RANGE(0x1a8000, 0x1a9fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram")
265   AM_RANGE(0x1a8000, 0x1a9fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
267266   AM_RANGE(0x1b0000, 0x1b0007) AM_READWRITE(cninja_irq_r, cninja_irq_w)
268267   AM_RANGE(0x1b8000, 0x1bbfff) AM_RAM AM_SHARE("ram") /* Main ram */
269   AM_RANGE(0x1f0000, 0x1f0001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w)
268   AM_RANGE(0x1f0000, 0x1f0001) AM_DEVWRITE("deco_common", decocomn_device, priority_w)
270269   AM_RANGE(0x1f8000, 0x1f8001) AM_READ_PORT("DSW3") /* Dipswitch #3 */
271270ADDRESS_MAP_END
272271
r24069r24070
275274   AM_RANGE(0x100000, 0x103fff) AM_RAM
276275   AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_SHARE("spriteram")
277276   AM_RANGE(0x140000, 0x1407ff) AM_RAM AM_SHARE("spriteram2")
278   AM_RANGE(0x160000, 0x161fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram")
279   AM_RANGE(0x180000, 0x180001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w)
277   AM_RANGE(0x160000, 0x161fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
278   AM_RANGE(0x180000, 0x180001) AM_DEVWRITE("deco_common", decocomn_device, priority_w)
280279   AM_RANGE(0x180002, 0x180003) AM_WRITENOP /* VBL irq ack */
281280   AM_RANGE(0x1a0000, 0x1a07ff) AM_READWRITE_LEGACY(deco16_66_prot_r, deco16_66_prot_w) AM_SHARE("prot16ram") /* Protection device */
282   AM_RANGE(0x1c0000, 0x1c0001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) AM_DEVREAD_LEGACY("deco_common", decocomn_71_r)
281   AM_RANGE(0x1c0000, 0x1c0001) AM_DEVWRITE("spriteram", buffered_spriteram16_device, write) AM_DEVREAD("deco_common", decocomn_device, d_71_r)
283282   AM_RANGE(0x1e0000, 0x1e0001) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write)
284283
285284   AM_RANGE(0x300000, 0x30000f) AM_WRITE(cninja_pf12_control_w)
trunk/src/mame/drivers/rohga.c
r24069r24070
112112#include "includes/rohga.h"
113113#include "sound/2151intf.h"
114114#include "sound/okim6295.h"
115#include "video/decocomn.h"
116115
117116READ16_MEMBER(rohga_state::rohga_irq_ack_r)
118117{
r24069r24070
142141
143142   AM_RANGE(0x300000, 0x300001) AM_WRITE(rohga_buffer_spriteram16_w) /* write 1 for sprite dma */
144143   AM_RANGE(0x310000, 0x310009) AM_WRITENOP /* Palette control? */
145   AM_RANGE(0x31000a, 0x31000b) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w) /* Write 1111 for dma?  (Or any value?) */
144   AM_RANGE(0x31000a, 0x31000b) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w) /* Write 1111 for dma?  (Or any value?) */
146145   AM_RANGE(0x320000, 0x320001) AM_WRITENOP /* ? */
147   AM_RANGE(0x322000, 0x322001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w)
146   AM_RANGE(0x322000, 0x322001) AM_DEVWRITE("deco_common", decocomn_device, priority_w)
148147   AM_RANGE(0x321100, 0x321101) AM_READ(rohga_irq_ack_r) /* Irq ack?  Value not used */
149148
150149   AM_RANGE(0x3c0000, 0x3c1fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_r, pf1_data_w)
r24069r24070
158157   AM_RANGE(0x3ce000, 0x3cefff) AM_MIRROR(0x1000) AM_RAM AM_SHARE("pf4_rowscroll")
159158
160159   AM_RANGE(0x3d0000, 0x3d07ff) AM_RAM AM_SHARE("spriteram")
161   AM_RANGE(0x3e0000, 0x3e1fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram")
160   AM_RANGE(0x3e0000, 0x3e1fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram")
162161   AM_RANGE(0x3f0000, 0x3f3fff) AM_RAM /* Main ram */
163162ADDRESS_MAP_END
164163
r24069r24070
177176   AM_RANGE(0x300000, 0x30000f) AM_DEVWRITE("tilegen1", deco16ic_device, pf_control_w)
178177   AM_RANGE(0x310000, 0x31000f) AM_DEVWRITE("tilegen2", deco16ic_device, pf_control_w)
179178
180   AM_RANGE(0x320000, 0x320001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) /* Priority */
179   AM_RANGE(0x320000, 0x320001) AM_DEVWRITE("deco_common", decocomn_device, priority_w) /* Priority */
181180   AM_RANGE(0x320002, 0x320003) AM_WRITENOP /* ? */
182181   AM_RANGE(0x320004, 0x320005) AM_WRITE(wizdfire_irq_ack_w) /* VBL IRQ ack */
183182
r24069r24070
186185   AM_RANGE(0x360000, 0x3607ff) AM_RAM AM_SHARE("spriteram2")
187186   AM_RANGE(0x370000, 0x370001) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write) /* Triggers DMA for spriteram */
188187
189   AM_RANGE(0x380000, 0x381fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram")
190   AM_RANGE(0x390008, 0x390009) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w)
188   AM_RANGE(0x380000, 0x381fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram")
189   AM_RANGE(0x390008, 0x390009) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w)
191190
192191   AM_RANGE(0xfe4000, 0xfe47ff) AM_READWRITE_LEGACY(deco16_104_prot_r,deco16_104_prot_w) AM_SHARE("prot16ram") /* Protection device */
193192   AM_RANGE(0xfdc000, 0xffffff) AM_RAM
r24069r24070
209208   AM_RANGE(0x300000, 0x30000f) AM_DEVWRITE("tilegen1", deco16ic_device, pf_control_w)
210209   AM_RANGE(0x310000, 0x31000f) AM_DEVWRITE("tilegen2", deco16ic_device, pf_control_w)
211210
212   AM_RANGE(0x320000, 0x320001) AM_READ_PORT("DSW3") AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w) /* Priority */
211   AM_RANGE(0x320000, 0x320001) AM_READ_PORT("DSW3") AM_DEVWRITE("deco_common", decocomn_device, priority_w) /* Priority */
213212   AM_RANGE(0x320002, 0x320003) AM_WRITENOP /* ? */
214213   AM_RANGE(0x320004, 0x320005) AM_WRITE(wizdfire_irq_ack_w) /* VBL IRQ ack */
215214
r24069r24070
218217   AM_RANGE(0x360000, 0x3607ff) AM_RAM AM_SHARE("spriteram2")
219218   AM_RANGE(0x370000, 0x370001) AM_DEVWRITE("spriteram2", buffered_spriteram16_device, write) /* Triggers DMA for spriteram */
220219
221   AM_RANGE(0x380000, 0x381fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram")
222   AM_RANGE(0x390008, 0x390009) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w)
220   AM_RANGE(0x380000, 0x381fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram")
221   AM_RANGE(0x390008, 0x390009) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w)
223222
224223   AM_RANGE(0xfec000, 0xff3fff) AM_RAM
225224   AM_RANGE(0xff4000, 0xff47ff) AM_MIRROR(0x800) AM_READWRITE_LEGACY(deco16_146_nitroball_prot_r,deco16_146_nitroball_prot_w) AM_SHARE("prot16ram") /* Protection device */
r24069r24070
236235   AM_RANGE(0x300000, 0x300001) AM_READ_PORT("DSW3")  AM_WRITE(rohga_buffer_spriteram16_w) /* write 1 for sprite dma */
237236   AM_RANGE(0x310002, 0x310003) AM_READ_PORT("IN1")
238237   AM_RANGE(0x310000, 0x310009) AM_WRITENOP /* Palette control? */
239   AM_RANGE(0x31000a, 0x31000b) AM_DEVWRITE_LEGACY("deco_common", decocomn_palette_dma_w) /* Write 1111 for dma?  (Or any value?) */
238   AM_RANGE(0x31000a, 0x31000b) AM_DEVWRITE("deco_common", decocomn_device, palette_dma_w) /* Write 1111 for dma?  (Or any value?) */
240239   AM_RANGE(0x320000, 0x320001) AM_WRITENOP /* ? */
241   AM_RANGE(0x322000, 0x322001) AM_DEVWRITE_LEGACY("deco_common", decocomn_priority_w)
240   AM_RANGE(0x322000, 0x322001) AM_DEVWRITE("deco_common", decocomn_device, priority_w)
242241   AM_RANGE(0x321100, 0x321101) AM_WRITE(wizdfire_irq_ack_w)  /* Irq ack?  Value not used */
243242
244243   AM_RANGE(0x3c0000, 0x3c1fff) AM_DEVREADWRITE("tilegen1", deco16ic_device, pf1_data_r, pf1_data_w)
r24069r24070
251250   AM_RANGE(0x3ce000, 0x3cefff) AM_MIRROR(0x1000) AM_RAM AM_SHARE("pf4_rowscroll")
252251
253252   AM_RANGE(0x3d0000, 0x3d07ff) AM_RAM AM_SHARE("spriteram")
254   AM_RANGE(0x3e0000, 0x3e1fff) AM_MIRROR(0x2000) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_buffered_palette_w) AM_SHARE("paletteram")
253   AM_RANGE(0x3e0000, 0x3e1fff) AM_MIRROR(0x2000) AM_RAM_DEVWRITE("deco_common", decocomn_device, buffered_palette_w) AM_SHARE("paletteram")
255254   AM_RANGE(0xff0000, 0xff7fff) AM_RAM /* Main ram */
256255ADDRESS_MAP_END
257256
trunk/src/mame/drivers/pktgaldx.c
r24069r24070
5858#include "includes/decoprot.h"
5959#include "sound/okim6295.h"
6060#include "includes/pktgaldx.h"
61#include "video/decocomn.h"
6261
6362/**********************************************************************************/
6463
r24069r24070
7877   AM_RANGE(0x112000, 0x1127ff) AM_RAM AM_SHARE("pf2_rowscroll")
7978
8079   AM_RANGE(0x120000, 0x1207ff) AM_RAM AM_SHARE("spriteram")
81   AM_RANGE(0x130000, 0x130fff) AM_RAM_DEVWRITE_LEGACY("deco_common", decocomn_nonbuffered_palette_w) AM_SHARE("paletteram")
80   AM_RANGE(0x130000, 0x130fff) AM_RAM_DEVWRITE("deco_common", decocomn_device, nonbuffered_palette_w) AM_SHARE("paletteram")
8281
8382   AM_RANGE(0x140000, 0x14000f) AM_DEVWRITE8("oki1", okim6295_device, write, 0x00ff)
8483   AM_RANGE(0x140006, 0x140007) AM_DEVREAD8("oki1", okim6295_device, read, 0x00ff)
trunk/src/mame/includes/dietgo.h
r24069r24070
66
77#include "video/decospr.h"
88#include "video/deco16ic.h"
9#include "video/decocomn.h"
910
1011class dietgo_state : public driver_device
1112{
r24069r24070
1819      m_sprgen(*this, "spritegen"),
1920      m_maincpu(*this, "maincpu"),
2021      m_audiocpu(*this, "audiocpu"),
21      m_deco_tilegen1(*this, "tilegen1")
22      m_deco_tilegen1(*this, "tilegen1"),
23      m_decocomn(*this, "deco_common")
2224   { }
2325
2426   /* memory pointers */
r24069r24070
3234   required_device<cpu_device> m_maincpu;
3335   required_device<cpu_device> m_audiocpu;
3436   required_device<deco16ic_device> m_deco_tilegen1;
37   required_device<decocomn_device> m_decocomn;
3538   DECLARE_DRIVER_INIT(dietgo);
3639   virtual void machine_start();
3740   UINT32 screen_update_dietgo(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect);
trunk/src/mame/includes/boogwing.h
r24069r24070
88#include "video/deco16ic.h"
99#include "video/decocomn.h"
1010#include "video/bufsprite.h"
11#include "video/decocomn.h"
1112#include "video/decospr.h"
1213
1314class boogwing_state : public driver_device
trunk/src/mame/includes/pktgaldx.h
r24069r24070
66#include "sound/okim6295.h"
77#include "video/decospr.h"
88#include "video/deco16ic.h"
9#include "video/decocomn.h"
910
1011class pktgaldx_state : public driver_device
1112{
r24069r24070
2021      m_sprgen(*this, "spritegen"),
2122      m_maincpu(*this, "maincpu"),
2223      m_oki2(*this, "oki2"),
23      m_deco_tilegen1(*this, "tilegen1")
24   { }
24      m_deco_tilegen1(*this, "tilegen1"),
25      m_decocomn(*this, "deco_common") { }
2526
2627   /* memory pointers */
2728   optional_shared_ptr<UINT16> m_pf1_rowscroll;
r24069r24070
3738   required_device<cpu_device> m_maincpu;
3839   required_device<okim6295_device> m_oki2;
3940   optional_device<deco16ic_device> m_deco_tilegen1;
41   optional_device<decocomn_device> m_decocomn;
4042   DECLARE_READ16_MEMBER(pckgaldx_unknown_r);
4143   DECLARE_READ16_MEMBER(pckgaldx_protection_r);
4244   DECLARE_WRITE16_MEMBER(pktgaldx_oki_bank_w);
trunk/src/mame/video/cninja.c
r24069r24070
66
77#include "emu.h"
88#include "includes/cninja.h"
9#include "video/decocomn.h"
109
1110/******************************************************************************/
1211
r24069r24070
189188{
190189   address_space &space = machine().driver_data()->generic_space();
191190   UINT16 flip = m_deco_tilegen1->pf_control_r(space, 0, 0xffff);
192   UINT16 priority = decocomn_priority_r(m_decocomn, space, 0, 0xffff);
191   UINT16 priority = m_decocomn->priority_r(space, 0, 0xffff);
193192
194193   /* One of the tilemap chips can switch between 2 tilemaps at 4bpp, or 1 at 8bpp */
195194   if (priority & 4)
r24069r24070
246245{
247246   address_space &space = machine().driver_data()->generic_space();
248247   UINT16 flip = m_deco_tilegen1->pf_control_r(space, 0, 0xffff);
249   UINT16 priority = decocomn_priority_r(m_decocomn, space, 0, 0xffff);
248   UINT16 priority = m_decocomn->priority_r(space, 0, 0xffff);
250249
251250
252251   flip_screen_set(BIT(flip, 7));
trunk/src/mame/video/rohga.c
r24069r24070
6464{
6565   address_space &space = machine().driver_data()->generic_space();
6666   UINT16 flip = m_deco_tilegen1->pf_control_r(space, 0, 0xffff);
67   UINT16 priority = decocomn_priority_r(m_decocomn, space, 0, 0xffff);
67   UINT16 priority = m_decocomn->priority_r(space, 0, 0xffff);
6868
6969   /* Update playfields */
7070   flip_screen_set(BIT(flip, 7));
r24069r24070
167167{
168168   address_space &space = machine().driver_data()->generic_space();
169169   UINT16 flip = m_deco_tilegen1->pf_control_r(space, 0, 0xffff);
170   UINT16 priority = decocomn_priority_r(m_decocomn, space, 0, 0xffff);
170   UINT16 priority = m_decocomn->priority_r(space, 0, 0xffff);
171171
172172   /* draw sprite gfx to temp bitmaps */
173173   m_sprgen2->draw_sprites(bitmap, cliprect, m_spriteram2->buffer(), 0x400, true);
trunk/src/mame/video/dassault.c
r24069r24070
1515
1616#include "emu.h"
1717#include "includes/dassault.h"
18#include "video/decocomn.h"
1918
2019/******************************************************************************/
2120
r24069r24070
7675{
7776   address_space &space = machine().driver_data()->generic_space();
7877   UINT16 flip = m_deco_tilegen1->pf_control_r(space, 0, 0xffff);
79   UINT16 priority = decocomn_priority_r(m_decocomn, space, 0, 0xffff);
78   UINT16 priority = m_decocomn->priority_r(space, 0, 0xffff);
8079
8180   m_sprgen2->draw_sprites(bitmap, cliprect, m_spriteram2->buffer(), 0x400, false);
8281   m_sprgen1->draw_sprites(bitmap, cliprect, m_spriteram->buffer(), 0x400, false);
trunk/src/mame/video/decocomn.c
r24069r24070
99#include "ui.h"
1010
1111
12struct decocomn_state
12const device_type DECOCOMN = &device_creator<decocomn_device>;
13
14decocomn_device::decocomn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
15   : device_t(mconfig, DECOCOMN, "Data East Common Video Functions", tag, owner, clock, "decocomn", __FILE__),
16   m_screen(NULL),
17   m_dirty_palette(NULL),
18   m_priority(0)
1319{
14   screen_device *screen;
15   UINT8 *dirty_palette;
16   UINT16 priority;
17};
20}
1821
19/*****************************************************************************
20    INLINE FUNCTIONS
21*****************************************************************************/
22//-------------------------------------------------
23//  device_config_complete - perform any
24//  operations now that the configuration is
25//  complete
26//-------------------------------------------------
2227
23INLINE decocomn_state *get_safe_token( device_t *device )
28void decocomn_device::device_config_complete()
2429{
25   assert(device != NULL);
26   assert(device->type() == DECOCOMN);
30   // inherit a copy of the static data
31   const decocomn_interface *intf = reinterpret_cast<const decocomn_interface *>(static_config());
32   if (intf != NULL)
33   *static_cast<decocomn_interface *>(this) = *intf;
2734
28   return (decocomn_state *)downcast<decocomn_device *>(device)->token();
35   // or initialize to defaults if none provided
36   else
37   {
38   m_screen_tag = "";
39   }
2940}
3041
31INLINE const decocomn_interface *get_interface( device_t *device )
42//-------------------------------------------------
43//  device_start - device-specific startup
44//-------------------------------------------------
45
46void decocomn_device::device_start()
3247{
33   assert(device != NULL);
34   assert((device->type() == DECOCOMN));
35   return (const decocomn_interface *) device->static_config();
48//  int width, height;
49
50   m_screen = machine().device<screen_device>(m_screen_tag);
51//  width = m_screen->width();
52//  height = m_screen->height();
53
54   m_dirty_palette = auto_alloc_array_clear(machine(), UINT8, 4096);
55
56   save_item(NAME(m_priority));
57   save_pointer(NAME(m_dirty_palette), 4096);
3658}
3759
60//-------------------------------------------------
61//  device_reset - device-specific reset
62//-------------------------------------------------
63
64void decocomn_device::device_reset()
65{
66   m_priority = 0;
67}
68
3869/*****************************************************************************
3970    DEVICE HANDLERS
4071*****************************************************************************/
r24069r24070
4273/* Later games have double buffered paletteram - the real palette ram is
4374only updated on a DMA call */
4475
45WRITE16_DEVICE_HANDLER( decocomn_nonbuffered_palette_w )
76WRITE16_MEMBER( decocomn_device::nonbuffered_palette_w )
4677{
78   driver_device *state = space.machine().driver_data();
79   
4780   int r,g,b;
4881
49   driver_device *state = space.machine().driver_data();
5082   COMBINE_DATA(&state->m_generic_paletteram_16[offset]);
5183   if (offset&1) offset--;
5284
r24069r24070
5789   palette_set_color(space.machine(), offset / 2, MAKE_RGB(r,g,b));
5890}
5991
60WRITE16_DEVICE_HANDLER( decocomn_buffered_palette_w )
92WRITE16_MEMBER( decocomn_device::buffered_palette_w )
6193{
62   decocomn_state *decocomn = get_safe_token(device);
63
6494   driver_device *state = space.machine().driver_data();
95   
6596   COMBINE_DATA(&state->m_generic_paletteram_16[offset]);
6697
67   decocomn->dirty_palette[offset / 2] = 1;
98   m_dirty_palette[offset / 2] = 1;
6899}
69100
70WRITE16_DEVICE_HANDLER( decocomn_palette_dma_w )
101WRITE16_MEMBER( decocomn_device::palette_dma_w )
71102{
72   decocomn_state *decocomn = get_safe_token(device);
73103   driver_device *state = space.machine().driver_data();
104   
74105   const int m = space.machine().total_colors();
75106   int r, g, b, i;
76107
77108   for (i = 0; i < m; i++)
78109   {
79      if (decocomn->dirty_palette[i])
110      if (m_dirty_palette[i])
80111      {
81         decocomn->dirty_palette[i] = 0;
112         m_dirty_palette[i] = 0;
82113
83114         b = (state->m_generic_paletteram_16[i * 2] >> 0) & 0xff;
84115         g = (state->m_generic_paletteram_16[i * 2 + 1] >> 8) & 0xff;
r24069r24070
92123/*****************************************************************************************/
93124
94125/* */
95READ16_DEVICE_HANDLER( decocomn_71_r )
126READ16_MEMBER( decocomn_device::d_71_r )
96127{
97128   return 0xffff;
98129}
99130
100WRITE16_DEVICE_HANDLER( decocomn_priority_w )
131WRITE16_MEMBER( decocomn_device::priority_w )
101132{
102   decocomn_state *decocomn = get_safe_token(device);
103   decocomn->priority = data;
133   m_priority = data;
104134}
105135
106READ16_DEVICE_HANDLER( decocomn_priority_r )
136READ16_MEMBER( decocomn_device::priority_r )
107137{
108   decocomn_state *decocomn = get_safe_token(device);
109   return decocomn->priority;
138   return m_priority;
110139}
111
112
113/******************************************************************************/
114
115/*****************************************************************************
116    DEVICE INTERFACE
117*****************************************************************************/
118
119static DEVICE_START( decocomn )
120{
121   decocomn_state *decocomn = get_safe_token(device);
122   const decocomn_interface *intf = get_interface(device);
123//  int width, height;
124
125   decocomn->screen = device->machine().device<screen_device>(intf->screen);
126//  width = decocomn->screen->width();
127//  height = decocomn->screen->height();
128
129   decocomn->dirty_palette = auto_alloc_array_clear(device->machine(), UINT8, 4096);
130
131   device->save_item(NAME(decocomn->priority));
132   device->save_pointer(NAME(decocomn->dirty_palette), 4096);
133}
134
135static DEVICE_RESET( decocomn )
136{
137   decocomn_state *decocomn = get_safe_token(device);
138   decocomn->priority = 0;
139}
140
141
142const device_type DECOCOMN = &device_creator<decocomn_device>;
143
144decocomn_device::decocomn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
145   : device_t(mconfig, DECOCOMN, "Data East Common Video Functions", tag, owner, clock, "decocomn", __FILE__)
146{
147   m_token = global_alloc_clear(decocomn_state);
148}
149
150//-------------------------------------------------
151//  device_config_complete - perform any
152//  operations now that the configuration is
153//  complete
154//-------------------------------------------------
155
156void decocomn_device::device_config_complete()
157{
158}
159
160//-------------------------------------------------
161//  device_start - device-specific startup
162//-------------------------------------------------
163
164void decocomn_device::device_start()
165{
166   DEVICE_START_NAME( decocomn )(this);
167}
168
169//-------------------------------------------------
170//  device_reset - device-specific reset
171//-------------------------------------------------
172
173void decocomn_device::device_reset()
174{
175   DEVICE_RESET_NAME( decocomn )(this);
176}
trunk/src/mame/video/decocomn.h
r24069r24070
88#ifndef __DECOCOMN_H__
99#define __DECOCOMN_H__
1010
11#include "devcb.h"
1211
13
1412/***************************************************************************
1513    TYPE DEFINITIONS
1614***************************************************************************/
r24069r24070
1816
1917struct decocomn_interface
2018{
21   const char         *screen;
19   const char         *m_screen_tag;
2220};
2321
24class decocomn_device : public device_t
22class decocomn_device : public device_t,
23                              public decocomn_interface
2524{
2625public:
2726   decocomn_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock);
28   ~decocomn_device() { global_free(m_token); }
27   ~decocomn_device() {}
28   
29   DECLARE_WRITE16_MEMBER( nonbuffered_palette_w );
30   DECLARE_WRITE16_MEMBER( buffered_palette_w );
31   DECLARE_WRITE16_MEMBER( palette_dma_w );
32   DECLARE_WRITE16_MEMBER( priority_w );
33   DECLARE_READ16_MEMBER( priority_r );
34   DECLARE_READ16_MEMBER( d_71_r );
2935
30   // access to legacy token
31   void *token() const { assert(m_token != NULL); return m_token; }
3236protected:
3337   // device-level overrides
3438   virtual void device_config_complete();
3539   virtual void device_start();
3640   virtual void device_reset();
41
3742private:
3843   // internal state
39   void *m_token;
44   screen_device *m_screen;
45   UINT8 *m_dirty_palette;
46   UINT16 m_priority;
4047};
4148
4249extern const device_type DECOCOMN;
r24069r24070
5158   MCFG_DEVICE_ADD(_tag, DECOCOMN, 0) \
5259   MCFG_DEVICE_CONFIG(_interface)
5360
54/***************************************************************************
55    DEVICE I/O FUNCTIONS
56***************************************************************************/
57
58DECLARE_WRITE16_DEVICE_HANDLER( decocomn_nonbuffered_palette_w );
59DECLARE_WRITE16_DEVICE_HANDLER( decocomn_buffered_palette_w );
60DECLARE_WRITE16_DEVICE_HANDLER( decocomn_palette_dma_w );
61
62DECLARE_WRITE16_DEVICE_HANDLER( decocomn_priority_w );
63DECLARE_READ16_DEVICE_HANDLER( decocomn_priority_r );
64
65DECLARE_READ16_DEVICE_HANDLER( decocomn_71_r );
66
6761#endif
trunk/src/mame/video/boogwing.c
r24069r24070
11#include "emu.h"
22#include "includes/boogwing.h"
3#include "video/deco16ic.h"
4#include "video/decocomn.h"
53
64
75void boogwing_state::video_start()
r24069r24070
2826   bitmap_ind8* priority_bitmap;
2927
3028   address_space &space = machine().driver_data()->generic_space();
31   UINT16 priority = decocomn_priority_r(m_decocomn, space, 0, 0xffff);
29   UINT16 priority = m_decocomn->priority_r(space, 0, 0xffff);
3230
3331   sprite_bitmap1 = &m_sprgen1->get_sprite_temp_bitmap();
3432   sprite_bitmap2 = &m_sprgen2->get_sprite_temp_bitmap();
r24069r24070
181179{
182180   address_space &space = machine().driver_data()->generic_space();
183181   UINT16 flip = m_deco_tilegen1->pf_control_r(space, 0, 0xffff);
184   UINT16 priority = decocomn_priority_r(m_decocomn, space, 0, 0xffff);
182   UINT16 priority = m_decocomn->priority_r(space, 0, 0xffff);
185183
186184   /* Draw sprite planes to bitmaps for later mixing */
187185   m_sprgen2->draw_sprites(bitmap, cliprect, m_spriteram2->buffer(), 0x400, true);

Previous 199869 Revisions Next


© 1997-2024 The MAME Team