From 381e7cc659c7c7ade2515f2de1f0ca65616a4843 Mon Sep 17 00:00:00 2001 From: Jens Ahrensfeld Date: Wed, 4 Nov 2009 19:29:50 +0000 Subject: [PATCH] - added cursor position status port - 'dout' is set to last written character Committed on the Free edition of March Hare Software CVSNT Server. Upgrade to CVS Suite for more features and support: http://march-hare.com/cvsnt/ git-svn-id: http://moon:8086/svn/vhdl/trunk@603 cc03376c-175c-47c8-b038-4cd826a8556b --- lib/VGA_ctrl/src/char_gen.vhd | 42 +++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/lib/VGA_ctrl/src/char_gen.vhd b/lib/VGA_ctrl/src/char_gen.vhd index 1f412da..c9d9970 100644 --- a/lib/VGA_ctrl/src/char_gen.vhd +++ b/lib/VGA_ctrl/src/char_gen.vhd @@ -54,16 +54,21 @@ entity char_gen is -- Host Signals clr_screen : in std_logic; clr_line : in std_logic; - ascii_data : in unsigned(7 downto 0); - ascii_data_we : in std_logic; - ascii_posy_we : in std_logic; - ascii_posx_we : in std_logic; + din : in unsigned(7 downto 0); + dout : out unsigned(7 downto 0); + ascii_we : in std_logic; + posy_we : in std_logic; + posx_we : in std_logic; ready : out std_logic; -- Control signals - pos_x : in natural range 0 to tsvga.ts_h.ncyc_scan-1; - pos_y : in natural range 0 to tsvga.ts_v.ncyc_scan-1; + scan_pos_x_in : in natural range 0 to tsvga.ts_h.ncyc_scan-1; + scan_pos_y_in : in natural range 0 to tsvga.ts_v.ncyc_scan-1; + -- Status signals + csr_pos_x_out : out natural range 0 to MAX_CHAR_PER_LINE-1; + csr_pos_y_out : out natural range 0 to MAX_LINE_PER_FRAME-1; + -- Output char_draw_en : out std_logic @@ -198,6 +203,8 @@ begin char_addr <= to_unsigned(csr_posx_reg, char_addr'length); char_rom_addr <= a_data_rd & char_rom_row(NextExpBaseTwo(CHAR_SIZE_Y)-1 downto (CHARACTER_SCALE-1)); cursor_rom_addr <= cursor_visible & char_rom_row(NextExpBaseTwo(CHAR_SIZE_Y)-1 downto (CHARACTER_SCALE-1)); + csr_pos_x_out <= csr_posx_reg; + csr_pos_y_out <= csr_posy_reg; inst_char_rom : entity work.char_rom PORT MAP @@ -317,22 +324,23 @@ begin csr_posx_cnt_set <= '0'; csr_posy_cnt_en <= '0'; csr_posy_cnt_set <= '0'; - if ascii_posy_we = '1' then - csr_posy_cnt_din <= to_integer(ascii_data); + if posy_we = '1' then + csr_posy_cnt_din <= to_integer(din); csr_posy_cnt_set <= '1'; - elsif ascii_posx_we = '1' then - csr_posx_cnt_din <= to_integer(ascii_data); + elsif posx_we = '1' then + csr_posx_cnt_din <= to_integer(din); csr_posx_cnt_set <= '1'; - elsif ascii_data_we = '1' then - if ascii_data < X"20" then - if ascii_data = X"0D" then + elsif ascii_we = '1' then + dout <= din; -- written char is simply echoed back to dout + if din < X"20" then + if din = X"0D" then csr_posx_cnt_din <= 0; csr_posx_cnt_set <= '1'; - elsif ascii_data = X"0A" then + elsif din = X"0A" then csr_posy_cnt_en <= '1'; end if; else - a_data_reg <= ascii_data - X"20"; + a_data_reg <= din - X"20"; a_data_we <= '1'; csr_posx_cnt_en <= '1'; end if; @@ -500,13 +508,13 @@ begin char_draw_en <= char_en2 and char_reg(char_reg'left); char_en2 := char_en; char_en := '0'; - if pos_y = SCREEN_OFFSET_Y then + if scan_pos_y_in = SCREEN_OFFSET_Y then enable_y := '1'; cell_y_cnt <= 0; char_x_cnt <= 0; line_offset <= scroll_offset; end if; - if pos_x = SCREEN_OFFSET_X and enable_y = '1' then + if scan_pos_x_in = SCREEN_OFFSET_X and enable_y = '1' then enable_x := '1'; cell_x_cnt <= 0; char_x_cnt <= 0;