Working on learning verilog, so I've been using Loopy's mappers as a reference in writing some of my own.
The first thing I noticed is that he always has things running on the posedge of M2. However, when I try doing things that way the mapper doesn't work...I get nothing but a black screen.
Here's an example, an exact copy of his code from the MMC3 mapper. This version does NOT work:
Here is an edited version that DOES work:
With those changes made I can boot a basic TLROM game, albeit without any IRQ (I haven't gotten that working yet).
Can anyone give any insight into this? Is using M2 the correct way, or is this something that the Powerpak relies on?
The first thing I noticed is that he always has things running on the posedge of M2. However, when I try doing things that way the mapper doesn't work...I get nothing but a black screen.
Here's an example, an exact copy of his code from the MMC3 mapper. This version does NOT work:
Code:
always @ (posedge m2) begin
if(nesprg_we & prgain[15] begin
case({prgain[14:13],prgain[0]})
0:{chrswap, prgswap, regsel} <= {nesprgdin[7:6],nesprgdin[2:0]}; //8000
1:bankreg[regsel] <= nesprgdin; //8001
2:mirror <= nesprgdin[0];// & ~cfg_fourscreen; //A000
3:wramen <= nesprgdin[7:6]; //A001
4:irqlatch <= nesprgdin; //C000
6:irqen <= 0;
7:irqen <= 1;
endcase
end
if(nesprg_we & prgain[15] begin
case({prgain[14:13],prgain[0]})
0:{chrswap, prgswap, regsel} <= {nesprgdin[7:6],nesprgdin[2:0]}; //8000
1:bankreg[regsel] <= nesprgdin; //8001
2:mirror <= nesprgdin[0];// & ~cfg_fourscreen; //A000
3:wramen <= nesprgdin[7:6]; //A001
4:irqlatch <= nesprgdin; //C000
6:irqen <= 0;
7:irqen <= 1;
endcase
end
Here is an edited version that DOES work:
Code:
always @ (posedge prgain[15]) begin
if(nesprg_we ==0) begin
case({prgain[14:13],prgain[0]})
0:{chrswap, prgswap, regsel} <= {nesprgdin[7:6],nesprgdin[2:0]}; //8000
1:bankreg[regsel] <= nesprgdin; //8001
2:mirror <= nesprgdin[0];// & ~cfg_fourscreen; //A000
3:wramen <= nesprgdin[7:6]; //A001
4:irqlatch <= nesprgdin; //C000
6:irqen <= 0;
7:irqen <= 1;
endcase
end
if(nesprg_we ==0) begin
case({prgain[14:13],prgain[0]})
0:{chrswap, prgswap, regsel} <= {nesprgdin[7:6],nesprgdin[2:0]}; //8000
1:bankreg[regsel] <= nesprgdin; //8001
2:mirror <= nesprgdin[0];// & ~cfg_fourscreen; //A000
3:wramen <= nesprgdin[7:6]; //A001
4:irqlatch <= nesprgdin; //C000
6:irqen <= 0;
7:irqen <= 1;
endcase
end
With those changes made I can boot a basic TLROM game, albeit without any IRQ (I haven't gotten that working yet).
Can anyone give any insight into this? Is using M2 the correct way, or is this something that the Powerpak relies on?