segas24: Start untangling the Vogon poetry Atari Ace left is his wake.
Apply the new timing implementation per cgfm's analysis. Gain ground is going to be stuck in free play mode. [O. Galibert]
This commit is contained in:
parent
35af804269
commit
59a98d5c7c
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -3681,7 +3681,6 @@ src/mame/machine/segag80.h svneol=native#text/plain
|
||||
src/mame/machine/segaic16.c svneol=native#text/plain
|
||||
src/mame/machine/segaic16.h svneol=native#text/plain
|
||||
src/mame/machine/segamsys.c svneol=native#text/plain
|
||||
src/mame/machine/segas24.c svneol=native#text/plain
|
||||
src/mame/machine/segas32.c svneol=native#text/plain
|
||||
src/mame/machine/seibuspi.c svneol=native#text/plain
|
||||
src/mame/machine/seibuspi.h svneol=native#text/plain
|
||||
|
@ -877,12 +877,12 @@ static ADDRESS_MAP_START( model1_mem, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x610000, 0x61ffff) AM_RAM_WRITE(md1_w) AM_BASE_MEMBER(model1_state, m_display_list1)
|
||||
AM_RANGE(0x680000, 0x680003) AM_READWRITE(model1_listctl_r, model1_listctl_w)
|
||||
|
||||
AM_RANGE(0x700000, 0x70ffff) AM_READWRITE(sys24_tile_r, sys24_tile_w)
|
||||
AM_RANGE(0x700000, 0x70ffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, tile_r, tile_w)
|
||||
AM_RANGE(0x720000, 0x720001) AM_WRITENOP // Unknown, always 0
|
||||
AM_RANGE(0x740000, 0x740001) AM_WRITENOP // Horizontal synchronization register
|
||||
AM_RANGE(0x760000, 0x760001) AM_WRITENOP // Vertical synchronization register
|
||||
AM_RANGE(0x770000, 0x770001) AM_WRITENOP // Video synchronization switch
|
||||
AM_RANGE(0x780000, 0x7fffff) AM_READWRITE(sys24_char_r, sys24_char_w)
|
||||
AM_RANGE(0x780000, 0x7fffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, char_r, char_w)
|
||||
|
||||
AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(p_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x910000, 0x91bfff) AM_RAM AM_BASE_MEMBER(model1_state, m_color_xlat)
|
||||
@ -925,12 +925,12 @@ static ADDRESS_MAP_START( model1_vr_mem, AS_PROGRAM, 16 )
|
||||
AM_RANGE(0x610000, 0x61ffff) AM_RAM_WRITE(md1_w) AM_BASE_MEMBER(model1_state, m_display_list1)
|
||||
AM_RANGE(0x680000, 0x680003) AM_READWRITE(model1_listctl_r, model1_listctl_w)
|
||||
|
||||
AM_RANGE(0x700000, 0x70ffff) AM_READWRITE(sys24_tile_r, sys24_tile_w)
|
||||
AM_RANGE(0x700000, 0x70ffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, tile_r, tile_w)
|
||||
AM_RANGE(0x720000, 0x720001) AM_WRITENOP // Unknown, always 0
|
||||
AM_RANGE(0x740000, 0x740001) AM_WRITENOP // Horizontal synchronization register
|
||||
AM_RANGE(0x760000, 0x760001) AM_WRITENOP // Vertical synchronization register
|
||||
AM_RANGE(0x770000, 0x770001) AM_WRITENOP // Video synchronization switch
|
||||
AM_RANGE(0x780000, 0x7fffff) AM_READWRITE(sys24_char_r, sys24_char_w)
|
||||
AM_RANGE(0x780000, 0x7fffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, char_r, char_w)
|
||||
|
||||
AM_RANGE(0x900000, 0x903fff) AM_RAM_WRITE(p_w) AM_BASE_GENERIC(paletteram)
|
||||
AM_RANGE(0x910000, 0x91bfff) AM_RAM AM_BASE_MEMBER(model1_state, m_color_xlat)
|
||||
@ -1514,6 +1514,8 @@ static MACHINE_CONFIG_START( model1, model1_state )
|
||||
MCFG_MACHINE_RESET(model1)
|
||||
MCFG_NVRAM_ADD_0FILL("nvram")
|
||||
|
||||
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
|
||||
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK )
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
|
@ -1373,14 +1373,12 @@ static ADDRESS_MAP_START( model2_base_mem, AS_PROGRAM, 32 )
|
||||
|
||||
AM_RANGE(0x00f00000, 0x00f0000f) AM_READWRITE(timers_r, timers_w)
|
||||
|
||||
AM_RANGE(0x01000000, 0x0100ffff) AM_READWRITE(sys24_tile32_r, sys24_tile32_w) AM_MIRROR(0x100000)
|
||||
AM_RANGE(0x01000000, 0x0100ffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, tile32_r, tile32_w) AM_MIRROR(0x110000)
|
||||
AM_RANGE(0x01020000, 0x01020003) AM_WRITENOP AM_MIRROR(0x100000) // Unknown, always 0
|
||||
AM_RANGE(0x01040000, 0x01040003) AM_WRITENOP AM_MIRROR(0x100000) // Horizontal synchronization register
|
||||
AM_RANGE(0x01060000, 0x01060003) AM_WRITENOP AM_MIRROR(0x100000) // Vertical synchronization register
|
||||
AM_RANGE(0x01070000, 0x01070003) AM_WRITENOP AM_MIRROR(0x100000) // Video synchronization switch
|
||||
AM_RANGE(0x01080000, 0x010fffff) AM_READWRITE(sys24_char32_r, sys24_char32_w) AM_MIRROR(0x100000)
|
||||
AM_RANGE(0x01100000, 0x0110ffff) AM_READWRITE(sys24_tile32_r, sys24_tile32_w) AM_MIRROR(0x10000)
|
||||
AM_RANGE(0x01180000, 0x011fffff) AM_READWRITE(sys24_char32_r, sys24_char32_w) AM_MIRROR(0x100000)
|
||||
AM_RANGE(0x01080000, 0x010fffff) AM_DEVREADWRITE_MODERN("tile", segas24_tile, char32_r, char32_w) AM_MIRROR(0x100000)
|
||||
|
||||
AM_RANGE(0x01800000, 0x01803fff) AM_RAM_WRITE(pal32_w) AM_BASE_MEMBER(model2_state, m_paletteram32)
|
||||
AM_RANGE(0x01810000, 0x0181bfff) AM_RAM AM_BASE_MEMBER(model2_state, m_colorxlat)
|
||||
@ -2028,6 +2026,8 @@ static MACHINE_CONFIG_START( model2o, model2_state )
|
||||
MCFG_TIMER_ADD("timer3", model2_timer_cb)
|
||||
MCFG_TIMER_PTR((FPTR)3)
|
||||
|
||||
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
|
||||
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK )
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
@ -2085,6 +2085,8 @@ static MACHINE_CONFIG_START( model2a, model2_state )
|
||||
MCFG_TIMER_ADD("timer3", model2_timer_cb)
|
||||
MCFG_TIMER_PTR((FPTR)3)
|
||||
|
||||
MCFG_S24TILE_DEVICE_ADD("tile", 0x3fff)
|
||||
|
||||
MCFG_VIDEO_ATTRIBUTES(VIDEO_UPDATE_AFTER_VBLANK )
|
||||
|
||||
MCFG_SCREEN_ADD("screen", RASTER)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,74 +1,94 @@
|
||||
#include "video/segaic24.h"
|
||||
|
||||
class segas24_state : public driver_device
|
||||
{
|
||||
public:
|
||||
segas24_state(running_machine &machine, const driver_device_config_base &config)
|
||||
: driver_device(machine, config) { }
|
||||
|
||||
int m_fdc_status;
|
||||
int m_fdc_track;
|
||||
int m_fdc_sector;
|
||||
int m_fdc_data;
|
||||
int m_fdc_phys_track;
|
||||
int m_fdc_irq;
|
||||
int m_fdc_drq;
|
||||
int m_fdc_span;
|
||||
int m_fdc_index_count;
|
||||
UINT8 *m_fdc_pt;
|
||||
int m_track_size;
|
||||
int m_cur_input_line;
|
||||
UINT8 m_hotrod_ctrl_cur;
|
||||
UINT8 m_resetcontrol;
|
||||
UINT8 m_prev_resetcontrol;
|
||||
UINT8 m_curbank;
|
||||
UINT8 m_mlatch;
|
||||
const UINT8 *m_mlatch_table;
|
||||
UINT16 m_irq_timera;
|
||||
UINT8 m_irq_timerb;
|
||||
UINT8 m_irq_allow0;
|
||||
UINT8 m_irq_allow1;
|
||||
int m_irq_timer_pend0;
|
||||
int m_irq_timer_pend1;
|
||||
int m_irq_yms;
|
||||
int m_irq_vblank;
|
||||
int m_irq_sprite;
|
||||
timer_device *m_irq_timer;
|
||||
timer_device *m_irq_timer_clear;
|
||||
int m_turns;
|
||||
UINT16 *m_system24temp_sys16_shared_ram;
|
||||
UINT8 (*m_system24temp_sys16_io_io_r)(running_machine &machine, int port);
|
||||
void (*m_system24temp_sys16_io_io_w)(running_machine &machine, int port, UINT8 data);
|
||||
void (*m_system24temp_sys16_io_cnt_w)(address_space *space, UINT8 data);
|
||||
read16_space_func m_system24temp_sys16_io_iod_r;
|
||||
write16_space_func m_system24temp_sys16_io_iod_w;
|
||||
UINT8 m_system24temp_sys16_io_cnt;
|
||||
UINT8 m_system24temp_sys16_io_dir;
|
||||
|
||||
static const UINT8 mahmajn_mlt[8];
|
||||
static const UINT8 mahmajn2_mlt[8];
|
||||
static const UINT8 qgh_mlt[8];
|
||||
static const UINT8 bnzabros_mlt[8];
|
||||
static const UINT8 qrouka_mlt[8];
|
||||
static const UINT8 quizmeku_mlt[8];
|
||||
static const UINT8 dcclub_mlt[8];
|
||||
|
||||
int fdc_status;
|
||||
int fdc_track;
|
||||
int fdc_sector;
|
||||
int fdc_data;
|
||||
int fdc_phys_track;
|
||||
int fdc_irq;
|
||||
int fdc_drq;
|
||||
int fdc_span;
|
||||
int fdc_index_count;
|
||||
UINT8 *fdc_pt;
|
||||
int track_size;
|
||||
int cur_input_line;
|
||||
UINT8 hotrod_ctrl_cur;
|
||||
UINT8 resetcontrol;
|
||||
UINT8 prev_resetcontrol;
|
||||
UINT8 curbank;
|
||||
UINT8 mlatch;
|
||||
const UINT8 *mlatch_table;
|
||||
|
||||
UINT16 irq_tdata, irq_tval;
|
||||
UINT8 irq_tmode, irq_allow0, irq_allow1;
|
||||
int irq_timer_pend0;
|
||||
int irq_timer_pend1;
|
||||
int irq_yms;
|
||||
int irq_vblank;
|
||||
int irq_sprite;
|
||||
attotime irq_synctime, irq_vsynctime;
|
||||
timer_device *irq_timer;
|
||||
timer_device *irq_timer_clear;
|
||||
|
||||
UINT16 *shared_ram;
|
||||
UINT8 (segas24_state::*io_r)(UINT8 port);
|
||||
void (segas24_state::*io_w)(UINT8 port, UINT8 data);
|
||||
UINT8 io_cnt, io_dir;
|
||||
|
||||
segas24_tile *vtile;
|
||||
segas24_sprite *vsprite;
|
||||
segas24_mixer *vmixer;
|
||||
|
||||
DECLARE_READ16_MEMBER( sys16_paletteram_r );
|
||||
DECLARE_WRITE16_MEMBER( sys16_paletteram_w );
|
||||
DECLARE_READ16_MEMBER( irq_r );
|
||||
DECLARE_WRITE16_MEMBER( irq_w );
|
||||
DECLARE_READ16_MEMBER( fdc_r );
|
||||
DECLARE_WRITE16_MEMBER( fdc_w );
|
||||
DECLARE_READ16_MEMBER( fdc_status_r );
|
||||
DECLARE_WRITE16_MEMBER( fdc_ctrl_w );
|
||||
DECLARE_READ16_MEMBER( curbank_r );
|
||||
DECLARE_WRITE16_MEMBER( curbank_w );
|
||||
DECLARE_READ16_MEMBER( mlatch_r );
|
||||
DECLARE_WRITE16_MEMBER( mlatch_w );
|
||||
DECLARE_READ16_MEMBER( hotrod3_ctrl_r );
|
||||
DECLARE_WRITE16_MEMBER( hotrod3_ctrl_w );
|
||||
DECLARE_READ16_MEMBER( iod_r );
|
||||
DECLARE_WRITE16_MEMBER( iod_w );
|
||||
DECLARE_READ16_MEMBER ( sys16_io_r );
|
||||
DECLARE_WRITE16_MEMBER( sys16_io_w );
|
||||
|
||||
UINT8 hotrod_io_r(UINT8 port);
|
||||
UINT8 dcclub_io_r(UINT8 port);
|
||||
UINT8 mahmajn_io_r(UINT8 port);
|
||||
|
||||
void hotrod_io_w(UINT8 port, UINT8 data);
|
||||
void mahmajn_io_w(UINT8 port, UINT8 data);
|
||||
|
||||
void fdc_init();
|
||||
void reset_reset();
|
||||
void reset_bank();
|
||||
void irq_init();
|
||||
void irq_timer_sync();
|
||||
void irq_timer_start(int old_tmode);
|
||||
void reset_control_w(UINT8 data);
|
||||
};
|
||||
|
||||
|
||||
/*----------- defined in machine/segas24.c -----------*/
|
||||
|
||||
/* system24temp_ functions / variables are from shared rewrite files,
|
||||
once the rest of the rewrite is complete they can be removed, I
|
||||
just made a copy & renamed them for now to avoid any conflicts
|
||||
*/
|
||||
|
||||
/* New Code */
|
||||
|
||||
void system24temp_sys16_io_set_callbacks(
|
||||
running_machine &machine,
|
||||
UINT8 (*io_r)(running_machine &machine, int port),
|
||||
void (*io_w)(running_machine &machine, int port, UINT8 data),
|
||||
void (*cnt_w)(address_space *space, UINT8 data),
|
||||
read16_space_func iod_r,
|
||||
write16_space_func iod_w);
|
||||
|
||||
READ16_HANDLER ( system24temp_sys16_io_r );
|
||||
WRITE16_HANDLER( system24temp_sys16_io_w );
|
||||
READ32_HANDLER ( system24temp_sys16_io_dword_r );
|
||||
|
||||
/* End New Code */
|
||||
|
||||
|
||||
/*----------- defined in machine/s24fd.c -----------*/
|
||||
|
||||
extern void s24_fd1094_machine_init(running_machine &machine);
|
||||
@ -77,5 +97,4 @@ extern void s24_fd1094_driver_init(running_machine &machine);
|
||||
|
||||
/*----------- defined in video/segas24.c -----------*/
|
||||
|
||||
VIDEO_START(system24);
|
||||
SCREEN_UPDATE(system24);
|
||||
|
@ -1,109 +0,0 @@
|
||||
#include "emu.h"
|
||||
#include "includes/segas24.h"
|
||||
|
||||
/* system24temp_ functions / variables are from shared rewrite files,
|
||||
once the rest of the rewrite is complete they can be removed, I
|
||||
just made a copy & renamed them for now to avoid any conflicts
|
||||
*/
|
||||
|
||||
#ifdef UNUSED_FUNCTION
|
||||
READ16_HANDLER( system24temp_sys16_shared_ram_r )
|
||||
{
|
||||
segas24_state *state = space->machine().driver_data<segas24_state>();
|
||||
return state->m_system24temp_sys16_shared_ram[offset];
|
||||
}
|
||||
|
||||
WRITE16_HANDLER( system24temp_sys16_shared_ram_w )
|
||||
{
|
||||
segas24_state *state = space->machine().driver_data<segas24_state>();
|
||||
COMBINE_DATA(state->m_system24temp_sys16_shared_ram + offset);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* The 315-5296
|
||||
8 8bits I/O ports, 3 output-only pins, some protection, and
|
||||
external/daughterboard chip selection on half of the address
|
||||
range
|
||||
*/
|
||||
|
||||
void system24temp_sys16_io_set_callbacks(
|
||||
running_machine &machine,
|
||||
UINT8 (*io_r)(running_machine &machine, int port),
|
||||
void (*io_w)(running_machine &machine, int port, UINT8 data),
|
||||
void (*cnt_w)(address_space *space, UINT8 data),
|
||||
read16_space_func iod_r,
|
||||
write16_space_func iod_w)
|
||||
{
|
||||
segas24_state *state = machine.driver_data<segas24_state>();
|
||||
state->m_system24temp_sys16_io_io_r = io_r;
|
||||
state->m_system24temp_sys16_io_io_w = io_w;
|
||||
state->m_system24temp_sys16_io_cnt_w = cnt_w;
|
||||
state->m_system24temp_sys16_io_iod_r = iod_r;
|
||||
state->m_system24temp_sys16_io_iod_w = iod_w;
|
||||
state->m_system24temp_sys16_io_cnt = 0x00;
|
||||
state->m_system24temp_sys16_io_dir = 0x00;
|
||||
}
|
||||
|
||||
READ16_HANDLER ( system24temp_sys16_io_r )
|
||||
{
|
||||
segas24_state *state = space->machine().driver_data<segas24_state>();
|
||||
// logerror("IO read %02x (%s:%x)\n", offset, space->device().tag(), cpu_get_pc(&space->device()));
|
||||
if(offset < 8)
|
||||
return state->m_system24temp_sys16_io_io_r ? state->m_system24temp_sys16_io_io_r(space->machine(),offset) : 0xff;
|
||||
else if (offset < 0x20) {
|
||||
switch(offset) {
|
||||
case 0x8:
|
||||
return 'S';
|
||||
case 0x9:
|
||||
return 'E';
|
||||
case 0xa:
|
||||
return 'G';
|
||||
case 0xb:
|
||||
return 'A';
|
||||
case 0xe:
|
||||
return state->m_system24temp_sys16_io_cnt;
|
||||
case 0xf:
|
||||
return state->m_system24temp_sys16_io_dir;
|
||||
default:
|
||||
logerror("IO control read %02x (%s:%x)\n", offset, space->device().tag(), cpu_get_pc(&space->device()));
|
||||
return 0xff;
|
||||
}
|
||||
} else
|
||||
return state->m_system24temp_sys16_io_iod_r ? state->m_system24temp_sys16_io_iod_r(space, offset & 0x1f, mem_mask) : 0xff;
|
||||
}
|
||||
|
||||
READ32_HANDLER(system24temp_sys16_io_dword_r)
|
||||
{
|
||||
return system24temp_sys16_io_r(space, 2*offset, mem_mask)|(system24temp_sys16_io_r(space,2*offset+1, mem_mask>>16)<<16);
|
||||
}
|
||||
|
||||
|
||||
WRITE16_HANDLER( system24temp_sys16_io_w )
|
||||
{
|
||||
segas24_state *state = space->machine().driver_data<segas24_state>();
|
||||
if(ACCESSING_BITS_0_7) {
|
||||
if(offset < 8) {
|
||||
if(!(state->m_system24temp_sys16_io_dir & (1 << offset))) {
|
||||
logerror("IO port write on input-only port (%d, [%02x], %02x, %s:%x)\n", offset, state->m_system24temp_sys16_io_dir, data & 0xff, space->device().tag(), cpu_get_pc(&space->device()));
|
||||
return;
|
||||
}
|
||||
if(state->m_system24temp_sys16_io_io_w)
|
||||
state->m_system24temp_sys16_io_io_w(space->machine(), offset, data);
|
||||
} else if (offset < 0x20) {
|
||||
switch(offset) {
|
||||
case 0xe:
|
||||
state->m_system24temp_sys16_io_cnt = data;
|
||||
if(state->m_system24temp_sys16_io_cnt_w)
|
||||
state->m_system24temp_sys16_io_cnt_w(space, data & 7);
|
||||
break;
|
||||
case 0xf:
|
||||
state->m_system24temp_sys16_io_dir = data;
|
||||
break;
|
||||
default:
|
||||
logerror("IO control write %02x, %02x (%s:%x)\n", offset, data & 0xff, space->device().tag(), cpu_get_pc(&space->device()));
|
||||
}
|
||||
}
|
||||
}
|
||||
if(offset >= 0x20 && state->m_system24temp_sys16_io_iod_w)
|
||||
state->m_system24temp_sys16_io_iod_w(space, offset & 0x1f, data, mem_mask);
|
||||
}
|
@ -1165,7 +1165,7 @@ $(MAMEOBJ)/sega.a: \
|
||||
$(DRIVERS)/segas16a.o $(VIDEO)/segas16a.o \
|
||||
$(DRIVERS)/segas16b.o $(VIDEO)/segas16b.o \
|
||||
$(DRIVERS)/segas18.o $(VIDEO)/segas18.o \
|
||||
$(DRIVERS)/segas24.o $(MACHINE)/segas24.o $(VIDEO)/segas24.o \
|
||||
$(DRIVERS)/segas24.o $(VIDEO)/segas24.o \
|
||||
$(DRIVERS)/segas32.o $(MACHINE)/segas32.o $(VIDEO)/segas32.o \
|
||||
$(DRIVERS)/segaxbd.o $(VIDEO)/segaxbd.o \
|
||||
$(DRIVERS)/segaybd.o $(VIDEO)/segaybd.o \
|
||||
|
@ -1452,8 +1452,6 @@ VIDEO_START(model1)
|
||||
|
||||
state->m_view = auto_alloc_clear(machine, struct view);
|
||||
|
||||
sys24_tile_vh_start(machine, 0x3fff);
|
||||
|
||||
state->m_poly_rom = (UINT32 *)machine.region("user1")->base();
|
||||
state->m_poly_ram = auto_alloc_array_clear(machine, UINT32, 0x400000);
|
||||
state->m_tgp_ram = auto_alloc_array_clear(machine, UINT16, 0x100000-0x40000);
|
||||
@ -1523,17 +1521,18 @@ SCREEN_UPDATE(model1)
|
||||
bitmap_fill(screen->machine().priority_bitmap, NULL, 0);
|
||||
bitmap_fill(bitmap, cliprect, screen->machine().pens[0]);
|
||||
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, 6, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, 4, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, 2, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, 0, 0, 0);
|
||||
segas24_tile *tile = screen->machine().device<segas24_tile>("tile");
|
||||
tile->draw(bitmap, cliprect, 6, 0, 0);
|
||||
tile->draw(bitmap, cliprect, 4, 0, 0);
|
||||
tile->draw(bitmap, cliprect, 2, 0, 0);
|
||||
tile->draw(bitmap, cliprect, 0, 0, 0);
|
||||
|
||||
tgp_render(screen->machine(), bitmap, cliprect);
|
||||
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, 7, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, 5, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, 3, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, 1, 0, 0);
|
||||
tile->draw(bitmap, cliprect, 7, 0, 0);
|
||||
tile->draw(bitmap, cliprect, 5, 0, 0);
|
||||
tile->draw(bitmap, cliprect, 3, 0, 0);
|
||||
tile->draw(bitmap, cliprect, 1, 0, 0);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -2712,7 +2712,6 @@ VIDEO_START(model2)
|
||||
int width = visarea.max_x - visarea.min_x;
|
||||
int height = visarea.max_y - visarea.min_y;
|
||||
|
||||
sys24_tile_vh_start(machine, 0x3fff);
|
||||
state->m_sys24_bitmap = auto_alloc(machine, bitmap_t(width, height+4, BITMAP_FORMAT_INDEXED16));
|
||||
|
||||
state->m_poly = poly_alloc(machine, 4000, sizeof(poly_extra_data), 0);
|
||||
@ -2750,10 +2749,11 @@ SCREEN_UPDATE(model2)
|
||||
bitmap_fill(bitmap, cliprect, screen->machine().pens[0]);
|
||||
bitmap_fill(state->m_sys24_bitmap, cliprect, 0);
|
||||
|
||||
sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 7, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 6, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 5, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 4, 0, 0);
|
||||
segas24_tile *tile = screen->machine().device<segas24_tile>("tile");
|
||||
tile->draw(state->m_sys24_bitmap, cliprect, 7, 0, 0);
|
||||
tile->draw(state->m_sys24_bitmap, cliprect, 6, 0, 0);
|
||||
tile->draw(state->m_sys24_bitmap, cliprect, 5, 0, 0);
|
||||
tile->draw(state->m_sys24_bitmap, cliprect, 4, 0, 0);
|
||||
|
||||
convert_bitmap(screen->machine(), bitmap, state->m_sys24_bitmap, cliprect);
|
||||
|
||||
@ -2767,10 +2767,10 @@ SCREEN_UPDATE(model2)
|
||||
model2_3d_frame_end( state, bitmap, cliprect );
|
||||
|
||||
bitmap_fill(state->m_sys24_bitmap, cliprect, 0);
|
||||
sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 3, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 2, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 1, 0, 0);
|
||||
sys24_tile_draw(screen->machine(), state->m_sys24_bitmap, cliprect, 0, 0, 0);
|
||||
tile->draw(state->m_sys24_bitmap, cliprect, 3, 0, 0);
|
||||
tile->draw(state->m_sys24_bitmap, cliprect, 2, 0, 0);
|
||||
tile->draw(state->m_sys24_bitmap, cliprect, 1, 0, 0);
|
||||
tile->draw(state->m_sys24_bitmap, cliprect, 0, 0, 0);
|
||||
|
||||
convert_bitmap(screen->machine(), bitmap, state->m_sys24_bitmap, cliprect);
|
||||
|
||||
|
@ -12,81 +12,78 @@ System 24 68000x2 315-5292 315-5293 315-5294 315-5242 ym2151 da
|
||||
|
||||
*/
|
||||
|
||||
/*
|
||||
* System 16 color palette formats
|
||||
*/
|
||||
|
||||
|
||||
/* system24temp_ functions / variables are from shared rewrite files,
|
||||
once the rest of the rewrite is complete they can be removed, I
|
||||
just made a copy & renamed them for now to avoid any conflicts
|
||||
*/
|
||||
|
||||
#include "emu.h"
|
||||
#include "segaic24.h"
|
||||
|
||||
|
||||
static void set_color(running_machine &machine, int color, UINT8 r, UINT8 g, UINT8 b, int highlight)
|
||||
{
|
||||
palette_set_color (machine, color, MAKE_RGB(r, g, b));
|
||||
const device_type S24TILE = segas24_tile_config::static_alloc_device_config;
|
||||
const device_type S24SPRITE = segas24_sprite_config::static_alloc_device_config;
|
||||
const device_type S24MIXER = segas24_mixer_config::static_alloc_device_config;
|
||||
|
||||
if(highlight) {
|
||||
r = 255-0.6*(255-r);
|
||||
g = 255-0.6*(255-g);
|
||||
b = 255-0.6*(255-b);
|
||||
} else {
|
||||
r = 0.6*r;
|
||||
g = 0.6*g;
|
||||
b = 0.6*b;
|
||||
}
|
||||
palette_set_color(machine,color+machine.total_colors()/2, MAKE_RGB(r, g, b));
|
||||
segas24_tile_config::segas24_tile_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "S24TILE", tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
// 315-5242
|
||||
|
||||
// qgh expects to be able to read the palette shared between CPUs
|
||||
READ16_HANDLER( system24temp_sys16_paletteram1_r )
|
||||
device_config *segas24_tile_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
{
|
||||
return space->machine().generic.paletteram.u16[offset];
|
||||
return global_alloc(segas24_tile_config(mconfig, tag, owner, clock));
|
||||
}
|
||||
|
||||
void segas24_tile_config::static_set_tile_mask(device_config *device, UINT16 _tile_mask)
|
||||
{
|
||||
segas24_tile_config *dev = downcast<segas24_tile_config *>(device);
|
||||
dev->tile_mask = _tile_mask;
|
||||
}
|
||||
|
||||
device_t *segas24_tile_config::alloc_device(running_machine &machine) const
|
||||
{
|
||||
return auto_alloc(machine, segas24_tile(machine, *this));
|
||||
}
|
||||
|
||||
|
||||
WRITE16_HANDLER (system24temp_sys16_paletteram1_w)
|
||||
segas24_sprite_config::segas24_sprite_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "S24SPRITE", tag, owner, clock)
|
||||
{
|
||||
int r, g, b;
|
||||
COMBINE_DATA (space->machine().generic.paletteram.u16 + offset);
|
||||
data = space->machine().generic.paletteram.u16[offset];
|
||||
|
||||
r = (data & 0x00f) << 4;
|
||||
if(data & 0x1000)
|
||||
r |= 8;
|
||||
|
||||
g = data & 0x0f0;
|
||||
if(data & 0x2000)
|
||||
g |= 8;
|
||||
|
||||
b = (data & 0xf00) >> 4;
|
||||
if(data & 0x4000)
|
||||
b |= 8;
|
||||
|
||||
r |= r >> 5;
|
||||
g |= g >> 5;
|
||||
b |= b >> 5;
|
||||
set_color(space->machine(), offset, r, g, b, data & 0x8000);
|
||||
}
|
||||
|
||||
// - System 24
|
||||
device_config *segas24_sprite_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
{
|
||||
return global_alloc(segas24_sprite_config(mconfig, tag, owner, clock));
|
||||
}
|
||||
|
||||
enum {SYS24_TILES = 0x4000};
|
||||
device_t *segas24_sprite_config::alloc_device(running_machine &machine) const
|
||||
{
|
||||
return auto_alloc(machine, segas24_sprite(machine, *this));
|
||||
}
|
||||
|
||||
static UINT16 *sys24_char_ram, *sys24_tile_ram;
|
||||
static UINT16 sys24_tile_mask;
|
||||
static int sys24_char_gfx_index;
|
||||
static tilemap_t *sys24_tile_layer[4];
|
||||
|
||||
segas24_mixer_config::segas24_mixer_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
: device_config(mconfig, static_alloc_device_config, "S24MIXER", tag, owner, clock)
|
||||
{
|
||||
}
|
||||
|
||||
device_config *segas24_mixer_config::static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock)
|
||||
{
|
||||
return global_alloc(segas24_mixer_config(mconfig, tag, owner, clock));
|
||||
}
|
||||
|
||||
device_t *segas24_mixer_config::alloc_device(running_machine &machine) const
|
||||
{
|
||||
return auto_alloc(machine, segas24_mixer(machine, *this));
|
||||
}
|
||||
|
||||
|
||||
|
||||
segas24_tile::segas24_tile(running_machine &_machine, const segas24_tile_config &_config)
|
||||
: device_t(_machine, _config),
|
||||
config(_config)
|
||||
{
|
||||
}
|
||||
|
||||
#define XOR(a) WORD_XOR_BE(a)
|
||||
|
||||
static const gfx_layout sys24_char_layout = {
|
||||
const gfx_layout segas24_tile::char_layout = {
|
||||
8, 8,
|
||||
SYS24_TILES,
|
||||
4,
|
||||
@ -96,79 +93,75 @@ static const gfx_layout sys24_char_layout = {
|
||||
8*32
|
||||
};
|
||||
|
||||
static TILE_GET_INFO( sys24_tile_info_0s )
|
||||
void segas24_tile::tile_info(int offset, tile_data *tileinfo, tilemap_memory_index tile_index)
|
||||
{
|
||||
UINT16 val = sys24_tile_ram[tile_index];
|
||||
UINT16 val = tile_ram[tile_index|offset];
|
||||
tileinfo->category = (val & 0x8000) != 0;
|
||||
SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
|
||||
tileinfo_set(machine(), tileinfo, char_gfx_index, val & config.tile_mask, (val >> 7) & 0xff, 0);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( sys24_tile_info_0w )
|
||||
TILE_GET_INFO_DEVICE( segas24_tile::tile_info_0s )
|
||||
{
|
||||
UINT16 val = sys24_tile_ram[tile_index|0x1000];
|
||||
tileinfo->category = (val & 0x8000) != 0;
|
||||
SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
|
||||
downcast<segas24_tile *>(device)->tile_info(0x0000, tileinfo, tile_index);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( sys24_tile_info_1s )
|
||||
TILE_GET_INFO_DEVICE( segas24_tile::tile_info_0w )
|
||||
{
|
||||
UINT16 val = sys24_tile_ram[tile_index|0x2000];
|
||||
tileinfo->category = (val & 0x8000) != 0;
|
||||
SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
|
||||
downcast<segas24_tile *>(device)->tile_info(0x1000, tileinfo, tile_index);
|
||||
}
|
||||
|
||||
static TILE_GET_INFO( sys24_tile_info_1w )
|
||||
TILE_GET_INFO_DEVICE( segas24_tile::tile_info_1s )
|
||||
{
|
||||
UINT16 val = sys24_tile_ram[tile_index|0x3000];
|
||||
tileinfo->category = (val & 0x8000) != 0;
|
||||
SET_TILE_INFO(sys24_char_gfx_index, val & sys24_tile_mask, (val >> 7) & 0xff, 0);
|
||||
downcast<segas24_tile *>(device)->tile_info(0x2000, tileinfo, tile_index);
|
||||
}
|
||||
|
||||
void sys24_tile_vh_start(running_machine &machine, UINT16 tile_mask)
|
||||
TILE_GET_INFO_DEVICE( segas24_tile::tile_info_1w )
|
||||
{
|
||||
sys24_tile_mask = tile_mask;
|
||||
downcast<segas24_tile *>(device)->tile_info(0x3000, tileinfo, tile_index);
|
||||
}
|
||||
|
||||
for(sys24_char_gfx_index = 0; sys24_char_gfx_index < MAX_GFX_ELEMENTS; sys24_char_gfx_index++)
|
||||
if (machine.gfx[sys24_char_gfx_index] == 0)
|
||||
void segas24_tile::device_start()
|
||||
{
|
||||
for(char_gfx_index = 0; char_gfx_index < MAX_GFX_ELEMENTS; char_gfx_index++)
|
||||
if (machine().gfx[char_gfx_index] == 0)
|
||||
break;
|
||||
assert(sys24_char_gfx_index != MAX_GFX_ELEMENTS);
|
||||
assert(char_gfx_index != MAX_GFX_ELEMENTS);
|
||||
|
||||
sys24_char_ram = auto_alloc_array(machine, UINT16, 0x80000/2);
|
||||
char_ram = auto_alloc_array(machine(), UINT16, 0x80000/2);
|
||||
tile_ram = auto_alloc_array(machine(), UINT16, 0x10000/2);
|
||||
|
||||
sys24_tile_ram = auto_alloc_array(machine, UINT16, 0x10000/2);
|
||||
tile_layer[0] = tilemap_create_device(this, tile_info_0s, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
tile_layer[1] = tilemap_create_device(this, tile_info_0w, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
tile_layer[2] = tilemap_create_device(this, tile_info_1s, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
tile_layer[3] = tilemap_create_device(this, tile_info_1w, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
|
||||
sys24_tile_layer[0] = tilemap_create(machine, sys24_tile_info_0s, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
sys24_tile_layer[1] = tilemap_create(machine, sys24_tile_info_0w, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
sys24_tile_layer[2] = tilemap_create(machine, sys24_tile_info_1s, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
sys24_tile_layer[3] = tilemap_create(machine, sys24_tile_info_1w, tilemap_scan_rows, 8, 8, 64, 64);
|
||||
tilemap_set_transparent_pen(tile_layer[0], 0);
|
||||
tilemap_set_transparent_pen(tile_layer[1], 0);
|
||||
tilemap_set_transparent_pen(tile_layer[2], 0);
|
||||
tilemap_set_transparent_pen(tile_layer[3], 0);
|
||||
|
||||
tilemap_set_transparent_pen(sys24_tile_layer[0], 0);
|
||||
tilemap_set_transparent_pen(sys24_tile_layer[1], 0);
|
||||
tilemap_set_transparent_pen(sys24_tile_layer[2], 0);
|
||||
tilemap_set_transparent_pen(sys24_tile_layer[3], 0);
|
||||
memset(char_ram, 0, 0x80000);
|
||||
memset(tile_ram, 0, 0x10000);
|
||||
|
||||
memset(sys24_char_ram, 0, 0x80000);
|
||||
memset(sys24_tile_ram, 0, 0x10000);
|
||||
machine().gfx[char_gfx_index] = gfx_element_alloc(machine(), &char_layout, (UINT8 *)char_ram, machine().total_colors() / 16, 0);
|
||||
|
||||
machine.gfx[sys24_char_gfx_index] = gfx_element_alloc(machine, &sys24_char_layout, (UINT8 *)sys24_char_ram, machine.total_colors() / 16, 0);
|
||||
|
||||
state_save_register_global_pointer(machine, sys24_tile_ram, 0x10000/2);
|
||||
state_save_register_global_pointer(machine, sys24_char_ram, 0x80000/2);
|
||||
save_pointer(NAME(tile_ram), 0x10000/2);
|
||||
save_pointer(NAME(char_ram), 0x80000/2);
|
||||
}
|
||||
|
||||
static void sys24_tile_draw_rect(running_machine &machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
|
||||
UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
|
||||
void segas24_tile::draw_rect(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
|
||||
UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
|
||||
{
|
||||
int y;
|
||||
const UINT16 *source = ((UINT16 *)bm->base) + sx + sy*bm->rowpixels;
|
||||
const UINT8 *trans = ((UINT8 *) tm->base) + sx + sy*tm->rowpixels;
|
||||
UINT8 *prib = (UINT8 *)machine.priority_bitmap->base;
|
||||
UINT8 *prib = (UINT8 *)machine().priority_bitmap->base;
|
||||
UINT16 *dest = (UINT16 *)dm->base;
|
||||
|
||||
tpri |= TILEMAP_PIXEL_LAYER0;
|
||||
|
||||
dest += yy1*dm->rowpixels + xx1;
|
||||
prib += yy1*machine.priority_bitmap->rowpixels + xx1;
|
||||
prib += yy1*machine().priority_bitmap->rowpixels + xx1;
|
||||
mask += yy1*4;
|
||||
yy2 -= yy1;
|
||||
|
||||
@ -280,7 +273,7 @@ static void sys24_tile_draw_rect(running_machine &machine, bitmap_t *bm, bitmap_
|
||||
source += bm->rowpixels;
|
||||
trans += tm->rowpixels;
|
||||
dest += dm->rowpixels;
|
||||
prib += machine.priority_bitmap->rowpixels;
|
||||
prib += machine().priority_bitmap->rowpixels;
|
||||
mask += 4;
|
||||
}
|
||||
}
|
||||
@ -288,16 +281,16 @@ static void sys24_tile_draw_rect(running_machine &machine, bitmap_t *bm, bitmap_
|
||||
|
||||
// The rgb version is used by model 1 & 2 which do not need to care
|
||||
// about sprite priority hence the lack of support for the
|
||||
// machine.priority_bitmap
|
||||
// priority_bitmap
|
||||
|
||||
static void sys24_tile_draw_rect_rgb(running_machine &machine, bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
|
||||
UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
|
||||
void segas24_tile::draw_rect_rgb(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
|
||||
UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2)
|
||||
{
|
||||
int y;
|
||||
const UINT16 *source = ((UINT16 *)bm->base) + sx + sy*bm->rowpixels;
|
||||
const UINT8 *trans = ((UINT8 *) tm->base) + sx + sy*tm->rowpixels;
|
||||
UINT16 *dest = (UINT16 *)dm->base;
|
||||
const pen_t *pens = machine.pens;
|
||||
const pen_t *pens = machine().pens;
|
||||
|
||||
tpri |= TILEMAP_PIXEL_LAYER0;
|
||||
|
||||
@ -402,12 +395,12 @@ static void sys24_tile_draw_rect_rgb(running_machine &machine, bitmap_t *bm, bit
|
||||
}
|
||||
}
|
||||
|
||||
void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int lpri, int flags)
|
||||
void segas24_tile::draw(bitmap_t *bitmap, const rectangle *cliprect, int layer, int lpri, int flags)
|
||||
{
|
||||
UINT16 hscr = sys24_tile_ram[0x5000+(layer >> 1)];
|
||||
UINT16 vscr = sys24_tile_ram[0x5004+(layer >> 1)];
|
||||
UINT16 ctrl = sys24_tile_ram[0x5004+((layer >> 1) & 2)];
|
||||
UINT16 *mask = sys24_tile_ram + (layer & 4 ? 0x6800 : 0x6000);
|
||||
UINT16 hscr = tile_ram[0x5000+(layer >> 1)];
|
||||
UINT16 vscr = tile_ram[0x5004+(layer >> 1)];
|
||||
UINT16 ctrl = tile_ram[0x5004+((layer >> 1) & 2)];
|
||||
UINT16 *mask = tile_ram + (layer & 4 ? 0x6800 : 0x6000);
|
||||
UINT16 tpri = layer & 1;
|
||||
|
||||
lpri = 1 << lpri;
|
||||
@ -422,11 +415,11 @@ void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
if(layer & 1)
|
||||
return;
|
||||
|
||||
tilemap_set_scrolly(sys24_tile_layer[layer], 0, vscr & 0x1ff);
|
||||
tilemap_set_scrolly(sys24_tile_layer[layer|1], 0, vscr & 0x1ff);
|
||||
tilemap_set_scrolly(tile_layer[layer], 0, vscr & 0x1ff);
|
||||
tilemap_set_scrolly(tile_layer[layer|1], 0, vscr & 0x1ff);
|
||||
|
||||
if(hscr & 0x8000) {
|
||||
UINT16 *hscrtb = sys24_tile_ram + 0x4000 + 0x200*layer;
|
||||
UINT16 *hscrtb = tile_ram + 0x4000 + 0x200*layer;
|
||||
|
||||
switch((ctrl & 0x6000) >> 13) {
|
||||
case 1: {
|
||||
@ -446,8 +439,8 @@ void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
hscr = hscrtb[y];
|
||||
|
||||
h = hscr & 0x1ff;
|
||||
tilemap_set_scrollx(sys24_tile_layer[l1], 0, -h);
|
||||
tilemap_draw(bitmap, &c, sys24_tile_layer[l1], tpri, lpri);
|
||||
tilemap_set_scrollx(tile_layer[l1], 0, -h);
|
||||
tilemap_draw(bitmap, &c, tile_layer[l1], tpri, lpri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
@ -462,8 +455,8 @@ void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
hscr = hscrtb[y];
|
||||
|
||||
h = hscr & 0x1ff;
|
||||
tilemap_set_scrollx(sys24_tile_layer[layer], 0, -h);
|
||||
tilemap_set_scrollx(sys24_tile_layer[layer|1], 0, -h);
|
||||
tilemap_set_scrollx(tile_layer[layer], 0, -h);
|
||||
tilemap_set_scrollx(tile_layer[layer|1], 0, -h);
|
||||
|
||||
if(c1.max_x >= h)
|
||||
c1.max_x = h-1;
|
||||
@ -474,16 +467,16 @@ void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
|
||||
c1.min_y = c1.max_y = c2.min_y = c2.max_y = y;
|
||||
|
||||
tilemap_draw(bitmap, &c1, sys24_tile_layer[l1], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c2, sys24_tile_layer[l1^1], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c1, tile_layer[l1], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c2, tile_layer[l1^1], tpri, lpri);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
tilemap_set_scrollx(sys24_tile_layer[layer], 0, -(hscr & 0x1ff));
|
||||
tilemap_set_scrollx(sys24_tile_layer[layer|1], 0, -(hscr & 0x1ff));
|
||||
tilemap_set_scrollx(tile_layer[layer], 0, -(hscr & 0x1ff));
|
||||
tilemap_set_scrollx(tile_layer[layer|1], 0, -(hscr & 0x1ff));
|
||||
|
||||
switch((ctrl & 0x6000) >> 13) {
|
||||
case 1: {
|
||||
@ -498,8 +491,8 @@ void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
if(!((-vscr) & 0x200))
|
||||
layer ^= 1;
|
||||
|
||||
tilemap_draw(bitmap, &c1, sys24_tile_layer[layer], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c2, sys24_tile_layer[layer^1], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c1, tile_layer[layer], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c2, tile_layer[layer^1], tpri, lpri);
|
||||
break;
|
||||
}
|
||||
case 2: case 3: {
|
||||
@ -514,8 +507,8 @@ void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
if(!((+hscr) & 0x200))
|
||||
layer ^= 1;
|
||||
|
||||
tilemap_draw(bitmap, &c1, sys24_tile_layer[layer], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c2, sys24_tile_layer[layer^1], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c1, tile_layer[layer], tpri, lpri);
|
||||
tilemap_draw(bitmap, &c2, tile_layer[layer^1], tpri, lpri);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -523,32 +516,32 @@ void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
|
||||
} else {
|
||||
bitmap_t *bm, *tm;
|
||||
void (*draw)(running_machine &machine, bitmap_t *, bitmap_t *, bitmap_t *, const UINT16 *,
|
||||
void (segas24_tile::*draw)(bitmap_t *, bitmap_t *, bitmap_t *, const UINT16 *,
|
||||
UINT16, UINT8, int, int, int, int, int, int, int);
|
||||
int win = layer & 1;
|
||||
|
||||
if(bitmap->format != BITMAP_FORMAT_INDEXED16)
|
||||
draw = sys24_tile_draw_rect_rgb;
|
||||
draw = &segas24_tile::draw_rect_rgb;
|
||||
else
|
||||
draw = sys24_tile_draw_rect;
|
||||
draw = &segas24_tile::draw_rect;
|
||||
|
||||
bm = tilemap_get_pixmap(sys24_tile_layer[layer]);
|
||||
tm = tilemap_get_flagsmap(sys24_tile_layer[layer]);
|
||||
bm = tilemap_get_pixmap(tile_layer[layer]);
|
||||
tm = tilemap_get_flagsmap(tile_layer[layer]);
|
||||
|
||||
if(hscr & 0x8000) {
|
||||
int y;
|
||||
UINT16 *hscrtb = sys24_tile_ram + 0x4000 + 0x200*layer;
|
||||
UINT16 *hscrtb = tile_ram + 0x4000 + 0x200*layer;
|
||||
vscr &= 0x1ff;
|
||||
|
||||
for(y=0; y<384; y++) {
|
||||
hscr = (-hscrtb[y]) & 0x1ff;
|
||||
if(hscr + 496 <= 512) {
|
||||
// Horizontal split unnecessary
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, y, 496, y+1);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, y, 496, y+1);
|
||||
} else {
|
||||
// Horizontal split necessary
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, y, 512-hscr, y+1);
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, 0, vscr, 512-hscr, y, 496, y+1);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, y, 512-hscr, y+1);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, 0, vscr, 512-hscr, y, 496, y+1);
|
||||
}
|
||||
vscr = (vscr + 1) & 0x1ff;
|
||||
}
|
||||
@ -560,89 +553,90 @@ void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle
|
||||
// Horizontal split unnecessary
|
||||
if(vscr + 384 <= 512) {
|
||||
// Vertical split unnecessary
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, 0, 496, 384);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, 0, 496, 384);
|
||||
} else {
|
||||
// Vertical split necessary
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, 0, 496, 512-vscr);
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, 0, 0, 512-vscr, 496, 384);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, 0, 496, 512-vscr);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, 0, 0, 512-vscr, 496, 384);
|
||||
|
||||
}
|
||||
} else {
|
||||
// Horizontal split necessary
|
||||
if(vscr + 384 <= 512) {
|
||||
// Vertical split unnecessary
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, 0, 512-hscr, 384);
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, 0, vscr, 512-hscr, 0, 496, 384);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, 0, 512-hscr, 384);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, 0, vscr, 512-hscr, 0, 496, 384);
|
||||
} else {
|
||||
// Vertical split necessary
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, 0, 512-hscr, 512-vscr);
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, 0, vscr, 512-hscr, 0, 496, 512-vscr);
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, hscr, 0, 0, 512-vscr, 512-hscr, 384);
|
||||
draw(machine, bm, tm, bitmap, mask, tpri, lpri, win, 0, 0, 512-hscr, 512-vscr, 496, 384);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, vscr, 0, 0, 512-hscr, 512-vscr);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, 0, vscr, 512-hscr, 0, 496, 512-vscr);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, hscr, 0, 0, 512-vscr, 512-hscr, 384);
|
||||
(this->*draw)(bm, tm, bitmap, mask, tpri, lpri, win, 0, 0, 512-hscr, 512-vscr, 496, 384);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
READ16_HANDLER(sys24_tile_r)
|
||||
READ16_MEMBER(segas24_tile::tile_r)
|
||||
{
|
||||
return sys24_tile_ram[offset];
|
||||
return tile_ram[offset];
|
||||
}
|
||||
|
||||
READ16_HANDLER(sys24_char_r)
|
||||
READ16_MEMBER(segas24_tile::char_r)
|
||||
{
|
||||
return sys24_char_ram[offset];
|
||||
return char_ram[offset];
|
||||
}
|
||||
|
||||
WRITE16_HANDLER(sys24_tile_w)
|
||||
WRITE16_MEMBER(segas24_tile::tile_w)
|
||||
{
|
||||
COMBINE_DATA(sys24_tile_ram + offset);
|
||||
COMBINE_DATA(tile_ram + offset);
|
||||
if(offset < 0x4000)
|
||||
tilemap_mark_tile_dirty(sys24_tile_layer[offset >> 12], offset & 0xfff);
|
||||
tilemap_mark_tile_dirty(tile_layer[offset >> 12], offset & 0xfff);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER(sys24_char_w)
|
||||
WRITE16_MEMBER(segas24_tile::char_w)
|
||||
{
|
||||
UINT16 old = sys24_char_ram[offset];
|
||||
COMBINE_DATA(sys24_char_ram + offset);
|
||||
if(old != sys24_char_ram[offset]) {
|
||||
gfx_element_mark_dirty(space->machine().gfx[sys24_char_gfx_index], offset / 16);
|
||||
}
|
||||
UINT16 old = char_ram[offset];
|
||||
COMBINE_DATA(char_ram + offset);
|
||||
if(old != char_ram[offset])
|
||||
gfx_element_mark_dirty(machine().gfx[char_gfx_index], offset / 16);
|
||||
}
|
||||
|
||||
READ32_HANDLER(sys24_tile32_r)
|
||||
READ32_MEMBER(segas24_tile::tile32_r)
|
||||
{
|
||||
return sys24_tile_r(space, offset*2, mem_mask&0xffff) | sys24_tile_r(space, (offset*2)+1, mem_mask>>16)<<16;
|
||||
return tile_r(space, offset*2, mem_mask&0xffff) | tile_r(space, (offset*2)+1, mem_mask>>16)<<16;
|
||||
}
|
||||
|
||||
READ32_HANDLER(sys24_char32_r)
|
||||
READ32_MEMBER(segas24_tile::char32_r)
|
||||
{
|
||||
return sys24_char_r(space, offset*2, mem_mask&0xffff) | sys24_char_r(space, (offset*2)+1, mem_mask>>16)<<16;
|
||||
return char_r(space, offset*2, mem_mask&0xffff) | char_r(space, (offset*2)+1, mem_mask>>16)<<16;
|
||||
}
|
||||
|
||||
WRITE32_HANDLER(sys24_tile32_w)
|
||||
WRITE32_MEMBER(segas24_tile::tile32_w)
|
||||
{
|
||||
sys24_tile_w(space, offset*2, data&0xffff, mem_mask&0xffff);
|
||||
sys24_tile_w(space, (offset*2)+1, data>>16, mem_mask>>16);
|
||||
tile_w(space, offset*2, data&0xffff, mem_mask&0xffff);
|
||||
tile_w(space, (offset*2)+1, data>>16, mem_mask>>16);
|
||||
}
|
||||
|
||||
WRITE32_HANDLER(sys24_char32_w)
|
||||
WRITE32_MEMBER(segas24_tile::char32_w)
|
||||
{
|
||||
sys24_char_w(space,offset*2, data&0xffff, mem_mask&0xffff);
|
||||
sys24_char_w(space,(offset*2)+1, data>>16, mem_mask>>16);
|
||||
char_w(space, offset*2, data&0xffff, mem_mask&0xffff);
|
||||
char_w(space, (offset*2)+1, data>>16, mem_mask>>16);
|
||||
}
|
||||
|
||||
// - System 24
|
||||
|
||||
static UINT16 *sys24_sprite_ram;
|
||||
|
||||
void sys24_sprite_vh_start(running_machine &machine)
|
||||
segas24_sprite::segas24_sprite(running_machine &_machine, const segas24_sprite_config &_config)
|
||||
: device_t(_machine, _config),
|
||||
config(_config)
|
||||
{
|
||||
sys24_sprite_ram = auto_alloc_array(machine, UINT16, 0x40000/2);
|
||||
}
|
||||
|
||||
state_save_register_global_pointer(machine, sys24_sprite_ram, 0x40000/2);
|
||||
// kc = 0;
|
||||
void segas24_sprite::device_start()
|
||||
{
|
||||
sprite_ram = auto_alloc_array(machine(), UINT16, 0x40000/2);
|
||||
|
||||
save_pointer(NAME(sprite_ram), 0x40000/2);
|
||||
}
|
||||
|
||||
/* System24 sprites
|
||||
@ -669,7 +663,7 @@ void sys24_sprite_vh_start(running_machine &machine)
|
||||
0 11------ --------
|
||||
*/
|
||||
|
||||
void sys24_sprite_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, const int *spri)
|
||||
void segas24_sprite::draw(bitmap_t *bitmap, const rectangle *cliprect, const int *spri)
|
||||
{
|
||||
UINT16 curspr = 0;
|
||||
int countspr = 0;
|
||||
@ -686,7 +680,7 @@ void sys24_sprite_draw(running_machine &machine, bitmap_t *bitmap, const rectang
|
||||
UINT16 *source;
|
||||
UINT16 type;
|
||||
|
||||
source = sys24_sprite_ram + (curspr << 3);
|
||||
source = sprite_ram + (curspr << 3);
|
||||
|
||||
if(curspr == 0 && source[0] == 0)
|
||||
break;
|
||||
@ -783,7 +777,7 @@ void sys24_sprite_draw(running_machine &machine, bitmap_t *bitmap, const rectang
|
||||
flipy = source[4] & 0x8000;
|
||||
sy = 1 << ((source[4] & 0x7000) >> 12);
|
||||
|
||||
pix = &sys24_sprite_ram[(source[3] & 0x3fff)* 0x8];
|
||||
pix = &sprite_ram[(source[3] & 0x3fff)* 0x8];
|
||||
for(px=0; px<8; px++) {
|
||||
int c;
|
||||
c = pix[px] >> 8;
|
||||
@ -830,8 +824,8 @@ void sys24_sprite_draw(running_machine &machine, bitmap_t *bitmap, const rectang
|
||||
if(xpos2 >= min_x && xpos2 <= max_x) {
|
||||
int zx1 = flipx ? 7-zx : zx;
|
||||
UINT32 neweroffset = (newoffset+(zx1>>2))&0x1ffff; // crackdown sometimes attempts to use data past the end of spriteram
|
||||
int c = (sys24_sprite_ram[neweroffset] >> (((~zx1) & 3) << 2)) & 0xf;
|
||||
UINT8 *pri = BITMAP_ADDR8(machine.priority_bitmap, ypos1, xpos2);
|
||||
int c = (sprite_ram[neweroffset] >> (((~zx1) & 3) << 2)) & 0xf;
|
||||
UINT8 *pri = BITMAP_ADDR8(machine().priority_bitmap, ypos1, xpos2);
|
||||
if(!(*pri & pm[c])) {
|
||||
c = colors[c];
|
||||
if(c) {
|
||||
@ -868,39 +862,41 @@ void sys24_sprite_draw(running_machine &machine, bitmap_t *bitmap, const rectang
|
||||
}
|
||||
|
||||
|
||||
WRITE16_HANDLER(sys24_sprite_w)
|
||||
WRITE16_MEMBER(segas24_sprite::write)
|
||||
{
|
||||
COMBINE_DATA(sys24_sprite_ram + offset);
|
||||
COMBINE_DATA(sprite_ram + offset);
|
||||
}
|
||||
|
||||
READ16_HANDLER(sys24_sprite_r)
|
||||
READ16_MEMBER(segas24_sprite::read)
|
||||
{
|
||||
return sys24_sprite_ram[offset];
|
||||
return sprite_ram[offset];
|
||||
}
|
||||
|
||||
// Programmable mixers
|
||||
// System 24
|
||||
|
||||
static UINT16 sys24_mixer_reg[0x10];
|
||||
|
||||
void sys24_mixer_vh_start(running_machine &machine)
|
||||
segas24_mixer::segas24_mixer(running_machine &_machine, const segas24_mixer_config &_config)
|
||||
: device_t(_machine, _config),
|
||||
config(_config)
|
||||
{
|
||||
memset(sys24_mixer_reg, 0, sizeof(sys24_mixer_reg));
|
||||
state_save_register_global_array(machine, sys24_mixer_reg);
|
||||
}
|
||||
|
||||
WRITE16_HANDLER (sys24_mixer_w)
|
||||
void segas24_mixer::device_start()
|
||||
{
|
||||
COMBINE_DATA(sys24_mixer_reg + offset);
|
||||
memset(mixer_reg, 0, sizeof(mixer_reg));
|
||||
save_item(NAME(mixer_reg));
|
||||
}
|
||||
|
||||
READ16_HANDLER (sys24_mixer_r)
|
||||
WRITE16_MEMBER(segas24_mixer::write)
|
||||
{
|
||||
return sys24_mixer_reg[offset];
|
||||
COMBINE_DATA(mixer_reg + offset);
|
||||
}
|
||||
|
||||
int sys24_mixer_get_reg(int reg)
|
||||
READ16_MEMBER(segas24_mixer::read)
|
||||
{
|
||||
return sys24_mixer_reg[reg];
|
||||
return mixer_reg[offset];
|
||||
}
|
||||
|
||||
UINT16 segas24_mixer::get_reg(int reg)
|
||||
{
|
||||
return mixer_reg[reg];
|
||||
}
|
||||
|
||||
|
@ -1,43 +1,153 @@
|
||||
#ifndef __SEGAIC_H
|
||||
#define __SEGAIC_H
|
||||
#ifndef __SEGAIC24_H
|
||||
#define __SEGAIC24_H
|
||||
|
||||
/* system24temp_ functions / variables are from shared rewrite files,
|
||||
once the rest of the rewrite is complete they can be removed, I
|
||||
just made a copy & renamed them for now to avoid any conflicts
|
||||
*/
|
||||
#define MCFG_S24TILE_DEVICE_ADD(_tag, tile_mask) \
|
||||
MCFG_DEVICE_ADD(_tag, S24TILE, 0) \
|
||||
segas24_tile_config::static_set_tile_mask(device, tile_mask);
|
||||
|
||||
READ16_HANDLER (system24temp_sys16_paletteram1_r);
|
||||
WRITE16_HANDLER (system24temp_sys16_paletteram1_w);
|
||||
#define MCFG_S24SPRITE_DEVICE_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, S24SPRITE, 0)
|
||||
|
||||
// Tilemaps
|
||||
// System24
|
||||
void sys24_tile_vh_start(running_machine &machine, UINT16 tile_mask);
|
||||
void sys24_tile_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, int layer, int pri, int flags);
|
||||
#define MCFG_S24MIXER_DEVICE_ADD(_tag) \
|
||||
MCFG_DEVICE_ADD(_tag, S24MIXER, 0)
|
||||
|
||||
READ16_HANDLER(sys24_tile_r);
|
||||
READ16_HANDLER(sys24_char_r);
|
||||
WRITE16_HANDLER(sys24_tile_w);
|
||||
WRITE16_HANDLER(sys24_char_w);
|
||||
class segas24_tile;
|
||||
class segas24_sprite;
|
||||
class segas24_mixer;
|
||||
|
||||
READ32_HANDLER(sys24_tile32_r);
|
||||
READ32_HANDLER(sys24_char32_r);
|
||||
WRITE32_HANDLER(sys24_tile32_w);
|
||||
WRITE32_HANDLER(sys24_char32_w);
|
||||
class segas24_tile_config : public device_config
|
||||
{
|
||||
friend class segas24_tile;
|
||||
|
||||
// Sprites
|
||||
// System24
|
||||
void sys24_sprite_vh_start(running_machine &machine);
|
||||
void sys24_sprite_draw(running_machine &machine, bitmap_t *bitmap, const rectangle *cliprect, const int *spri);
|
||||
protected:
|
||||
segas24_tile_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
|
||||
WRITE16_HANDLER (sys24_sprite_w);
|
||||
READ16_HANDLER (sys24_sprite_r);
|
||||
public:
|
||||
static void static_set_tile_mask(device_config *device, UINT16 tile_mask);
|
||||
|
||||
// Programmable mixers
|
||||
// System24
|
||||
void sys24_mixer_vh_start(running_machine &machine);
|
||||
int sys24_mixer_get_reg(int reg);
|
||||
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
virtual device_t *alloc_device(running_machine &machine) const;
|
||||
|
||||
WRITE16_HANDLER (sys24_mixer_w);
|
||||
READ16_HANDLER (sys24_mixer_r);
|
||||
private:
|
||||
UINT16 tile_mask;
|
||||
};
|
||||
|
||||
class segas24_sprite_config : public device_config
|
||||
{
|
||||
friend class segas24_sprite;
|
||||
|
||||
protected:
|
||||
segas24_sprite_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
|
||||
public:
|
||||
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
virtual device_t *alloc_device(running_machine &machine) const;
|
||||
};
|
||||
|
||||
class segas24_mixer_config : public device_config
|
||||
{
|
||||
friend class segas24_mixer;
|
||||
|
||||
protected:
|
||||
segas24_mixer_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
|
||||
public:
|
||||
static device_config *static_alloc_device_config(const machine_config &mconfig, const char *tag, const device_config *owner, UINT32 clock);
|
||||
virtual device_t *alloc_device(running_machine &machine) const;
|
||||
};
|
||||
|
||||
|
||||
class segas24_tile : public device_t
|
||||
{
|
||||
friend class segas24_tile_config;
|
||||
|
||||
segas24_tile(running_machine &_machine, const segas24_tile_config &config);
|
||||
|
||||
public:
|
||||
DECLARE_READ16_MEMBER(tile_r);
|
||||
DECLARE_WRITE16_MEMBER(tile_w);
|
||||
DECLARE_READ16_MEMBER(char_r);
|
||||
DECLARE_WRITE16_MEMBER(char_w);
|
||||
|
||||
DECLARE_READ32_MEMBER(tile32_r);
|
||||
DECLARE_WRITE32_MEMBER(tile32_w);
|
||||
DECLARE_READ32_MEMBER(char32_r);
|
||||
DECLARE_WRITE32_MEMBER(char32_w);
|
||||
|
||||
void draw(bitmap_t *bitmap, const rectangle *cliprect, int layer, int pri, int flags);
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
|
||||
const segas24_tile_config &config;
|
||||
|
||||
private:
|
||||
enum {
|
||||
SYS24_TILES = 0x4000
|
||||
};
|
||||
|
||||
UINT16 *char_ram, *tile_ram;
|
||||
int char_gfx_index;
|
||||
tilemap_t *tile_layer[4];
|
||||
|
||||
static const gfx_layout char_layout;
|
||||
|
||||
void tile_info(int offset, tile_data *tileinfo, tilemap_memory_index tile_index);
|
||||
static TILE_GET_INFO_DEVICE(tile_info_0s);
|
||||
static TILE_GET_INFO_DEVICE(tile_info_0w);
|
||||
static TILE_GET_INFO_DEVICE(tile_info_1s);
|
||||
static TILE_GET_INFO_DEVICE(tile_info_1w);
|
||||
|
||||
void draw_rect(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
|
||||
UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2);
|
||||
void draw_rect_rgb(bitmap_t *bm, bitmap_t *tm, bitmap_t *dm, const UINT16 *mask,
|
||||
UINT16 tpri, UINT8 lpri, int win, int sx, int sy, int xx1, int yy1, int xx2, int yy2);
|
||||
|
||||
};
|
||||
|
||||
class segas24_sprite : public device_t
|
||||
{
|
||||
friend class segas24_sprite_config;
|
||||
|
||||
segas24_sprite(running_machine &_machine, const segas24_sprite_config &config);
|
||||
|
||||
public:
|
||||
DECLARE_READ16_MEMBER(read);
|
||||
DECLARE_WRITE16_MEMBER(write);
|
||||
|
||||
void draw(bitmap_t *bitmap, const rectangle *cliprect, const int *spri);
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
|
||||
const segas24_sprite_config &config;
|
||||
|
||||
private:
|
||||
UINT16 *sprite_ram;
|
||||
};
|
||||
|
||||
|
||||
class segas24_mixer : public device_t
|
||||
{
|
||||
friend class segas24_mixer_config;
|
||||
|
||||
segas24_mixer(running_machine &_machine, const segas24_mixer_config &config);
|
||||
|
||||
public:
|
||||
DECLARE_READ16_MEMBER(read);
|
||||
DECLARE_WRITE16_MEMBER(write);
|
||||
|
||||
UINT16 get_reg(int reg);
|
||||
|
||||
protected:
|
||||
virtual void device_start();
|
||||
|
||||
const segas24_mixer_config &config;
|
||||
|
||||
private:
|
||||
UINT16 mixer_reg[16];
|
||||
};
|
||||
|
||||
extern const device_type S24TILE, S24SPRITE, S24MIXER;
|
||||
|
||||
#endif
|
||||
|
@ -1,32 +1,33 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
#include "emu.h"
|
||||
#include "video/segaic24.h"
|
||||
#include "includes/segas24.h"
|
||||
|
||||
VIDEO_START(system24)
|
||||
{
|
||||
sys24_tile_vh_start(machine, 0xfff);
|
||||
sys24_sprite_vh_start(machine);
|
||||
sys24_mixer_vh_start(machine);
|
||||
}
|
||||
|
||||
static int layer_cmp(const void *pl1, const void *pl2)
|
||||
{
|
||||
static const int default_pri[12] = { 0, 1, 2, 3, 4, 5, 6, 7, -4, -3, -2, -1 };
|
||||
int l1 = *(int *)pl1;
|
||||
int l2 = *(int *)pl2;
|
||||
int p1 = sys24_mixer_get_reg(l1) & 7;
|
||||
int p2 = sys24_mixer_get_reg(l2) & 7;
|
||||
if(p1 != p2)
|
||||
return p1 - p2;
|
||||
return default_pri[l2] - default_pri[l1];
|
||||
}
|
||||
namespace {
|
||||
struct layer_sort {
|
||||
layer_sort(segas24_mixer *_mixer) { mixer = _mixer; }
|
||||
|
||||
bool operator()(int l1, int l2) {
|
||||
static const int default_pri[12] = { 0, 1, 2, 3, 4, 5, 6, 7, -4, -3, -2, -1 };
|
||||
int p1 = mixer->get_reg(l1) & 7;
|
||||
int p2 = mixer->get_reg(l2) & 7;
|
||||
if(p1 != p2)
|
||||
return p1 - p2 < 0;
|
||||
return default_pri[l2] - default_pri[l1] < 0;
|
||||
}
|
||||
|
||||
segas24_mixer *mixer;
|
||||
};
|
||||
};
|
||||
|
||||
SCREEN_UPDATE(system24)
|
||||
{
|
||||
int i, level;
|
||||
int order[12], spri[4];
|
||||
segas24_state *state = screen->machine().driver_data<segas24_state>();
|
||||
|
||||
if(sys24_mixer_get_reg(13) & 1) {
|
||||
if(state->vmixer->get_reg(13) & 1) {
|
||||
bitmap_fill(bitmap, 0, get_black_pen(screen->machine()));
|
||||
return 0;
|
||||
}
|
||||
@ -34,19 +35,23 @@ SCREEN_UPDATE(system24)
|
||||
bitmap_fill(screen->machine().priority_bitmap, 0, 0);
|
||||
bitmap_fill(bitmap, cliprect, 0);
|
||||
|
||||
for(i=0; i<12; i++)
|
||||
std::vector<int> order;
|
||||
order.resize(12);
|
||||
for(int i=0; i<12; i++)
|
||||
order[i] = i;
|
||||
qsort(order, 12, sizeof(int), layer_cmp);
|
||||
|
||||
level = 0;
|
||||
for(i=0; i<12; i++)
|
||||
std::sort(order.begin(), order.end(), layer_sort(state->vmixer));
|
||||
|
||||
int spri[4];
|
||||
int level = 0;
|
||||
for(int i=0; i<12; i++)
|
||||
if(order[i] < 8)
|
||||
sys24_tile_draw(screen->machine(), bitmap, cliprect, order[i], level, 0);
|
||||
state->vtile->draw(bitmap, cliprect, order[i], level, 0);
|
||||
else {
|
||||
spri[order[i]-8] = level;
|
||||
level++;
|
||||
}
|
||||
|
||||
sys24_sprite_draw(screen->machine(), bitmap, cliprect, spri);
|
||||
state->vsprite->draw(bitmap, cliprect, spri);
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user