Skip to content

Commit

Permalink
Bring in changes from mister core repro
Browse files Browse the repository at this point in the history
  • Loading branch information
budude2 committed Jun 18, 2024
1 parent 753570a commit 5eccd7e
Show file tree
Hide file tree
Showing 9 changed files with 128 additions and 106 deletions.
4 changes: 2 additions & 2 deletions pkg/gb/Cores/budude2.GB/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"description": "Game Boy",
"author": "budude2",
"url": "https://github.com/budude2/openfpga-GBC",
"version": "1.2.1",
"date_release": "2024-05-27"
"version": "1.2.2",
"date_release": "2024-06-17"
},
"framework": {
"target_product": "Analogue Pocket",
Expand Down
Binary file modified pkg/gb/Cores/budude2.GB/gb.rbf_r
Binary file not shown.
4 changes: 2 additions & 2 deletions pkg/gbc/Cores/budude2.GBC/core.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"description": "Game Boy Color",
"author": "budude2",
"url": "https://github.com/budude2/openfpga-GBC",
"version": "1.2.1",
"date_release": "2024-05-27"
"version": "1.2.2",
"date_release": "2024-06-17"
},
"framework": {
"target_product": "Analogue Pocket",
Expand Down
Binary file modified pkg/gbc/Cores/budude2.GBC/gbc.rbf_r
Binary file not shown.
6 changes: 3 additions & 3 deletions src/apf/build_id.mif
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ DATA_RADIX = HEX;
CONTENT
BEGIN

0E0 : 20240527;
0E1 : 00101448;
0E2 : 9aad315e;
0E0 : 20240617;
0E1 : 00215826;
0E2 : 5986fad0;

END;
7 changes: 4 additions & 3 deletions src/gb/cart.v
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ module cart_top (
input [7:0] Savestate_CRAMWriteData,
output [7:0] Savestate_CRAMReadData,
output rumbling
);
);
///////////////////////////////////////////////////


Expand Down Expand Up @@ -277,11 +277,12 @@ always @(posedge clk_sys) begin
mmm01 <= 0;
{ sachen, sachen_t1, sachen_t2 } <= 0;
mapper_sel_r <= mapper_sel;
rom_mask <= 9'd0;
end

if(cart_download & ioctl_wr) begin

rom_mask <= ioctl_addr[22:14];
rom_mask <= ioctl_addr[22:14] | rom_mask;

if (megaduck) begin
cart_cgb_flag <= 0;
Expand Down Expand Up @@ -420,7 +421,7 @@ assign ram_mask_file = // 0 - no ram

assign has_save = mbc_battery && (cart_ram_size > 0 || mbc2 || mbc7 || tama);

//Up to 8kb * 16banks of Cart Ram (128kb)
// Up to 8kb * 16banks of Cart Ram (128kb)
dpram #(16) cram_l (
.clock_a (clk_sys),
.address_a (cram_addr[16:1]),
Expand Down
15 changes: 7 additions & 8 deletions src/gb/gb.v
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ wire [63:0] SaveStateBus_wired_or[0:SAVESTATE_MODULES-1];

wire [56:0] SS_Top;
wire [56:0] SS_Top_BACK;
eReg_SavestateV #(0, 31, 56, 0, 64'h0000000000800001) iREG_SAVESTATE_Top (clk_sys, SaveStateBus_Din, SaveStateBus_Adr, SaveStateBus_wren, SaveStateBus_rst, SaveStateBus_wired_or[6], SS_Top_BACK, SS_Top);
eReg_SavestateV #(0, 31, 56, 0, 64'h0000000000800000) iREG_SAVESTATE_Top (clk_sys, SaveStateBus_Din, SaveStateBus_Adr, SaveStateBus_wren, SaveStateBus_rst, SaveStateBus_wired_or[6], SS_Top_BACK, SS_Top);

wire [10:0] SS_Top2;
wire [10:0] SS_Top2_BACK;
Expand Down Expand Up @@ -861,8 +861,10 @@ wire [12:0] wram_addr_i = ~isGBC ? ext_bus_addr[12:0] :
dma_read_wram_bus ? dma_addr[12:0] :
cpu_addr[12:0];

wire [14:0] wram_addr = (wram_addr_i[12]) ? { wram_bank, wram_addr_i[11:0] } // bank 1-7 $D000-DFFF
: { 3'd0, wram_addr_i[11:0] }; // bank 0 $C000-CFFF
// 0 -> 1
wire [2:0] wram_bank_o = (!wram_bank ? 3'd1 : wram_bank);
wire [14:0] wram_addr = (wram_addr_i[12]) ? { wram_bank_o, wram_addr_i[11:0] } // bank 1-7 $D000-DFFF
: { 3'd0, wram_addr_i[11:0] }; // bank 0 $C000-CFFF

dpram #(15) wram (
.clock_a (clk_cpu),
Expand All @@ -883,12 +885,9 @@ assign SS_Top_BACK[2:0] = wram_bank;

always @(posedge clk_sys) begin
if(reset_ss)
wram_bank <= SS_Top[2:0]; // 3'd1;
wram_bank <= SS_Top[2:0]; // 3'd0;
else if(ce_cpu && sel_wram_bank && !cpu_wr_n_edge) begin
if (cpu_do[2:0]==3'd0) // 0 -> 1;
wram_bank <= 3'd1;
else
wram_bank <= cpu_do[2:0];
wram_bank <= cpu_do[2:0];
end
end

Expand Down
3 changes: 2 additions & 1 deletion src/gb/sgb.v
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,9 @@ always @(posedge clk_sys) begin
if (reset) begin
joypad_id <= 0;
end else if (ce) begin
joypad_id <= (joypad_id & mlt_ctrl);
if (sgb_en & ~old_p15 & p15) begin
joypad_id <= (joypad_id + 1'b1) & mlt_ctrl;
joypad_id <= (joypad_id + 1'b1);
end
end
end
Expand Down
Loading

0 comments on commit 5eccd7e

Please sign in to comment.