Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/devices/cpu/i960/i960.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2411,6 +2411,8 @@ void i960_cpu_device::device_reset()
m_r[I960_FP] = m_program.read_dword(m_PRCB+24);
m_r[I960_SP] = m_r[I960_FP] + 64;
m_rcache_pos = 0;

m_stall_state.burst_mode = false;
}

std::unique_ptr<util::disasm_interface> i960_cpu_device::create_disassembler()
Expand Down
38 changes: 14 additions & 24 deletions src/mame/sega/model2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@

TODO (per-game issues)
- doa, doaa: corrupted sound, eventually becomes silent;
- dynamcopc: corrupts palette for 2d;
- hpyagu98: stops with 'Error #1' message during boot.
Also writes to the 0x600000-0x62ffff range in main CPU program map;
- lastbrnx: uses external DMA port 0 for uploading SHARC program, hook-up might not be 100% right;
Expand Down Expand Up @@ -159,6 +158,8 @@ void model2_state::machine_start()
save_item(NAME(m_timerrun[1]));
save_item(NAME(m_timerrun[2]));
save_item(NAME(m_timerrun[3]));
save_item(NAME(m_videocontrol));
save_item(NAME(m_framenum));

save_item(NAME(m_geo_write_start_address));
save_item(NAME(m_geo_read_start_address));
Expand Down Expand Up @@ -352,35 +353,19 @@ u16 model2_state::colorxlat_r(offs_t offset)
return m_colorxlat[offset];
}

// Apparently original Model 2 doesn't have fifo control?
u32 model2o_state::fifo_control_2o_r()
u32 model2_state::fifo_control_r()
{
return 0xffffffff;
}

u32 model2_state::fifo_control_2a_r()
{
u32 r = 0;

if (m_copro_fifo_out->is_empty())
{
r |= 1;
}

// #### 1 if fifo empty, zerogun needs | 0x04 set
// TODO: 0x04 is probably fifo full, zeroguna stalls with a fresh nvram with that enabled?
return r;
// return r | 0x04;
return m_copro_fifo_out->is_empty() ? 1 : 0;
}

u32 model2_state::videoctl_r()
{
u8 framenum;

if(m_render_mode == false)
framenum = (m_screen->frame_number() & 2) << 1;
framenum = (m_framenum & 2) << 1;
else
framenum = (m_screen->frame_number() & 1) << 2;
framenum = (m_framenum & 1) << 2;

return (framenum) | (m_videocontrol & 3);
}
Expand Down Expand Up @@ -1075,7 +1060,7 @@ void model2_state::model2_base_mem(address_map &map)

map(0x00900000, 0x0091ffff).mirror(0x60000).ram().share("bufferram").flags(i960_cpu_device::BURST);

map(0x00980004, 0x00980007).r(FUNC(model2_state::fifo_control_2a_r));
map(0x00980004, 0x00980007).r(FUNC(model2_state::fifo_control_r));
map(0x0098000c, 0x0098000f).rw(FUNC(model2_state::videoctl_r), FUNC(model2_state::videoctl_w));
map(0x00980030, 0x0098003f).r(FUNC(model2_state::tgpid_r));

Expand Down Expand Up @@ -1264,7 +1249,6 @@ void model2o_state::model2o_mem(address_map &map)

map(0x00200000, 0x0021ffff).ram().flags(i960_cpu_device::BURST);
map(0x00220000, 0x0023ffff).rom().region("maincpu", 0x20000).flags(i960_cpu_device::BURST);
map(0x00980004, 0x00980007).r(FUNC(model2o_state::fifo_control_2o_r));
map(0x01c00000, 0x01c00fff).rw("dpram", FUNC(mb8421_device::right_r), FUNC(mb8421_device::right_w)).umask32(0x00ff00ff); // 2k*8-bit dual port ram
map(0x01c80000, 0x01c80003).rw(m_uart, FUNC(i8251_device::read), FUNC(i8251_device::write)).umask16(0x00ff);
}
Expand Down Expand Up @@ -2411,6 +2395,12 @@ TIMER_DEVICE_CALLBACK_MEMBER(model2_state::model2_interrupt)

