cls key, slow down display to 1 char/frame
This commit is contained in:
parent
624652c8ce
commit
dee2d5221b
11
rtl/apple1.v
11
rtl/apple1.v
|
@ -85,13 +85,15 @@ assign ram_wr = we & ram_cs;
|
|||
wire display_cs = (addr[15:1] == 15'b110100000001001); // 0xD012 -> 0xD013
|
||||
wire ram_cs = !keyboard_cs & !display_cs;
|
||||
|
||||
wire [7:0] display_dout = 8'b0; // display always returns ready on the control port
|
||||
// byte returned from display out
|
||||
wire [7:0] display_dout = { ~PB7, 7'b0 };
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Peripherals
|
||||
|
||||
// PS/2 keyboard interface
|
||||
wire [7:0] ps2_dout;
|
||||
wire cls_key;
|
||||
ps2keyboard keyboard(
|
||||
.clk(sys_clock),
|
||||
.rst(reset),
|
||||
|
@ -99,9 +101,11 @@ assign ram_wr = we & ram_cs;
|
|||
.key_din(ps2_din),
|
||||
.cs(keyboard_cs),
|
||||
.address(addr[0]),
|
||||
.dout(ps2_dout)
|
||||
.dout(ps2_dout),
|
||||
.cls_key(cls_key)
|
||||
);
|
||||
|
||||
wire PB7; // (negated) display ready (PB7 of CIA)
|
||||
display display(
|
||||
.reset(reset),
|
||||
|
||||
|
@ -118,7 +122,8 @@ assign ram_wr = we & ram_cs;
|
|||
.address(addr[0]),
|
||||
.w_en(we & display_cs),
|
||||
.din(cpu_dout),
|
||||
.clr_screen(vga_cls)
|
||||
.clr_screen(cls_key),
|
||||
.ready(PB7)
|
||||
);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
// TODO check diff with updated data_io.v and other modules
|
||||
// TODO keyboard: isolate ps2 keyboard from apple1
|
||||
// TODO keyboard: check ps2 clock
|
||||
// TODO keyboard: reset and cls key
|
||||
// TODO keyboard: reset key
|
||||
// TODO keyboard: make a true ascii keyboard
|
||||
// TODO osd menu yellow, why it doesn't work?
|
||||
// TODO display: check NTSC AD724 hsync problem
|
||||
|
@ -23,12 +23,9 @@
|
|||
// TODO display: reduce to 512 bytes font
|
||||
// TODO display: check parameters vs real apple1
|
||||
// TODO display: check cursor blinking vs 555 timings
|
||||
// TODO display: slow it down
|
||||
// TODO display: emulate PIA registers
|
||||
|
||||
|
||||
|
||||
|
||||
module apple1_mist(
|
||||
input CLOCK_27,
|
||||
|
||||
|
@ -289,7 +286,7 @@ apple1 apple1
|
|||
.vga_grn(g),
|
||||
.vga_blu(b),
|
||||
|
||||
.vga_cls() // clear screen button (not connected yet)
|
||||
.vga_cls() // clear screen button (not connected yet)
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ module display (
|
|||
output vga_red, // red VGA signal
|
||||
output vga_grn, // green VGA signal
|
||||
output vga_blu, // blue VGA signal
|
||||
|
||||
output reg ready, // display ready (PB7 of CIA)
|
||||
|
||||
// cpu interface
|
||||
input address, // address bus
|
||||
|
@ -70,6 +72,8 @@ module display (
|
|||
// active region strobes
|
||||
wire h_active = (h_cnt >= hbp && h_cnt < hfp);
|
||||
wire v_active = (v_cnt >= vbp && v_cnt < vfp);
|
||||
|
||||
|
||||
|
||||
// horizontal and vertical counters
|
||||
always @(posedge sys_clock or posedge reset) begin
|
||||
|
@ -100,7 +104,7 @@ module display (
|
|||
// reset vertical counters
|
||||
v_cnt <= 0;
|
||||
v_dot <= 0;
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -201,17 +205,19 @@ module display (
|
|||
|
||||
always @(posedge sys_clock or posedge reset)
|
||||
begin
|
||||
if (reset)
|
||||
begin
|
||||
if (reset) begin
|
||||
h_cursor <= 6'd0;
|
||||
v_cursor <= 5'd0;
|
||||
char_seen <= 'b0;
|
||||
vram_start_addr <= 5'd0;
|
||||
vram_end_addr <= 5'd24;
|
||||
ready <= 0;
|
||||
end
|
||||
else
|
||||
if(pixel_clken) begin
|
||||
vram_w_en <= 0;
|
||||
if(v_cnt == 0 && h_cnt == 0)
|
||||
ready <= 1;
|
||||
|
||||
if (clr_screen)
|
||||
begin
|
||||
|
@ -244,10 +250,11 @@ module display (
|
|||
|
||||
if (address == 1'b0) // address low == TX register
|
||||
begin
|
||||
if (cpu_clken & w_en & ~char_seen)
|
||||
if (cpu_clken & w_en & ~char_seen & ready)
|
||||
begin
|
||||
// incoming character
|
||||
char_seen <= 1;
|
||||
ready <= 0;
|
||||
|
||||
case(din)
|
||||
8'h0D,
|
||||
|
@ -274,7 +281,7 @@ module display (
|
|||
endcase
|
||||
end
|
||||
else if(~cpu_clken & ~w_en)
|
||||
char_seen <= 0;
|
||||
char_seen <= 0;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
|
|
@ -32,7 +32,9 @@ module ps2keyboard (
|
|||
// I/O interface to computer
|
||||
input cs, // chip select, active high
|
||||
input address, // =0 RX buffer, =1 RX status
|
||||
output reg [7:0] dout // 8-bit output bus.
|
||||
output reg [7:0] dout, // 8-bit output bus.
|
||||
|
||||
output reg cls_key // F1 acts as clear screeen hardware button
|
||||
);
|
||||
|
||||
reg [3:0] rxcnt; // count how many bits have been shift into rxshiftbuf
|
||||
|
@ -177,6 +179,7 @@ module ps2keyboard (
|
|||
else begin
|
||||
if (!shift)
|
||||
case(rx)
|
||||
8'h05: cls_key <= 1;
|
||||
8'h1C: ascii <= "A";
|
||||
8'h32: ascii <= "B";
|
||||
8'h21: ascii <= "C";
|
||||
|
@ -308,6 +311,7 @@ module ps2keyboard (
|
|||
if ((rx == 8'h59) || (rx == 8'h12))
|
||||
shift <= 1'b0;
|
||||
next_state = S_KEYNORMAL;
|
||||
cls_key <= 0;
|
||||
end
|
||||
S_KEYE0:
|
||||
begin
|
||||
|
|
Loading…
Reference in New Issue