- 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
This commit is contained in:
@@ -54,15 +54,20 @@ entity char_gen is
|
|||||||
-- Host Signals
|
-- Host Signals
|
||||||
clr_screen : in std_logic;
|
clr_screen : in std_logic;
|
||||||
clr_line : in std_logic;
|
clr_line : in std_logic;
|
||||||
ascii_data : in unsigned(7 downto 0);
|
din : in unsigned(7 downto 0);
|
||||||
ascii_data_we : in std_logic;
|
dout : out unsigned(7 downto 0);
|
||||||
ascii_posy_we : in std_logic;
|
ascii_we : in std_logic;
|
||||||
ascii_posx_we : in std_logic;
|
posy_we : in std_logic;
|
||||||
|
posx_we : in std_logic;
|
||||||
ready : out std_logic;
|
ready : out std_logic;
|
||||||
|
|
||||||
-- Control signals
|
-- Control signals
|
||||||
pos_x : in natural range 0 to tsvga.ts_h.ncyc_scan-1;
|
scan_pos_x_in : 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_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
|
-- Output
|
||||||
char_draw_en : out std_logic
|
char_draw_en : out std_logic
|
||||||
@@ -198,6 +203,8 @@ begin
|
|||||||
char_addr <= to_unsigned(csr_posx_reg, char_addr'length);
|
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));
|
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));
|
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
|
inst_char_rom : entity work.char_rom
|
||||||
PORT MAP
|
PORT MAP
|
||||||
@@ -317,22 +324,23 @@ begin
|
|||||||
csr_posx_cnt_set <= '0';
|
csr_posx_cnt_set <= '0';
|
||||||
csr_posy_cnt_en <= '0';
|
csr_posy_cnt_en <= '0';
|
||||||
csr_posy_cnt_set <= '0';
|
csr_posy_cnt_set <= '0';
|
||||||
if ascii_posy_we = '1' then
|
if posy_we = '1' then
|
||||||
csr_posy_cnt_din <= to_integer(ascii_data);
|
csr_posy_cnt_din <= to_integer(din);
|
||||||
csr_posy_cnt_set <= '1';
|
csr_posy_cnt_set <= '1';
|
||||||
elsif ascii_posx_we = '1' then
|
elsif posx_we = '1' then
|
||||||
csr_posx_cnt_din <= to_integer(ascii_data);
|
csr_posx_cnt_din <= to_integer(din);
|
||||||
csr_posx_cnt_set <= '1';
|
csr_posx_cnt_set <= '1';
|
||||||
elsif ascii_data_we = '1' then
|
elsif ascii_we = '1' then
|
||||||
if ascii_data < X"20" then
|
dout <= din; -- written char is simply echoed back to dout
|
||||||
if ascii_data = X"0D" then
|
if din < X"20" then
|
||||||
|
if din = X"0D" then
|
||||||
csr_posx_cnt_din <= 0;
|
csr_posx_cnt_din <= 0;
|
||||||
csr_posx_cnt_set <= '1';
|
csr_posx_cnt_set <= '1';
|
||||||
elsif ascii_data = X"0A" then
|
elsif din = X"0A" then
|
||||||
csr_posy_cnt_en <= '1';
|
csr_posy_cnt_en <= '1';
|
||||||
end if;
|
end if;
|
||||||
else
|
else
|
||||||
a_data_reg <= ascii_data - X"20";
|
a_data_reg <= din - X"20";
|
||||||
a_data_we <= '1';
|
a_data_we <= '1';
|
||||||
csr_posx_cnt_en <= '1';
|
csr_posx_cnt_en <= '1';
|
||||||
end if;
|
end if;
|
||||||
@@ -500,13 +508,13 @@ begin
|
|||||||
char_draw_en <= char_en2 and char_reg(char_reg'left);
|
char_draw_en <= char_en2 and char_reg(char_reg'left);
|
||||||
char_en2 := char_en;
|
char_en2 := char_en;
|
||||||
char_en := '0';
|
char_en := '0';
|
||||||
if pos_y = SCREEN_OFFSET_Y then
|
if scan_pos_y_in = SCREEN_OFFSET_Y then
|
||||||
enable_y := '1';
|
enable_y := '1';
|
||||||
cell_y_cnt <= 0;
|
cell_y_cnt <= 0;
|
||||||
char_x_cnt <= 0;
|
char_x_cnt <= 0;
|
||||||
line_offset <= scroll_offset;
|
line_offset <= scroll_offset;
|
||||||
end if;
|
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';
|
enable_x := '1';
|
||||||
cell_x_cnt <= 0;
|
cell_x_cnt <= 0;
|
||||||
char_x_cnt <= 0;
|
char_x_cnt <= 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user