summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/video
diff options
context:
space:
mode:
author hap <happppp@users.noreply.github.com>2020-08-24 11:07:31 +0200
committer hap <happppp@users.noreply.github.com>2020-08-24 11:07:46 +0200
commit8fbe4a8050b47df98b163f7eb6de0ed2310fa824 (patch)
tree0a23b6abf770fd4acc2b65171f1838e1e76cc97f /src/devices/video
parent68ef85836c9f5f57a8abb4c35785dc384d10f76a (diff)
i8244: change pos hold strobe again, add sound interrupt
Diffstat (limited to 'src/devices/video')
-rw-r--r--src/devices/video/i8244.cpp59
-rw-r--r--src/devices/video/i8244.h6
2 files changed, 26 insertions, 39 deletions
diff --git a/src/devices/video/i8244.cpp b/src/devices/video/i8244.cpp
index 6721f43ed2d..2cc49aaf6a8 100644
--- a/src/devices/video/i8244.cpp
+++ b/src/devices/video/i8244.cpp
@@ -140,14 +140,12 @@ void i8244_device::device_start()
save_item(NAME(m_x_beam_pos));
save_item(NAME(m_y_beam_pos));
- save_item(NAME(m_y_latch));
save_item(NAME(m_control_status));
save_item(NAME(m_collision_status));
- save_item(NAME(m_pos_hold));
- save_item(NAME(m_y_hold));
save_item(NAME(m_sh_written));
save_item(NAME(m_sh_pending));
save_item(NAME(m_sh_prescaler));
+ save_item(NAME(m_sh_count));
save_item(NAME(m_sh_output));
save_item(NAME(m_sh_duty));
}
@@ -309,7 +307,7 @@ uint8_t i8244_device::read(offs_t offset)
data |= (h >= 225 && h < m_bgate_start && get_y_beam() <= m_vblank_start) ? 1 : 0;
// position strobe status
- data |= m_pos_hold ? 2 : 0;
+ data |= m_vdc.s.control & 0x02;
m_irq_func(CLEAR_LINE);
m_control_status &= ~0xcc;
@@ -323,34 +321,12 @@ uint8_t i8244_device::read(offs_t offset)
break;
case 0xa4:
- if (m_y_hold)
- {
- data = m_y_latch;
- m_y_hold = false;
- }
- else if (m_pos_hold)
- data = m_y_beam_pos;
- else
- data = get_y_beam();
-
+ data = (m_vdc.s.control & 0x02) ? get_y_beam() : m_y_beam_pos;
break;
case 0xa5:
- {
- if (m_pos_hold)
- {
- data = m_x_beam_pos;
- m_pos_hold = false;
- }
- else
- data = get_x_beam();
-
- // Y is latched when reading X
- m_y_hold = true;
- m_y_latch = get_y_beam();
-
+ data = (m_vdc.s.control & 0x02) ? get_x_beam() : m_x_beam_pos;
break;
- }
default:
data = m_vdc.reg[offset];
@@ -387,15 +363,12 @@ void i8244_device::write(offs_t offset, uint8_t data)
switch (offset)
{
case 0xa0:
- if ((m_vdc.s.control & 0x02) && !(data & 0x02) && !m_pos_hold)
+ if ((m_vdc.s.control & 0x02) && !(data & 0x02))
{
// toggling strobe bit, tuck away values
m_x_beam_pos = get_x_beam();
m_y_beam_pos = get_y_beam();
- m_pos_hold = true;
}
- // note: manual talks about a hblank interrupt on d0, and a sound interrupt on d2,
- // but tests done on 8244 reveal no such features
break;
case 0xa7: case 0xa8: case 0xa9:
@@ -800,19 +773,35 @@ void i8244_device::sound_update()
int feedback = m_sh_output;
signal >>= 1;
- /* Noise tap is on bits 0 and 5 and fed back to bit 15 */
+ // noise tap is on bits 0 and 5 and fed back to bit 15
if (m_vdc.s.sound & 0x10)
{
feedback ^= signal >> 4 & 1; // pre-shift bit 5
signal = (signal & ~0x8000) | (feedback << 15);
}
- /* Loop sound */
+ // loop sound
signal |= feedback << 23;
m_vdc.s.shift3 = signal & 0xFF;
m_vdc.s.shift2 = ( signal >> 8 ) & 0xFF;
m_vdc.s.shift1 = ( signal >> 16 ) & 0xFF;
+
+ // sound interrupt
+ if (++m_sh_count == 24)
+ {
+ m_sh_count = 0;
+ if (m_vdc.s.control & 0x04)
+ {
+ m_control_status |= 0x04;
+ m_irq_func(ASSERT_LINE);
+ }
+ }
+ }
+ else if (m_sh_written)
+ {
+ m_sh_count = 0;
+ m_sh_written = false;
}
- m_sh_written = false;
+
}
diff --git a/src/devices/video/i8244.h b/src/devices/video/i8244.h
index 6ddff5806aa..c46034dd2b4 100644
--- a/src/devices/video/i8244.h
+++ b/src/devices/video/i8244.h
@@ -140,15 +140,13 @@ protected:
uint8_t m_x_beam_pos = 0;
uint8_t m_y_beam_pos = 0;
- uint8_t m_y_latch = 0;
uint8_t m_control_status = 0;
uint8_t m_collision_status = 0;
- bool m_pos_hold = false;
- bool m_y_hold = false;
bool m_sh_written = false;
bool m_sh_pending = false;
- u8 m_sh_prescaler = 0 ;
+ u8 m_sh_prescaler = 0;
+ u8 m_sh_count = 0;
int m_sh_output = 0;
u8 m_sh_duty = 0;
};