Line 61... |
Line 61... |
output wire SRAM_OE_N,
|
output wire SRAM_OE_N,
|
output wire SRAM_WE_N,
|
output wire SRAM_WE_N,
|
output wire SRAM_UB_N,
|
output wire SRAM_UB_N,
|
output wire SRAM_LB_N,
|
output wire SRAM_LB_N,
|
|
|
//-------- My little imitation of a Kempston joystick -----------
|
//-------- Atari joystick mapped as Kempston
|
input wire [5:0] kempston,
|
input wire [4:0] kempston, // Input with weak pull-up
|
|
output wire kempston_gnd, // Helps mapping to DB9 cable
|
output wire [4:0] LEDG, // Show the joystick state
|
output wire [4:0] LEDG, // Show the joystick state
|
|
|
//-------- Misc and debug -------------------
|
//-------- Misc and debug -------------------
|
input wire SW0, // ROM selection
|
input wire SW0, // ROM selection
|
input wire SW1, // Enable/disable interrupts
|
input wire SW1, // Enable/disable interrupts
|
Line 83... |
Line 84... |
|
|
// Export selected pins to the extension connector
|
// Export selected pins to the extension connector
|
assign GPIO_1[15:0] = A[15:0];
|
assign GPIO_1[15:0] = A[15:0];
|
assign GPIO_1[23:16] = D[7:0];
|
assign GPIO_1[23:16] = D[7:0];
|
assign GPIO_1[31:24] = {nM1,nMREQ,nIORQ,nRD,nWR,nRFSH,nHALT,nBUSACK};
|
assign GPIO_1[31:24] = {nM1,nMREQ,nIORQ,nRD,nWR,nRFSH,nHALT,nBUSACK};
|
|
assign kempston_gnd = 0;
|
|
|
// Top 3 green LEDs show various states:
|
// Top 3 green LEDs show various states:
|
assign LEDGTOP[2] = 0; // Reserved for future use
|
assign LEDGTOP[2] = 0; // Reserved for future use
|
assign LEDGTOP[1] = beeper; // Show the beeper state
|
assign LEDGTOP[1] = beeper; // Show the beeper state
|
assign LEDGTOP[0] = pressed; // Show when a key is being pressed
|
assign LEDGTOP[0] = pressed; // Show when a key is being pressed
|
Line 127... |
Line 129... |
// ---------------------------------- IO read ----------------------------------
|
// ---------------------------------- IO read ----------------------------------
|
3'b001: begin
|
3'b001: begin
|
// Normally data supplied by the ULA
|
// Normally data supplied by the ULA
|
D[7:0] = ula_data;
|
D[7:0] = ula_data;
|
|
|
// Kempston joystick at the IO address of 0x1F: active bits are high: 000FUDLR
|
// Kempston joystick at the IO address 0x1F; active bits are high:
|
// The bits are scrambled since I just happen to solder them that way on a game
|
// FIRE UP DOWN LEFT RIGHT
|
// pad I've got (see my blog); you can remap it if you have another kind of joystick
|
|
if (A[7:0]==8'h1F) begin
|
if (A[7:0]==8'h1F) begin
|
D[7:0] = { 3'b0, !kempston[3],!kempston[5],!kempston[4],!kempston[0],!kempston[2] };
|
D[7:0] = { 3'b0, !kempston[4],!kempston[0],!kempston[1],!kempston[2],!kempston[3] };
|
end
|
end
|
end
|
end
|
default:
|
default:
|
D[7:0] = {8{1'bz}};
|
D[7:0] = {8{1'bz}};
|
endcase
|
endcase
|
Line 282... |
Line 283... |
);
|
);
|
|
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
// Lit green LEDs to show activity on a Kempston compatible joystick
|
// Lit green LEDs to show activity on a Kempston compatible joystick
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
assign LEDG[0] = !kempston[5]; // UP
|
assign LEDG[0] = !kempston[0]; // UP
|
assign LEDG[1] = !kempston[4]; // DOWN
|
assign LEDG[1] = !kempston[1]; // DOWN
|
assign LEDG[2] = !kempston[0]; // LEFT
|
assign LEDG[2] = !kempston[2]; // LEFT
|
assign LEDG[3] = !kempston[2]; // RIGHT
|
assign LEDG[3] = !kempston[3]; // RIGHT
|
assign LEDG[4] = !kempston[3] | !kempston[1]; // BUTTON
|
assign LEDG[4] = !kempston[4]; // FIRE
|
|
|
endmodule
|
endmodule
|