summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu/vt50/vt50.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/cpu/vt50/vt50.cpp')
-rw-r--r--src/devices/cpu/vt50/vt50.cpp29
1 files changed, 26 insertions, 3 deletions
diff --git a/src/devices/cpu/vt50/vt50.cpp b/src/devices/cpu/vt50/vt50.cpp
index c4d237b0f2f..346c057ecc9 100644
--- a/src/devices/cpu/vt50/vt50.cpp
+++ b/src/devices/cpu/vt50/vt50.cpp
@@ -20,6 +20,8 @@ vt5x_cpu_device::vt5x_cpu_device(const machine_config &mconfig, device_type type
, m_ram_config("data", ENDIANNESS_LITTLE, 8, 6 + ybits, 0) // actually 7 bits wide
, m_rom_cache(nullptr)
, m_ram_cache(nullptr)
+ , m_baud_9600_callback(*this)
+ , m_vert_count_callback(*this)
, m_uart_rd_callback(*this)
, m_uart_xd_callback(*this)
, m_ur_flag_callback(*this)
@@ -94,6 +96,8 @@ device_memory_interface::space_config_vector vt5x_cpu_device::memory_space_confi
void vt5x_cpu_device::device_resolve_objects()
{
// resolve callbacks
+ m_baud_9600_callback.resolve_safe();
+ m_vert_count_callback.resolve_safe();
m_uart_rd_callback.resolve_safe(0);
m_uart_xd_callback.resolve_safe();
m_ur_flag_callback.resolve_safe(0);
@@ -180,6 +184,9 @@ void vt5x_cpu_device::device_reset()
m_horiz_count = 0;
m_vert_count = 0;
m_top_of_screen = true;
+
+ m_baud_9600_callback(0);
+ m_vert_count_callback(0);
}
offs_t vt5x_cpu_device::translate_xy() const
@@ -376,6 +383,15 @@ void vt5x_cpu_device::execute_tw(u8 inst)
m_done_ff = true;
}
+void vt52_cpu_device::execute_tw(u8 inst)
+{
+ vt5x_cpu_device::execute_tw(inst);
+
+ // ZCAV also borrows from the upper half of AC on the VT52
+ if (inst == 0100)
+ m_ac = (m_ac - 020) & 0177;
+}
+
void vt50_cpu_device::execute_tg(u8 inst)
{
switch (inst & 0362)
@@ -473,12 +489,12 @@ void vt5x_cpu_device::execute_th(u8 inst)
break;
case 0020:
- // M0: TABJ
+ // M0: TABJ (jump on 74H10 NAND of AC0–2; documentation incorrectly suggests the opposite)
// M1: AEMJ
if (m_mode_ff)
m_load_pc = m_ac == m_ram_do;
else
- m_load_pc = (m_ac & 7) == 7;
+ m_load_pc = (m_ac & 7) != 7;
break;
case 0040:
@@ -565,19 +581,26 @@ void vt5x_cpu_device::clock_video_counters()
m_vert_count = m_frq_callback() ? 03000 : 02000;
m_horiz_count = 0;
m_top_of_screen = true;
+ m_vert_count_callback(0);
}
else
{
m_vert_count++;
if (m_horiz_count == 10 * 16)
m_horiz_count = 0;
+ m_vert_count_callback(m_vert_count & 0177);
}
}
else
{
m_horiz_count++;
if (m_horiz_count == 8)
+ {
m_top_of_screen = false;
+ m_baud_9600_callback(0);
+ }
+ else if (m_horiz_count == 4)
+ m_baud_9600_callback(1);
}
}
@@ -606,7 +629,7 @@ void vt5x_cpu_device::execute_run()
if (!m_write_ff)
m_ram_do = m_ram_cache->read_byte(translate_xy()) & 0177;
m_cursor_active = m_ac == (m_x ^ (m_x8 ? 8 : 0));
- if (m_video_process && m_horiz_count >= 2 * 16)
+ if (m_video_process && u8(m_horiz_count - 2) >= 2 * 16)
m_x = (m_x + 1) & 0177;
m_t = 3;
break;