-
Notifications
You must be signed in to change notification settings - Fork 26
Implement pirate mapper 044 inside the 004.RBF library. #8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
vslashg
wants to merge
1
commit into
krikzz:main
Choose a base branch
from
vslashg:map_044
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,126 @@ | ||
|
|
||
| module map_044( // MMC3 pirate multicart | ||
|
|
||
| input MapIn mai, | ||
| output MapOut mao | ||
| ); | ||
| //************************************************************* base header | ||
| CpuBus cpu; | ||
| PpuBus ppu; | ||
| SysCfg cfg; | ||
| SSTBus sst; | ||
| assign cpu = mai.cpu; | ||
| assign ppu = mai.ppu; | ||
| assign cfg = mai.cfg; | ||
| assign sst = mai.sst; | ||
|
|
||
| MemCtrl prg; | ||
| MemCtrl chr; | ||
| MemCtrl srm; | ||
| assign mao.prg = prg; | ||
| assign mao.chr = chr; | ||
| assign mao.srm = srm; | ||
|
|
||
| assign prg.dati = cpu.data; | ||
| assign chr.dati = ppu.data; | ||
| assign srm.dati = cpu.data; | ||
|
|
||
| wire int_cpu_oe; | ||
| wire int_ppu_oe; | ||
| wire [7:0]int_cpu_data; | ||
| wire [7:0]int_ppu_data; | ||
|
|
||
| assign mao.map_cpu_oe = int_cpu_oe | (srm.ce & srm.oe) | (prg.ce & prg.oe); | ||
| assign mao.map_cpu_do = int_cpu_oe ? int_cpu_data : srm.ce ? mai.srm_do : mai.prg_do; | ||
|
|
||
| assign mao.map_ppu_oe = int_ppu_oe | (chr.ce & chr.oe); | ||
| assign mao.map_ppu_do = int_ppu_oe ? int_ppu_data : mai.chr_do; | ||
| //************************************************************* configuration | ||
| assign mao.prg_mask_off = 0; | ||
| assign mao.chr_mask_off = 0; | ||
| assign mao.srm_mask_off = 0; | ||
| assign mao.mir_4sc = 1;//enable support for 4-screen mirroring. for activation should be enabled in cfg.mir_4 also | ||
| assign mao.bus_cf = 0;//bus conflicts | ||
| //************************************************************* save state regs read | ||
| assign mao.sst_di[7:0] = | ||
| sst.addr[7:0] < 127 ? sst_di : | ||
| sst.addr[7:0] == 127 ? cfg.map_idx : 8'hff; | ||
| //************************************************************* mapper-controlled pins | ||
| assign srm.ce = ram_ce; | ||
| assign srm.oe = cpu.rw; | ||
| assign srm.we = !ram_we_n; | ||
| assign srm.addr[12:0] = cpu.addr[12:0]; | ||
|
|
||
| assign prg.ce = !prg_ce_n; | ||
| assign prg.oe = cpu.rw; | ||
| assign prg.we = 0; | ||
| assign prg.addr[12:0] = cpu.addr[12:0]; | ||
| assign prg.addr[16:13] = prg_addr[16:13]; | ||
| assign prg.addr[17] = | ||
| block_sel[2:1] == 3 ? prg_addr[17] : block_sel[0]; | ||
| assign prg.addr[19:18] = block_sel[2:1]; | ||
|
|
||
| assign chr.ce = mao.ciram_ce; | ||
| assign chr.oe = !ppu.oe; | ||
| assign chr.we = 0; | ||
| assign chr.addr[9:0] = ppu.addr[9:0]; | ||
| assign chr.addr[16:10] = chr_addr[16:10]; | ||
| assign chr.addr[17] = | ||
| block_sel[2:1] == 3 ? chr_addr[17] : block_sel[0]; | ||
| assign chr.addr[19:18] = block_sel[2:1]; | ||
|
|
||
| //A10-Vmir, A11-Hmir | ||
| assign mao.ciram_a10 = ciram_a10; | ||
| assign mao.ciram_ce = !ppu.addr[13]; | ||
|
|
||
| assign mao.irq = !irq_n; | ||
| //************************************************************* mapper implementation below | ||
|
|
||
| wire irq_n; | ||
| wire ciram_a10; | ||
| wire ram_ce; | ||
| wire ram_ce_n; | ||
| wire ram_we_n; | ||
| wire prg_ce_n; | ||
| wire [20:13]prg_addr; | ||
| wire [17:10]chr_addr; | ||
| wire [2:0]block_sel; | ||
|
|
||
| wire [7:0]sst_di; | ||
|
|
||
| chip_mmc3 mmc3_inst( | ||
|
|
||
| .cpu_data(cpu.data[7:0]), | ||
| .cpu_a14(cpu.addr[14]), | ||
| .cpu_a13(cpu.addr[13]), | ||
| .cpu_a0(cpu.addr[0]), | ||
| .cpu_ce_n(!cpu.addr[15]), | ||
| .cpu_rw(cpu.rw), | ||
| .cpu_m2(cpu.m2), | ||
| .ppu_addr(ppu.addr[12:10]), | ||
|
|
||
| .irq_n(irq_n), | ||
| .ciram_a10(ciram_a10), | ||
| .ram_ce(ram_ce), | ||
| .ram_ce_n(ram_ce_n), | ||
| .ram_we_n(ram_we_n), | ||
| .prg_ce_n(prg_ce_n), | ||
| .prg_addr(prg_addr), | ||
| .chr_addr(chr_addr), | ||
|
|
||
| .clk(mai.clk), | ||
| .rst(mai.map_rst), | ||
| .map_sub(mai.cfg.map_sub), | ||
| .mir_h(cfg.mir_h), | ||
| .cpu_m3(cpu.m3), | ||
|
|
||
| .sst(sst), | ||
| .sst_di(sst_di), | ||
| .block_sel(block_sel) | ||
| ); | ||
|
|
||
|
|
||
|
|
||
| endmodule | ||
|
|
||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is a very minor copy-paste change of map_004.sv.