mirror of
https://github.com/holub/mame
synced 2025-05-22 05:38:52 +03:00
Converted toobin to RGB32 to allow for mid-screen palette updates.
Also added correct video timing and full memory map, and connected watchdog.
This commit is contained in:
parent
abf8eafc47
commit
7038a72e76
@ -22,6 +22,8 @@
|
||||
#include "audio/atarijsa.h"
|
||||
#include "toobin.h"
|
||||
|
||||
#define MASTER_CLOCK XTAL_32MHz
|
||||
|
||||
|
||||
|
||||
/*************************************
|
||||
@ -42,9 +44,9 @@ static UINT16 *interrupt_scan;
|
||||
|
||||
static void update_interrupts(running_machine *machine)
|
||||
{
|
||||
cpunum_set_input_line(machine, 0, 1, atarigen_scanline_int_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
cpunum_set_input_line(machine, 0, 2, atarigen_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
cpunum_set_input_line(machine, 0, 3, atarigen_scanline_int_state && atarigen_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(machine, "main", 1, atarigen_scanline_int_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(machine, "main", 2, atarigen_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
cputag_set_input_line(machine, "main", 3, atarigen_scanline_int_state && atarigen_sound_int_state ? ASSERT_LINE : CLEAR_LINE);
|
||||
}
|
||||
|
||||
|
||||
@ -101,29 +103,30 @@ static READ16_HANDLER( special_port1_r )
|
||||
*
|
||||
*************************************/
|
||||
|
||||
/* full address map decoded from schematics */
|
||||
static ADDRESS_MAP_START( main_map, ADDRESS_SPACE_PROGRAM, 16 )
|
||||
ADDRESS_MAP_GLOBAL_MASK(0xc7ffff)
|
||||
AM_RANGE(0x000000, 0x07ffff) AM_ROM
|
||||
AM_RANGE(0xc00000, 0xc09fff) AM_READ(SMH_RAM)
|
||||
AM_RANGE(0xc00000, 0xc07fff) AM_WRITE(atarigen_playfield_large_w) AM_BASE(&atarigen_playfield)
|
||||
AM_RANGE(0xc08000, 0xc097ff) AM_WRITE(atarigen_alpha_w) AM_BASE(&atarigen_alpha)
|
||||
AM_RANGE(0xc09800, 0xc09fff) AM_WRITE(atarimo_0_spriteram_w) AM_BASE(&atarimo_0_spriteram)
|
||||
AM_RANGE(0xc10000, 0xc107ff) AM_RAM_WRITE(toobin_paletteram_w) AM_BASE(&paletteram16)
|
||||
AM_RANGE(0xc00000, 0xc07fff) AM_RAM_WRITE(atarigen_playfield_large_w) AM_BASE(&atarigen_playfield)
|
||||
AM_RANGE(0xc08000, 0xc097ff) AM_MIRROR(0x046000) AM_RAM_WRITE(atarigen_alpha_w) AM_BASE(&atarigen_alpha)
|
||||
AM_RANGE(0xc09800, 0xc09fff) AM_MIRROR(0x046000) AM_RAM_WRITE(atarimo_0_spriteram_w) AM_BASE(&atarimo_0_spriteram)
|
||||
AM_RANGE(0xc10000, 0xc107ff) AM_MIRROR(0x047800) AM_RAM_WRITE(toobin_paletteram_w) AM_BASE(&paletteram16)
|
||||
AM_RANGE(0xff6000, 0xff6001) AM_READ(SMH_NOP) /* who knows? read at controls time */
|
||||
AM_RANGE(0xff8000, 0xff8001) AM_WRITE(watchdog_reset16_w)
|
||||
AM_RANGE(0xff8100, 0xff8101) AM_WRITE(atarigen_sound_w)
|
||||
AM_RANGE(0xff8300, 0xff8301) AM_WRITE(toobin_intensity_w)
|
||||
AM_RANGE(0xff8340, 0xff8341) AM_WRITE(interrupt_scan_w) AM_BASE(&interrupt_scan)
|
||||
AM_RANGE(0xff8380, 0xff8381) AM_WRITE(toobin_slip_w) AM_BASE(&atarimo_0_slipram)
|
||||
AM_RANGE(0xff83c0, 0xff83c1) AM_WRITE(atarigen_scanline_int_ack_w)
|
||||
AM_RANGE(0xff8400, 0xff8401) AM_WRITE(atarigen_sound_reset_w)
|
||||
AM_RANGE(0xff8500, 0xff8501) AM_WRITE(atarigen_eeprom_enable_w)
|
||||
AM_RANGE(0xff8600, 0xff8601) AM_WRITE(toobin_xscroll_w) AM_BASE(&atarigen_xscroll)
|
||||
AM_RANGE(0xff8700, 0xff8701) AM_WRITE(toobin_yscroll_w) AM_BASE(&atarigen_yscroll)
|
||||
AM_RANGE(0xff8800, 0xff8801) AM_READ_PORT("FF8800")
|
||||
AM_RANGE(0xff9000, 0xff9001) AM_READ(special_port1_r)
|
||||
AM_RANGE(0xff9800, 0xff9801) AM_READ(atarigen_sound_r)
|
||||
AM_RANGE(0xffa000, 0xffafff) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_BASE(&atarigen_eeprom) AM_SIZE(&atarigen_eeprom_size)
|
||||
AM_RANGE(0xffc000, 0xffffff) AM_RAM
|
||||
AM_RANGE(0xff8000, 0xff8001) AM_MIRROR(0x4500fe) AM_WRITE(watchdog_reset16_w)
|
||||
AM_RANGE(0xff8100, 0xff8101) AM_MIRROR(0x4500fe) AM_WRITE(atarigen_sound_w)
|
||||
AM_RANGE(0xff8300, 0xff8301) AM_MIRROR(0x45003e) AM_WRITE(toobin_intensity_w)
|
||||
AM_RANGE(0xff8340, 0xff8341) AM_MIRROR(0x45003e) AM_WRITE(interrupt_scan_w) AM_BASE(&interrupt_scan)
|
||||
AM_RANGE(0xff8380, 0xff8381) AM_MIRROR(0x45003e) AM_WRITE(toobin_slip_w) AM_BASE(&atarimo_0_slipram)
|
||||
AM_RANGE(0xff83c0, 0xff83c1) AM_MIRROR(0x45003e) AM_WRITE(atarigen_scanline_int_ack_w)
|
||||
AM_RANGE(0xff8400, 0xff8401) AM_MIRROR(0x4500fe) AM_WRITE(atarigen_sound_reset_w)
|
||||
AM_RANGE(0xff8500, 0xff8501) AM_MIRROR(0x4500fe) AM_WRITE(atarigen_eeprom_enable_w)
|
||||
AM_RANGE(0xff8600, 0xff8601) AM_MIRROR(0x4500fe) AM_WRITE(toobin_xscroll_w) AM_BASE(&atarigen_xscroll)
|
||||
AM_RANGE(0xff8700, 0xff8701) AM_MIRROR(0x4500fe) AM_WRITE(toobin_yscroll_w) AM_BASE(&atarigen_yscroll)
|
||||
AM_RANGE(0xff8800, 0xff8801) AM_MIRROR(0x4507fe) AM_READ_PORT("FF8800")
|
||||
AM_RANGE(0xff9000, 0xff9001) AM_MIRROR(0x4507fe) AM_READ(special_port1_r)
|
||||
AM_RANGE(0xff9800, 0xff9801) AM_MIRROR(0x4507fe) AM_READ(atarigen_sound_r)
|
||||
AM_RANGE(0xffa000, 0xffafff) AM_MIRROR(0x451000) AM_READWRITE(atarigen_eeprom_r, atarigen_eeprom_w) AM_BASE(&atarigen_eeprom) AM_SIZE(&atarigen_eeprom_size)
|
||||
AM_RANGE(0xffc000, 0xffffff) AM_MIRROR(0x450000) AM_RAM
|
||||
ADDRESS_MAP_END
|
||||
|
||||
|
||||
@ -221,21 +224,19 @@ GFXDECODE_END
|
||||
static MACHINE_DRIVER_START( toobin )
|
||||
|
||||
/* basic machine hardware */
|
||||
MDRV_CPU_ADD("main", M68010, ATARI_CLOCK_32MHz/4)
|
||||
MDRV_CPU_ADD("main", M68010, MASTER_CLOCK/4)
|
||||
MDRV_CPU_PROGRAM_MAP(main_map,0)
|
||||
|
||||
MDRV_MACHINE_RESET(toobin)
|
||||
MDRV_NVRAM_HANDLER(atarigen)
|
||||
MDRV_WATCHDOG_VBLANK_INIT(8)
|
||||
|
||||
/* video hardware */
|
||||
MDRV_VIDEO_ATTRIBUTES(VIDEO_UPDATE_BEFORE_VBLANK)
|
||||
|
||||
MDRV_SCREEN_ADD("main", RASTER)
|
||||
MDRV_SCREEN_REFRESH_RATE(60)
|
||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_INDEXED16)
|
||||
/* the vert size is copied from atarisy2.c. Needs to be verified */
|
||||
MDRV_SCREEN_SIZE(64*8, 420)
|
||||
MDRV_SCREEN_VISIBLE_AREA(0*8, 64*8-1, 0*8, 48*8-1)
|
||||
MDRV_SCREEN_RAW_PARAMS(MASTER_CLOCK/2, 640, 0, 512, 416, 0, 384)
|
||||
MDRV_SCREEN_FORMAT(BITMAP_FORMAT_RGB32)
|
||||
|
||||
MDRV_GFXDECODE(toobin)
|
||||
MDRV_PALETTE_LENGTH(1024)
|
||||
|
@ -406,7 +406,7 @@ void atarimo_init(running_machine *machine, int map, const atarimo_desc *desc)
|
||||
mo->slipram = (map == 0) ? &atarimo_0_slipram : &atarimo_1_slipram;
|
||||
|
||||
/* allocate the temp bitmap */
|
||||
mo->bitmap = video_screen_auto_bitmap_alloc(machine->primary_screen);
|
||||
mo->bitmap = auto_bitmap_alloc(video_screen_get_width(machine->primary_screen), video_screen_get_height(machine->primary_screen), BITMAP_FORMAT_INDEXED16);
|
||||
fillbitmap(mo->bitmap, desc->transpen, NULL);
|
||||
|
||||
/* allocate the spriteram */
|
||||
|
@ -17,6 +17,7 @@
|
||||
*************************************/
|
||||
|
||||
static double brightness;
|
||||
static bitmap_t *pfbitmap;
|
||||
|
||||
|
||||
|
||||
@ -101,6 +102,9 @@ VIDEO_START( toobin )
|
||||
/* initialize the alphanumerics */
|
||||
atarigen_alpha_tilemap = tilemap_create(get_alpha_tile_info, tilemap_scan_rows, 8,8, 64,48);
|
||||
tilemap_set_transparent_pen(atarigen_alpha_tilemap, 0);
|
||||
|
||||
/* allocate a playfield bitmap for rendering */
|
||||
pfbitmap = auto_bitmap_alloc(video_screen_get_width(machine->primary_screen), video_screen_get_height(machine->primary_screen), BITMAP_FORMAT_INDEXED16);
|
||||
}
|
||||
|
||||
|
||||
@ -227,42 +231,47 @@ WRITE16_HANDLER( toobin_slip_w )
|
||||
|
||||
VIDEO_UPDATE( toobin )
|
||||
{
|
||||
const rgb_t *palette = palette_entry_list_adjusted(screen->machine->palette);
|
||||
atarimo_rect_list rectlist;
|
||||
bitmap_t *mobitmap;
|
||||
int x, y, r;
|
||||
int x, y;
|
||||
|
||||
/* draw the playfield */
|
||||
fillbitmap(priority_bitmap, 0, cliprect);
|
||||
tilemap_draw(bitmap, cliprect, atarigen_playfield_tilemap, 0, 0);
|
||||
tilemap_draw(bitmap, cliprect, atarigen_playfield_tilemap, 1, 1);
|
||||
tilemap_draw(bitmap, cliprect, atarigen_playfield_tilemap, 2, 2);
|
||||
tilemap_draw(bitmap, cliprect, atarigen_playfield_tilemap, 3, 3);
|
||||
tilemap_draw(pfbitmap, cliprect, atarigen_playfield_tilemap, 0, 0);
|
||||
tilemap_draw(pfbitmap, cliprect, atarigen_playfield_tilemap, 1, 1);
|
||||
tilemap_draw(pfbitmap, cliprect, atarigen_playfield_tilemap, 2, 2);
|
||||
tilemap_draw(pfbitmap, cliprect, atarigen_playfield_tilemap, 3, 3);
|
||||
|
||||
/* draw and merge the MO */
|
||||
mobitmap = atarimo_render(0, cliprect, &rectlist);
|
||||
for (r = 0; r < rectlist.numrects; r++, rectlist.rect++)
|
||||
for (y = rectlist.rect->min_y; y <= rectlist.rect->max_y; y++)
|
||||
for (y = cliprect->min_y; y <= cliprect->max_y; y++)
|
||||
{
|
||||
UINT32 *dest = BITMAP_ADDR32(bitmap, y, 0);
|
||||
UINT16 *mo = BITMAP_ADDR16(mobitmap, y, 0);
|
||||
UINT16 *pf = BITMAP_ADDR16(pfbitmap, y, 0);
|
||||
UINT8 *pri = BITMAP_ADDR8(priority_bitmap, y, 0);
|
||||
for (x = cliprect->min_x; x <= cliprect->max_x; x++)
|
||||
{
|
||||
UINT16 *mo = (UINT16 *)mobitmap->base + mobitmap->rowpixels * y;
|
||||
UINT16 *pf = (UINT16 *)bitmap->base + bitmap->rowpixels * y;
|
||||
UINT8 *pri = (UINT8 *)priority_bitmap->base + priority_bitmap->rowpixels * y;
|
||||
for (x = rectlist.rect->min_x; x <= rectlist.rect->max_x; x++)
|
||||
if (mo[x])
|
||||
{
|
||||
/* not verified: logic is all controlled in a PAL
|
||||
UINT16 pix = pf[x];
|
||||
if (mo[x])
|
||||
{
|
||||
/* not verified: logic is all controlled in a PAL
|
||||
|
||||
factors: LBPRI1-0, LBPIX3, ANPIX1-0, PFPIX3, PFPRI1-0,
|
||||
(~LBPIX3 & ~LBPIX2 & ~LBPIX1 & ~LBPIX0)
|
||||
*/
|
||||
factors: LBPRI1-0, LBPIX3, ANPIX1-0, PFPIX3, PFPRI1-0,
|
||||
(~LBPIX3 & ~LBPIX2 & ~LBPIX1 & ~LBPIX0)
|
||||
*/
|
||||
|
||||
/* only draw if not high priority PF */
|
||||
if (!pri[x] || !(pf[x] & 8))
|
||||
pf[x] = mo[x];
|
||||
/* only draw if not high priority PF */
|
||||
if (!pri[x] || !(pix & 8))
|
||||
pix = mo[x];
|
||||
|
||||
/* erase behind ourselves */
|
||||
mo[x] = 0;
|
||||
}
|
||||
/* erase behind ourselves */
|
||||
mo[x] = 0;
|
||||
}
|
||||
dest[x] = palette[pix];
|
||||
}
|
||||
}
|
||||
|
||||
/* add the alpha on top */
|
||||
tilemap_draw(bitmap, cliprect, atarigen_alpha_tilemap, 0, 0);
|
||||
|
Loading…
Reference in New Issue
Block a user