summaryrefslogtreecommitdiffstatshomepage
path: root/src
diff options
context:
space:
mode:
author Angelo Salese <angelosa@users.noreply.github.com>2011-08-25 17:20:15 +0000
committer Angelo Salese <angelosa@users.noreply.github.com>2011-08-25 17:20:15 +0000
commit0bc39743631815eef31ffe95d4d9a1e002d6f322 (patch)
treebf360c5732f343494bdf0d20ad17849a1bfe3c90 /src
parentd6e61f8d4641dfb9d2f66b92075179920cf0510e (diff)
Moved 3d drawing functions outside of the screen updating function in Taito Air System driver, this should help in preparation of properly fixing the 3d graphics in it [Angelo Salese]
Diffstat (limited to 'src')
-rw-r--r--src/mame/drivers/taitoair.c6
-rw-r--r--src/mame/includes/taitoair.h7
-rw-r--r--src/mame/video/taitoair.c139
3 files changed, 114 insertions, 38 deletions
diff --git a/src/mame/drivers/taitoair.c b/src/mame/drivers/taitoair.c
index 128508dd4aa..b69cb4d27b5 100644
--- a/src/mame/drivers/taitoair.c
+++ b/src/mame/drivers/taitoair.c
@@ -390,10 +390,11 @@ static ADDRESS_MAP_START( airsys_map, AS_PROGRAM, 16 )
AM_RANGE(0x0c0000, 0x0cffff) AM_RAM AM_BASE_MEMBER(taitoair_state, m_m68000_mainram)
AM_RANGE(0x140000, 0x140001) AM_WRITE(system_control_w) /* Pause the TMS32025 */
AM_RANGE(0x180000, 0x187fff) AM_RAM_WRITE(airsys_gradram_w) AM_BASE_MEMBER(taitoair_state, m_gradram) /* "gradiation ram (0/1)" */
- AM_RANGE(0x188000, 0x18bfff) AM_RAM_WRITE(airsys_paletteram16_w) AM_BASE_MEMBER(taitoair_state, m_paletteram)
+ AM_RANGE(0x188000, 0x189fff) AM_MIRROR(0x2000) AM_RAM_WRITE(airsys_paletteram16_w) AM_BASE_MEMBER(taitoair_state, m_paletteram)
AM_RANGE(0x800000, 0x820fff) AM_DEVREADWRITE("tc0080vco", tc0080vco_word_r, tc0080vco_word_w) /* tilemaps, sprites */
AM_RANGE(0x908000, 0x90ffff) AM_RAM AM_BASE_MEMBER(taitoair_state, m_line_ram) /* "line ram" */
AM_RANGE(0x910000, 0x91ffff) AM_RAM AM_BASE_MEMBER(taitoair_state, m_dsp_ram) /* "dsp common ram" (TMS320C25) */
+ AM_RANGE(0x980000, 0x98000f) AM_RAM AM_BASE_MEMBER(taitoair_state, m_backregs)
AM_RANGE(0xa00000, 0xa00007) AM_READ(stick_input_r)
AM_RANGE(0xa00100, 0xa00107) AM_READ(stick2_input_r)
AM_RANGE(0xa00200, 0xa0020f) AM_DEVREADWRITE8("tc0220ioc", tc0220ioc_r, tc0220ioc_w, 0x00ff) /* other I/O */
@@ -424,6 +425,7 @@ static ADDRESS_MAP_START( DSP_map_program, AS_PROGRAM, 16 )
ADDRESS_MAP_END
static ADDRESS_MAP_START( DSP_map_data, AS_DATA, 16 )
+ AM_RANGE(0x3000, 0x3002) AM_WRITE(dsp_flags_w)
AM_RANGE(0x4000, 0x7fff) AM_READWRITE(lineram_r, lineram_w)
AM_RANGE(0x8000, 0xffff) AM_READWRITE(dspram_r, dspram_w)
ADDRESS_MAP_END
@@ -694,9 +696,11 @@ static MACHINE_CONFIG_START( airsys, taitoair_state )
MCFG_SCREEN_SIZE(64*16, 64*16)
MCFG_SCREEN_VISIBLE_AREA(0*16, 32*16-1, 3*16, 28*16-1)
MCFG_SCREEN_UPDATE(taitoair)
+ MCFG_VIDEO_START(taitoair);
MCFG_GFXDECODE(airsys)
MCFG_PALETTE_LENGTH(512*16+512*16)
+ MCFG_PALETTE_INIT(all_black)
MCFG_TC0080VCO_ADD("tc0080vco", airsys_tc0080vco_intf)
diff --git a/src/mame/includes/taitoair.h b/src/mame/includes/taitoair.h
index 487c52fbf00..d8bc7893c1b 100644
--- a/src/mame/includes/taitoair.h
+++ b/src/mame/includes/taitoair.h
@@ -42,9 +42,16 @@ public:
device_t *m_tc0080vco;
UINT16 * m_gradram;
+ UINT16 * m_backregs;
+
+ bitmap_t *m_framebuffer[2];
+ UINT8 m_cur_fb;
};
/*----------- defined in video/taitoair.c -----------*/
SCREEN_UPDATE( taitoair );
+VIDEO_START( taitoair );
+
+WRITE16_HANDLER( dsp_flags_w );
diff --git a/src/mame/video/taitoair.c b/src/mame/video/taitoair.c
index ee6f10ff507..e8d286201a8 100644
--- a/src/mame/video/taitoair.c
+++ b/src/mame/video/taitoair.c
@@ -85,6 +85,7 @@ static void draw_sprites( running_machine &machine, bitmap_t *bitmap, const rect
for (offs = 0x03f8 / 2; offs >= 0; offs -= 0x008 / 2)
{
+ /* TODO: remove this aberration of nature */
if (offs < 0x01b0 && priority == 0) continue;
if (offs >= 0x01b0 && priority == 1) continue;
@@ -341,6 +342,75 @@ static void fill_poly( bitmap_t *bitmap, const rectangle *cliprect, const struct
}
}
+/*
+ TODO: still don't know how this works. It calls three values (0x1fff-0x5fff-0xdfff), for two or three offsets.
+ In theory this should fit into framebuffer draw, display, clear and swap in some way.
+*/
+WRITE16_HANDLER( dsp_flags_w )
+{
+ taitoair_state *state = space->machine().driver_data<taitoair_state>();
+ rectangle cliprect;
+
+ if(data == 0x1fff)
+ state->m_cur_fb = 0;
+ //else if(data == 0xdfff)
+ // state->m_cur_fb = 1;
+
+ cliprect.min_x = 0;
+ cliprect.min_y = 3*16;
+ cliprect.max_x = space->machine().primary_screen->width() - 1;
+ cliprect.max_y = space->machine().primary_screen->height() - 1;
+
+ {
+ //if(offset == 0)
+ // bitmap_fill(state->m_framebuffer[state->m_cur_fb], &cliprect, 0);
+
+ //if(offset == 1)
+ {
+ if (state->m_line_ram[0x3fff])
+ {
+ int adr = 0x3fff;
+// struct taitoair_poly q;
+
+ while (adr >= 0 && state->m_line_ram[adr] && state->m_line_ram[adr] != 0x4000)
+ {
+ int pcount;
+ if (!(state->m_line_ram[adr] & 0x8000) || adr < 10)
+ {
+ logerror("quad: unknown value %04x at %04x\n", state->m_line_ram[adr], adr);
+ break;
+ }
+ state->m_q.col = (state->m_line_ram[adr] & 0x007f) + 0x300;
+ adr--;
+ pcount = 0;
+ while (pcount < TAITOAIR_POLY_MAX_PT && adr >= 1 && !(state->m_line_ram[adr] & 0xc000))
+ {
+ state->m_q.p[pcount].y = state->m_line_ram[adr] + 3 * 16;
+ state->m_q.p[pcount].x = state->m_line_ram[adr - 1];
+ pcount++;
+ adr -= 2;
+ }
+ adr--;
+ state->m_q.pcount = pcount;
+ fill_poly(state->m_framebuffer[state->m_cur_fb], &cliprect, &state->m_q);
+ }
+ }
+ }
+ }
+}
+
+VIDEO_START( taitoair )
+{
+ taitoair_state *state = machine.driver_data<taitoair_state>();
+ int width, height;
+
+ width = machine.primary_screen->width();
+ height = machine.primary_screen->height();
+ state->m_framebuffer[0] = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16);
+ state->m_framebuffer[1] = auto_bitmap_alloc(machine, width, height, BITMAP_FORMAT_INDEXED16);
+ state->m_cur_fb = 0;
+}
+
SCREEN_UPDATE( taitoair )
{
taitoair_state *state = screen->machine().driver_data<taitoair_state>();
@@ -349,51 +419,46 @@ SCREEN_UPDATE( taitoair )
bitmap_fill(bitmap, cliprect, 0);
-#ifdef MAME_DEBUG
- if (!screen->machine().input().code_pressed(KEYCODE_A))
- tc0080vco_tilemap_draw(state->m_tc0080vco, bitmap, cliprect, 0, 0, 0);
- if (!screen->machine().input().code_pressed(KEYCODE_S))
- draw_sprites(screen->machine(), bitmap, cliprect, 0);
- if (!screen->machine().input().code_pressed(KEYCODE_D))
- tc0080vco_tilemap_draw(state->m_tc0080vco, bitmap, cliprect, 1, 0, 0);
- if (!screen->machine().input().code_pressed(KEYCODE_F))
- draw_sprites(screen->machine(), bitmap, cliprect, 1);
-#else
- tc0080vco_tilemap_draw(state->m_tc0080vco, bitmap, cliprect, 0, 0, 0);
- draw_sprites(screen->machine(), bitmap, cliprect, 0);
- tc0080vco_tilemap_draw(state->m_tc0080vco, bitmap, cliprect, 1, 0, 0);
- draw_sprites(screen->machine(), bitmap, cliprect, 1);
-#endif
-
- tc0080vco_tilemap_draw(state->m_tc0080vco, bitmap, cliprect, 2, 0, 0);
-
- if (state->m_line_ram[0x3fff])
{
- int adr = 0x3fff;
-// struct taitoair_poly q;
+ int x,y;
+
+ /*
+ [0x980000-3] dword for Y 0
+ [0x980004-7] dword for rotation param 0
+ [0x980008-b] dword for Y 1
+ [0x98000c-f] dword for rotation param 1
+ */
- while (adr >= 0 && state->m_line_ram[adr] && state->m_line_ram[adr] != 0x4000)
+ for(y=cliprect->min_y;y<cliprect->max_y/2;y++)
{
- int pcount;
- if (!(state->m_line_ram[adr] & 0x8000) || adr < 10)
+ for(x=cliprect->min_x;x<cliprect->max_x;x++)
{
- logerror("quad: unknown value %04x at %04x\n", state->m_line_ram[adr], adr);
- break;
+ *BITMAP_ADDR16(bitmap,y,x) = 0x2000 + (0x3f - ((y >> 2) & 0x3f));
}
- state->m_q.col = (state->m_line_ram[adr] & 0x7fff) + 0x300;
- adr--;
- pcount = 0;
- while (pcount < TAITOAIR_POLY_MAX_PT && adr >= 1 && !(state->m_line_ram[adr] & 0xc000))
+ }
+
+ #if 0
+ for(y=cliprect->max_y/2;y<cliprect->max_y;y++)
+ {
+ for(x=cliprect->min_x;x<cliprect->max_x;x++)
{
- state->m_q.p[pcount].y = state->m_line_ram[adr] + 3 * 16;
- state->m_q.p[pcount].x = state->m_line_ram[adr - 1];
- pcount++;
- adr -= 2;
+ *BITMAP_ADDR16(bitmap,y,x) = 0x2040 + (0x3f - ((y >> 2) & 0x3f));
}
- adr--;
- state->m_q.pcount = pcount;
- fill_poly(bitmap, cliprect, &state->m_q);
}
+ #endif
}
+
+ tc0080vco_tilemap_draw(state->m_tc0080vco, bitmap, cliprect, 0, 0, 0);
+
+ draw_sprites(screen->machine(), bitmap, cliprect, 0);
+
+ copybitmap_trans(bitmap, state->m_framebuffer[state->m_cur_fb], 0, 0, 0, 0, cliprect, 0);
+
+ tc0080vco_tilemap_draw(state->m_tc0080vco, bitmap, cliprect, 1, 0, 0);
+
+ draw_sprites(screen->machine(), bitmap, cliprect, 1);
+
+ tc0080vco_tilemap_draw(state->m_tc0080vco, bitmap, cliprect, 2, 0, 0);
+
return 0;
}