From a3aef48df56d4c2cb9f840fe1b4e01f0c66faab7 Mon Sep 17 00:00:00 2001 From: Zsolt Vasvari Date: Fri, 29 Feb 2008 01:42:25 +0000 Subject: [PATCH] - Converted Amiga based games to partial updating and proper scanline based timers - Beginning of the clean-up of Space Guerilla - fixed rotation, some other stuff - Removed tmpbitmap from some drivers --- .gitattributes | 1 - src/mame/drivers/39in1.c | 8 ++- src/mame/drivers/alg.c | 26 ++++++--- src/mame/drivers/arcadia.c | 3 +- src/mame/drivers/cubocd32.c | 3 +- src/mame/drivers/ertictac.c | 77 +++++++++++++------------ src/mame/drivers/f-32.c | 44 ++++++++------- src/mame/drivers/galspnbl.c | 78 +++++++++----------------- src/mame/drivers/m79amb.c | 104 ++++++++++++++++++++++------------ src/mame/drivers/mquake.c | 3 +- src/mame/drivers/spaceg.c | 109 ++++++++++-------------------------- src/mame/drivers/upscope.c | 3 +- src/mame/drivers/vcombat.c | 7 ++- src/mame/includes/amiga.h | 4 +- src/mame/machine/amiga.c | 26 +++++++-- src/mame/mame.mak | 2 +- src/mame/video/amiga.c | 35 +++++++++--- src/mame/video/galspnbl.c | 54 +++++++++--------- src/mame/video/m79amb.c | 42 -------------- 19 files changed, 297 insertions(+), 332 deletions(-) delete mode 100644 src/mame/video/m79amb.c diff --git a/.gitattributes b/.gitattributes index 66fd9303a6c..cc34b56c15d 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2902,7 +2902,6 @@ src/mame/video/m57.c svneol=native#text/plain src/mame/video/m58.c svneol=native#text/plain src/mame/video/m62.c svneol=native#text/plain src/mame/video/m72.c svneol=native#text/plain -src/mame/video/m79amb.c svneol=native#text/plain src/mame/video/m90.c svneol=native#text/plain src/mame/video/m92.c svneol=native#text/plain src/mame/video/macrossp.c svneol=native#text/plain diff --git a/src/mame/drivers/39in1.c b/src/mame/drivers/39in1.c index 471188b4a15..e4f16b1bc47 100644 --- a/src/mame/drivers/39in1.c +++ b/src/mame/drivers/39in1.c @@ -28,6 +28,11 @@ ADDRESS_MAP_END static INPUT_PORTS_START( 39in1 ) INPUT_PORTS_END +static VIDEO_UPDATE( 39in1 ) +{ + return 0; +} + static MACHINE_DRIVER_START( 39in1 ) MDRV_CPU_ADD(ARM7, 200000000) // actually Xscale PXA255, but ARM7 is a compatible subset MDRV_CPU_PROGRAM_MAP(39in1_map,0) @@ -38,8 +43,7 @@ static MACHINE_DRIVER_START( 39in1 ) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_RAW_PARAMS(16777216/4, 308, 0, 240, 228, 0, 160) // completely bogus for this h/w - MDRV_VIDEO_START(generic_bitmapped) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(39in1) MDRV_SPEAKER_STANDARD_STEREO("left", "right") MACHINE_DRIVER_END diff --git a/src/mame/drivers/alg.c b/src/mame/drivers/alg.c index eaf30b6b6d0..f6f33496020 100644 --- a/src/mame/drivers/alg.c +++ b/src/mame/drivers/alg.c @@ -32,6 +32,7 @@ static emu_timer *serial_timer; static UINT8 serial_timer_active; static UINT16 input_select; +static bitmap_t *amiga_bitmap; static render_texture *video_texture; static render_texture *overlay_texture; @@ -76,6 +77,9 @@ static VIDEO_START( alg ) /* configure for cleanup */ add_exit_callback(machine, video_cleanup); + /* allocate Amiga bitmap */ + amiga_bitmap = auto_bitmap_alloc(machine->screen[0].width, machine->screen[0].height, machine->screen[0].format); + /* standard video start */ VIDEO_START_CALL(amiga); @@ -103,8 +107,14 @@ static void video_cleanup(running_machine *machine) static VIDEO_UPDATE( alg ) { - /* composite the video */ - if (!video_skip_this_frame()) + int y; + + /* update the Amiga video */ + for (y = cliprect->min_y; y <= cliprect->max_y; y++) + amiga_render_scanline(amiga_bitmap, y); + + /* at the end of the frame, composite the video */ + if (!video_skip_this_frame() && (cliprect->max_y == machine->screen[screen].visarea.max_y)) { mame_bitmap *vidbitmap; rectangle fixedvis = machine->screen[screen].visarea; @@ -120,17 +130,17 @@ static VIDEO_UPDATE( alg ) /* then overlay the Amiga video */ if (overlay_texture == NULL) overlay_texture = render_texture_alloc(NULL, NULL); - render_texture_set_bitmap(overlay_texture, tmpbitmap, &fixedvis, 0, TEXFORMAT_PALETTEA16); + render_texture_set_bitmap(overlay_texture, amiga_bitmap, &fixedvis, 0, TEXFORMAT_PALETTEA16); /* add both quads to the screen */ render_container_empty(render_container_get_screen(screen)); render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), video_texture, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), overlay_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1)); - } - /* display disc information */ - if (discinfo != NULL) - popmessage("%s", laserdisc_describe_state(discinfo)); + /* display disc information */ + if (discinfo != NULL) + popmessage("%s", laserdisc_describe_state(discinfo)); + } return 0; } @@ -455,7 +465,6 @@ static MACHINE_DRIVER_START( alg_r1 ) /* basic machine hardware */ MDRV_CPU_ADD_TAG("main", M68000, AMIGA_68000_NTSC_CLOCK) MDRV_CPU_PROGRAM_MAP(main_map_r1,0) - MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) MDRV_MACHINE_START(alg) MDRV_MACHINE_RESET(alg) @@ -507,7 +516,6 @@ static MACHINE_DRIVER_START( picmatic ) /* adjust for PAL specs */ MDRV_CPU_REPLACE("main", M68000, AMIGA_68000_PAL_CLOCK) MDRV_CPU_PROGRAM_MAP(main_map_picmatic,0) - MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 312) MDRV_SCREEN_MODIFY("main") MDRV_SCREEN_REFRESH_RATE(50) diff --git a/src/mame/drivers/arcadia.c b/src/mame/drivers/arcadia.c index b9c225a4555..0908b2da7bf 100644 --- a/src/mame/drivers/arcadia.c +++ b/src/mame/drivers/arcadia.c @@ -291,7 +291,6 @@ static MACHINE_DRIVER_START( arcadia ) /* basic machine hardware */ MDRV_CPU_ADD(M68000, AMIGA_68000_NTSC_CLOCK) MDRV_CPU_PROGRAM_MAP(amiga_map,0) - MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) MDRV_MACHINE_RESET(amiga) MDRV_NVRAM_HANDLER(generic_0fill) @@ -309,7 +308,7 @@ static MACHINE_DRIVER_START( arcadia ) MDRV_PALETTE_INIT(amiga) MDRV_VIDEO_START(amiga) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(amiga) /* sound hardware */ MDRV_SPEAKER_STANDARD_STEREO("left", "right") diff --git a/src/mame/drivers/cubocd32.c b/src/mame/drivers/cubocd32.c index 8745f559da8..e8ca6ae7909 100644 --- a/src/mame/drivers/cubocd32.c +++ b/src/mame/drivers/cubocd32.c @@ -267,7 +267,6 @@ static MACHINE_DRIVER_START( cd32 ) /* basic machine hardware */ MDRV_CPU_ADD(M68EC020, AMIGA_68EC020_PAL_CLOCK) /* 14.3 Mhz */ MDRV_CPU_PROGRAM_MAP(cd32_map,0) - MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 312) MDRV_MACHINE_RESET(amiga) MDRV_NVRAM_HANDLER(cd32) @@ -286,7 +285,7 @@ static MACHINE_DRIVER_START( cd32 ) MDRV_PALETTE_INIT(amiga) MDRV_VIDEO_START(amiga) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(amiga) /* sound hardware */ MDRV_SPEAKER_STANDARD_STEREO("left", "right") diff --git a/src/mame/drivers/ertictac.c b/src/mame/drivers/ertictac.c index 5a4df22771e..54c4314a055 100644 --- a/src/mame/drivers/ertictac.c +++ b/src/mame/drivers/ertictac.c @@ -31,31 +31,10 @@ TODO: #include "cpu/arm/arm.h" static UINT32 *ertictac_mainram; -static UINT32 *ram; +static UINT32 *ertictac_videoram; static UINT32 IRQSTA, IRQMSKA, IRQMSKB, FIQMSK, T1low, T1high; static UINT32 vidFIFO[256]; -static READ32_HANDLER(ram_r) -{ - return ram[offset]; -} - -static WRITE32_HANDLER(ram_w) -{ - COMBINE_DATA(&ram[offset]); - if(offset>=vidFIFO[0x88]/4 && offset<( (vidFIFO[0x88]/4) + 0x28000/4)) - { - int tmp=offset-vidFIFO[0x88]/4; - int x=(tmp%80)<<2; - int y=(tmp/80)&0xff; - - *BITMAP_ADDR16(tmpbitmap, y, x++) = (ram[offset]>> 0)&0xff; - *BITMAP_ADDR16(tmpbitmap, y, x++) = (ram[offset]>> 8)&0xff; - *BITMAP_ADDR16(tmpbitmap, y, x++) = (ram[offset]>>16)&0xff; - *BITMAP_ADDR16(tmpbitmap, y, x ) = (ram[offset]>>24)&0xff; - } -} - static WRITE32_HANDLER(video_fifo_w) { vidFIFO[data>>24]=data&0xffffff; @@ -172,7 +151,7 @@ static WRITE32_HANDLER(T1GO_w) static ADDRESS_MAP_START( ertictac_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x00000000, 0x0007ffff) AM_RAM AM_BASE (&ertictac_mainram) - AM_RANGE(0x01f00000, 0x01ffffff) AM_READWRITE(ram_r, ram_w) AM_BASE (&ram) + AM_RANGE(0x01f00000, 0x01ffffff) AM_RAM AM_BASE (&ertictac_videoram) AM_RANGE(0x03200000, 0x03200003) AM_READWRITE(IOCR_r, IOCR_w) AM_RANGE(0x03200010, 0x03200013) AM_READ(IRQSTA_r) AM_RANGE(0x03200014, 0x03200017) AM_READWRITE(IRQRQA_r, IRQRQA_w) @@ -360,23 +339,47 @@ static INTERRUPT_GEN( ertictac_interrupt ) } } -static PALETTE_INIT(ertictac) + +#define NUM_PENS (0x100) + +static void get_pens(pen_t *pens) { - int c; + int color; - for (c = 0; c < 256; c++) + for (color = 0; color < NUM_PENS; color++) { - int r,g,b,i; + UINT8 i = color & 0x03; + UINT8 r = ((color & 0x04) >> 0) | ((color & 0x10) >> 1) | i; + UINT8 g = ((color & 0x20) >> 3) | ((color & 0x40) >> 3) | i; + UINT8 b = ((color & 0x08) >> 1) | ((color & 0x80) >> 4) | i; - i = c & 0x03; - r = ((c & 0x04) >> 0) | ((c & 0x10) >> 1) | i; - g = ((c & 0x20) >> 3) | ((c & 0x40) >> 3) | i; - b = ((c & 0x08) >> 1) | ((c & 0x80) >> 4) | i; - - palette_set_color_rgb(machine, c, pal4bit(r), pal4bit(g), pal4bit(b)); + pens[color] = MAKE_RGB(pal4bit(r), pal4bit(g), pal4bit(b)); } } + +static VIDEO_UPDATE( ertictac ) +{ + int y, x; + pen_t pens[NUM_PENS]; + + get_pens(pens); + + for (y = cliprect->min_y; y <= cliprect->max_y; y++) + for (x = 0; x < 0x140; x += 4) + { + offs_t offs = (y * 0x50) + (x >> 2) + (vidFIFO[0x88] >> 2); + + *BITMAP_ADDR32(bitmap, y, x + 0) = pens[(ertictac_videoram[offs] >> 0) & 0xff]; + *BITMAP_ADDR32(bitmap, y, x + 1) = pens[(ertictac_videoram[offs] >> 8) & 0xff]; + *BITMAP_ADDR32(bitmap, y, x + 2) = pens[(ertictac_videoram[offs] >> 16) & 0xff]; + *BITMAP_ADDR32(bitmap, y, x + 3) = pens[(ertictac_videoram[offs] >> 24) & 0xff]; + } + + return 0; +} + + static MACHINE_DRIVER_START( ertictac ) MDRV_CPU_ADD(ARM, 16000000) /* guess */ @@ -389,15 +392,11 @@ static MACHINE_DRIVER_START( ertictac ) MDRV_SCREEN_ADD("main", RASTER) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) - MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) + MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) MDRV_SCREEN_SIZE(320, 256) MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 255) - MDRV_PALETTE_LENGTH(256) - MDRV_PALETTE_INIT(ertictac) - - MDRV_VIDEO_START(generic_bitmapped) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(ertictac) MACHINE_DRIVER_END ROM_START( ertictac ) diff --git a/src/mame/drivers/f-32.c b/src/mame/drivers/f-32.c index 73a21961d17..011195bf3d2 100644 --- a/src/mame/drivers/f-32.c +++ b/src/mame/drivers/f-32.c @@ -16,7 +16,7 @@ #include "sound/2151intf.h" #include "sound/okim6295.h" -static UINT32 *vram; +static UINT32 *mosaicf2_videoram; static READ32_HANDLER( oki_32bit_r ) { @@ -43,22 +43,6 @@ static WRITE32_HANDLER( ym2151_register_32bit_w ) YM2151_register_port_0_w(0,data & 0xff); } -static WRITE32_HANDLER( vram_w ) -{ - int x,y; - - COMBINE_DATA(&vram[offset]); - - y = offset >> 8; - x = offset & 0xff; - - if(x < 320/2 && y < 224) - { - *BITMAP_ADDR16(tmpbitmap, y, x*2+0) = (vram[offset] >> 16) & 0x7fff; - *BITMAP_ADDR16(tmpbitmap, y, x*2+1) = vram[offset] & 0x7fff; - } -} - static READ32_HANDLER( eeprom_r ) { return EEPROM_read_bit(); @@ -80,9 +64,30 @@ static WRITE32_HANDLER( eeprom_clock_line_w ) } +static VIDEO_UPDATE( mosaicf2 ) +{ + offs_t offs; + + for (offs = 0; offs < 0x10000; offs++) + { + int y = offs >> 8; + int x = offs & 0xff; + + if ((x < 0xa0) && (y < 0xe0)) + { + *BITMAP_ADDR16(bitmap, y, (x * 2) + 0) = (mosaicf2_videoram[offs] >> 16) & 0x7fff; + *BITMAP_ADDR16(bitmap, y, (x * 2) + 1) = (mosaicf2_videoram[offs] >> 0) & 0x7fff; + } + } + + return 0; +} + + + static ADDRESS_MAP_START( common_map, ADDRESS_SPACE_PROGRAM, 32 ) AM_RANGE(0x00000000, 0x001fffff) AM_RAM - AM_RANGE(0x40000000, 0x4003ffff) AM_WRITE(vram_w) AM_BASE(&vram) + AM_RANGE(0x40000000, 0x4003ffff) AM_RAM AM_BASE(&mosaicf2_videoram) AM_RANGE(0x80000000, 0x80ffffff) AM_ROM AM_REGION(REGION_USER2,0) AM_RANGE(0xfff00000, 0xffffffff) AM_ROM AM_REGION(REGION_USER1,0) ADDRESS_MAP_END @@ -159,8 +164,7 @@ static MACHINE_DRIVER_START( mosaicf2 ) MDRV_SCREEN_SIZE(512, 512) MDRV_SCREEN_VISIBLE_AREA(0, 319, 0, 223) - MDRV_VIDEO_START(generic_bitmapped) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(mosaicf2) /* sound hardware */ MDRV_SPEAKER_STANDARD_STEREO("left", "right") diff --git a/src/mame/drivers/galspnbl.c b/src/mame/drivers/galspnbl.c index 5dc3ed8f26f..cc2a52b36fd 100644 --- a/src/mame/drivers/galspnbl.c +++ b/src/mame/drivers/galspnbl.c @@ -25,11 +25,12 @@ TODO: #include "sound/3812intf.h" -extern UINT16 *galspnbl_bgvideoram,*galspnbl_videoram,*galspnbl_colorram; +extern UINT16 *galspnbl_bgvideoram; +extern UINT16 *galspnbl_videoram; +extern UINT16 *galspnbl_colorram; +extern UINT16 *galspnbl_scroll; PALETTE_INIT( galspnbl ); -WRITE16_HANDLER( galspnbl_bgvideoram_w ); -WRITE16_HANDLER( galspnbl_scroll_w ); VIDEO_UPDATE( galspnbl ); @@ -43,60 +44,38 @@ static WRITE16_HANDLER( soundcommand_w ) } -static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x000000, 0x3fffff) AM_READ(MRA16_ROM) - AM_RANGE(0x700000, 0x703fff) AM_READ(MRA16_RAM) /* galspnbl */ - AM_RANGE(0x708000, 0x70ffff) AM_READ(MRA16_RAM) /* galspnbl */ - AM_RANGE(0x800000, 0x803fff) AM_READ(MRA16_RAM) /* hotpinbl */ - AM_RANGE(0x808000, 0x80ffff) AM_READ(MRA16_RAM) /* hotpinbl */ - AM_RANGE(0x880000, 0x880fff) AM_READ(MRA16_RAM) - AM_RANGE(0x900000, 0x900fff) AM_READ(MRA16_RAM) - AM_RANGE(0x904000, 0x904fff) AM_READ(MRA16_RAM) - AM_RANGE(0x980000, 0x9bffff) AM_READ(MRA16_RAM) - AM_RANGE(0xa80000, 0xa80001) AM_READ(input_port_0_word_r) - AM_RANGE(0xa80010, 0xa80011) AM_READ(input_port_1_word_r) - AM_RANGE(0xa80020, 0xa80021) AM_READ(input_port_2_word_r) - AM_RANGE(0xa80030, 0xa80031) AM_READ(input_port_3_word_r) - AM_RANGE(0xa80040, 0xa80041) AM_READ(input_port_4_word_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 16 ) - AM_RANGE(0x000000, 0x3fffff) AM_WRITE(MWA16_ROM) - AM_RANGE(0x700000, 0x703fff) AM_WRITE(MWA16_RAM) /* galspnbl work RAM */ - AM_RANGE(0x708000, 0x70ffff) AM_WRITE(MWA16_RAM) /* galspnbl work RAM, bitmaps are decompressed here */ - AM_RANGE(0x800000, 0x803fff) AM_WRITE(MWA16_RAM) /* hotpinbl work RAM */ - AM_RANGE(0x808000, 0x80ffff) AM_WRITE(MWA16_RAM) /* hotpinbl work RAM, bitmaps are decompressed here */ - AM_RANGE(0x880000, 0x880fff) AM_WRITE(MWA16_RAM) AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) +static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 ) + AM_RANGE(0x000000, 0x3fffff) AM_ROM + AM_RANGE(0x700000, 0x703fff) AM_RAM /* galspnbl work RAM */ + AM_RANGE(0x708000, 0x70ffff) AM_RAM /* galspnbl work RAM, bitmaps are decompressed here */ + AM_RANGE(0x800000, 0x803fff) AM_RAM /* hotpinbl work RAM */ + AM_RANGE(0x808000, 0x80ffff) AM_RAM /* hotpinbl work RAM, bitmaps are decompressed here */ + AM_RANGE(0x880000, 0x880fff) AM_RAM AM_BASE(&spriteram16) AM_SIZE(&spriteram_size) AM_RANGE(0x8ff400, 0x8fffff) AM_WRITE(MWA16_NOP) /* ??? */ - AM_RANGE(0x900000, 0x900fff) AM_WRITE(MWA16_RAM) AM_BASE(&galspnbl_colorram) + AM_RANGE(0x900000, 0x900fff) AM_RAM AM_BASE(&galspnbl_colorram) AM_RANGE(0x901000, 0x903fff) AM_WRITE(MWA16_NOP) /* ??? */ - AM_RANGE(0x904000, 0x904fff) AM_WRITE(MWA16_RAM) AM_BASE(&galspnbl_videoram) + AM_RANGE(0x904000, 0x904fff) AM_RAM AM_BASE(&galspnbl_videoram) AM_RANGE(0x905000, 0x907fff) AM_WRITE(MWA16_NOP) /* ??? */ - AM_RANGE(0x980000, 0x9bffff) AM_WRITE(galspnbl_bgvideoram_w) AM_BASE(&galspnbl_bgvideoram) + AM_RANGE(0x980000, 0x9bffff) AM_RAM AM_BASE(&galspnbl_bgvideoram) AM_RANGE(0xa00000, 0xa00fff) AM_WRITE(MWA16_NOP) /* more palette ? */ AM_RANGE(0xa01000, 0xa017ff) AM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE(&paletteram16) AM_RANGE(0xa01800, 0xa027ff) AM_WRITE(MWA16_NOP) /* more palette ? */ - AM_RANGE(0xa80010, 0xa80011) AM_WRITE(soundcommand_w) - AM_RANGE(0xa80020, 0xa80021) AM_WRITE(MWA16_NOP) /* could be watchdog, but causes resets when picture is shown */ - AM_RANGE(0xa80030, 0xa80031) AM_WRITE(MWA16_NOP) /* irq ack? */ - AM_RANGE(0xa80050, 0xa80051) AM_WRITE(galspnbl_scroll_w) + AM_RANGE(0xa80000, 0xa80001) AM_READ(input_port_0_word_r) + AM_RANGE(0xa80010, 0xa80011) AM_READWRITE(input_port_1_word_r, soundcommand_w) + AM_RANGE(0xa80020, 0xa80021) AM_READWRITE(input_port_2_word_r, MWA16_NOP) /* w - could be watchdog, but causes resets when picture is shown */ + AM_RANGE(0xa80030, 0xa80031) AM_READWRITE(input_port_3_word_r, MWA16_NOP) /* w - irq ack? */ + AM_RANGE(0xa80040, 0xa80041) AM_READ(input_port_4_word_r) + AM_RANGE(0xa80050, 0xa80051) AM_WRITE(MWA16_RAM) AM_BASE(&galspnbl_scroll) /* ??? */ ADDRESS_MAP_END -static ADDRESS_MAP_START( sound_readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0xefff) AM_READ(MRA8_ROM) - AM_RANGE(0xf000, 0xf7ff) AM_READ(MRA8_RAM) - AM_RANGE(0xf800, 0xf800) AM_READ(OKIM6295_status_0_r) - AM_RANGE(0xfc00, 0xfc00) AM_READ(MRA8_NOP) /* irq ack ?? */ - AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r) -ADDRESS_MAP_END - -static ADDRESS_MAP_START( sound_writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0xefff) AM_WRITE(MWA8_ROM) - AM_RANGE(0xf000, 0xf7ff) AM_WRITE(MWA8_RAM) - AM_RANGE(0xf800, 0xf800) AM_WRITE(OKIM6295_data_0_w) +static ADDRESS_MAP_START( audio_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0xefff) AM_ROM + AM_RANGE(0xf000, 0xf7ff) AM_RAM + AM_RANGE(0xf800, 0xf800) AM_READWRITE(OKIM6295_status_0_r, OKIM6295_data_0_w) AM_RANGE(0xf810, 0xf810) AM_WRITE(YM3812_control_port_0_w) AM_RANGE(0xf811, 0xf811) AM_WRITE(YM3812_write_port_0_w) - AM_RANGE(0xfc00, 0xfc00) AM_WRITE(MWA8_NOP) /* irq ack ?? */ + AM_RANGE(0xfc00, 0xfc00) AM_READWRITE(MRA8_NOP, MWA8_NOP) /* irq ack ?? */ + AM_RANGE(0xfc20, 0xfc20) AM_READ(soundlatch_r) ADDRESS_MAP_END @@ -301,12 +280,12 @@ static MACHINE_DRIVER_START( galspnbl ) /* basic machine hardware */ MDRV_CPU_ADD(M68000, 10000000) /* 10 MHz ??? */ - MDRV_CPU_PROGRAM_MAP(readmem,writemem) + MDRV_CPU_PROGRAM_MAP(main_map,0) MDRV_CPU_VBLANK_INT(irq3_line_hold,1)/* also has vector for 6, but it does nothing */ MDRV_CPU_ADD(Z80, 4000000) /* audio CPU */ /* 4 MHz ??? */ - MDRV_CPU_PROGRAM_MAP(sound_readmem,sound_writemem) + MDRV_CPU_PROGRAM_MAP(audio_map,0) /* NMI is caused by the main CPU */ /* video hardware */ @@ -321,7 +300,6 @@ static MACHINE_DRIVER_START( galspnbl ) MDRV_PALETTE_LENGTH(1024 + 32768) MDRV_PALETTE_INIT(galspnbl) - MDRV_VIDEO_START(generic_bitmapped) MDRV_VIDEO_UPDATE(galspnbl) /* sound hardware */ diff --git a/src/mame/drivers/m79amb.c b/src/mame/drivers/m79amb.c index ad67529b213..7facf0acfde 100644 --- a/src/mame/drivers/m79amb.c +++ b/src/mame/drivers/m79amb.c @@ -51,16 +51,57 @@ Ports: */ #include "driver.h" -WRITE8_HANDLER( ramtek_videoram_w ); - INTERRUPT_GEN( invaders_interrupt ); void ramtek_sh_update(void); -WRITE8_HANDLER( ramtek_mask_w ); -/* - * since these functions aren't used anywhere else, i've made them - * static, and included them here - */ + +/*************************************************************************** + + video.c + + Functions to emulate the video hardware of the machine. + +***************************************************************************/ + +#include "driver.h" + + + +static UINT8 *ramtek_videoram; +static UINT8 *mask; + + +static WRITE8_HANDLER( ramtek_videoram_w ) +{ + ramtek_videoram[offset] = data & ~*mask; +} + +static VIDEO_UPDATE( ramtek ) +{ + offs_t offs; + + for (offs = 0; offs < 0x2000; offs++) + { + int i; + + UINT8 data = ramtek_videoram[offs]; + int y = offs >> 5; + int x = (offs & 0x1f) << 3; + + for (i = 0; i < 8; i++) + { + pen_t pen = (data & 0x80) ? RGB_WHITE : RGB_BLACK; + *BITMAP_ADDR32(bitmap, y, x) = pen; + + x++; + data <<= 1; + } + } + + return 0; +} + + static const int ControllerTable[32] = { 0 , 1 , 3 , 2 , 6 , 7 , 5 , 4 , 12 , 13 , 15 , 14 , 10 , 11 , 9 , 8 , @@ -78,34 +119,26 @@ static READ8_HANDLER( gray5bit_controller1_r ) return (input_port_3_r(0) & 0xe0) | (~ControllerTable[input_port_3_r(0) & 0x1f] & 0x1f); } -static ADDRESS_MAP_START( readmem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_READ(MRA8_ROM) - AM_RANGE(0x4000, 0x63ff) AM_READ(MRA8_RAM) - AM_RANGE(0x8000, 0x8000) AM_READ(input_port_0_r) - AM_RANGE(0x8002, 0x8002) AM_READ(input_port_1_r) - AM_RANGE(0x8004, 0x8004) AM_READ(gray5bit_controller0_r) - AM_RANGE(0x8005, 0x8005) AM_READ(gray5bit_controller1_r) - AM_RANGE(0xC000, 0xC07f) AM_READ(MRA8_RAM) /* ?? */ - AM_RANGE(0xC200, 0xC27f) AM_READ(MRA8_RAM) /* ?? */ -ADDRESS_MAP_END - static WRITE8_HANDLER( sound_w ) { } -static ADDRESS_MAP_START( writemem, ADDRESS_SPACE_PROGRAM, 8 ) - AM_RANGE(0x0000, 0x1fff) AM_WRITE(MWA8_ROM) - AM_RANGE(0x4000, 0x43ff) AM_WRITE(MWA8_RAM) - AM_RANGE(0x4400, 0x5fff) AM_WRITE(ramtek_videoram_w) AM_BASE(&videoram) - AM_RANGE(0x6000, 0x63ff) AM_WRITE(MWA8_RAM) /* ?? */ - AM_RANGE(0x8001, 0x8001) AM_WRITE(ramtek_mask_w) - AM_RANGE(0x8000, 0x8000) AM_WRITE(sound_w) /* sound_w listed twice?? */ - AM_RANGE(0x8002, 0x8003) AM_WRITE(sound_w) /* Manual Shows sound control at 0x8002 */ - AM_RANGE(0xC000, 0xC07f) AM_WRITE(MWA8_RAM) /* ?? */ - AM_RANGE(0xC200, 0xC27f) AM_WRITE(MWA8_RAM) /* ?? */ +static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 8 ) + AM_RANGE(0x0000, 0x1fff) AM_ROM + AM_RANGE(0x4000, 0x5fff) AM_READWRITE(MRA8_RAM, ramtek_videoram_w) AM_BASE(&ramtek_videoram) + AM_RANGE(0x6000, 0x63ff) AM_RAM /* ?? */ + AM_RANGE(0x8000, 0x8000) AM_READWRITE(input_port_0_r, sound_w) /* sound_w listed twice?? */ + AM_RANGE(0x8001, 0x8001) AM_WRITE(MWA8_RAM) AM_BASE(&mask) + AM_RANGE(0x8002, 0x8002) AM_READWRITE(input_port_1_r, sound_w) + AM_RANGE(0x8003, 0x8003) AM_WRITE(sound_w) /* Manual Shows sound control at 0x8002 */ + AM_RANGE(0x8004, 0x8004) AM_READ(gray5bit_controller0_r) + AM_RANGE(0x8005, 0x8005) AM_READ(gray5bit_controller1_r) + AM_RANGE(0xc000, 0xc07f) AM_RAM /* ?? */ + AM_RANGE(0xc200, 0xc27f) AM_RAM /* ?? */ ADDRESS_MAP_END + static INPUT_PORTS_START( m79amb ) PORT_START /* 8000 */ PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_UNKNOWN ) /* dip switch */ @@ -142,7 +175,7 @@ static INPUT_PORTS_START( m79amb ) INPUT_PORTS_END -static INTERRUPT_GEN( M79_interrupt ) +static INTERRUPT_GEN( m79amb_interrupt ) { cpunum_set_input_line_and_vector(machine, 0, 0, HOLD_LINE, 0xcf); /* RST 08h */ } @@ -161,19 +194,18 @@ static MACHINE_DRIVER_START( m79amb ) /* basic machine hardware */ MDRV_CPU_ADD(8080, 1996800) - MDRV_CPU_PROGRAM_MAP(readmem,writemem) - MDRV_CPU_VBLANK_INT(M79_interrupt,1) + MDRV_CPU_PROGRAM_MAP(main_map,0) + MDRV_CPU_VBLANK_INT(m79amb_interrupt,1) /* video hardware */ MDRV_SCREEN_ADD("main", RASTER) MDRV_SCREEN_REFRESH_RATE(60) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500) /* not accurate */) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32) - MDRV_SCREEN_SIZE(32*8, 28*8) - MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 0*8, 28*8-1) + MDRV_SCREEN_SIZE(32*8, 32*8) + MDRV_SCREEN_VISIBLE_AREA(0*8, 32*8-1, 4*8, 32*8-1) - MDRV_VIDEO_START(generic_bitmapped) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(ramtek) /* sound hardware */ MACHINE_DRIVER_END @@ -202,4 +234,4 @@ ROM_END -GAME( 1977, m79amb, 0, m79amb, m79amb, m79amb, ROT0, "RamTek", "M79 Ambush", GAME_NO_SOUND ) +GAME( 1977, m79amb, 0, m79amb, m79amb, m79amb, ROT0, "Ramtek", "M-79 Ambush", GAME_NO_SOUND ) diff --git a/src/mame/drivers/mquake.c b/src/mame/drivers/mquake.c index ee0edc45dcf..91457b8e60f 100644 --- a/src/mame/drivers/mquake.c +++ b/src/mame/drivers/mquake.c @@ -352,7 +352,6 @@ static MACHINE_DRIVER_START( mquake ) /* basic machine hardware */ MDRV_CPU_ADD(M68000, AMIGA_68000_NTSC_CLOCK) MDRV_CPU_PROGRAM_MAP(main_map,0) - MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) MDRV_MACHINE_RESET(mquake) MDRV_NVRAM_HANDLER(generic_0fill) @@ -371,7 +370,7 @@ static MACHINE_DRIVER_START( mquake ) MDRV_PALETTE_INIT(amiga) MDRV_VIDEO_START(amiga) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(amiga) /* sound hardware */ MDRV_SPEAKER_STANDARD_STEREO("left", "right") diff --git a/src/mame/drivers/spaceg.c b/src/mame/drivers/spaceg.c index fd7dc813d6f..2c194878241 100644 --- a/src/mame/drivers/spaceg.c +++ b/src/mame/drivers/spaceg.c @@ -170,10 +170,10 @@ Notes: -static UINT8 unkram[65536]; +static UINT8 *unkram; -static int io9400; -static int io9401; +static UINT8 *io9400; +static UINT8 *io9401; static PALETTE_INIT( spaceg ) { @@ -205,7 +205,7 @@ static PALETTE_INIT( spaceg ) static WRITE8_HANDLER( zvideoram_w ) { - int i,x,y,col; + int col; col = unkram[0x400]; @@ -213,7 +213,7 @@ static WRITE8_HANDLER( zvideoram_w ) col &=0x0f; - switch(io9401) + switch(*io9401) { case 0x0d: /* 1101 */ videoram[offset] &= ~data; @@ -226,28 +226,14 @@ static WRITE8_HANDLER( zvideoram_w ) break; default: - logerror("mode =%02x pc=%04x\n",io9401,activecpu_get_pc() ); - popmessage("mode =%02x pc=%04x\n",io9401,activecpu_get_pc() ); + logerror("mode =%02x pc=%04x\n",*io9401,activecpu_get_pc() ); + popmessage("mode =%02x pc=%04x\n",*io9401,activecpu_get_pc() ); return; break; } unkram [offset] = col; - - y= 255 - (offset & 0xff); - x= 255 - ((offset>>8)*8); - x -= ((io9400&0xe0)>>5); - - /* draw modified eight pixels */ - if (y >= 0 && y < tmpbitmap->height) - for (i = 0; i < 8; i++) - { - if (x >= 0 && y < tmpbitmap->width) - *BITMAP_ADDR16(tmpbitmap, y, x) = (data&1)? col : 0; - x++; - data >>= 1; - } } static READ8_HANDLER(fake_r) @@ -283,83 +269,49 @@ int rgbcolor; logerror("palette? read from unkram offset = %04x\n",offset); } -if (io9401!=0x40) - logerror("unkram read in mode: 9401 = %02x (offset=%04x)\n",io9401,offset); +if (*io9401!=0x40) + logerror("unkram read in mode: 9401 = %02x (offset=%04x)\n",*io9401,offset); return unkram[offset]; } -static WRITE8_HANDLER(spaceg_colorram_w) + +static VIDEO_UPDATE( spaceg ) { - int i,x,y,col; + offs_t offs; - unkram[offset] = data; + for (offs = 0; offs < 0x2000; offs++) + { + int i; + UINT8 data = videoram[offs]; + int y = offs & 0xff; + UINT8 x = ((offs >> 8) << 3) - ((*io9400 & 0xe0) >> 5); - /* refresh eight pixels because the color might have just been changed */ - data = videoram[offset]; - col = unkram [offset]; - - y= 255 - (offset & 0xff); - x= 255 - ((offset>>8)*8); - x -= ((io9400&0xe0)>>5); - - /* draw modified eight pixels */ - if (y >= 0 && y < tmpbitmap->height) for (i = 0; i < 8; i++) { - if (x >= 0 && x < tmpbitmap->width) - *BITMAP_ADDR16(tmpbitmap, y, x) = (data&1)? col : 0; + *BITMAP_ADDR16(bitmap, y, x) = (data & 0x80) ? unkram[offs] : 0; + x++; - data >>= 1; + data <<= 1; } -} - - -static READ8_HANDLER(zr_r) -{ - return videoram[offset]; -} - -static WRITE8_HANDLER(io9400_w) -{ - io9400=data; - if (io9400 & 0x1f) - { - logerror("!!9400 =%02x pc=%04x\n",io9400,activecpu_get_pc() ); } + + return 0; } -static WRITE8_HANDLER(io9401_w) -{ - io9401 = data; - - -//0x40 - loads the palette on READ, address line 0x100 is the ninth bit (3rd bit of the red component) - - switch(io9401) - { - case 0x0d: - case 0x01: - case 0x00: - break; - default: - logerror("!!9401 mode =%02x pc=%04x\n",io9401,activecpu_get_pc() ); - break; - } -} static ADDRESS_MAP_START( readwritemem, ADDRESS_SPACE_PROGRAM, 8 ) AM_RANGE(0x0000, 0x1fff) AM_ROM AM_RANGE(0x3000, 0x3fff) AM_ROM AM_RANGE(0x7000, 0x77ff) AM_RAM - AM_RANGE(0xc000, 0xdfff) AM_READWRITE(zr_r, zvideoram_w) AM_BASE(&videoram) - AM_RANGE(0xa000, 0xbfff) AM_READWRITE(spaceg_colorram_r, spaceg_colorram_w) + AM_RANGE(0xc000, 0xdfff) AM_READWRITE(MRA8_RAM, zvideoram_w) AM_BASE(&videoram) + AM_RANGE(0xa000, 0xbfff) AM_READWRITE(spaceg_colorram_r, MWA8_RAM) AM_BASE(&unkram) - AM_RANGE(0x9400, 0x9400) AM_WRITE(io9400_w) /* gfx ctrl */ - AM_RANGE(0x9401, 0x9401) AM_WRITE(io9401_w) /* gfx ctrl */ + AM_RANGE(0x9400, 0x9400) AM_WRITE(MWA8_RAM) AM_BASE(&io9400) /* gfx ctrl */ + AM_RANGE(0x9401, 0x9401) AM_WRITE(MWA8_RAM) AM_BASE(&io9401) /* gfx ctrl */ /* 9402 - bits 0 and 1 probably control the lamps under the player 1 and player 2 start buttons bit 3 is probably a flip screen @@ -422,12 +374,11 @@ static MACHINE_DRIVER_START( spaceg ) MDRV_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(0)) MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16) MDRV_SCREEN_SIZE(256, 256) - MDRV_SCREEN_VISIBLE_AREA(0, 256-1, 0, 256-1-3*8) + MDRV_SCREEN_VISIBLE_AREA(0, 255, 32, 255) MDRV_PALETTE_LENGTH(16+128-16) MDRV_PALETTE_INIT( spaceg ) - MDRV_VIDEO_START(generic_bitmapped) - MDRV_VIDEO_UPDATE( generic_bitmapped ) + MDRV_VIDEO_UPDATE( spaceg ) /* sound hardware */ MDRV_SPEAKER_STANDARD_MONO("mono") @@ -469,4 +420,4 @@ ROM_START( spaceg ) ROM_END -GAME( 1979, spaceg, 0, spaceg, spaceg, 0, ROT90, "Omori", "Space Guerrilla", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND) +GAME( 1979, spaceg, 0, spaceg, spaceg, 0, ROT270, "Omori", "Space Guerrilla", GAME_IMPERFECT_GRAPHICS | GAME_NO_SOUND) diff --git a/src/mame/drivers/upscope.c b/src/mame/drivers/upscope.c index ed022adbb37..73078ef331b 100644 --- a/src/mame/drivers/upscope.c +++ b/src/mame/drivers/upscope.c @@ -290,7 +290,6 @@ static MACHINE_DRIVER_START( upscope ) /* basic machine hardware */ MDRV_CPU_ADD(M68000, AMIGA_68000_NTSC_CLOCK) MDRV_CPU_PROGRAM_MAP(main_map,0) - MDRV_CPU_VBLANK_INT(amiga_scanline_callback, 262) MDRV_MACHINE_RESET(amiga) MDRV_NVRAM_HANDLER(generic_0fill) @@ -309,7 +308,7 @@ static MACHINE_DRIVER_START( upscope ) MDRV_PALETTE_INIT(amiga) MDRV_VIDEO_START(amiga) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(amiga) /* sound hardware */ MDRV_SPEAKER_STANDARD_STEREO("left", "right") diff --git a/src/mame/drivers/vcombat.c b/src/mame/drivers/vcombat.c index b5cc195c4ad..9808142230d 100644 --- a/src/mame/drivers/vcombat.c +++ b/src/mame/drivers/vcombat.c @@ -88,6 +88,10 @@ ADDRESS_MAP_END static INPUT_PORTS_START( vcombat ) INPUT_PORTS_END +static VIDEO_UPDATE( vcombat ) +{ + return 0; +} static MACHINE_DRIVER_START( vcombat ) MDRV_CPU_ADD_TAG("main", M68000, XTAL_12MHz) @@ -110,8 +114,7 @@ static MACHINE_DRIVER_START( vcombat ) MDRV_PALETTE_LENGTH(0x100) - MDRV_VIDEO_START(generic_bitmapped) - MDRV_VIDEO_UPDATE(generic_bitmapped) + MDRV_VIDEO_UPDATE(vcombat) MACHINE_DRIVER_END diff --git a/src/mame/includes/amiga.h b/src/mame/includes/amiga.h index 47f80940c5c..d3b4fd3b15f 100644 --- a/src/mame/includes/amiga.h +++ b/src/mame/includes/amiga.h @@ -377,7 +377,6 @@ extern void (*amiga_chip_ram_w)(offs_t offset, UINT16 data); void amiga_machine_config(const amiga_machine_interface *intf); MACHINE_RESET( amiga ); -INTERRUPT_GEN( amiga_scanline_callback ); CUSTOM_INPUT( amiga_joystick_convert ); @@ -408,11 +407,12 @@ void amiga_audio_data_w(int which, UINT16 data); PALETTE_INIT( amiga ); VIDEO_START( amiga ); +VIDEO_UPDATE( amiga ); UINT32 amiga_gethvpos(void); void copper_setpc(UINT32 pc); void amiga_set_genlock_color(UINT16 color); -void amiga_render_scanline(int scanline); +void amiga_render_scanline(bitmap_t *bitmap, int scanline); void amiga_sprite_dma_reset(int which); void amiga_sprite_enable_comparitor(int which, int enable); diff --git a/src/mame/machine/amiga.c b/src/mame/machine/amiga.c index ddf5358f6df..d59365c473d 100644 --- a/src/mame/machine/amiga.c +++ b/src/mame/machine/amiga.c @@ -43,6 +43,7 @@ #define BLITTER_NASTY_DELAY 16 + /************************************* * * Type definitions @@ -178,6 +179,9 @@ static void amiga_cia_0_irq(int state); static void amiga_cia_1_irq(int state); static TIMER_CALLBACK( amiga_irq_proc ); static TIMER_CALLBACK( amiga_blitter_proc ); +static TIMER_CALLBACK( scanline_callback ); + + /************************************* * @@ -247,6 +251,7 @@ static void amiga_chip_ram32_w(offs_t offset, UINT16 data) } + /************************************* * * Machine config/reset @@ -346,6 +351,9 @@ MACHINE_RESET( amiga ) /* call the system-specific callback */ if (amiga_intf->reset_callback) (*amiga_intf->reset_callback)(); + + /* start the scanline timer */ + timer_set(video_screen_get_time_until_pos(0, 0, 0), NULL, 0, scanline_callback); } @@ -356,9 +364,9 @@ MACHINE_RESET( amiga ) * *************************************/ -INTERRUPT_GEN( amiga_scanline_callback ) +static TIMER_CALLBACK( scanline_callback ) { - int scanline = machine->screen[0].height - 1 - cpu_getiloops(); + int scanline = param; /* on the first scanline, we do some extra bookkeeping */ if (scanline == 0) @@ -377,11 +385,18 @@ INTERRUPT_GEN( amiga_scanline_callback ) /* on every scanline, clock the second CIA TOD */ cia_clock_tod(1); - /* render this scanline */ - amiga_render_scanline(scanline); + /* render up to this scanline */ + if (scanline < machine->screen[0].visarea.min_y) + amiga_render_scanline(NULL, scanline); + else + video_screen_update_partial(0, scanline); /* force a sound update */ amiga_audio_update(); + + /* set timer for next line */ + scanline = (scanline + 1) % machine->screen[0].height; + timer_set(video_screen_get_time_until_pos(0, scanline, 0), NULL, scanline, scanline_callback); } @@ -432,12 +447,15 @@ static void update_irqs(void) cpunum_set_input_line(Machine, 0, 7, CLEAR_LINE); } + static TIMER_CALLBACK( amiga_irq_proc ) { update_irqs(); timer_reset( amiga_irq_timer, attotime_never); } + + /************************************* * * Standard joystick conversion diff --git a/src/mame/mame.mak b/src/mame/mame.mak index 6e792ad2916..86321bdc377 100644 --- a/src/mame/mame.mak +++ b/src/mame/mame.mak @@ -926,7 +926,7 @@ $(MAMEOBJ)/midcoin.a: \ $(MAMEOBJ)/midw8080.a: \ $(DRIVERS)/8080bw.o $(AUDIO)/8080bw.o $(VIDEO)/8080bw.o \ - $(DRIVERS)/m79amb.o $(VIDEO)/m79amb.o \ + $(DRIVERS)/m79amb.o \ $(DRIVERS)/mw8080bw.o $(MACHINE)/mw8080bw.o $(AUDIO)/mw8080bw.o $(VIDEO)/mw8080bw.o \ $(DRIVERS)/rotaryf.o \ $(DRIVERS)/sspeedr.o $(VIDEO)/sspeedr.o \ diff --git a/src/mame/video/amiga.c b/src/mame/video/amiga.c index 7532d7c3ce1..28063abd26b 100644 --- a/src/mame/video/amiga.c +++ b/src/mame/video/amiga.c @@ -155,8 +155,6 @@ VIDEO_START( amiga ) /* reset the genlock color */ genlock_color = 0xffff; - - VIDEO_START_CALL(generic_bitmapped); } @@ -609,7 +607,7 @@ INLINE int update_ham(int newpix) * *************************************/ -void amiga_render_scanline(int scanline) +void amiga_render_scanline(bitmap_t *bitmap, int scanline) { UINT16 save_color0 = CUSTOM_REG(REG_COLOR00); int ddf_start_pixel = 0, ddf_stop_pixel = 0; @@ -620,7 +618,7 @@ void amiga_render_scanline(int scanline) int planes = 0; int x; - UINT16 *dst; + UINT16 *dst = NULL; int ebitoffs = 0, obitoffs = 0; int ecolmask = 0, ocolmask = 0; int edelay = 0, odelay = 0; @@ -640,7 +638,8 @@ void amiga_render_scanline(int scanline) update_sprite_dma(scanline); /* start of a new line, signal we're not done with it and fill up vars */ - dst = BITMAP_ADDR16(tmpbitmap, scanline, 0); + if (bitmap != NULL) + dst = BITMAP_ADDR16(bitmap, scanline, 0); /* all sprites off at the start of the line */ memset(sprite_remain, 0, sizeof(sprite_remain)); @@ -697,8 +696,9 @@ void amiga_render_scanline(int scanline) } /* clear the target pixels to the background color as a starting point */ - dst[x*2+0] = - dst[x*2+1] = CUSTOM_REG(REG_COLOR00); + if (dst != NULL) + dst[x*2+0] = + dst[x*2+1] = CUSTOM_REG(REG_COLOR00); /* if we hit the first fetch pixel, reset the counters and latch the delays */ if (x == ddf_start_pixel) @@ -838,7 +838,7 @@ void amiga_render_scanline(int scanline) CUSTOM_REG(REG_CLXDAT) |= 0x001; /* if we are within the display region, render */ - if (x >= hstart && x < hstop) + if (dst != NULL && x >= hstart && x < hstop) { /* hold-and-modify mode -- assume low-res (hi-res not supported by the hardware) */ if (ham) @@ -969,3 +969,22 @@ void amiga_render_scanline(int scanline) } #endif } + + + +/************************************* + * + * Update + * + *************************************/ + +VIDEO_UPDATE( amiga ) +{ + int y; + + /* render each scanline in the visible region */ + for (y = cliprect->min_y; y <= cliprect->max_y; y++) + amiga_render_scanline(bitmap, y); + + return 0; +} diff --git a/src/mame/video/galspnbl.c b/src/mame/video/galspnbl.c index 4f5d34f898b..cc269cba178 100644 --- a/src/mame/video/galspnbl.c +++ b/src/mame/video/galspnbl.c @@ -2,9 +2,10 @@ #include "deprecat.h" -UINT16 *galspnbl_bgvideoram,*galspnbl_videoram,*galspnbl_colorram; -static int screenscroll; - +UINT16 *galspnbl_bgvideoram; +UINT16 *galspnbl_videoram; +UINT16 *galspnbl_colorram; +UINT16 *galspnbl_scroll; PALETTE_INIT( galspnbl ) @@ -18,27 +19,6 @@ PALETTE_INIT( galspnbl ) -WRITE16_HANDLER( galspnbl_bgvideoram_w ) -{ - int sx,sy; - - - data = COMBINE_DATA(&galspnbl_bgvideoram[offset]); - - sx = offset % 512; - sy = offset / 512; - - *BITMAP_ADDR16(tmpbitmap, sy, sx) = 1024 + (data >> 1); -} - -WRITE16_HANDLER( galspnbl_scroll_w ) -{ - if (ACCESSING_LSB) - screenscroll = 4-(data & 0xff); -} - - - /* sprite format (see also Ninja Gaiden): * * word bit usage @@ -84,7 +64,8 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re color = spriteram16[offs+2]; size = 1 << (color & 0x0003); // 1,2,4,8 color = (color & 0x00f0) >> 4; - sx = spriteram16[offs+4] + screenscroll; +// sx = spriteram16[offs+4] + screenscroll; + sx = spriteram16[offs+4]; sy = spriteram16[offs+3]; flipx = attr & 0x0001; flipy = attr & 0x0002; @@ -108,13 +89,27 @@ static void draw_sprites(running_machine *machine, mame_bitmap *bitmap, const re } +static void draw_background(mame_bitmap *bitmap, const rectangle *cliprect) +{ + offs_t offs; + +// int screenscroll = 4 - (galspnbl_scroll[0] & 0xff); + + for (offs = 0; offs < 0x20000; offs++) + { + int y = offs >> 9; + int x = offs & 0x1ff; + + *BITMAP_ADDR16(bitmap, y, x) = 1024 + (galspnbl_bgvideoram[offs] >> 1); + } +} + + VIDEO_UPDATE( galspnbl ) { int offs; - - /* copy the temporary bitmap to the screen */ - copyscrollbitmap(bitmap,tmpbitmap,1,&screenscroll,0,0,cliprect); + draw_background(bitmap, cliprect); draw_sprites(machine,bitmap,cliprect,0); @@ -135,7 +130,8 @@ VIDEO_UPDATE( galspnbl ) code, color, 0,0, - 16*sx + screenscroll,8*sy, +// 16*sx + screenscroll,8*sy, + 16*sx,8*sy, cliprect,TRANSPARENCY_PEN,0); } } diff --git a/src/mame/video/m79amb.c b/src/mame/video/m79amb.c deleted file mode 100644 index fe610883124..00000000000 --- a/src/mame/video/m79amb.c +++ /dev/null @@ -1,42 +0,0 @@ -/*************************************************************************** - - video.c - - Functions to emulate the video hardware of the machine. - -***************************************************************************/ - -#include "driver.h" - - - -static UINT8 mask = 0; - -WRITE8_HANDLER( ramtek_mask_w ) -{ - mask = data; -} - -WRITE8_HANDLER( ramtek_videoram_w ) -{ - data = data & ~mask; - - if (videoram[offset] != data) - { - int i,x,y; - - videoram[offset] = data; - - y = offset / 32; - x = 8 * (offset % 32); - - for (i = 0; i < 8; i++) - { - pen_t pen = (data & 0x80) ? RGB_WHITE : RGB_BLACK; - *BITMAP_ADDR32(tmpbitmap, y, x) = pen; - - x++; - data <<= 1; - } - } -}