1
0
mirror of https://github.com/mist-devel/mist-board.git synced 2026-02-06 16:14:42 +00:00

[C64] 1541: flip write protect flag during disk change

Allows to detect the change
This commit is contained in:
Gyorgy Szombathelyi
2019-02-02 19:13:07 +01:00
parent 0f1eb43301
commit 7e58371f8e

View File

@@ -110,6 +110,9 @@ signal track_modified : std_logic;
signal sector_offset : std_logic;
signal save_track_stage : std_logic_vector(3 downto 0);
signal wps_flag : std_logic;
signal change_timer : integer;
signal dbg_sector : std_logic_vector(4 downto 0);
signal dbg_adr_fetch : std_logic_vector(15 downto 0);
@@ -172,7 +175,7 @@ begin
freq => freq, -- motor frequency
sync_n => sync_n, -- reading SYNC bytes
byte_n => byte_n, -- byte ready
wps_n => not disk_readonly, -- write-protect sense (0 = protected)
wps_n => not wps_flag, -- write-protect sense (0 = protected)
tr00_sense_n => '1', -- track 0 sense (unused?)
act => act, -- activity LED
@@ -266,7 +269,22 @@ port map
--
-- dbg_state => dbg_sd_state
--);
wps_flag <= disk_readonly when change_timer = 0 else not disk_readonly;
process (clk32,reset)
begin
if reset = '1' then
change_timer <= 0;
elsif rising_edge(clk32) then
if disk_change = '1' then
change_timer <= 1000000;
elsif change_timer /= 0 then
change_timer <= change_timer - 1;
end if;
end if;
end process;
process (clk32)
begin
if rising_edge(clk32) then