add changes by gitlab.com/emax73g

This commit is contained in:
antoniovillena 2022-05-31 15:23:43 +02:00
parent a8165d9556
commit 4b49d65e54
2 changed files with 286 additions and 276 deletions

View File

@ -149,14 +149,14 @@ module ps2_host_to_kb (
);
`define PULLCLKLOW 3'b000
`define PULLDATALOW 3'b001
`define SENDDATA 3'b010
`define SENDPARITY 3'b011
`define RCVACK 3'b100
`define RCVIDLE 3'b101
`define SENDFINISHED 3'b110
`define PULLCLKDATALOW 3'b001
`define PULLDATALOW 3'b010
`define SENDDATA 3'b011
`define SENDPARITY 3'b100
`define RCVACK 3'b101
`define RCVIDLE 3'b110
`define SENDFINISHED 3'b111
reg initial_kb_reset = 1'b1;
reg busy = 1'b0;
reg error = 1'b0;
assign ps2busy = busy;
@ -198,16 +198,6 @@ module ps2_host_to_kb (
always @(posedge clk) begin
// Carga de rdata desde el exterior
`ifdef INITIAL_KB_RESET
if (initial_kb_reset) begin // Reset inicial de teclado para establecer el SET 2
initial_kb_reset <= 1'b0;
rdata <= 8'hFF;
busy <= 1'b1;
error <= 1'b0;
timeoutcnt <= 24'h000000;
state <= `PULLCLKLOW;
end
`endif
if (dataload) begin
rdata <= data;
busy <= 1'b1;
@ -226,11 +216,17 @@ module ps2_host_to_kb (
case (state)
`PULLCLKLOW: begin // 280000 cuentas son 10ms para 28 MHz
if (timeoutcnt >= 24'd280000) begin
state <= `PULLDATALOW;
shiftreg <= rdata;
cntbits <= 3'd0;
timeoutcnt <= 24'h000000;
if (timeoutcnt >= 24'd3360) begin
state <= `PULLCLKDATALOW;
timeoutcnt <= 24'h000000;
end
end
`PULLCLKDATALOW: begin
if (timeoutcnt >= 24'd280) begin
state <= `PULLDATALOW;
shiftreg <= rdata;
cntbits <= 3'd0;
timeoutcnt <= 24'h000000;
end
end
`PULLDATALOW: begin
@ -280,10 +276,10 @@ module ps2_host_to_kb (
endcase
end
assign ps2data_ext = (state == `PULLCLKLOW || state == `PULLDATALOW) ? 1'b0 :
assign ps2data_ext = (state == `PULLCLKDATALOW || state == `PULLDATALOW) ? 1'b0 :
(state == `SENDDATA && shiftreg[0] == 1'b0) ? 1'b0 :
(state == `SENDPARITY && paritycalculated == 1'b0) ? 1'b0 : // si lo que se va a enviar es un 1
1'bZ; // no se manda, sino que se pone la línea a alta impedancia
assign ps2clk_ext = (state == `PULLCLKLOW) ? 1'b0 :
assign ps2clk_ext = (state == `PULLCLKLOW || state == `PULLCLKDATALOW) ? 1'b0 :
1'bZ;
endmodule

View File

@ -250,6 +250,17 @@ kemp defb $1f, $1e, $1d, $1c, $0d ; Right Left Down Up Enter
start ld bc, chrend-sdtab
ldir
wreg scan_code, $f6 ; $f6 = kb set defaults
halt
halt
wreg scan_code, $f0 ; $f0 + 2 = Set scan code set 2
halt
halt
wreg scan_code, $02
ld c, $05 ; 100msec delay
delay1 halt
dec c
jr nz, delay1
IF recovery=0
call alto loadch
ld hl, (scanli)
@ -463,7 +474,10 @@ star16 djnz star18
halt
wreg scan_code, $ed ; $ed + 2 = kb set leds + numlock
halt
halt
wreg scan_code, $02
halt
halt
IF vertical=0
ld hl, $0017 ; Si se acaba el temporizador borrar
ld de, $2001 ; lo de presione Break