Added clear screen button

This commit is contained in:
Alan Garfield 2018-02-16 13:43:43 +11:00
parent ae59891f2e
commit b7f3f186f7
3 changed files with 68 additions and 51 deletions

View File

@ -48,6 +48,7 @@ module apple1 #(
output vga_red, // red VGA signal
output vga_grn, // green VGA signal
output vga_blu, // blue VGA signal
input clr_screen, // clear screen button
// Debugging ports
output [15:0] pc_monitor // spy for program counter / debugging
@ -175,8 +176,6 @@ module apple1 #(
.uart_tx(uart_tx),
.uart_cts(uart_cts),
//.address({1'b1, ab[0]}), // for ps/2
//.address({1'b0, ab[0]}), // for vga
.address(ab[1:0]), // for uart
.w_en(we & uart_cs),
.din(dbo),
@ -214,7 +213,8 @@ module apple1 #(
.address(ab[0]),
.w_en(we & vga_cs),
.din(dbo),
.mode(vga_mode)
.mode(vga_mode),
.clr_screen(clr_screen)
);
// FIXME: REMOVE THIS

View File

@ -104,6 +104,7 @@ module apple1_top #(
.vga_red(vga_red),
.vga_grn(vga_grn),
.vga_blu(vga_blu),
.clr_screen(~button[1]),
.pc_monitor(pc_monitor)
);

View File

@ -13,7 +13,8 @@ module vga #(
input address, // address bus
input w_en, // active high write enable strobe
input [7:0] din, // 8-bit data bus (input)
input [1:0] mode // 2-bit mode setting for pixel doubling
input [1:0] mode, // 2-bit mode setting for pixel doubling
input clr_screen // clear screen button
);
//////////////////////////////////////////////////////////////////////////
@ -60,9 +61,6 @@ module vga #(
wire [4:0] font_line;
wire font_out;
// Font ROM contents
parameter ROM_FILENAME = "";
// cpu control registers
reg char_seen;
@ -229,6 +227,22 @@ module vga #(
begin
vram_w_en <= 0;
if (clr_screen)
begin
// return to top of screen
h_cursor <= 6'd0;
v_cursor <= 5'd0;
vram_start_addr <= 5'd0;
vram_end_addr <= 5'd23;
// clear the screen
vram_w_addr <= {vram_v_addr, vram_h_addr};
vram_din <= 6'd32;
vram_w_en <= 1;
end
else
begin
// cursor overflow handling
if (h_cursor == 6'd40)
begin
@ -256,8 +270,9 @@ module vga #(
v_cursor <= v_cursor + 'd1;
end
8'h9B,
8'h7F: begin
// ignore the DDR call to the PIA
// ignore the escape key
h_cursor <= 0;
end
@ -280,5 +295,6 @@ module vga #(
end
end
end
end
endmodule