Previous 199869 Revisions Next

r36128 Friday 27th February, 2015 at 18:00:28 UTC by Osso
argus.c: killed trampolines, made use of configured banks, added save state support (nw)
[src/mame/drivers]argus.c
[src/mame/includes]argus.h
[src/mame/video]argus.c

trunk/src/mame/drivers/argus.c
r244639r244640
107107===============
108108 - Half transparent color (50% alpha blending) is not emulated.
109109 - Sprite priority switch of Butasan is shown in test mode. What will be
110   happened when set it ? JFF is not implemented this mistery switch too.
110   happened when set it ? JFF is not implemented this mystery switch too.
111111 - Data proms of Butasan does exist. But I don't know what is used for.
112112 - Though clock speed of Argus is actually 4 MHz, major sprite problems
113113   are broken out in the middle of slowdown. So, it is set 5 MHz now.
r244639r244640
123123#include "includes/argus.h"
124124
125125
126void argus_state::machine_start()
127{
128   membank("mainbank")->configure_entries(0, 8, memregion("maincpu")->base() + 0x10000, 0x4000);
129}
130
126131/***************************************************************************
127132
128133  Interrupt(s)
129134
130135***************************************************************************/
131136
132TIMER_DEVICE_CALLBACK_MEMBER(argus_state::argus_scanline)
137TIMER_DEVICE_CALLBACK_MEMBER(argus_state::scanline)
133138{
134139   int scanline = param;
135140
r244639r244640
151156      m_maincpu->set_input_line_and_vector(0, HOLD_LINE,0xcf); /* RST 08h */
152157}
153158
154/* Handler called by the YM2203 emulator when the internal timers cause an IRQ */
155WRITE_LINE_MEMBER(argus_state::irqhandler)
156{
157   m_audiocpu->set_input_line(0, state ? ASSERT_LINE : CLEAR_LINE);
158}
159159
160160/***************************************************************************
161161
r244639r244640
163163
164164***************************************************************************/
165165
166WRITE8_MEMBER(argus_state::argus_bankselect_w)
166WRITE8_MEMBER(argus_state::bankselect_w)
167167{
168   UINT8 *RAM = memregion("maincpu")->base();
169   int bankaddress;
170
171   bankaddress = 0x10000 + ((data & 7) * 0x4000);
172   membank("bank1")->set_base(&RAM[bankaddress]);   /* Select 8 banks of 16k */
168   membank("mainbank")->set_entry(data & 7);   /* Select 8 banks of 16k */
173169}
174170
175171
r244639r244640
181177
182178static ADDRESS_MAP_START( argus_map, AS_PROGRAM, 8, argus_state )
183179   AM_RANGE(0x0000, 0x7fff) AM_ROM
184   AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1")
180   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("mainbank")
185181   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("SYSTEM")
186182   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P1")
187183   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
188184   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
189185   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
190186   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w)
191   AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w)
192   AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w)
187   AM_RANGE(0xc201, 0xc201) AM_WRITE(flipscreen_w)
188   AM_RANGE(0xc202, 0xc202) AM_WRITE(bankselect_w)
193189   AM_RANGE(0xc300, 0xc301) AM_RAM AM_SHARE("bg0_scrollx")
194190   AM_RANGE(0xc302, 0xc303) AM_RAM AM_SHARE("bg0_scrolly")
195191   AM_RANGE(0xc308, 0xc309) AM_RAM AM_SHARE("bg1_scrollx")
196192   AM_RANGE(0xc30a, 0xc30b) AM_RAM AM_SHARE("bg1_scrolly")
197193   AM_RANGE(0xc30c, 0xc30c) AM_WRITE(argus_bg_status_w)
198   AM_RANGE(0xc400, 0xcfff) AM_READWRITE(argus_paletteram_r, argus_paletteram_w) AM_SHARE("paletteram")
199   AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(argus_txram_r, argus_txram_w) AM_SHARE("txram")
200   AM_RANGE(0xd800, 0xdfff) AM_READWRITE(argus_bg1ram_r, argus_bg1ram_w) AM_SHARE("bg1ram")
194   AM_RANGE(0xc400, 0xcfff) AM_RAM_WRITE(argus_paletteram_w) AM_SHARE("paletteram")
195   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(txram_w) AM_SHARE("txram")
196   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(bg1ram_w) AM_SHARE("bg1ram")
201197   AM_RANGE(0xe000, 0xf1ff) AM_RAM
202198   AM_RANGE(0xf200, 0xf7ff) AM_RAM AM_SHARE("spriteram")
203199   AM_RANGE(0xf800, 0xffff) AM_RAM
r244639r244640
205201
206202static ADDRESS_MAP_START( valtric_map, AS_PROGRAM, 8, argus_state )
207203   AM_RANGE(0x0000, 0x7fff) AM_ROM
208   AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1")
204   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("mainbank")
209205   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("SYSTEM")
210206   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P1")
211207   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
212208   AM_RANGE(0xc003, 0xc003) AM_READ_PORT("DSW1")
213209   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
214210   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w)
215   AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w)
216   AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w)
211   AM_RANGE(0xc201, 0xc201) AM_WRITE(flipscreen_w)
212   AM_RANGE(0xc202, 0xc202) AM_WRITE(bankselect_w)
217213   AM_RANGE(0xc300, 0xc300) AM_WRITE(valtric_unknown_w)
218214   AM_RANGE(0xc308, 0xc309) AM_RAM AM_SHARE("bg1_scrollx")
219215   AM_RANGE(0xc30a, 0xc30b) AM_RAM AM_SHARE("bg1_scrolly")
220216   AM_RANGE(0xc30c, 0xc30c) AM_WRITE(valtric_bg_status_w)
221217   AM_RANGE(0xc30d, 0xc30d) AM_WRITE(valtric_mosaic_w)
222   AM_RANGE(0xc400, 0xcfff) AM_READWRITE(argus_paletteram_r, valtric_paletteram_w) AM_SHARE("paletteram")
223   AM_RANGE(0xd000, 0xd7ff) AM_READWRITE(argus_txram_r, argus_txram_w) AM_SHARE("txram")
224   AM_RANGE(0xd800, 0xdfff) AM_READWRITE(argus_bg1ram_r, argus_bg1ram_w) AM_SHARE("bg1ram")
218   AM_RANGE(0xc400, 0xcfff) AM_RAM_WRITE(valtric_paletteram_w) AM_SHARE("paletteram")
219   AM_RANGE(0xd000, 0xd7ff) AM_RAM_WRITE(txram_w) AM_SHARE("txram")
220   AM_RANGE(0xd800, 0xdfff) AM_RAM_WRITE(bg1ram_w) AM_SHARE("bg1ram")
225221   AM_RANGE(0xe000, 0xf1ff) AM_RAM
226222   AM_RANGE(0xf200, 0xf7ff) AM_RAM AM_SHARE("spriteram")
227223   AM_RANGE(0xf800, 0xffff) AM_RAM
r244639r244640
229225
230226static ADDRESS_MAP_START( butasan_map, AS_PROGRAM, 8, argus_state )
231227   AM_RANGE(0x0000, 0x7fff) AM_ROM
232   AM_RANGE(0x8000, 0xbfff) AM_RAMBANK("bank1")
228   AM_RANGE(0x8000, 0xbfff) AM_ROMBANK("mainbank")
233229   AM_RANGE(0xc000, 0xc000) AM_READ_PORT("SYSTEM")
234230   AM_RANGE(0xc001, 0xc001) AM_READ_PORT("P1")
235231   AM_RANGE(0xc002, 0xc002) AM_READ_PORT("P2")
r244639r244640
237233   AM_RANGE(0xc004, 0xc004) AM_READ_PORT("DSW2")
238234   AM_RANGE(0xc100, 0xc100) AM_WRITE(butasan_unknown_w)
239235   AM_RANGE(0xc200, 0xc200) AM_WRITE(soundlatch_byte_w)
240   AM_RANGE(0xc201, 0xc201) AM_WRITE(argus_flipscreen_w)
241   AM_RANGE(0xc202, 0xc202) AM_WRITE(argus_bankselect_w)
236   AM_RANGE(0xc201, 0xc201) AM_WRITE(flipscreen_w)
237   AM_RANGE(0xc202, 0xc202) AM_WRITE(bankselect_w)
242238   AM_RANGE(0xc203, 0xc203) AM_WRITE(butasan_pageselect_w)
243239   AM_RANGE(0xc300, 0xc301) AM_RAM AM_SHARE("bg0_scrollx")
244240   AM_RANGE(0xc302, 0xc303) AM_RAM AM_SHARE("bg0_scrolly")
r244639r244640
246242   AM_RANGE(0xc308, 0xc309) AM_RAM AM_SHARE("bg1_scrollx")
247243   AM_RANGE(0xc30a, 0xc30b) AM_RAM AM_SHARE("bg1_scrolly")
248244   AM_RANGE(0xc30c, 0xc30c) AM_WRITE(butasan_bg1_status_w)
249   AM_RANGE(0xc400, 0xc7ff) AM_READWRITE(butasan_bg1ram_r, butasan_bg1ram_w) AM_SHARE("butasan_bg1ram")
250   AM_RANGE(0xc800, 0xcfff) AM_READWRITE(argus_paletteram_r, butasan_paletteram_w) AM_SHARE("paletteram")
245   AM_RANGE(0xc400, 0xc7ff) AM_RAM_WRITE(butasan_bg1ram_w) AM_SHARE("butasan_bg1ram")
246   AM_RANGE(0xc800, 0xcfff) AM_RAM_WRITE(butasan_paletteram_w) AM_SHARE("paletteram")
251247   AM_RANGE(0xd000, 0xdfff) AM_READWRITE(butasan_pagedram_r, butasan_pagedram_w)
252248   AM_RANGE(0xe000, 0xefff) AM_RAM
253249   AM_RANGE(0xf000, 0xf67f) AM_RAM AM_SHARE("spriteram")
r244639r244640
534530   /* basic machine hardware */
535531   MCFG_CPU_ADD("maincpu", Z80, 5000000)           /* 4 MHz */
536532   MCFG_CPU_PROGRAM_MAP(argus_map)
537   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", argus_state, argus_scanline, "screen", 0, 1)
533   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", argus_state, scanline, "screen", 0, 1)
538534
539535   MCFG_CPU_ADD("audiocpu", Z80, 5000000)
540536   MCFG_CPU_PROGRAM_MAP(sound_map_a)
r244639r244640
560556   MCFG_SPEAKER_STANDARD_MONO("mono")
561557
562558   MCFG_SOUND_ADD("ym1", YM2203, 6000000 / 4)
563   MCFG_YM2203_IRQ_HANDLER(WRITELINE(argus_state, irqhandler))
559   MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
564560   MCFG_SOUND_ROUTE(0, "mono", 0.15)
565561   MCFG_SOUND_ROUTE(1, "mono", 0.15)
566562   MCFG_SOUND_ROUTE(2, "mono", 0.15)
r244639r244640
578574   /* basic machine hardware */
579575   MCFG_CPU_ADD("maincpu", Z80, 5000000)           /* 5 MHz */
580576   MCFG_CPU_PROGRAM_MAP(valtric_map)
581   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", argus_state, argus_scanline, "screen", 0, 1)
577   MCFG_TIMER_DRIVER_ADD_SCANLINE("scantimer", argus_state, scanline, "screen", 0, 1)
582578
583579   MCFG_CPU_ADD("audiocpu", Z80, 5000000)
584580   MCFG_CPU_PROGRAM_MAP(sound_map_a)
r244639r244640
604600   MCFG_SPEAKER_STANDARD_MONO("mono")
605601
606602   MCFG_SOUND_ADD("ym1", YM2203, 6000000 / 4)
607   MCFG_YM2203_IRQ_HANDLER(WRITELINE(argus_state, irqhandler))
603   MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
608604   MCFG_SOUND_ROUTE(0, "mono", 0.15)
609605   MCFG_SOUND_ROUTE(1, "mono", 0.15)
610606   MCFG_SOUND_ROUTE(2, "mono", 0.15)
r244639r244640
648644   MCFG_SPEAKER_STANDARD_MONO("mono")
649645
650646   MCFG_SOUND_ADD("ym1", YM2203, 6000000 / 4)
651   MCFG_YM2203_IRQ_HANDLER(WRITELINE(argus_state, irqhandler))
647   MCFG_YM2203_IRQ_HANDLER(INPUTLINE("audiocpu", 0))
652648   MCFG_SOUND_ROUTE(0, "mono", 0.30)
653649   MCFG_SOUND_ROUTE(1, "mono", 0.30)
654650   MCFG_SOUND_ROUTE(2, "mono", 0.30)
r244639r244640
796792
797793
798794/*  ( YEAR   NAME     PARENT  MACHINE   INPUT     INIT  MONITOR  COMPANY                  FULLNAME ) */
799GAME( 1986, argus,    0,      argus,    argus, driver_device,    0,    ROT270,  "NMK (Jaleco license)", "Argus",                                       GAME_IMPERFECT_GRAPHICS )
800GAME( 1986, valtric,  0,      valtric,  valtric, driver_device,  0,    ROT270,  "NMK (Jaleco license)", "Valtric",                                     GAME_IMPERFECT_GRAPHICS )
801GAME( 1987, butasan,  0,      butasan,  butasan, driver_device,  0,    ROT0,    "NMK (Jaleco license)", "Butasan - Pig's & Bomber's (Japan, English)", GAME_IMPERFECT_GRAPHICS )
802GAME( 1987, butasanj, butasan,butasan,  butasan, driver_device,  0,    ROT0,    "NMK (Jaleco license)", "Butasan (Japan, Japanese)",                   GAME_IMPERFECT_GRAPHICS )
795GAME( 1986, argus,    0,      argus,    argus, driver_device,    0,    ROT270,  "NMK (Jaleco license)", "Argus",                                       GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
796GAME( 1986, valtric,  0,      valtric,  valtric, driver_device,  0,    ROT270,  "NMK (Jaleco license)", "Valtric",                                     GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
797GAME( 1987, butasan,  0,      butasan,  butasan, driver_device,  0,    ROT0,    "NMK (Jaleco license)", "Butasan - Pig's & Bomber's (Japan, English)", GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
798GAME( 1987, butasanj, butasan,butasan,  butasan, driver_device,  0,    ROT0,    "NMK (Jaleco license)", "Butasan (Japan, Japanese)",                   GAME_IMPERFECT_GRAPHICS | GAME_SUPPORTS_SAVE )
trunk/src/mame/includes/argus.h
r244639r244640
33public:
44   argus_state(const machine_config &mconfig, device_type type, const char *tag)
55      : driver_device(mconfig, type, tag),
6      m_maincpu(*this, "maincpu"),
7      m_audiocpu(*this, "audiocpu"),
8      m_gfxdecode(*this, "gfxdecode"),
9      m_screen(*this, "screen"),
10      m_palette(*this, "palette"),
611      m_bg0_scrollx(*this, "bg0_scrollx"),
712      m_bg0_scrolly(*this, "bg0_scrolly"),
813      m_bg1_scrollx(*this, "bg1_scrollx"),
r244639r244640
1116      m_txram(*this, "txram"),
1217      m_bg1ram(*this, "bg1ram"),
1318      m_spriteram(*this, "spriteram"),
14      m_butasan_bg1ram(*this, "butasan_bg1ram"),
15      m_maincpu(*this, "maincpu"),
16      m_audiocpu(*this, "audiocpu"),
17      m_gfxdecode(*this, "gfxdecode"),
18      m_screen(*this, "screen"),
19      m_palette(*this, "palette")  { }
19      m_butasan_bg1ram(*this, "butasan_bg1ram")  { }
2020
21   required_device<cpu_device> m_maincpu;
22   required_device<cpu_device> m_audiocpu;
23   required_device<gfxdecode_device> m_gfxdecode;
24   required_device<screen_device> m_screen;
25   required_device<palette_device> m_palette;
26
2127   optional_shared_ptr<UINT8> m_bg0_scrollx;
2228   optional_shared_ptr<UINT8> m_bg0_scrolly;
2329   required_shared_ptr<UINT8> m_bg1_scrollx;
r244639r244640
2834   required_shared_ptr<UINT8> m_spriteram;
2935   optional_shared_ptr<UINT8> m_butasan_bg1ram;
3036
37   // common
38   UINT8 m_bg_status;
39   UINT8 m_flipscreen;
40   UINT16 m_palette_intensity;
41   
42   // argus specific
3143   UINT8 *m_dummy_bg0ram;
44   int m_lowbitscroll;
45   int m_prvscrollx;
46   
47   // butasan specific
3248   UINT8 *m_butasan_txram;
3349   UINT8 *m_butasan_bg0ram;
3450   UINT8 *m_butasan_bg0backram;
3551   UINT8 *m_butasan_txbackram;
3652   UINT8 *m_butasan_pagedram[2];
3753   UINT8 m_butasan_page_latch;
38   tilemap_t *m_tx_tilemap;
39   tilemap_t *m_bg0_tilemap;
40   tilemap_t *m_bg1_tilemap;
41   UINT8 m_bg_status;
4254   UINT8 m_butasan_bg1_status;
43   UINT8 m_flipscreen;
44   UINT16 m_palette_intensity;
45   int m_lowbitscroll;
46   int m_prvscrollx;
55   UINT8 m_butasan_unknown;
56   
57   // valtric specific
4758   UINT8 m_valtric_mosaic;
4859   bitmap_rgb32 m_mosaicbitmap;
4960   UINT8 m_valtric_unknown;
50   UINT8 m_butasan_unknown;
5161   int m_mosaic;
52   DECLARE_WRITE8_MEMBER(argus_bankselect_w);
62   
63   tilemap_t *m_tx_tilemap;
64   tilemap_t *m_bg0_tilemap;
65   tilemap_t *m_bg1_tilemap;
66   
67   // common
68   DECLARE_WRITE8_MEMBER(bankselect_w);
5369   DECLARE_WRITE8_MEMBER(valtric_mosaic_w);
54   DECLARE_READ8_MEMBER(argus_txram_r);
55   DECLARE_WRITE8_MEMBER(argus_txram_w);
56   DECLARE_READ8_MEMBER(argus_bg1ram_r);
57   DECLARE_WRITE8_MEMBER(argus_bg1ram_w);
70   DECLARE_WRITE8_MEMBER(txram_w);
71   DECLARE_WRITE8_MEMBER(bg1ram_w);
72   DECLARE_WRITE8_MEMBER(flipscreen_w);
73
74   // argus specific
5875   DECLARE_WRITE8_MEMBER(argus_bg_status_w);
59   DECLARE_WRITE8_MEMBER(valtric_bg_status_w);
76   DECLARE_WRITE8_MEMBER(argus_paletteram_w);
77
78   // butasan specific
6079   DECLARE_WRITE8_MEMBER(butasan_bg0_status_w);
6180   DECLARE_WRITE8_MEMBER(butasan_bg1_status_w);
62   DECLARE_WRITE8_MEMBER(argus_flipscreen_w);
63   DECLARE_READ8_MEMBER(argus_paletteram_r);
64   DECLARE_WRITE8_MEMBER(argus_paletteram_w);
65   DECLARE_WRITE8_MEMBER(valtric_paletteram_w);
6681   DECLARE_WRITE8_MEMBER(butasan_paletteram_w);
6782   DECLARE_READ8_MEMBER(butasan_bg1ram_r);
6883   DECLARE_WRITE8_MEMBER(butasan_bg1ram_w);
6984   DECLARE_WRITE8_MEMBER(butasan_pageselect_w);
7085   DECLARE_READ8_MEMBER(butasan_pagedram_r);
7186   DECLARE_WRITE8_MEMBER(butasan_pagedram_w);
87   DECLARE_WRITE8_MEMBER(butasan_unknown_w);
88
89   // valtric specific
90   DECLARE_WRITE8_MEMBER(valtric_bg_status_w);
91   DECLARE_WRITE8_MEMBER(valtric_paletteram_w);
7292   DECLARE_WRITE8_MEMBER(valtric_unknown_w);
73   DECLARE_WRITE8_MEMBER(butasan_unknown_w);
93   
7494   TILE_GET_INFO_MEMBER(argus_get_tx_tile_info);
7595   TILE_GET_INFO_MEMBER(argus_get_bg0_tile_info);
7696   TILE_GET_INFO_MEMBER(argus_get_bg1_tile_info);
r244639r244640
7999   TILE_GET_INFO_MEMBER(butasan_get_tx_tile_info);
80100   TILE_GET_INFO_MEMBER(butasan_get_bg0_tile_info);
81101   TILE_GET_INFO_MEMBER(butasan_get_bg1_tile_info);
102   
103   virtual void machine_start();
82104   DECLARE_VIDEO_START(argus);
83105   DECLARE_VIDEO_RESET(argus);
84106   DECLARE_VIDEO_START(valtric);
85107   DECLARE_VIDEO_RESET(valtric);
86108   DECLARE_VIDEO_START(butasan);
87109   DECLARE_VIDEO_RESET(butasan);
110   
88111   UINT32 screen_update_argus(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
89112   UINT32 screen_update_valtric(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
90113   UINT32 screen_update_butasan(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
91   TIMER_DEVICE_CALLBACK_MEMBER(argus_scanline);
114   
115   TIMER_DEVICE_CALLBACK_MEMBER(scanline);
92116   TIMER_DEVICE_CALLBACK_MEMBER(butasan_scanline);
117   
93118   void reset_common();
94   void argus_write_dummy_rams(int dramoffs, int vromoffs);
95   void argus_change_palette(int color, int lo_offs, int hi_offs);
96   void argus_change_bg_palette(int color, int lo_offs, int hi_offs);
119   void change_palette(int color, int lo_offs, int hi_offs);
120   void change_bg_palette(int color, int lo_offs, int hi_offs);
97121   void bg_setting();
122   
123   // argus specific
98124   void argus_bg0_scroll_handle();
125   void argus_write_dummy_rams(int dramoffs, int vromoffs);
99126   void argus_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority);
127   
128   // butasan specific
129   void butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
130   void butasan_log_vram();
131   
132   // valtric specific
100133   void valtric_draw_mosaic(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
101134   void valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
102   void butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect);
103   void butasan_log_vram();
104   DECLARE_WRITE_LINE_MEMBER(irqhandler);
105   required_device<cpu_device> m_maincpu;
106   required_device<cpu_device> m_audiocpu;
107   required_device<gfxdecode_device> m_gfxdecode;
108   required_device<screen_device> m_screen;
109   required_device<palette_device> m_palette;
110135};
trunk/src/mame/video/argus.c
r244639r244640
8989-----------------------------------------------------------------------------
9090 +0
9191 ---- ---x  = BG enable bit
92 ---- --x-  = gray scale effect or tile bank select.
92 ---- --x-  = grey scale effect or tile bank select.
9393
9494
9595Flip screen controller
r244639r244640
109109(*) Things which are not emulated.
110110 - Color $000 - 00f, $01e, $02e ... are half transparent color.
111111 - Sprite priority bit may be present in Butasan. But I don't know
112   what is happened when it is set.
112   what happens when it is set.
113113
114114***************************************************************************/
115115
r244639r244640
272272   m_dummy_bg0ram = auto_alloc_array(machine(), UINT8, 0x800);
273273
274274   jal_blend_init(machine(), 1);
275   
276   save_item(NAME(m_bg_status));
277   save_item(NAME(m_flipscreen));
278   save_item(NAME(m_palette_intensity));
279   save_pointer(NAME(m_dummy_bg0ram), 0x800);
280   save_item(NAME(m_lowbitscroll));
281   save_item(NAME(m_prvscrollx));
275282}
276283
277284VIDEO_RESET_MEMBER(argus_state,argus)
r244639r244640
295302   m_screen->register_screen_bitmap(m_mosaicbitmap);
296303
297304   jal_blend_init(machine(), 1);
305   
306   save_item(NAME(m_bg_status));
307   save_item(NAME(m_flipscreen));
308   save_item(NAME(m_palette_intensity));
309   save_item(NAME(m_valtric_mosaic));
310   save_item(NAME(m_valtric_unknown));
311   save_item(NAME(m_mosaic));
298312}
299313
300314VIDEO_RESET_MEMBER(argus_state,valtric)
r244639r244640
322336   m_butasan_txbackram  = &m_butasan_pagedram[1][0x800];
323337
324338   jal_blend_init(machine(), 1);
339   
340   save_item(NAME(m_bg_status));
341   save_item(NAME(m_flipscreen));
342   save_item(NAME(m_palette_intensity));
343   save_pointer(NAME(m_butasan_pagedram[0]), 0x1000);
344   save_pointer(NAME(m_butasan_pagedram[1]), 0x1000);
345   save_item(NAME(m_butasan_page_latch));
346   save_item(NAME(m_butasan_bg1_status));
347   save_item(NAME(m_butasan_unknown));
325348}
326349
327350VIDEO_RESET_MEMBER(argus_state,butasan)
r244639r244640
363386   }
364387}
365388
366void argus_state::argus_change_palette(int color, int lo_offs, int hi_offs)
389void argus_state::change_palette(int color, int lo_offs, int hi_offs)
367390{
368391   UINT8 lo = m_paletteram[lo_offs];
369392   UINT8 hi = m_paletteram[hi_offs];
r244639r244640
371394   m_palette->set_pen_color(color, pal4bit(lo >> 4), pal4bit(lo), pal4bit(hi >> 4));
372395}
373396
374void argus_state::argus_change_bg_palette(int color, int lo_offs, int hi_offs)
397void argus_state::change_bg_palette(int color, int lo_offs, int hi_offs)
375398{
376399   UINT8 r,g,b,lo,hi,ir,ig,ib,ix;
377400   rgb_t rgb,irgb;
r244639r244640
418441   m_valtric_mosaic = data;
419442}
420443
421READ8_MEMBER(argus_state::argus_txram_r)
444WRITE8_MEMBER(argus_state::txram_w)
422445{
423   return m_txram[offset];
424}
425
426WRITE8_MEMBER(argus_state::argus_txram_w)
427{
428446   m_txram[offset] = data;
429447   m_tx_tilemap->mark_tile_dirty(offset >> 1);
430448}
431449
432READ8_MEMBER(argus_state::argus_bg1ram_r)
450WRITE8_MEMBER(argus_state::bg1ram_w)
433451{
434   return m_bg1ram[offset];
435}
436
437WRITE8_MEMBER(argus_state::argus_bg1ram_w)
438{
439452   m_bg1ram[offset] = data;
440453   m_bg1_tilemap->mark_tile_dirty(offset >> 1);
441454}
r244639r244640
453466
454467         for (offs = 0x400; offs < 0x500; offs++)
455468         {
456            argus_change_bg_palette((offs - 0x400) + 0x080, offs, offs + 0x400);
469            change_bg_palette((offs - 0x400) + 0x080, offs, offs + 0x400);
457470         }
458471      }
459472   }
r244639r244640
472485
473486         for (offs = 0x400; offs < 0x600; offs += 2)
474487         {
475            argus_change_bg_palette(((offs - 0x400) >> 1) + 0x100, offs & ~1, offs | 1);
488            change_bg_palette(((offs - 0x400) >> 1) + 0x100, offs & ~1, offs | 1);
476489         }
477490      }
478491   }
r244639r244640
494507   }
495508}
496509
497WRITE8_MEMBER(argus_state::argus_flipscreen_w)
510WRITE8_MEMBER(argus_state::flipscreen_w)
498511{
499512   m_flipscreen = data & 0x80;
500513}
501514
502READ8_MEMBER(argus_state::argus_paletteram_r)
503{
504   return m_paletteram[offset];
505}
506
507515WRITE8_MEMBER(argus_state::argus_paletteram_w)
508516{
509517   int offs;
r244639r244640
514522   {
515523      offset &= 0x07f;
516524
517      argus_change_palette(offset, offset, offset + 0x080);
525      change_palette(offset, offset, offset + 0x080);
518526
519527      if (offset == 0x07f || offset == 0x0ff)
520528      {
521529         m_palette_intensity = m_paletteram[0x0ff] | (m_paletteram[0x07f] << 8);
522530
523531         for (offs = 0x400; offs < 0x500; offs++)
524            argus_change_bg_palette((offs & 0xff) + 0x080, offs, offs + 0x400);
532            change_bg_palette((offs & 0xff) + 0x080, offs, offs + 0x400);
525533      }
526534   }
527535   else if ((offset >= 0x400 && offset <= 0x4ff) ||
r244639r244640
530538      offs = offset & 0xff;
531539      offset = offs | 0x400;
532540
533      argus_change_bg_palette(offs + 0x080, offset, offset + 0x400);
541      change_bg_palette(offs + 0x080, offset, offset + 0x400);
534542   }
535543   else if ((offset >= 0x500 && offset <= 0x5ff) ||
536544            (offset >= 0x900 && offset <= 0x9ff))       /* BG1 color */
r244639r244640
538546      offs = offset & 0xff;
539547      offset = offs | 0x500;
540548
541      argus_change_palette(offs + 0x180, offset, offset + 0x400);
549      change_palette(offs + 0x180, offset, offset + 0x400);
542550   }
543551   else if ((offset >= 0x700 && offset <= 0x7ff) ||
544552            (offset >= 0xb00 && offset <= 0xbff))       /* text color */
r244639r244640
546554      offs = offset & 0xff;
547555      offset = offs | 0x700;
548556
549      argus_change_palette(offs + 0x280, offset, offset + 0x400);
557      change_palette(offs + 0x280, offset, offset + 0x400);
550558   }
551559}
552560
r244639r244640
556564
557565   if (offset <= 0x1ff)                            /* Sprite color */
558566   {
559      argus_change_palette(offset >> 1, offset & ~1, offset | 1);
567      change_palette(offset >> 1, offset & ~1, offset | 1);
560568
561569      if (offset == 0x1fe || offset == 0x1ff)
562570      {
r244639r244640
565573         m_palette_intensity = m_paletteram[0x1ff] | (m_paletteram[0x1fe] << 8);
566574
567575         for (offs = 0x400; offs < 0x600; offs += 2)
568            argus_change_bg_palette(((offs & 0x1ff) >> 1) + 0x100, offs & ~1, offs | 1);
576            change_bg_palette(((offs & 0x1ff) >> 1) + 0x100, offs & ~1, offs | 1);
569577      }
570578   }
571579   else if (offset >= 0x400 && offset <= 0x5ff)        /* BG color */
572580   {
573      argus_change_bg_palette(((offset & 0x1ff) >> 1) + 0x100, offset & ~1, offset | 1);
581      change_bg_palette(((offset & 0x1ff) >> 1) + 0x100, offset & ~1, offset | 1);
574582   }
575583   else if (offset >= 0x600 && offset <= 0x7ff)        /* Text color */
576584   {
577      argus_change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1);
585      change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1);
578586   }
579587}
580588
r244639r244640
584592
585593   if (offset <= 0x1ff)                            /* BG0 color */
586594   {
587      argus_change_palette((offset >> 1) + 0x100, offset & ~1, offset | 1);
595      change_palette((offset >> 1) + 0x100, offset & ~1, offset | 1);
588596   }
589597   else if (offset <= 0x23f)                       /* BG1 color */
590598   {
591      argus_change_palette(((offset & 0x3f) >> 1) + 0x0c0, offset & ~1, offset | 1);
599      change_palette(((offset & 0x3f) >> 1) + 0x0c0, offset & ~1, offset | 1);
592600   }
593601   else if (offset >= 0x400 && offset <= 0x47f)    /* Sprite color */
594602   {                                               /* 16 colors */
595      argus_change_palette((offset & 0x7f) >> 1, offset & ~1, offset | 1);
603      change_palette((offset & 0x7f) >> 1, offset & ~1, offset | 1);
596604   }
597605   else if (offset >= 0x480 && offset <= 0x4ff)    /* Sprite color */
598606   {                                               /* 8  colors */
599607      int offs = (offset & 0x070) | ((offset & 0x00f) >> 1);
600608
601      argus_change_palette(offs + 0x040, offset & ~1, offset | 1);
602      argus_change_palette(offs + 0x048, offset & ~1, offset | 1);
609      change_palette(offs + 0x040, offset & ~1, offset | 1);
610      change_palette(offs + 0x048, offset & ~1, offset | 1);
603611   }
604612   else if (offset >= 0x600 && offset <= 0x7ff)    /* Text color */
605613   {
606      argus_change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1);
614      change_palette(((offset & 0x1ff) >> 1) + 0x200, offset & ~1, offset | 1);
607615   }
608616   else if (offset >= 0x240 && offset <= 0x25f)    // dummy
609      argus_change_palette(((offset & 0x1f) >> 1) + 0xe0, offset & ~1, offset | 1);
617      change_palette(((offset & 0x1f) >> 1) + 0xe0, offset & ~1, offset | 1);
610618   else if (offset >= 0x500 && offset <= 0x51f)    // dummy
611      argus_change_palette(((offset & 0x1f) >> 1) + 0xf0, offset & ~1, offset | 1);
619      change_palette(((offset & 0x1f) >> 1) + 0xf0, offset & ~1, offset | 1);
612620}
613621
614READ8_MEMBER(argus_state::butasan_bg1ram_r)
615{
616   return m_butasan_bg1ram[offset];
617}
618
619622WRITE8_MEMBER(argus_state::butasan_bg1ram_w)
620623{
621624   int idx;
r244639r244640
804807
805808void argus_state::argus_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect, int priority)
806809{
807   UINT8 *spriteram = m_spriteram;
808   int offs;
809
810810   /* Draw the sprites */
811   for (offs = 0; offs < m_spriteram.bytes(); offs += 16)
811   for (int offs = 0; offs < m_spriteram.bytes(); offs += 16)
812812   {
813      if (!(spriteram[offs+15] == 0 && spriteram[offs+11] == 0xf0))
813      if (!(m_spriteram[offs+15] == 0 && m_spriteram[offs+11] == 0xf0))
814814      {
815815         int sx, sy, tile, flipx, flipy, color, pri;
816816
817         sx = spriteram[offs+12]; if (spriteram[offs+13] & 0x01) sx -= 256;
818         sy = spriteram[offs+11]; if (!(spriteram[offs+13] & 0x02)) sy -= 256;
817         sx = m_spriteram[offs+12]; if (m_spriteram[offs+13] & 0x01) sx -= 256;
818         sy = m_spriteram[offs+11]; if (!(m_spriteram[offs+13] & 0x02)) sy -= 256;
819819
820         tile  = spriteram[offs+14] | ((spriteram[offs+13] & 0xc0) << 2);
821         flipx = spriteram[offs+13] & 0x10;
822         flipy = spriteram[offs+13] & 0x20;
823         color = spriteram[offs+15] & 0x07;
824         pri   = (spriteram[offs+15] & 0x08) >> 3;
820         tile  = m_spriteram[offs+14] | ((m_spriteram[offs+13] & 0xc0) << 2);
821         flipx = m_spriteram[offs+13] & 0x10;
822         flipy = m_spriteram[offs+13] & 0x20;
823         color = m_spriteram[offs+15] & 0x07;
824         pri   = (m_spriteram[offs+15] & 0x08) >> 3;
825825
826826         if (m_flipscreen)
827827         {
r244639r244640
933933
934934void argus_state::valtric_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
935935{
936   UINT8 *spriteram = m_spriteram;
937   int offs;
938
939936   /* Draw the sprites */
940   for (offs = 0; offs < m_spriteram.bytes(); offs += 16)
937   for (int offs = 0; offs < m_spriteram.bytes(); offs += 16)
941938   {
942      if (!(spriteram[offs+15] == 0 && spriteram[offs+11] == 0xf0))
939      if (!(m_spriteram[offs+15] == 0 && m_spriteram[offs+11] == 0xf0))
943940      {
944941         int sx, sy, tile, flipx, flipy, color;
945942
946         sx = spriteram[offs+12]; if (spriteram[offs+13] & 0x01) sx -= 256;
947         sy = spriteram[offs+11]; if (!(spriteram[offs+13] & 0x02)) sy -= 256;
943         sx = m_spriteram[offs+12]; if (m_spriteram[offs+13] & 0x01) sx -= 256;
944         sy = m_spriteram[offs+11]; if (!(m_spriteram[offs+13] & 0x02)) sy -= 256;
948945
949         tile  = spriteram[offs+14] | ((spriteram[offs+13] & 0xc0) << 2);
950         flipx = spriteram[offs+13] & 0x10;
951         flipy = spriteram[offs+13] & 0x20;
952         color = spriteram[offs+15] & 0x0f;
946         tile  = m_spriteram[offs+14] | ((m_spriteram[offs+13] & 0xc0) << 2);
947         flipx = m_spriteram[offs+13] & 0x10;
948         flipy = m_spriteram[offs+13] & 0x20;
949         color = m_spriteram[offs+15] & 0x0f;
953950
954951         if (m_flipscreen)
955952         {
r244639r244640
972969
973970void argus_state::butasan_draw_sprites(bitmap_rgb32 &bitmap, const rectangle &cliprect)
974971{
975   UINT8 *spriteram = m_spriteram;
976   int offs;
977
978972   /* Draw the sprites */
979   for (offs = 0; offs < m_spriteram.bytes(); offs += 16)
973   for (int offs = 0; offs < m_spriteram.bytes(); offs += 16)
980974   {
981975      int sx, sy, tile, flipx, flipy, color;
982976      int fx, fy;
983977
984      tile  = spriteram[offs+14] | ((spriteram[offs+15] & 0x0f) << 8);
985      flipx = spriteram[offs+8] & 0x01;
986      flipy = spriteram[offs+8] & 0x04;
987      color = spriteram[offs+9] & 0x0f;
978      tile  = m_spriteram[offs+14] | ((m_spriteram[offs+15] & 0x0f) << 8);
979      flipx = m_spriteram[offs+8] & 0x01;
980      flipy = m_spriteram[offs+8] & 0x04;
981      color = m_spriteram[offs+9] & 0x0f;
988982
989      sx = spriteram[offs+10];
990      sy = spriteram[offs+12];
983      sx = m_spriteram[offs+10];
984      sy = m_spriteram[offs+12];
991985
992      if (spriteram[offs+11] & 0x01) sx-=256;
993      if (spriteram[offs+13] & 0x01) sy-=256;
986      if (m_spriteram[offs+11] & 0x01) sx-=256;
987      if (m_spriteram[offs+13] & 0x01) sy-=256;
994988
995989      sy = 240 - sy;
996990


Previous 199869 Revisions Next


© 1997-2024 The MAME Team