mirror of
https://github.com/holub/mame
synced 2025-04-24 01:11:11 +03:00
crt9007: Save state (nw)
This commit is contained in:
parent
7860c918a3
commit
00579c63a3
@ -274,7 +274,7 @@ inline void crt9007_device::update_cblank_line()
|
||||
int y = screen().vpos();
|
||||
|
||||
// composite blank
|
||||
int cblank = !(m_hs & m_vs);
|
||||
bool cblank = !(m_hs && m_vs);
|
||||
|
||||
if (m_cblank != cblank)
|
||||
{
|
||||
@ -291,7 +291,7 @@ inline void crt9007_device::update_cblank_line()
|
||||
// update_hsync_timer -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void crt9007_device::update_hsync_timer(int state)
|
||||
inline void crt9007_device::update_hsync_timer(bool state)
|
||||
{
|
||||
int y = screen().vpos();
|
||||
|
||||
@ -308,7 +308,7 @@ inline void crt9007_device::update_hsync_timer(int state)
|
||||
// update_vsync_timer -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void crt9007_device::update_vsync_timer(int state)
|
||||
inline void crt9007_device::update_vsync_timer(bool state)
|
||||
{
|
||||
int next_y = state ? m_vsync_start : m_vsync_end;
|
||||
|
||||
@ -322,7 +322,7 @@ inline void crt9007_device::update_vsync_timer(int state)
|
||||
// update_vlt_timer -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void crt9007_device::update_vlt_timer(int state)
|
||||
inline void crt9007_device::update_vlt_timer(bool state)
|
||||
{
|
||||
// this signal is active during all visible scan lines and during the horizontal trace at vertical retrace
|
||||
int y = screen().vpos();
|
||||
@ -340,7 +340,7 @@ inline void crt9007_device::update_vlt_timer(int state)
|
||||
// update_curs_timer -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void crt9007_device::update_curs_timer(int state)
|
||||
inline void crt9007_device::update_curs_timer(bool state)
|
||||
{
|
||||
// this signal is active for 1 character time for all scanlines within the data row
|
||||
// TODO
|
||||
@ -351,7 +351,7 @@ inline void crt9007_device::update_curs_timer(int state)
|
||||
// update_drb_timer -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void crt9007_device::update_drb_timer(int state)
|
||||
inline void crt9007_device::update_drb_timer(bool state)
|
||||
{
|
||||
// this signal is active for 1 full scan line (VLT edge to edge) at the top scan line of each new row
|
||||
// there is 1 extra DRB signal during the 1st scanline of the vertical retrace interval
|
||||
@ -473,19 +473,13 @@ crt9007_device::crt9007_device(const machine_config &mconfig, const char *tag, d
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
// device_resolve_objects - resolve objects that
|
||||
// may be needed for other devices to set
|
||||
// initial conditions at start time
|
||||
//-------------------------------------------------
|
||||
|
||||
void crt9007_device::device_start()
|
||||
void crt9007_device::device_resolve_objects()
|
||||
{
|
||||
// allocate timers
|
||||
m_hsync_timer = timer_alloc(TIMER_HSYNC);
|
||||
m_vsync_timer = timer_alloc(TIMER_VSYNC);
|
||||
m_vlt_timer = timer_alloc(TIMER_VLT);
|
||||
m_curs_timer = timer_alloc(TIMER_CURS);
|
||||
m_drb_timer = timer_alloc(TIMER_DRB);
|
||||
m_dma_timer = timer_alloc(TIMER_DMA);
|
||||
|
||||
// resolve callbacks
|
||||
m_write_int.resolve_safe();
|
||||
m_write_dmar.resolve_safe();
|
||||
@ -501,20 +495,49 @@ void crt9007_device::device_start()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_start - device-specific startup
|
||||
//-------------------------------------------------
|
||||
|
||||
void crt9007_device::device_start()
|
||||
{
|
||||
// allocate timers
|
||||
m_hsync_timer = timer_alloc(TIMER_HSYNC);
|
||||
m_vsync_timer = timer_alloc(TIMER_VSYNC);
|
||||
m_vlt_timer = timer_alloc(TIMER_VLT);
|
||||
m_curs_timer = timer_alloc(TIMER_CURS);
|
||||
m_drb_timer = timer_alloc(TIMER_DRB);
|
||||
m_dma_timer = timer_alloc(TIMER_DMA);
|
||||
|
||||
// save state
|
||||
save_item(NAME(m_reg));
|
||||
save_item(NAME(m_status));
|
||||
save_item(NAME(m_hpixels_per_column));
|
||||
save_item(NAME(m_disp));
|
||||
save_item(NAME(m_hs));
|
||||
save_item(NAME(m_vs));
|
||||
save_item(NAME(m_cblank));
|
||||
save_item(NAME(m_vlt));
|
||||
save_item(NAME(m_drb));
|
||||
save_item(NAME(m_lpstb));
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void crt9007_device::device_reset()
|
||||
{
|
||||
m_disp = 0;
|
||||
m_vs = 0;
|
||||
m_cblank = 0;
|
||||
m_disp = false;
|
||||
m_cblank = false;
|
||||
|
||||
// HS = 1
|
||||
m_hs = true;
|
||||
m_write_hs(1);
|
||||
|
||||
// VS = 1
|
||||
m_vs = true;
|
||||
m_write_vs(1);
|
||||
|
||||
// CBLANK = 1
|
||||
@ -548,6 +571,18 @@ void crt9007_device::device_reset()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_post_load - called after the loading a
|
||||
// saved state, so that registered variables can
|
||||
// be expanded as necessary
|
||||
//-------------------------------------------------
|
||||
|
||||
void crt9007_device::device_post_load()
|
||||
{
|
||||
recompute_parameters();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_clock_changed - handle clock change
|
||||
//-------------------------------------------------
|
||||
@ -570,7 +605,7 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_HSYNC:
|
||||
m_hs = param;
|
||||
m_hs = bool(param);
|
||||
|
||||
LOG("CRT9007 y %03u x %04u : HS %u\n", y, x, m_hs);
|
||||
|
||||
@ -578,15 +613,15 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
|
||||
update_cblank_line();
|
||||
|
||||
update_hsync_timer(param);
|
||||
update_hsync_timer(m_hs);
|
||||
break;
|
||||
|
||||
case TIMER_VSYNC:
|
||||
m_vs = param;
|
||||
m_vs = bool(param);
|
||||
|
||||
LOG("CRT9007 y %03u x %04u : VS %u\n", y, x, m_vs);
|
||||
|
||||
m_write_vs(param);
|
||||
m_write_vs(m_vs);
|
||||
|
||||
if (m_vs)
|
||||
{
|
||||
@ -600,17 +635,17 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
update_cblank_line();
|
||||
}
|
||||
|
||||
update_vsync_timer(param);
|
||||
update_vsync_timer(m_vs);
|
||||
break;
|
||||
|
||||
case TIMER_VLT:
|
||||
m_vlt = param;
|
||||
m_vlt = bool(param);
|
||||
|
||||
LOG("CRT9007 y %03u x %04u : VLT %u\n", y, x, m_vlt);
|
||||
|
||||
m_write_vlt(param);
|
||||
m_write_vlt(m_vlt);
|
||||
|
||||
update_vlt_timer(param);
|
||||
update_vlt_timer(m_vlt);
|
||||
break;
|
||||
|
||||
case TIMER_CURS:
|
||||
@ -622,11 +657,11 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
break;
|
||||
|
||||
case TIMER_DRB:
|
||||
m_drb = param;
|
||||
m_drb = bool(param);
|
||||
|
||||
LOG("CRT9007 y %03u x %04u : DRB %u\n", y, x, m_drb);
|
||||
|
||||
m_write_drb(param);
|
||||
m_write_drb(m_drb);
|
||||
|
||||
if (!m_drb && !DMA_DISABLE)
|
||||
{
|
||||
@ -640,7 +675,7 @@ void crt9007_device::device_timer(emu_timer &timer, device_timer_id id, int para
|
||||
m_write_dmar(ASSERT_LINE);
|
||||
}
|
||||
|
||||
update_drb_timer(param);
|
||||
update_drb_timer(m_drb);
|
||||
break;
|
||||
|
||||
case TIMER_DMA:
|
||||
@ -676,13 +711,19 @@ READ8_MEMBER( crt9007_device::read )
|
||||
switch (offset)
|
||||
{
|
||||
case 0x15:
|
||||
LOG("CRT9007 Start\n");
|
||||
m_disp = 1;
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
LOG("CRT9007 Start\n");
|
||||
m_disp = true;
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x16:
|
||||
LOG("CRT9007 Reset\n");
|
||||
device_reset();
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
LOG("CRT9007 Reset\n");
|
||||
device_reset();
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x38:
|
||||
@ -696,10 +737,13 @@ READ8_MEMBER( crt9007_device::read )
|
||||
case 0x3a:
|
||||
data = m_status;
|
||||
|
||||
// reset interrupt pending bit
|
||||
m_status &= ~STATUS_INTERRUPT_PENDING;
|
||||
LOG("CRT9007 INT 0\n");
|
||||
m_write_int(CLEAR_LINE);
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
// reset interrupt pending bit
|
||||
m_status &= ~STATUS_INTERRUPT_PENDING;
|
||||
LOG("CRT9007 INT 0\n");
|
||||
m_write_int(CLEAR_LINE);
|
||||
}
|
||||
break;
|
||||
|
||||
case 0x3b:
|
||||
@ -709,12 +753,16 @@ READ8_MEMBER( crt9007_device::read )
|
||||
case 0x3c:
|
||||
data = HORIZONTAL_LIGHT_PEN;
|
||||
|
||||
// reset light pen update bit
|
||||
m_status &= ~STATUS_LIGHT_PEN_UPDATE;
|
||||
if (!machine().side_effects_disabled())
|
||||
{
|
||||
// reset light pen update bit
|
||||
m_status &= ~STATUS_LIGHT_PEN_UPDATE;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
logerror("CRT9007 Read from Invalid Register: %02x!\n", offset);
|
||||
if (!machine().side_effects_disabled())
|
||||
logerror("CRT9007 Read from Invalid Register: %02x!\n", offset);
|
||||
}
|
||||
|
||||
return data;
|
||||
@ -834,7 +882,7 @@ WRITE8_MEMBER( crt9007_device::write )
|
||||
|
||||
case 0x15:
|
||||
LOG("CRT9007 Start\n");
|
||||
m_disp = 1;
|
||||
m_disp = true;
|
||||
break;
|
||||
|
||||
case 0x16:
|
||||
@ -898,7 +946,7 @@ WRITE_LINE_MEMBER( crt9007_device::lpstb_w )
|
||||
// TODO latch current row/column position
|
||||
}
|
||||
|
||||
m_lpstb = state;
|
||||
m_lpstb = bool(state);
|
||||
}
|
||||
|
||||
|
||||
@ -906,7 +954,7 @@ WRITE_LINE_MEMBER( crt9007_device::lpstb_w )
|
||||
// set_character_width -
|
||||
//-------------------------------------------------
|
||||
|
||||
void crt9007_device::set_character_width(int value)
|
||||
void crt9007_device::set_character_width(unsigned value)
|
||||
{
|
||||
m_hpixels_per_column = value;
|
||||
|
||||
|
@ -93,7 +93,7 @@ public:
|
||||
// construction/destruction
|
||||
crt9007_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
void config_set_character_width(int value) { m_hpixels_per_column = value; }
|
||||
void config_set_character_width(unsigned value) { m_hpixels_per_column = value; }
|
||||
|
||||
template <class Object> devcb_base &set_int_wr_callback(Object &&cb) { return m_write_int.set_callback(std::forward<Object>(cb)); }
|
||||
template <class Object> devcb_base &set_dmar_wr_callback(Object &&cb) { return m_write_dmar.set_callback(std::forward<Object>(cb)); }
|
||||
@ -110,15 +110,17 @@ public:
|
||||
DECLARE_READ8_MEMBER( read );
|
||||
DECLARE_WRITE8_MEMBER( write );
|
||||
|
||||
void set_character_width(int value);
|
||||
void set_character_width(unsigned value);
|
||||
|
||||
DECLARE_WRITE_LINE_MEMBER( ack_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( lpstb_w );
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_resolve_objects() override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_post_load() override;
|
||||
virtual void device_clock_changed() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
|
||||
|
||||
@ -142,11 +144,11 @@ private:
|
||||
|
||||
inline void trigger_interrupt(int line);
|
||||
inline void update_cblank_line();
|
||||
inline void update_hsync_timer(int state);
|
||||
inline void update_vsync_timer(int state);
|
||||
inline void update_vlt_timer(int state);
|
||||
inline void update_curs_timer(int state);
|
||||
inline void update_drb_timer(int state);
|
||||
inline void update_hsync_timer(bool state);
|
||||
inline void update_vsync_timer(bool state);
|
||||
inline void update_vlt_timer(bool state);
|
||||
inline void update_curs_timer(bool state);
|
||||
inline void update_drb_timer(bool state);
|
||||
inline void update_dma_timer();
|
||||
|
||||
inline void recompute_parameters();
|
||||
@ -170,8 +172,16 @@ private:
|
||||
uint8_t m_reg[0x3d];
|
||||
uint8_t m_status;
|
||||
|
||||
int m_disp;
|
||||
int m_hpixels_per_column;
|
||||
uint8_t m_hpixels_per_column;
|
||||
|
||||
// booleans
|
||||
bool m_disp;
|
||||
bool m_hs;
|
||||
bool m_vs;
|
||||
bool m_cblank;
|
||||
bool m_vlt;
|
||||
bool m_drb;
|
||||
bool m_lpstb;
|
||||
|
||||
// runtime variables, do not state save
|
||||
int m_vsync_start;
|
||||
@ -182,15 +192,9 @@ private:
|
||||
int m_vlt_end;
|
||||
int m_vlt_bottom;
|
||||
int m_drb_bottom;
|
||||
int m_hs;
|
||||
int m_vs;
|
||||
int m_cblank;
|
||||
int m_vlt;
|
||||
int m_drb;
|
||||
//int m_wben;
|
||||
//int m_slg;
|
||||
//int m_sld;
|
||||
int m_lpstb;
|
||||
|
||||
// DMA
|
||||
int m_dmar;
|
||||
|
Loading…
Reference in New Issue
Block a user