Implement backspace control character

This commit is contained in:
Klemens Schölhorn 2018-06-04 15:47:58 +02:00
parent bee5a3a471
commit 227dce66e9
1 changed files with 13 additions and 1 deletions

View File

@ -52,6 +52,7 @@ begin
-- the current row before jumping to the next one
process(sys_clk)
variable next_line: unsigned(5 downto 0);
variable previous_col: unsigned(6 downto 0);
begin
if rising_edge(sys_clk) then
-- we write to the current cursor position and simply pass the data
@ -74,9 +75,20 @@ begin
next_line := cursor_row + 1;
end if;
-- calculate previous column (saturating)
if cursor_col = 0 then
previous_col := (others => '0');
else
previous_col := cursor_col - 1;
end if;
if write_enable = '1' then
-- backspace
if write_data = x"08" then
cursor_col <= previous_col;
-- carriage return
if write_data = x"0d" then
elsif write_data = x"0d" then
cursor_col <= (others => '0');
-- line feed (implicit CR)