Line 15... |
Line 15... |
/* Capcom arcade boards like 1942 use two memory locations to
|
/* Capcom arcade boards like 1942 use two memory locations to
|
communicate with the AY-3-8910 (or compatible) chip. This small code
|
communicate with the AY-3-8910 (or compatible) chip. This small code
|
provides a 2-byte memory map as expected by Capcom games
|
provides a 2-byte memory map as expected by Capcom games
|
*/
|
*/
|
`timescale 1ns / 1ps
|
`timescale 1ns / 1ps
|
module AY_3_8910_capcom(
|
module AY_3_8910_capcom
|
|
#( parameter dump_writes=0, parameter id=0 )
|
|
(
|
input reset_n,
|
input reset_n,
|
input clk, // CPU clock
|
input clk, // CPU clock
|
input sound_clk, // normally slower than the CPU clock
|
input sound_clk, // normally slower than the CPU clock
|
input [7:0] din,
|
input [7:0] din,
|
input adr,
|
input adr,
|
Line 55... |
Line 57... |
latches[adr] = din;
|
latches[adr] = din;
|
if(adr) core_wr=1;
|
if(adr) core_wr=1;
|
end
|
end
|
end
|
end
|
|
|
SQMUSIC core( .reset_n(reset_n), .clk(sound_clk), .data_in(latches[1]),
|
SQMUSIC #(dump_writes, id) core( .reset_n(reset_n), .clk(sound_clk), .data_in(latches[1]),
|
.adr( latches[0][3:0] ), .rd(1'b0), .wr(core_wr), .A(A), .B(B), .C(C) );
|
.adr( latches[0][3:0] ), .rd(1'b0), .wr(core_wr), .A(A), .B(B), .C(C) );
|
endmodule
|
endmodule
|
|
|
/* The AY core does
|
/* The AY core does
|
*/
|
*/
|
module SQMUSIC( // pins are not multiplexed
|
module SQMUSIC
|
|
#( parameter dump_writes=0, parameter id=0 ) // set to 1 to dump register writes
|
|
( // note that input ports are not multiplexed
|
input reset_n,
|
input reset_n,
|
input clk,
|
input clk,
|
input [7:0] data_in,
|
input [7:0] data_in,
|
output reg [7:0] data_out, // read functionality not implemented yet
|
output reg [7:0] data_out,
|
input [3:0] adr,
|
input [3:0] adr,
|
input rd, // read
|
input rd, // read
|
input wr, // write
|
input wr, // write
|
output [3:0]A,B,C // channel outputs
|
output [3:0]A,B,C // channel outputs
|
);
|
);
|
Line 122... |
Line 126... |
for(aux=0;aux<=15;aux=aux+1) regarray[aux]=0;
|
for(aux=0;aux<=15;aux=aux+1) regarray[aux]=0;
|
end
|
end
|
else begin
|
else begin
|
if( rd )
|
if( rd )
|
data_out=regarray[ adr ];
|
data_out=regarray[ adr ];
|
else if( wr ) regarray[adr]=data_in;
|
else if( wr ) begin
|
|
regarray[adr]=data_in;
|
|
if( dump_writes ) begin
|
|
$display("#%d, %t, %d, %d", id, $realtime, adr, data_in );
|
|
end
|
|
end
|
end
|
end
|
end
|
end
|
|
|
endmodule
|
endmodule
|
|
|