mirror of
https://github.com/holub/mame
synced 2025-05-10 16:21:42 +03:00
(MESS) intv.c: Reduce tagmap lookups (nw)
This commit is contained in:
parent
e293e278ab
commit
02ff8ffa36
@ -34,14 +34,64 @@ class intv_state : public driver_device
|
||||
{
|
||||
public:
|
||||
intv_state(const machine_config &mconfig, device_type type, const char *tag)
|
||||
: driver_device(mconfig, type, tag),
|
||||
m_maincpu(*this, "maincpu"),
|
||||
m_intellivoice(*this, "sp0256_speech"),
|
||||
m_sound(*this, "ay8914.1"),
|
||||
m_ecs_sound(*this, "ay8914.2"),
|
||||
m_intvkbd_dualport_ram(*this, "dualport_ram"),
|
||||
m_videoram(*this, "videoram"),
|
||||
m_keyboard(*this, "keyboard")
|
||||
: driver_device(mconfig, type, tag)
|
||||
, m_maincpu(*this, "maincpu")
|
||||
, m_intellivoice(*this, "sp0256_speech")
|
||||
, m_sound(*this, "ay8914.1")
|
||||
, m_ecs_sound(*this, "ay8914.2")
|
||||
, m_intvkbd_dualport_ram(*this, "dualport_ram")
|
||||
, m_videoram(*this, "videoram")
|
||||
, m_keyboard(*this, "keyboard")
|
||||
, m_region_maincpu(*this, "maincpu")
|
||||
, m_region_ecs_rom(*this, "ecs_rom")
|
||||
, m_region_keyboard(*this, "keyboard")
|
||||
, m_bank1(*this, "bank1")
|
||||
, m_bank2(*this, "bank2")
|
||||
, m_bank3(*this, "bank3")
|
||||
, m_bank4(*this, "bank4")
|
||||
, m_io_keypad1(*this, "KEYPAD1")
|
||||
, m_io_disc1(*this, "DISC1")
|
||||
, m_io_discx1(*this, "DISCX1")
|
||||
, m_io_discy1(*this, "DISCY1")
|
||||
, m_io_keypad2(*this, "KEYPAD2")
|
||||
, m_io_disc2(*this, "DISC2")
|
||||
, m_io_discx2(*this, "DISCX2")
|
||||
, m_io_discy2(*this, "DISCY2")
|
||||
, m_io_options(*this, "OPTIONS")
|
||||
, m_io_ecs_row0(*this, "ECS_ROW0")
|
||||
, m_io_ecs_row1(*this, "ECS_ROW1")
|
||||
, m_io_ecs_row2(*this, "ECS_ROW2")
|
||||
, m_io_ecs_row3(*this, "ECS_ROW3")
|
||||
, m_io_ecs_row4(*this, "ECS_ROW4")
|
||||
, m_io_ecs_row5(*this, "ECS_ROW5")
|
||||
, m_io_ecs_row6(*this, "ECS_ROW6")
|
||||
, m_io_ecs_synth_row0(*this, "ECS_SYNTH_ROW0")
|
||||
, m_io_ecs_synth_row1(*this, "ECS_SYNTH_ROW1")
|
||||
, m_io_ecs_synth_row2(*this, "ECS_SYNTH_ROW2")
|
||||
, m_io_ecs_synth_row3(*this, "ECS_SYNTH_ROW3")
|
||||
, m_io_ecs_synth_row4(*this, "ECS_SYNTH_ROW4")
|
||||
, m_io_ecs_synth_row5(*this, "ECS_SYNTH_ROW5")
|
||||
, m_io_ecs_synth_row6(*this, "ECS_SYNTH_ROW6")
|
||||
, m_io_keypad3(*this, "KEYPAD3")
|
||||
, m_io_disc3(*this, "DISC3")
|
||||
, m_io_discx3(*this, "DISCX3")
|
||||
, m_io_discy3(*this, "DISCY3")
|
||||
, m_io_keypad4(*this, "KEYPAD4")
|
||||
, m_io_disc4(*this, "DISC4")
|
||||
, m_io_discx4(*this, "DISCX4")
|
||||
, m_io_discy4(*this, "DISCY4")
|
||||
, m_io_ecs_cntrlsel(*this, "ECS_CNTRLSEL")
|
||||
, m_io_row0(*this, "ROW0")
|
||||
, m_io_row1(*this, "ROW1")
|
||||
, m_io_row2(*this, "ROW2")
|
||||
, m_io_row3(*this, "ROW3")
|
||||
, m_io_row4(*this, "ROW4")
|
||||
, m_io_row5(*this, "ROW5")
|
||||
, m_io_row6(*this, "ROW6")
|
||||
, m_io_row7(*this, "ROW7")
|
||||
, m_io_row8(*this, "ROW8")
|
||||
, m_io_row9(*this, "ROW9")
|
||||
, m_io_test(*this, "TEST")
|
||||
{ }
|
||||
|
||||
required_device<cpu_device> m_maincpu;
|
||||
@ -146,10 +196,73 @@ public:
|
||||
|
||||
protected:
|
||||
optional_device<cpu_device> m_keyboard;
|
||||
required_memory_region m_region_maincpu;
|
||||
optional_memory_region m_region_ecs_rom;
|
||||
optional_memory_region m_region_keyboard;
|
||||
optional_memory_bank m_bank1;
|
||||
optional_memory_bank m_bank2;
|
||||
optional_memory_bank m_bank3;
|
||||
optional_memory_bank m_bank4;
|
||||
required_ioport m_io_keypad1;
|
||||
required_ioport m_io_disc1;
|
||||
required_ioport m_io_discx1;
|
||||
required_ioport m_io_discy1;
|
||||
required_ioport m_io_keypad2;
|
||||
required_ioport m_io_disc2;
|
||||
required_ioport m_io_discx2;
|
||||
required_ioport m_io_discy2;
|
||||
required_ioport m_io_options;
|
||||
optional_ioport m_io_ecs_row0;
|
||||
optional_ioport m_io_ecs_row1;
|
||||
optional_ioport m_io_ecs_row2;
|
||||
optional_ioport m_io_ecs_row3;
|
||||
optional_ioport m_io_ecs_row4;
|
||||
optional_ioport m_io_ecs_row5;
|
||||
optional_ioport m_io_ecs_row6;
|
||||
optional_ioport m_io_ecs_synth_row0;
|
||||
optional_ioport m_io_ecs_synth_row1;
|
||||
optional_ioport m_io_ecs_synth_row2;
|
||||
optional_ioport m_io_ecs_synth_row3;
|
||||
optional_ioport m_io_ecs_synth_row4;
|
||||
optional_ioport m_io_ecs_synth_row5;
|
||||
optional_ioport m_io_ecs_synth_row6;
|
||||
optional_ioport m_io_keypad3;
|
||||
optional_ioport m_io_disc3;
|
||||
optional_ioport m_io_discx3;
|
||||
optional_ioport m_io_discy3;
|
||||
optional_ioport m_io_keypad4;
|
||||
optional_ioport m_io_disc4;
|
||||
optional_ioport m_io_discx4;
|
||||
optional_ioport m_io_discy4;
|
||||
optional_ioport m_io_ecs_cntrlsel;
|
||||
optional_ioport m_io_row0;
|
||||
optional_ioport m_io_row1;
|
||||
optional_ioport m_io_row2;
|
||||
optional_ioport m_io_row3;
|
||||
optional_ioport m_io_row4;
|
||||
optional_ioport m_io_row5;
|
||||
optional_ioport m_io_row6;
|
||||
optional_ioport m_io_row7;
|
||||
optional_ioport m_io_row8;
|
||||
optional_ioport m_io_row9;
|
||||
optional_ioport m_io_test;
|
||||
|
||||
int intv_load_rom_file(device_image_interface &image);
|
||||
UINT8 intv_control_r(int hand);
|
||||
void intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color);
|
||||
UINT32 intv_get_pixel(bitmap_ind16 &bitmap, int x, int y);
|
||||
void intv_plot_box(bitmap_ind16 &bm, int x, int y, int w, int h, int color);
|
||||
int sprites_collide(int spriteNum1, int spriteNum2);
|
||||
void determine_sprite_collisions();
|
||||
void render_sprites();
|
||||
void render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor);
|
||||
void render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3);
|
||||
void render_color_stack_mode(bitmap_ind16 &bitmap);
|
||||
void render_fg_bg_mode(bitmap_ind16 &bitmap);
|
||||
void copy_sprites_to_background(bitmap_ind16 &bitmap);
|
||||
void render_background(bitmap_ind16 &bitmap);
|
||||
void draw_borders(bitmap_ind16 &bm);
|
||||
void intv_stic_screenrefresh();
|
||||
};
|
||||
|
||||
/*----------- defined in video/intv.c -----------*/
|
||||
void intv_stic_screenrefresh(running_machine &machine);
|
||||
|
||||
|
||||
#endif /* INTV_H_ */
|
||||
|
@ -48,27 +48,27 @@ READ8_MEMBER( intv_state::intvkbd_dualport8_msb_r )
|
||||
switch (offset)
|
||||
{
|
||||
case 0x000:
|
||||
rv = ioport("TEST")->read() & 0x80;
|
||||
rv = m_io_test->read() & 0x80;
|
||||
logerror("TAPE: Read %02x from 0x40%02x - XOR Data?\n",rv,offset);
|
||||
break;
|
||||
case 0x001:
|
||||
rv = (ioport("TEST")->read() & 0x40) << 1;
|
||||
rv = (m_io_test->read() & 0x40) << 1;
|
||||
logerror("TAPE: Read %02x from 0x40%02x - Sense 1?\n",rv,offset);
|
||||
break;
|
||||
case 0x002:
|
||||
rv = (ioport("TEST")->read() & 0x20) << 2;
|
||||
rv = (m_io_test->read() & 0x20) << 2;
|
||||
logerror("TAPE: Read %02x from 0x40%02x - Sense 2?\n",rv,offset);
|
||||
break;
|
||||
case 0x003:
|
||||
rv = (ioport("TEST")->read() & 0x10) << 3;
|
||||
rv = (m_io_test->read() & 0x10) << 3;
|
||||
logerror("TAPE: Read %02x from 0x40%02x - Tape Present\n",rv,offset);
|
||||
break;
|
||||
case 0x004:
|
||||
rv = (ioport("TEST")->read() & 0x08) << 4;
|
||||
rv = (m_io_test->read() & 0x08) << 4;
|
||||
logerror("TAPE: Read %02x from 0x40%02x - Comp (339/1)\n",rv,offset);
|
||||
break;
|
||||
case 0x005:
|
||||
rv = (ioport("TEST")->read() & 0x04) << 5;
|
||||
rv = (m_io_test->read() & 0x04) << 5;
|
||||
logerror("TAPE: Read %02x from 0x40%02x - Clocked Comp (339/13)\n",rv,offset);
|
||||
break;
|
||||
case 0x006:
|
||||
@ -88,25 +88,25 @@ READ8_MEMBER( intv_state::intvkbd_dualport8_msb_r )
|
||||
case 0x060: /* Keyboard Read */
|
||||
rv = 0xff;
|
||||
if (m_intvkbd_keyboard_col == 0)
|
||||
rv = ioport("ROW0")->read();
|
||||
rv = m_io_row0->read();
|
||||
if (m_intvkbd_keyboard_col == 1)
|
||||
rv = ioport("ROW1")->read();
|
||||
rv = m_io_row1->read();
|
||||
if (m_intvkbd_keyboard_col == 2)
|
||||
rv = ioport("ROW2")->read();
|
||||
rv = m_io_row2->read();
|
||||
if (m_intvkbd_keyboard_col == 3)
|
||||
rv = ioport("ROW3")->read();
|
||||
rv = m_io_row3->read();
|
||||
if (m_intvkbd_keyboard_col == 4)
|
||||
rv = ioport("ROW4")->read();
|
||||
rv = m_io_row4->read();
|
||||
if (m_intvkbd_keyboard_col == 5)
|
||||
rv = ioport("ROW5")->read();
|
||||
rv = m_io_row5->read();
|
||||
if (m_intvkbd_keyboard_col == 6)
|
||||
rv = ioport("ROW6")->read();
|
||||
rv = m_io_row6->read();
|
||||
if (m_intvkbd_keyboard_col == 7)
|
||||
rv = ioport("ROW7")->read();
|
||||
rv = m_io_row7->read();
|
||||
if (m_intvkbd_keyboard_col == 8)
|
||||
rv = ioport("ROW8")->read();
|
||||
rv = m_io_row8->read();
|
||||
if (m_intvkbd_keyboard_col == 9)
|
||||
rv = ioport("ROW9")->read();
|
||||
rv = m_io_row9->read();
|
||||
break;
|
||||
case 0x80:
|
||||
rv = 0x00;
|
||||
@ -338,11 +338,11 @@ WRITE16_MEMBER( intv_state::ecs_bank1_page_select )
|
||||
{
|
||||
if (data == 0x2A50)
|
||||
{
|
||||
membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (0x2000 << 1));
|
||||
m_bank1->set_base(m_region_maincpu->base() + (0x2000 << 1));
|
||||
}
|
||||
else if (data == 0x2A51)
|
||||
{
|
||||
membank("bank1")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0x2000 << 1));
|
||||
m_bank1->set_base(m_region_ecs_rom->base() + (0x2000 << 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -353,11 +353,11 @@ WRITE16_MEMBER( intv_state::ecs_bank2_page_select )
|
||||
{
|
||||
if (data == 0x7A50)
|
||||
{
|
||||
membank("bank2")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0x7000 << 1)); // ECS ROM at 0x7000 is on page 1
|
||||
m_bank2->set_base(m_region_ecs_rom->base() + (0x7000 << 1)); // ECS ROM at 0x7000 is on page 1
|
||||
}
|
||||
else if (data == 0x7A51 )
|
||||
{
|
||||
membank("bank2")->set_base(machine().root_device().memregion("maincpu")->base() + (0x7000 << 1));
|
||||
m_bank2->set_base(m_region_maincpu->base() + (0x7000 << 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -368,11 +368,11 @@ WRITE16_MEMBER( intv_state::ecs_bank3_page_select )
|
||||
{
|
||||
if (data == 0xEA50)
|
||||
{
|
||||
membank("bank3")->set_base(machine().root_device().memregion("maincpu")->base() + (0xE000 << 1));
|
||||
m_bank3->set_base(m_region_maincpu->base() + (0xE000 << 1));
|
||||
}
|
||||
else if (data == 0xEA51)
|
||||
{
|
||||
membank("bank3")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0xE000 << 1));
|
||||
m_bank3->set_base(m_region_ecs_rom->base() + (0xE000 << 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -384,16 +384,16 @@ WRITE16_MEMBER( intv_state::wsmlb_bank_page_select )
|
||||
{
|
||||
if (data == 0xFA50)
|
||||
{
|
||||
membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + (0xF000 << 1));
|
||||
m_bank4->set_base(m_region_maincpu->base() + (0xF000 << 1));
|
||||
}
|
||||
else if (data == 0xFA51)
|
||||
{
|
||||
membank("bank4")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0xF000 << 1));
|
||||
m_bank4->set_base(m_region_ecs_rom->base() + (0xF000 << 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static int intv_load_rom_file(device_image_interface &image)
|
||||
int intv_state::intv_load_rom_file(device_image_interface &image)
|
||||
{
|
||||
int i,j;
|
||||
|
||||
@ -408,9 +408,8 @@ static int intv_load_rom_file(device_image_interface &image)
|
||||
UINT8 high_byte;
|
||||
UINT8 low_byte;
|
||||
|
||||
UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
|
||||
intv_state *state = image.device().machine().driver_data<intv_state>();
|
||||
address_space &program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
UINT8 *memory = m_region_maincpu->base();
|
||||
address_space &program = m_maincpu->space(AS_PROGRAM);
|
||||
const char *filetype = image.filetype();
|
||||
|
||||
/* if it is in .rom format, we enter here */
|
||||
@ -505,8 +504,8 @@ static int intv_load_rom_file(device_image_interface &image)
|
||||
size = ( ram & 0x0f ) * 0x800;
|
||||
|
||||
program.install_readwrite_handler(start, start + size,
|
||||
read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state),
|
||||
write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state));
|
||||
read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), this),
|
||||
write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), this));
|
||||
}
|
||||
/* For now intellivoice always active
|
||||
if (extra & INTELLIVOICE_MASK)
|
||||
@ -553,9 +552,8 @@ DEVICE_IMAGE_LOAD_MEMBER( intv_state,intv_cart )
|
||||
{
|
||||
UINT16 offset[] = {0x4800, 0x5000, 0x6000, 0x7000, 0x9000, 0xa000, 0xc000, 0xd000, 0xf000};
|
||||
const char* region_name[] = {"4800", "5000", "6000", "7000", "9000", "A000", "C000", "D000", "F000"};
|
||||
UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
|
||||
intv_state *state = image.device().machine().driver_data<intv_state>();
|
||||
address_space &program = image.device().machine().device("maincpu")->memory().space(AS_PROGRAM);
|
||||
UINT8 *memory = m_region_maincpu->base();
|
||||
address_space &program = m_maincpu->space(AS_PROGRAM);
|
||||
|
||||
UINT32 size=0;
|
||||
UINT16 address = 0;
|
||||
@ -576,7 +574,7 @@ DEVICE_IMAGE_LOAD_MEMBER( intv_state,intv_cart )
|
||||
}
|
||||
// deal with wsmlb paged rom
|
||||
|
||||
UINT8 *ecs_rom_region = image.device().machine().root_device().memregion("ecs_rom")->base();
|
||||
UINT8 *ecs_rom_region = m_region_ecs_rom->base();
|
||||
size = image.get_software_region_length("F000_bank1");
|
||||
if (size && ecs_rom_region) // only load if ecs is plugged in (should probably be done a different way)
|
||||
{
|
||||
@ -593,16 +591,16 @@ DEVICE_IMAGE_LOAD_MEMBER( intv_state,intv_cart )
|
||||
if (size)
|
||||
{
|
||||
program.install_readwrite_handler(0xD000, 0xD000 + size,
|
||||
read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state),
|
||||
write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state));
|
||||
read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), this),
|
||||
write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), this));
|
||||
}
|
||||
|
||||
size = image.get_software_region_length("8800_RAM8");
|
||||
if (size)
|
||||
{
|
||||
program.install_readwrite_handler(0x8800, 0x8800 + size,
|
||||
read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), state),
|
||||
write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), state));
|
||||
read16_delegate( FUNC( intv_state::intv_cart_ram8_r ), this),
|
||||
write16_delegate( FUNC( intv_state::intv_cart_ram8_w ), this));
|
||||
}
|
||||
return IMAGE_INIT_PASS;
|
||||
}
|
||||
@ -617,33 +615,33 @@ DRIVER_INIT_MEMBER(intv_state,intv)
|
||||
/* Set Reset and INTR/INTRM Vector */
|
||||
void intv_state::machine_reset()
|
||||
{
|
||||
machine().device("maincpu")->execute().set_input_line_vector(CP1610_RESET, 0x1000);
|
||||
m_maincpu->set_input_line_vector(CP1610_RESET, 0x1000);
|
||||
|
||||
/* These are actually the same vector, and INTR is unused */
|
||||
machine().device("maincpu")->execute().set_input_line_vector(CP1610_INT_INTRM, 0x1004);
|
||||
machine().device("maincpu")->execute().set_input_line_vector(CP1610_INT_INTR, 0x1004);
|
||||
m_maincpu->set_input_line_vector(CP1610_INT_INTRM, 0x1004);
|
||||
m_maincpu->set_input_line_vector(CP1610_INT_INTR, 0x1004);
|
||||
|
||||
/* Set initial PC */
|
||||
machine().device("maincpu")->state().set_state_int(CP1610_R7, 0x1000);
|
||||
m_maincpu->set_state_int(CP1610_R7, 0x1000);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
MACHINE_RESET_MEMBER(intv_state,intvecs)
|
||||
{
|
||||
membank("bank1")->set_base(machine().root_device().memregion("maincpu")->base() + (0x2000 << 1));
|
||||
membank("bank2")->set_base(machine().root_device().memregion("ecs_rom")->base() + (0x7000 << 1));
|
||||
membank("bank3")->set_base(machine().root_device().memregion("maincpu")->base() + (0xE000 << 1));
|
||||
membank("bank4")->set_base(machine().root_device().memregion("maincpu")->base() + (0xF000 << 1));
|
||||
m_bank1->set_base(m_region_maincpu->base() + (0x2000 << 1));
|
||||
m_bank2->set_base(m_region_ecs_rom->base() + (0x7000 << 1));
|
||||
m_bank3->set_base(m_region_maincpu->base() + (0xE000 << 1));
|
||||
m_bank4->set_base(m_region_maincpu->base() + (0xF000 << 1));
|
||||
|
||||
machine().device("maincpu")->execute().set_input_line_vector(CP1610_RESET, 0x1000);
|
||||
m_maincpu->set_input_line_vector(CP1610_RESET, 0x1000);
|
||||
|
||||
/* These are actually the same vector, and INTR is unused */
|
||||
machine().device("maincpu")->execute().set_input_line_vector(CP1610_INT_INTRM, 0x1004);
|
||||
machine().device("maincpu")->execute().set_input_line_vector(CP1610_INT_INTR, 0x1004);
|
||||
m_maincpu->set_input_line_vector(CP1610_INT_INTRM, 0x1004);
|
||||
m_maincpu->set_input_line_vector(CP1610_INT_INTR, 0x1004);
|
||||
|
||||
/* Set initial PC */
|
||||
machine().device("maincpu")->state().set_state_int(CP1610_R7, 0x1000);
|
||||
m_maincpu->set_state_int(CP1610_R7, 0x1000);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -651,7 +649,7 @@ MACHINE_RESET_MEMBER(intv_state,intvecs)
|
||||
|
||||
TIMER_CALLBACK_MEMBER(intv_state::intv_interrupt_complete)
|
||||
{
|
||||
machine().device("maincpu")->execute().set_input_line(CP1610_INT_INTRM, CLEAR_LINE);
|
||||
m_maincpu->set_input_line(CP1610_INT_INTRM, CLEAR_LINE);
|
||||
m_bus_copy_mode = 0;
|
||||
}
|
||||
|
||||
@ -670,47 +668,47 @@ TIMER_CALLBACK_MEMBER(intv_state::intv_btb_fill)
|
||||
|
||||
INTERRUPT_GEN_MEMBER(intv_state::intv_interrupt)
|
||||
{
|
||||
machine().device("maincpu")->execute().set_input_line(CP1610_INT_INTRM, ASSERT_LINE);
|
||||
m_maincpu->set_input_line(CP1610_INT_INTRM, ASSERT_LINE);
|
||||
m_sr1_int_pending = 1;
|
||||
m_bus_copy_mode = 1;
|
||||
m_backtab_row = 0;
|
||||
UINT8 row;
|
||||
machine().device("maincpu")->execute().adjust_icount(-(12*STIC_ROW_BUSRQ+STIC_FRAME_BUSRQ)); // Account for stic cycle stealing
|
||||
m_maincpu->adjust_icount(-(12*STIC_ROW_BUSRQ+STIC_FRAME_BUSRQ)); // Account for stic cycle stealing
|
||||
machine().scheduler().timer_set(machine().device<cpu_device>("maincpu")
|
||||
->cycles_to_attotime(STIC_VBLANK_END), timer_expired_delegate(FUNC(intv_state::intv_interrupt_complete),this));
|
||||
for (row=0; row < STIC_BACKTAB_HEIGHT; row++)
|
||||
{
|
||||
machine().scheduler().timer_set(machine().device<cpu_device>("maincpu")
|
||||
machine().scheduler().timer_set(m_maincpu
|
||||
->cycles_to_attotime(STIC_FIRST_FETCH-STIC_FRAME_BUSRQ+STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*m_row_delay + (STIC_CYCLES_PER_SCANLINE*STIC_Y_SCALE*STIC_CARD_HEIGHT - STIC_ROW_BUSRQ)*row), timer_expired_delegate(FUNC(intv_state::intv_btb_fill),this));
|
||||
}
|
||||
|
||||
if (m_row_delay == 0)
|
||||
{
|
||||
machine().device("maincpu")->execute().adjust_icount(-STIC_ROW_BUSRQ); // extra row fetch occurs if vertical delay == 0
|
||||
m_maincpu->adjust_icount(-STIC_ROW_BUSRQ); // extra row fetch occurs if vertical delay == 0
|
||||
}
|
||||
|
||||
intv_stic_screenrefresh(machine());
|
||||
intv_stic_screenrefresh();
|
||||
}
|
||||
|
||||
/* hand 0 == left, 1 == right, 2 == ECS hand controller 1, 3 == ECS hand controller 2 */
|
||||
UINT8 intv_control_r(address_space &space, int hand)
|
||||
UINT8 intv_state::intv_control_r(int hand)
|
||||
{
|
||||
static const char* const keypad_name[] = { "KEYPAD1", "KEYPAD2", "KEYPAD3", "KEYPAD4" };
|
||||
ioport_port *keypad[] = { m_io_keypad1, m_io_keypad2, m_io_keypad3, m_io_keypad4 };
|
||||
static const UINT8 keypad_table[] =
|
||||
{
|
||||
0xFF, 0x3F, 0x9F, 0x5F, 0xD7, 0xB7, 0x77, 0xDB,
|
||||
0xBB, 0x7B, 0xDD, 0xBD, 0x7D, 0xDE, 0xBE, 0x7E
|
||||
};
|
||||
|
||||
static const char* const disc_name[] = { "DISC1", "DISC2", "DISC3", "DISC4" };
|
||||
ioport_port *disc[] = { m_io_disc1, m_io_disc2, m_io_disc3, m_io_disc4 };
|
||||
static const UINT8 disc_table[] =
|
||||
{
|
||||
0xF3, 0xE3, 0xE7, 0xF7, 0xF6, 0xE6, 0xEE, 0xFE,
|
||||
0xFC, 0xEC, 0xED, 0xFD, 0xF9, 0xE9, 0xEB, 0xFB
|
||||
};
|
||||
|
||||
static const char* const discx_name[] = { "DISCX1", "DISCX2", "DISCX3", "DISCX4" };
|
||||
static const char* const discy_name[] = { "DISCY1", "DISCY2", "DISKY3", "DISCY4" };
|
||||
ioport_port *discx[] = { m_io_discx1, m_io_discx2, m_io_discx3, m_io_discx4 };
|
||||
ioport_port *discy[] = { m_io_discy1, m_io_discy2, m_io_discy3, m_io_discy4 };
|
||||
static const UINT8 discyx_table[5][5] =
|
||||
{
|
||||
{ 0xE3, 0xF3, 0xFB, 0xEB, 0xE9 },
|
||||
@ -724,7 +722,7 @@ UINT8 intv_control_r(address_space &space, int hand)
|
||||
UINT8 rv = 0xFF;
|
||||
|
||||
/* keypad */
|
||||
x = space.machine().root_device().ioport(keypad_name[hand])->read();
|
||||
x = keypad[hand]->read();
|
||||
for (y = 0; y < 16; y++)
|
||||
{
|
||||
if (x & (1 << y))
|
||||
@ -733,12 +731,12 @@ UINT8 intv_control_r(address_space &space, int hand)
|
||||
}
|
||||
}
|
||||
|
||||
switch ((space.machine().root_device().ioport("OPTIONS")->read() >> hand) & 1)
|
||||
switch ((m_io_options->read() >> hand) & 1)
|
||||
{
|
||||
case 0: /* disc == digital */
|
||||
default:
|
||||
|
||||
x = space.machine().root_device().ioport(disc_name[hand])->read();
|
||||
x = disc[hand]->read();
|
||||
for (y = 0; y < 16; y++)
|
||||
{
|
||||
if (x & (1 << y))
|
||||
@ -750,8 +748,8 @@ UINT8 intv_control_r(address_space &space, int hand)
|
||||
|
||||
case 1: /* disc == _fake_ analog */
|
||||
|
||||
x = space.machine().root_device().ioport(discx_name[hand])->read();
|
||||
y = space.machine().root_device().ioport(discy_name[hand])->read();
|
||||
x = discx[hand]->read();
|
||||
y = discy[hand]->read();
|
||||
rv &= discyx_table[y / 32][x / 32];
|
||||
}
|
||||
|
||||
@ -760,51 +758,51 @@ UINT8 intv_control_r(address_space &space, int hand)
|
||||
|
||||
READ8_MEMBER( intv_state::intv_left_control_r )
|
||||
{
|
||||
return intv_control_r(space, 0);
|
||||
return intv_control_r(0);
|
||||
}
|
||||
|
||||
READ8_MEMBER( intv_state::intv_right_control_r )
|
||||
{
|
||||
return intv_control_r(space, 1);
|
||||
return intv_control_r(1);
|
||||
}
|
||||
|
||||
READ8_MEMBER( intv_state::intv_ecs_porta_r )
|
||||
{
|
||||
if (ioport("ECS_CNTRLSEL")->read() == 0)
|
||||
return intv_control_r(space, 2);
|
||||
if (m_io_ecs_cntrlsel->read() == 0)
|
||||
return intv_control_r(2);
|
||||
else
|
||||
return 0xff; // not sure what to return here, maybe it should be last output?
|
||||
}
|
||||
|
||||
READ8_MEMBER( intv_state::intv_ecs_portb_r )
|
||||
{
|
||||
switch (ioport("ECS_CNTRLSEL")->read())
|
||||
switch (m_io_ecs_cntrlsel->read())
|
||||
{
|
||||
case 0x00: // hand controller
|
||||
{
|
||||
return intv_control_r(space, 3);
|
||||
return intv_control_r(3);
|
||||
}
|
||||
case 0x01: // synthesizer keyboard
|
||||
{
|
||||
static const char* const ecs_synth_rows[] = { "ECS_SYNTH_ROW0", "ECS_SYNTH_ROW1", "ECS_SYNTH_ROW2", "ECS_SYNTH_ROW3", "ECS_SYNTH_ROW4", "ECS_SYNTH_ROW5", "ECS_SYNTH_ROW6" };
|
||||
ioport_port *ecs_synth_rows[] = { m_io_ecs_synth_row0, m_io_ecs_synth_row1, m_io_ecs_synth_row2, m_io_ecs_synth_row3, m_io_ecs_synth_row4, m_io_ecs_synth_row5, m_io_ecs_synth_row6 };
|
||||
UINT8 rv = 0xFF;
|
||||
// return correct result if more than one bit of 0xFE is set
|
||||
for (int i=0; i<7; i++)
|
||||
{
|
||||
if (m_ecs_psg_porta & (1<<i))
|
||||
rv &= ioport(ecs_synth_rows[i])->read();
|
||||
rv &= ecs_synth_rows[i]->read();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
case 0x02: // ecs keyboard
|
||||
{
|
||||
static const char* const ecs_keyboard_rows[] = { "ECS_ROW0", "ECS_ROW1", "ECS_ROW2", "ECS_ROW3", "ECS_ROW4", "ECS_ROW5", "ECS_ROW6" };
|
||||
ioport_port *ecs_keyboard_rows[] = { m_io_ecs_row0, m_io_ecs_row1, m_io_ecs_row2, m_io_ecs_row3, m_io_ecs_row4, m_io_ecs_row5, m_io_ecs_row6 };
|
||||
UINT8 rv = 0xFF;
|
||||
// return correct result if more than one bit of 0xFE is set
|
||||
for (int i=0; i<7; i++)
|
||||
{
|
||||
if (m_ecs_psg_porta & (1<<i))
|
||||
rv &= ioport(ecs_keyboard_rows[i])->read();
|
||||
rv &= ecs_keyboard_rows[i]->read();
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
@ -826,7 +824,7 @@ DEVICE_IMAGE_LOAD_MEMBER( intv_state,intvkbd_cart )
|
||||
{
|
||||
/* First, initialize these as empty so that the intellivision
|
||||
* will think that the playcable is not attached */
|
||||
UINT8 *memory = image.device().machine().root_device().memregion("maincpu")->base();
|
||||
UINT8 *memory = m_region_maincpu->base();
|
||||
|
||||
/* assume playcable is absent */
|
||||
memory[0x4800 << 1] = 0xff;
|
||||
@ -837,7 +835,7 @@ DEVICE_IMAGE_LOAD_MEMBER( intv_state,intvkbd_cart )
|
||||
|
||||
if (strcmp(image.device().tag(),":cart2") == 0) /* Keyboard component cartridge slot */
|
||||
{
|
||||
UINT8 *memory = image.device().machine().root_device().memregion("keyboard")->base();
|
||||
UINT8 *memory = m_region_keyboard->base();
|
||||
|
||||
/* Assume an 8K cart, like BASIC */
|
||||
image.fread( &memory[0xe000], 0x2000);
|
||||
|
@ -10,28 +10,28 @@
|
||||
|
||||
/* initialized to non-zero, because we divide by it */
|
||||
|
||||
INLINE void intv_set_pixel(intv_state *state, bitmap_ind16 &bitmap, int x, int y, UINT32 color)
|
||||
void intv_state::intv_set_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color)
|
||||
{
|
||||
int w, h;
|
||||
|
||||
// output scaling
|
||||
x *= state->m_x_scale;
|
||||
y *= state->m_y_scale;
|
||||
x *= m_x_scale;
|
||||
y *= m_y_scale;
|
||||
color = SET_COLOR(color);
|
||||
|
||||
for (h = 0; h < state->m_y_scale; h++)
|
||||
for (w = 0; w < state->m_x_scale; w++)
|
||||
for (h = 0; h < m_y_scale; h++)
|
||||
for (w = 0; w < m_x_scale; w++)
|
||||
bitmap.pix16(y + h, x + w) = color;
|
||||
}
|
||||
|
||||
INLINE UINT32 intv_get_pixel(intv_state *state, bitmap_ind16 &bitmap, int x, int y)
|
||||
UINT32 intv_state::intv_get_pixel(bitmap_ind16 &bitmap, int x, int y)
|
||||
{
|
||||
return GET_COLOR(bitmap.pix16(y * state->m_y_scale, x * state->m_x_scale));
|
||||
return GET_COLOR(bitmap.pix16(y * m_y_scale, x * m_x_scale));
|
||||
}
|
||||
|
||||
INLINE void intv_plot_box(intv_state *state, bitmap_ind16 &bm, int x, int y, int w, int h, int color)
|
||||
void intv_state::intv_plot_box(bitmap_ind16 &bm, int x, int y, int w, int h, int color)
|
||||
{
|
||||
bm.plot_box(x * state->m_x_scale, y * state->m_y_scale, w * state->m_x_scale, h * state->m_y_scale, SET_COLOR(color));
|
||||
bm.plot_box(x * m_x_scale, y * m_y_scale, w * m_x_scale, h * m_y_scale, SET_COLOR(color));
|
||||
}
|
||||
|
||||
void intv_state::video_start()
|
||||
@ -93,15 +93,15 @@ void intv_state::video_start()
|
||||
}
|
||||
|
||||
|
||||
static int sprites_collide(intv_state *state, int spriteNum1, int spriteNum2)
|
||||
int intv_state::sprites_collide(int spriteNum1, int spriteNum2)
|
||||
{
|
||||
INT16 x0, y0, w0, h0, x1, y1, w1, h1, x2, y2, w2, h2;
|
||||
|
||||
intv_sprite_type* s1 = &state->m_sprite[spriteNum1];
|
||||
intv_sprite_type* s2 = &state->m_sprite[spriteNum2];
|
||||
intv_sprite_type* s1 = &m_sprite[spriteNum1];
|
||||
intv_sprite_type* s2 = &m_sprite[spriteNum2];
|
||||
|
||||
x0 = STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay - STIC_CARD_WIDTH;
|
||||
y0 = STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay - STIC_CARD_HEIGHT;
|
||||
x0 = STIC_OVERSCAN_LEFT_WIDTH + m_col_delay - STIC_CARD_WIDTH;
|
||||
y0 = STIC_OVERSCAN_TOP_HEIGHT + m_row_delay - STIC_CARD_HEIGHT;
|
||||
x1 = (s1->xpos + x0) * STIC_X_SCALE; y1 = (s1->ypos + y0) * STIC_Y_SCALE;
|
||||
x2 = (s2->xpos + x0) * STIC_X_SCALE; y2 = (s2->ypos + y0) * STIC_Y_SCALE;
|
||||
w1 = (s1->doublex ? 2 : 1) * STIC_CARD_WIDTH;
|
||||
@ -126,8 +126,8 @@ static int sprites_collide(intv_state *state, int spriteNum1, int spriteNum2)
|
||||
{
|
||||
for (y0 = 0; y0 < h0; y0++)
|
||||
{
|
||||
if (state->m_sprite_buffers[spriteNum1][x0 + x1][y0 + y1] &&
|
||||
state->m_sprite_buffers[spriteNum2][x0 + x2][y0 + y2])
|
||||
if (m_sprite_buffers[spriteNum1][x0 + x1][y0 + y1] &&
|
||||
m_sprite_buffers[spriteNum2][x0 + x2][y0 + y2])
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
@ -135,23 +135,23 @@ static int sprites_collide(intv_state *state, int spriteNum1, int spriteNum2)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static void determine_sprite_collisions(intv_state *state)
|
||||
void intv_state::determine_sprite_collisions()
|
||||
{
|
||||
// check sprite to sprite collisions
|
||||
int i, j;
|
||||
for (i = 0; i < STIC_MOBS - 1; i++)
|
||||
{
|
||||
intv_sprite_type* s1 = &state->m_sprite[i];
|
||||
intv_sprite_type* s1 = &m_sprite[i];
|
||||
if (s1->xpos == 0 || !s1->coll)
|
||||
continue;
|
||||
|
||||
for (j = i + 1; j < STIC_MOBS; j++)
|
||||
{
|
||||
intv_sprite_type* s2 = &state->m_sprite[j];
|
||||
intv_sprite_type* s2 = &m_sprite[j];
|
||||
if (s2->xpos == 0 || !s2->coll)
|
||||
continue;
|
||||
|
||||
if (sprites_collide(state, i, j))
|
||||
if (sprites_collide(i, j))
|
||||
{
|
||||
s1->collision |= (1 << j);
|
||||
s2->collision |= (1 << i);
|
||||
@ -160,9 +160,8 @@ static void determine_sprite_collisions(intv_state *state)
|
||||
}
|
||||
}
|
||||
|
||||
static void render_sprites(running_machine &machine)
|
||||
void intv_state::render_sprites()
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
INT32 cardMemoryLocation, pixelSize;
|
||||
INT32 spritePixelHeight;
|
||||
INT32 nextMemoryLocation;
|
||||
@ -172,11 +171,11 @@ static void render_sprites(running_machine &machine)
|
||||
INT32 xInc;
|
||||
INT32 i, j, k;
|
||||
|
||||
UINT8* memory = state->memregion("maincpu")->base();
|
||||
UINT8* memory = m_region_maincpu->base();
|
||||
|
||||
for (i = 0; i < STIC_MOBS; i++)
|
||||
{
|
||||
intv_sprite_type* s = &state->m_sprite[i];
|
||||
intv_sprite_type* s = &m_sprite[i];
|
||||
|
||||
if (s->grom)
|
||||
cardMemoryLocation = (s->card * STIC_CARD_HEIGHT);
|
||||
@ -192,7 +191,7 @@ static void render_sprites(running_machine &machine)
|
||||
if (s->grom)
|
||||
nextData = memory[(0x3000+nextMemoryLocation)<<1];
|
||||
else if (nextMemoryLocation < 0x200)
|
||||
nextData = state->m_gram[nextMemoryLocation];
|
||||
nextData = m_gram[nextMemoryLocation];
|
||||
else
|
||||
nextData = 0xFFFF;
|
||||
nextX = (s->xflip ? ((s->doublex ? 2 : 1) * STIC_CARD_WIDTH - 1) : 0);
|
||||
@ -201,66 +200,60 @@ static void render_sprites(running_machine &machine)
|
||||
|
||||
for (k = 0; k < STIC_CARD_WIDTH * (1 + s->doublex); k++)
|
||||
{
|
||||
state->m_sprite_buffers[i][nextX + k * xInc][nextY] = (nextData & (1 << ((STIC_CARD_WIDTH - 1) - k / (1 + s->doublex)))) != 0;
|
||||
m_sprite_buffers[i][nextX + k * xInc][nextY] = (nextData & (1 << ((STIC_CARD_WIDTH - 1) - k / (1 + s->doublex)))) != 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void render_line(running_machine &machine, bitmap_ind16 &bitmap,
|
||||
UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor)
|
||||
void intv_state::render_line(bitmap_ind16 &bitmap, UINT8 nextByte, UINT16 x, UINT16 y, UINT8 fgcolor, UINT8 bgcolor)
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
UINT32 color;
|
||||
UINT8 i;
|
||||
|
||||
for (i = 0; i < STIC_CARD_WIDTH; i++)
|
||||
{
|
||||
color = (nextByte & (1 << ((STIC_CARD_WIDTH - 1) - i)) ? fgcolor : bgcolor);
|
||||
intv_set_pixel(state, bitmap, x+i, y, color);
|
||||
intv_set_pixel(state, bitmap, x+i, y+1, color);
|
||||
intv_set_pixel(bitmap, x+i, y, color);
|
||||
intv_set_pixel(bitmap, x+i, y+1, color);
|
||||
}
|
||||
}
|
||||
|
||||
static void render_colored_squares(running_machine &machine, bitmap_ind16 &bitmap,
|
||||
UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3)
|
||||
void intv_state::render_colored_squares(bitmap_ind16 &bitmap, UINT16 x, UINT16 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3)
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
|
||||
intv_plot_box(state, bitmap, x, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color0);
|
||||
intv_plot_box(state, bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color1);
|
||||
intv_plot_box(state, bitmap, x, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color2);
|
||||
intv_plot_box(state, bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color3);
|
||||
intv_plot_box(bitmap, x, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color0);
|
||||
intv_plot_box(bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color1);
|
||||
intv_plot_box(bitmap, x, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color2);
|
||||
intv_plot_box(bitmap, x + STIC_CSQM_WIDTH * STIC_X_SCALE, y + STIC_CSQM_HEIGHT * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, color3);
|
||||
}
|
||||
|
||||
static void render_color_stack_mode(running_machine &machine, bitmap_ind16 &bitmap)
|
||||
void intv_state::render_color_stack_mode(bitmap_ind16 &bitmap)
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
INT16 w, h, nextx, nexty;
|
||||
UINT8 csPtr = 0;
|
||||
UINT16 nextCard;
|
||||
UINT8 *ram = state->memregion("maincpu")->base();
|
||||
UINT8 *ram = m_region_maincpu->base();
|
||||
|
||||
for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE;
|
||||
for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE;
|
||||
h < STIC_BACKTAB_HEIGHT;
|
||||
h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE)
|
||||
{
|
||||
for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE;
|
||||
for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE;
|
||||
w < STIC_BACKTAB_WIDTH;
|
||||
w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE)
|
||||
{
|
||||
nextCard = state->m_backtab_buffer[h][w];
|
||||
nextCard = m_backtab_buffer[h][w];
|
||||
|
||||
// colored squares mode
|
||||
if ((nextCard & (STIC_CSTM_FG3|STIC_CSTM_SEL)) == STIC_CSTM_FG3)
|
||||
{
|
||||
UINT8 csColor = state->m_stic_registers[STIC_CSR + csPtr];
|
||||
UINT8 csColor = m_stic_registers[STIC_CSR + csPtr];
|
||||
UINT8 color0 = nextCard & STIC_CSQM_A;
|
||||
UINT8 color1 = (nextCard & STIC_CSQM_B) >> 3;
|
||||
UINT8 color2 = (nextCard & STIC_CSQM_C) >> 6;
|
||||
UINT8 color3 = ((nextCard & STIC_CSQM_D2) >> 11) |
|
||||
((nextCard & (STIC_CSQM_D10)) >> 9);
|
||||
render_colored_squares(machine, bitmap, nextx, nexty,
|
||||
render_colored_squares(bitmap, nextx, nexty,
|
||||
(color0 == 7 ? csColor : (color0 | FOREGROUND_BIT)),
|
||||
(color1 == 7 ? csColor : (color1 | FOREGROUND_BIT)),
|
||||
(color2 == 7 ? csColor : (color2 | FOREGROUND_BIT)),
|
||||
@ -279,7 +272,7 @@ static void render_color_stack_mode(running_machine &machine, bitmap_ind16 &bitm
|
||||
|
||||
fgcolor = ((nextCard & STIC_CSTM_FG3) >> 9) |
|
||||
(nextCard & (STIC_CSTM_FG20)) | FOREGROUND_BIT;
|
||||
bgcolor = state->m_stic_registers[STIC_CSR + csPtr] & STIC_CSR_BG;
|
||||
bgcolor = m_stic_registers[STIC_CSR + csPtr] & STIC_CSR_BG;
|
||||
|
||||
isGrom = !(nextCard & STIC_CSTM_SEL);
|
||||
if (isGrom)
|
||||
@ -287,15 +280,15 @@ static void render_color_stack_mode(running_machine &machine, bitmap_ind16 &bitm
|
||||
memoryLocation = 0x3000 + (nextCard & STIC_CSTM_C);
|
||||
memory = ram;
|
||||
for (j = 0; j < STIC_CARD_HEIGHT; j++)
|
||||
render_line(machine, bitmap, memory[(memoryLocation + j) * 2],
|
||||
render_line(bitmap, memory[(memoryLocation + j) * 2],
|
||||
nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
memoryLocation = (nextCard & STIC_CSTM_C50);
|
||||
memory = state->m_gram;
|
||||
memory = m_gram;
|
||||
for (j = 0; j < STIC_CARD_HEIGHT; j++)
|
||||
render_line(machine, bitmap, memory[memoryLocation + j],
|
||||
render_line(bitmap, memory[memoryLocation + j],
|
||||
nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor);
|
||||
}
|
||||
}
|
||||
@ -303,24 +296,23 @@ static void render_color_stack_mode(running_machine &machine, bitmap_ind16 &bitm
|
||||
}
|
||||
}
|
||||
|
||||
static void render_fg_bg_mode(running_machine &machine, bitmap_ind16 &bitmap)
|
||||
void intv_state::render_fg_bg_mode(bitmap_ind16 &bitmap)
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
INT16 w, h, nextx, nexty;
|
||||
UINT8 j, isGrom, fgcolor, bgcolor;
|
||||
UINT16 nextCard, memoryLocation;
|
||||
UINT8* memory;
|
||||
UINT8* ram = state->memregion("maincpu")->base();
|
||||
UINT8* ram = m_region_maincpu->base();
|
||||
|
||||
for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE;
|
||||
for (h = 0, nexty = (STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE;
|
||||
h < STIC_BACKTAB_HEIGHT;
|
||||
h++, nexty += STIC_CARD_HEIGHT * STIC_Y_SCALE)
|
||||
{
|
||||
for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE;
|
||||
for (w = 0, nextx = (STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE;
|
||||
w < STIC_BACKTAB_WIDTH;
|
||||
w++, nextx += STIC_CARD_WIDTH * STIC_X_SCALE)
|
||||
{
|
||||
nextCard = state->m_backtab_buffer[h][w];
|
||||
nextCard = m_backtab_buffer[h][w];
|
||||
fgcolor = (nextCard & STIC_FBM_FG) | FOREGROUND_BIT;
|
||||
bgcolor = ((nextCard & STIC_FBM_BG2) >> 11) |
|
||||
((nextCard & STIC_FBM_BG310) >> 9);
|
||||
@ -331,24 +323,23 @@ static void render_fg_bg_mode(running_machine &machine, bitmap_ind16 &bitmap)
|
||||
memoryLocation = 0x3000 + (nextCard & STIC_FBM_C);
|
||||
memory = ram;
|
||||
for (j = 0; j < STIC_CARD_HEIGHT; j++)
|
||||
render_line(machine, bitmap, memory[(memoryLocation + j) * 2],
|
||||
render_line(bitmap, memory[(memoryLocation + j) * 2],
|
||||
nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor);
|
||||
}
|
||||
else
|
||||
{
|
||||
memoryLocation = (nextCard & STIC_FBM_C);
|
||||
memory = state->m_gram;
|
||||
memory = m_gram;
|
||||
for (j = 0; j < STIC_CARD_HEIGHT; j++)
|
||||
render_line(machine, bitmap, memory[memoryLocation + j],
|
||||
render_line(bitmap, memory[memoryLocation + j],
|
||||
nextx, nexty + j * STIC_Y_SCALE, fgcolor, bgcolor);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void copy_sprites_to_background(running_machine &machine, bitmap_ind16 &bitmap)
|
||||
void intv_state::copy_sprites_to_background(bitmap_ind16 &bitmap)
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
UINT8 width, currentPixel;
|
||||
UINT8 borderCollision, foregroundCollision;
|
||||
UINT8 spritePixelHeight, x, y;
|
||||
@ -358,7 +349,7 @@ static void copy_sprites_to_background(running_machine &machine, bitmap_ind16 &b
|
||||
|
||||
for (i = STIC_MOBS - 1; i >= 0; i--)
|
||||
{
|
||||
intv_sprite_type *s = &state->m_sprite[i];
|
||||
intv_sprite_type *s = &m_sprite[i];
|
||||
if (s->xpos == 0 || (!s->coll && !s->visible))
|
||||
continue;
|
||||
|
||||
@ -368,12 +359,12 @@ static void copy_sprites_to_background(running_machine &machine, bitmap_ind16 &b
|
||||
spritePixelHeight = (s->quady ? 4 : 1) * (s->doubley ? 2 : 1) * (s->doubleyres ? 2 : 1) * STIC_CARD_HEIGHT;
|
||||
width = (s->doublex ? 2 : 1) * STIC_CARD_WIDTH;
|
||||
|
||||
leftX = (s->xpos - STIC_CARD_WIDTH + STIC_OVERSCAN_LEFT_WIDTH + state->m_col_delay) * STIC_X_SCALE;
|
||||
nextY = (s->ypos - STIC_CARD_HEIGHT + STIC_OVERSCAN_TOP_HEIGHT + state->m_row_delay) * STIC_Y_SCALE;
|
||||
leftX = (s->xpos - STIC_CARD_WIDTH + STIC_OVERSCAN_LEFT_WIDTH + m_col_delay) * STIC_X_SCALE;
|
||||
nextY = (s->ypos - STIC_CARD_HEIGHT + STIC_OVERSCAN_TOP_HEIGHT + m_row_delay) * STIC_Y_SCALE;
|
||||
|
||||
leftBorder = (STIC_OVERSCAN_LEFT_WIDTH + (state->m_left_edge_inhibit ? STIC_CARD_WIDTH : 0)) * STIC_X_SCALE;
|
||||
leftBorder = (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : 0)) * STIC_X_SCALE;
|
||||
rightBorder = (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 - 1) * STIC_X_SCALE;
|
||||
topBorder = (STIC_OVERSCAN_TOP_HEIGHT + (state->m_top_edge_inhibit ? STIC_CARD_HEIGHT : 0)) * STIC_Y_SCALE;
|
||||
topBorder = (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : 0)) * STIC_Y_SCALE;
|
||||
bottomBorder = (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE - 1;
|
||||
|
||||
for (y = 0; y < spritePixelHeight; y++)
|
||||
@ -381,7 +372,7 @@ static void copy_sprites_to_background(running_machine &machine, bitmap_ind16 &b
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
//if this sprite pixel is not on, then don't paint it
|
||||
if (!state->m_sprite_buffers[i][x][y])
|
||||
if (!m_sprite_buffers[i][x][y])
|
||||
continue;
|
||||
|
||||
nextX = leftX + x;
|
||||
@ -394,7 +385,7 @@ static void copy_sprites_to_background(running_machine &machine, bitmap_ind16 &b
|
||||
continue;
|
||||
}
|
||||
|
||||
currentPixel = intv_get_pixel(state, bitmap, nextX, nextY);
|
||||
currentPixel = intv_get_pixel(bitmap, nextX, nextY);
|
||||
|
||||
//check for foreground collision
|
||||
if (currentPixel & FOREGROUND_BIT)
|
||||
@ -406,7 +397,7 @@ static void copy_sprites_to_background(running_machine &machine, bitmap_ind16 &b
|
||||
|
||||
if (s->visible)
|
||||
{
|
||||
intv_set_pixel(state, bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT));
|
||||
intv_set_pixel(bitmap, nextX, nextY, s->color | (currentPixel & FOREGROUND_BIT));
|
||||
}
|
||||
}
|
||||
nextY++;
|
||||
@ -423,13 +414,12 @@ static void copy_sprites_to_background(running_machine &machine, bitmap_ind16 &b
|
||||
}
|
||||
}
|
||||
|
||||
static void render_background(running_machine &machine, bitmap_ind16 &bitmap)
|
||||
void intv_state::render_background(bitmap_ind16 &bitmap)
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
if (state->m_color_stack_mode)
|
||||
render_color_stack_mode(machine, bitmap);
|
||||
if (m_color_stack_mode)
|
||||
render_color_stack_mode(bitmap);
|
||||
else
|
||||
render_fg_bg_mode(machine, bitmap);
|
||||
render_fg_bg_mode(bitmap);
|
||||
}
|
||||
|
||||
#ifdef UNUSED_CODE
|
||||
@ -478,10 +468,10 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
|
||||
if (colorb == 7) colorb = state->m_stic_registers[STIC_CSR + STIC_CSR3];
|
||||
if (colorc == 7) colorc = state->m_stic_registers[STIC_CSR + STIC_CSR3];
|
||||
if (colord == 7) colord = state->m_stic_registers[STIC_CSR + STIC_CSR3];
|
||||
intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora);
|
||||
intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb);
|
||||
intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc);
|
||||
intv_plot_box(state, bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colord);
|
||||
intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colora);
|
||||
intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH)) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorb);
|
||||
intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colorc);
|
||||
intv_plot_box(bitmap, (x0 + col * STIC_CARD_WIDTH + STIC_CSQM_WIDTH) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + STIC_CSQM_HEIGHT) * STIC_Y_SCALE, STIC_CSQM_WIDTH * STIC_X_SCALE, STIC_CSQM_HEIGHT * STIC_Y_SCALE, colord);
|
||||
}
|
||||
else // normal color stack mode
|
||||
{
|
||||
@ -519,7 +509,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
|
||||
|
||||
for(j=0;j<8;j++)
|
||||
{
|
||||
//intv_set_pixel(state, bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 1);
|
||||
//intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 1);
|
||||
}
|
||||
|
||||
}
|
||||
@ -533,7 +523,7 @@ static void draw_background(running_machine &machine, bitmap_ind16 &bitmap, int
|
||||
|
||||
for(j=0;j<8;j++)
|
||||
{
|
||||
//intv_set_pixel(state, bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 2);
|
||||
//intv_set_pixel(bitmap, (x0 + col * STIC_CARD_WIDTH + j) * STIC_X_SCALE, (y0 + row * STIC_CARD_HEIGHT + 7) * STIC_Y_SCALE + 1, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -685,41 +675,38 @@ static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, int beh
|
||||
}
|
||||
#endif
|
||||
|
||||
static void draw_borders(running_machine &machine, bitmap_ind16 &bm)
|
||||
void intv_state::draw_borders(bitmap_ind16 &bm)
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
intv_plot_box(bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + (m_left_edge_inhibit ? STIC_CARD_WIDTH : m_col_delay)) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color);
|
||||
intv_plot_box(bm, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1) * STIC_X_SCALE, 0, STIC_OVERSCAN_RIGHT_WIDTH, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, m_border_color);
|
||||
|
||||
intv_plot_box(state, bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + (state->m_left_edge_inhibit ? STIC_CARD_WIDTH : state->m_col_delay)) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, state->m_border_color);
|
||||
intv_plot_box(state, bm, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1) * STIC_X_SCALE, 0, STIC_OVERSCAN_RIGHT_WIDTH, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT + STIC_OVERSCAN_BOTTOM_HEIGHT) * STIC_Y_SCALE, state->m_border_color);
|
||||
|
||||
intv_plot_box(state, bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + (state->m_top_edge_inhibit ? STIC_CARD_HEIGHT : state->m_row_delay)) * STIC_Y_SCALE, state->m_border_color);
|
||||
intv_plot_box(state, bm, 0, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT * STIC_Y_SCALE, state->m_border_color);
|
||||
intv_plot_box(bm, 0, 0, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, (STIC_OVERSCAN_TOP_HEIGHT + (m_top_edge_inhibit ? STIC_CARD_HEIGHT : m_row_delay)) * STIC_Y_SCALE, m_border_color);
|
||||
intv_plot_box(bm, 0, (STIC_OVERSCAN_TOP_HEIGHT + STIC_BACKTAB_HEIGHT * STIC_CARD_HEIGHT) * STIC_Y_SCALE, (STIC_OVERSCAN_LEFT_WIDTH + STIC_BACKTAB_WIDTH * STIC_CARD_WIDTH - 1 + STIC_OVERSCAN_RIGHT_WIDTH) * STIC_X_SCALE, STIC_OVERSCAN_BOTTOM_HEIGHT * STIC_Y_SCALE, m_border_color);
|
||||
}
|
||||
|
||||
void intv_stic_screenrefresh(running_machine &machine)
|
||||
void intv_state::intv_stic_screenrefresh()
|
||||
{
|
||||
intv_state *state = machine.driver_data<intv_state>();
|
||||
int i;
|
||||
|
||||
if (state->m_stic_handshake != 0)
|
||||
if (m_stic_handshake != 0)
|
||||
{
|
||||
state->m_stic_handshake = 0;
|
||||
m_stic_handshake = 0;
|
||||
// Render the background
|
||||
render_background(machine, state->m_bitmap);
|
||||
render_background(m_bitmap);
|
||||
// Render the sprites into their buffers
|
||||
render_sprites(machine);
|
||||
for (i = 0; i < STIC_MOBS; i++) state->m_sprite[i].collision = 0;
|
||||
render_sprites();
|
||||
for (i = 0; i < STIC_MOBS; i++) m_sprite[i].collision = 0;
|
||||
// Copy the sprites to the background
|
||||
copy_sprites_to_background(machine, state->m_bitmap);
|
||||
determine_sprite_collisions(state);
|
||||
for (i = 0; i < STIC_MOBS; i++) state->m_stic_registers[STIC_MCR + i] |= state->m_sprite[i].collision;
|
||||
copy_sprites_to_background(m_bitmap);
|
||||
determine_sprite_collisions();
|
||||
for (i = 0; i < STIC_MOBS; i++) m_stic_registers[STIC_MCR + i] |= m_sprite[i].collision;
|
||||
/* draw the screen borders if enabled */
|
||||
draw_borders(machine, state->m_bitmap);
|
||||
draw_borders(m_bitmap);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* STIC disabled, just fill with border color */
|
||||
state->m_bitmap.fill(SET_COLOR(state->m_border_color));
|
||||
m_bitmap.fill(SET_COLOR(m_border_color));
|
||||
}
|
||||
}
|
||||
|
||||
@ -729,7 +716,6 @@ void intv_stic_screenrefresh(running_machine &machine)
|
||||
|
||||
READ8_MEMBER( intv_state::intvkbd_tms9927_r )
|
||||
{
|
||||
//intv_state *state = space.machine().driver_data<intv_state>();
|
||||
UINT8 rv;
|
||||
switch (offset)
|
||||
{
|
||||
@ -752,7 +738,6 @@ void intv_stic_screenrefresh(running_machine &machine)
|
||||
|
||||
WRITE8_MEMBER( intv_state::intvkbd_tms9927_w )
|
||||
{
|
||||
//intv_state *state = space.machine().driver_data<intv_state>();
|
||||
switch (offset)
|
||||
{
|
||||
case 3:
|
||||
|
Loading…
Reference in New Issue
Block a user