if(scanline == 384)
{
m_framenum = m_screen->frame_number();

// if 60 Hz mode or frame number is even, trigger geometrizer to start new frame
if ((m_videocontrol & 1) == 0 || (m_framenum & 1) == 0)
geo_parse();

const u32 line = 1 << 0;
if (m_intena & line)
{
Expand Down Expand Up @@ -2502,7 +2492,7 @@ void model2_state::model2_screen(machine_config &config)
m_screen->set_video_attributes(VIDEO_UPDATE_AFTER_VBLANK);
// TODO: from System 24, might not be accurate for Model 2
m_screen->set_raw(VIDEO_CLOCK/2, 656, 0/*+69*/, 496/*+69*/, 424, 0/*+25*/, 384/*+25*/);
m_screen->set_screen_update(FUNC(model2_state::screen_update_model2));
m_screen->set_screen_update(FUNC(model2_state::screen_update));

PALETTE(config, m_palette).set_entries(8192);
}
Expand Down
23 changes: 12 additions & 11 deletions src/mame/sega/model2.h
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ class model2_state : public driver_device
void colorxlat_w(offs_t offset, u16 data, u16 mem_mask = ~0);
void eeprom_w(u8 data);
u8 in0_r();
u32 fifo_control_2a_r();
u32 fifo_control_r();
u32 videoctl_r();
void videoctl_w(offs_t offset, u32 data, u32 mem_mask = ~0);
u8 rchase2_drive_board_r();
Expand Down Expand Up @@ -220,15 +220,15 @@ class model2_state : public driver_device
void driveio_port_w(u8 data);
void push_geo_data(u32 data);
void reset_model2_scsp();
u32 screen_update_model2(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
// void screen_vblank_model2(int state);
u32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect);
// void screen_vblank(int state);
void sound_ready_w(int state);
template <int TNum> TIMER_DEVICE_CALLBACK_MEMBER(model2_timer_cb);
void scsp_irq(offs_t offset, u8 data);

void model2_3d_frame_start();
void render_frame_start();
void geo_parse();
void model2_3d_frame_end( bitmap_rgb32 &bitmap, const rectangle &cliprect );
void render_polygons( bitmap_rgb32 &bitmap, const rectangle &cliprect );
void draw_framebuffer(bitmap_rgb32 &bitmap, const rectangle &cliprect );

void model2_timers(machine_config &config);
Expand Down Expand Up @@ -268,10 +268,12 @@ class model2_state : public driver_device
u32 m_geoctl = 0;
u32 m_geocnt = 0;
u32 m_videocontrol = 0;
u32 m_framenum = 0;

bool m_render_unk = false;
bool m_render_mode = false;
bool m_render_test_mode = false;
bool m_render_done = false;
int16_t m_crtc_xoffset = 0, m_crtc_yoffset = 0;
bool m_palette_dirty = false;

Expand Down Expand Up @@ -307,13 +309,13 @@ class model2_state : public driver_device
// raster functions
// main data input port
void model2_3d_push( raster_state *raster, u32 input );
// quad & triangle push paths
void model2_3d_process_quad( raster_state *raster, u32 attr );
void model2_3d_process_triangle( raster_state *raster, u32 attr );
// polygon push path
template <unsigned NumVerts>
void model2_3d_process_polygon( raster_state *raster, u32 attr );

// inliners
inline void model2_3d_project( triangle *tri );
inline u16 float_to_zval( float floatval );
inline u16 float_to_zval( float floatval, s32 z_adjust );
inline bool check_culling( raster_state *raster, u32 attr, float min_z, float max_z );
};

Expand Down Expand Up @@ -398,7 +400,6 @@ class model2o_state : public model2_tgp_state
void vcop(machine_config &config);

protected:
u32 fifo_control_2o_r();
void daytona_output_w(u8 data);
void desert_output_w(u8 data);
void vcop_output_w(u8 data);
Expand Down Expand Up @@ -795,7 +796,7 @@ struct model2_state::raster_state
int16_t center[4][2] = { { 0, 0 }, { 0, 0 }, { 0, 0 }, { 0, 0 } }; // Centers (eye 0[x,y],1[x,y],2[x,y],3[x,y])
u16 center_sel = 0; // Selected center
u32 reverse = 0; // Left/Right Reverse
float z_adjust = 0; // ZSort Mode
s32 z_adjust = 0; // ZSort Mode
float triangle_z = 0; // Current Triangle z value
u8 master_z_clip = 0; // Master Z-Clip value
u32 cur_command = 0; // Current command
Expand Down
Loading
Loading