Implement backspace control character
This commit is contained in:
		
							
								
								
									
										14
									
								
								terminal.vhd
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								terminal.vhd
									
									
									
									
									
								
							@@ -52,6 +52,7 @@ begin
 | 
				
			|||||||
    -- the current row before jumping to the next one
 | 
					    -- the current row before jumping to the next one
 | 
				
			||||||
    process(sys_clk)
 | 
					    process(sys_clk)
 | 
				
			||||||
        variable next_line: unsigned(5 downto 0);
 | 
					        variable next_line: unsigned(5 downto 0);
 | 
				
			||||||
 | 
					        variable previous_col: unsigned(6 downto 0);
 | 
				
			||||||
    begin
 | 
					    begin
 | 
				
			||||||
        if rising_edge(sys_clk) then
 | 
					        if rising_edge(sys_clk) then
 | 
				
			||||||
            -- we write to the current cursor position and simply pass the data
 | 
					            -- we write to the current cursor position and simply pass the data
 | 
				
			||||||
@@ -74,9 +75,20 @@ begin
 | 
				
			|||||||
                next_line := cursor_row + 1;
 | 
					                next_line := cursor_row + 1;
 | 
				
			||||||
            end if;
 | 
					            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
 | 
					            if write_enable = '1' then
 | 
				
			||||||
 | 
					                -- backspace
 | 
				
			||||||
 | 
					                if write_data = x"08" then
 | 
				
			||||||
 | 
					                    cursor_col <= previous_col;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                -- carriage return
 | 
					                -- carriage return
 | 
				
			||||||
                if write_data = x"0d" then
 | 
					                elsif write_data = x"0d" then
 | 
				
			||||||
                    cursor_col <= (others => '0');
 | 
					                    cursor_col <= (others => '0');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                -- line feed (implicit CR)
 | 
					                -- line feed (implicit CR)
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user