mirror of
https://github.com/alangarf/apple-one.git
synced 2025-01-09 16:33:57 +00:00
PS/2 keyboard seems to be working including the shift key. It needs debouncing, however
This commit is contained in:
parent
5c87a46445
commit
586b006e88
21
rtl/apple1.v
21
rtl/apple1.v
@ -6,6 +6,9 @@ module apple1(
|
||||
output uart_tx,
|
||||
output uart_cts,
|
||||
|
||||
input ps2_clk, // PS/2 keyboard serial clock input
|
||||
input ps2_din, // PS/2 keyboard serial data input
|
||||
|
||||
output [15:0] pc_monitor // spy for program counter / debugging
|
||||
);
|
||||
parameter RAM_FILENAME = "../../roms/ram.hex";
|
||||
@ -109,6 +112,9 @@ module apple1(
|
||||
|
||||
wire ram_cs = (ab[15:13] == 3'b000); // 0x0000 -> 0x1FFF
|
||||
wire uart_cs = (ab[15:2] == 14'b11010000000100); // 0xD010 -> 0xD013
|
||||
wire ps2kb_cs = 1'b0;
|
||||
//wire uart_cs = (ab[15:1] == 15'b110100000001001); // 0xD012 -> 0xD013
|
||||
//wire ps2kb_cs = (ab[15:1] == 15'b110100000001000); // 0xD010 -> 0xD011
|
||||
wire basic_cs = (ab[15:12] == 4'b1110); // 0xE000 -> 0xEFFF
|
||||
wire rom_cs = (ab[15:8] == 8'b11111111); // 0xFF00 -> 0xFFFF
|
||||
|
||||
@ -155,16 +161,31 @@ module apple1(
|
||||
.uart_cts(uart_cts),
|
||||
|
||||
.enable(uart_cs & cpu_clken),
|
||||
//.address({1'b1, ab[0]}), // for ps/2
|
||||
.address(ab[1:0]),
|
||||
.w_en(we & uart_cs),
|
||||
.din(dbo),
|
||||
.dout(uart_dout)
|
||||
);
|
||||
|
||||
// PS/2 keyboard interface
|
||||
wire [7:0] ps2_dout;
|
||||
ps2keyboard keyboard
|
||||
(
|
||||
.clk25(clk25),
|
||||
.reset(reset),
|
||||
.key_clk(ps2_clk),
|
||||
.key_din(ps2_din),
|
||||
.cs(ps2kb_cs),
|
||||
.address(ab[0]),
|
||||
.dout(ps2_dout)
|
||||
);
|
||||
|
||||
// link up chip selected device to cpu input
|
||||
assign dbi = ram_cs ? ram_dout :
|
||||
rom_cs ? rom_dout :
|
||||
basic_cs ? basic_dout :
|
||||
uart_cs ? uart_dout :
|
||||
ps2kb_cs ? ps2_dout :
|
||||
8'hFF;
|
||||
endmodule
|
||||
|
@ -59,6 +59,8 @@ module apple1_de0_top(
|
||||
.uart_rx(UART_RXD),
|
||||
.uart_tx(UART_TXD),
|
||||
.uart_cts(UART_CTS),
|
||||
.ps2_clk(PS2_KBCLK),
|
||||
.ps2_din(PS2_KBDAT),
|
||||
.pc_monitor(pc_monitor)
|
||||
);
|
||||
|
||||
@ -92,18 +94,5 @@ module apple1_de0_top(
|
||||
.hexdigit_in(pc_monitor[15:12]),
|
||||
.display_out(HEX3_D)
|
||||
);
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////
|
||||
// Experimental PS/2 interface
|
||||
|
||||
ps2keyboard keys(
|
||||
.clk25(clk25),
|
||||
.reset(~BUTTON[0]),
|
||||
.key_clk(PS2_KBCLK),
|
||||
.key_din(PS2_KBDAT),
|
||||
.cs(1'b1),
|
||||
.address(1'b0),
|
||||
.dout(LEDG[7:0])
|
||||
);
|
||||
|
||||
endmodule
|
||||
|
@ -142,7 +142,7 @@ begin
|
||||
if (address == 1'b0)
|
||||
begin
|
||||
// RX buffer address
|
||||
dout <= ascii;
|
||||
dout <= {1'b1, ascii[6:0]};
|
||||
ascii_rdy <= 1'b0;
|
||||
end
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user