From 5667e081a0b6243cb2ce14f55fb330aa6e07a6ad Mon Sep 17 00:00:00 2001 From: Gyorgy Szombathelyi Date: Mon, 3 Sep 2018 03:26:18 +0200 Subject: [PATCH] C16: [T65] fix SO signal samping --- cores/c16/t65/T65.vhd | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cores/c16/t65/T65.vhd b/cores/c16/t65/T65.vhd index b9fa335..d6aba9c 100755 --- a/cores/c16/t65/T65.vhd +++ b/cores/c16/t65/T65.vhd @@ -463,9 +463,6 @@ begin --This should happen after P has been pushed to stack tmpP(Flag_I) := '1'; end if; - if SO_n_o = '1' and SO_n = '0' then - tmpP(Flag_V) := '1'; - end if; if RstCycle = '1' then tmpP(Flag_I) := '1'; tmpP(Flag_D) := '0'; @@ -474,7 +471,6 @@ begin P<=tmpP;--new way - SO_n_o <= SO_n; if IR(4 downto 0)/="10000" or Jump/="01" then -- delay interrupts during branches (checked with Lorenz test and real 6510), not best way yet, though - but works... IRQ_n_o <= IRQ_n; end if; @@ -484,6 +480,13 @@ begin NMI_n_o <= NMI_n; end if; end if; + -- act immediately on SO pin change + -- The signal is sampled on the trailing edge of phi1 and must be externally synchronized (from datasheet) + SO_n_o <= SO_n; + if SO_n_o = '1' and SO_n = '0' then + P(Flag_V) <= '1'; + end if; + end if; end process;