summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/cpu
diff options
context:
space:
mode:
author AJR <ajrhacker@users.noreply.github.com>2019-12-22 23:10:40 -0500
committer AJR <ajrhacker@users.noreply.github.com>2019-12-22 23:16:28 -0500
commit5f6e7a3c6825fef8193b40571ddd48e710286fe0 (patch)
tree6cffbeee527e2ca0b5dba5ad566db16d63f43e26 /src/devices/cpu
parent17b4efe8449262f2b99d718ddbfd4c0ea5c8f61a (diff)
vt52: Many updates (nw)
- Start driving UART from CPU timing chain, implementing most switch-configurable rates but just looping back data for now - Fix TABJ semantics - Add VT52-specific side effect of ZCAV - Add Caps Lock key - Misc. other additions and adjustments
Diffstat (limited to 'src/devices/cpu')
-rw-r--r--src/devices/cpu/vt50/vt50.cpp29
-rw-r--r--src/devices/cpu/vt50/vt50.h7
2 files changed, 32 insertions, 4 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;
diff --git a/src/devices/cpu/vt50/vt50.h b/src/devices/cpu/vt50/vt50.h
index fe46b556f99..206dfe86488 100644
--- a/src/devices/cpu/vt50/vt50.h
+++ b/src/devices/cpu/vt50/vt50.h
@@ -17,6 +17,8 @@ public:
};
// callback configuration
+ auto baud_9600_callback() { return m_baud_9600_callback.bind(); }
+ auto vert_count_callback() { return m_vert_count_callback.bind(); }
auto uart_rd_callback() { return m_uart_rd_callback.bind(); }
auto uart_xd_callback() { return m_uart_xd_callback.bind(); }
auto ur_flag_callback() { return m_ur_flag_callback.bind(); }
@@ -54,8 +56,8 @@ protected:
// execution helpers
void execute_te(u8 inst);
void execute_tf(u8 inst);
+ virtual void execute_tw(u8 inst);
virtual void execute_tg(u8 inst) = 0;
- void execute_tw(u8 inst);
virtual void execute_th(u8 inst);
void execute_tj(u8 dest);
void clock_video_counters();
@@ -67,6 +69,8 @@ protected:
memory_access_cache<0, 0, ENDIANNESS_LITTLE> *m_ram_cache;
// device callbacks
+ devcb_write_line m_baud_9600_callback;
+ devcb_write8 m_vert_count_callback;
devcb_read8 m_uart_rd_callback;
devcb_write8 m_uart_xd_callback;
devcb_read_line m_ur_flag_callback;
@@ -142,6 +146,7 @@ protected:
// device_disasm_interface overrides
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
+ virtual void execute_tw(u8 inst) override;
virtual void execute_tg(u8 inst) override;
virtual void execute_th(u8 inst) override;