From 8e355fd29584686b4a9dfae3dda47eb5896eff26 Mon Sep 17 00:00:00 2001 From: Bruno Duarte Gouveia Date: Thu, 27 Dec 2018 20:40:47 +0000 Subject: [PATCH] GBC: missing toggle after rebase --- Gameboy.sv | 4 +++- gb.v | 7 ++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Gameboy.sv b/Gameboy.sv index 0c0628a..e8985f5 100644 --- a/Gameboy.sv +++ b/Gameboy.sv @@ -133,7 +133,7 @@ localparam CONF_STR1 = { "GAMEBOY;;", "-;", "FS,GBCGB,Load ROM;", - "OB,System,Gameboy;", //Stub to disambiguate loading hybrid .gbc games in original gb mode + "OB,System,Gameboy,Gameboy Color;", "-;", "OC,Inverted color,No,Yes;", "O1,Palette,Grayscale,Custom;" @@ -502,6 +502,7 @@ wire speed; gb gb ( .reset ( reset ), .clk ( clk_cpu ), // the whole gameboy runs on 4mhnz + .clk2x ( clk_cpu2x ), // ~8MHz in dualspeed mode (GBC) .fast_boot ( status[2] ), .joystick ( joystick ), @@ -576,6 +577,7 @@ assign VGA_VS = video_vs; wire ce_cpu2x = ce_pix; wire clk_cpu = clk_sys & ce_cpu; +wire clk_cpu2x = clk_sys & ce_pix; reg ce_pix, ce_cpu; always @(negedge clk_sys) begin diff --git a/gb.v b/gb.v index 177225c..2523361 100644 --- a/gb.v +++ b/gb.v @@ -532,13 +532,14 @@ end // ------------------------ internal boot rom ------------------------- // -------------------------------------------------------------------- -// writing 01 to $ff50 disables the internal rom +// writing 01(GB) or 11(GBC) to $ff50 disables the internal rom reg boot_rom_enabled; always @(posedge clk) begin if(reset) boot_rom_enabled <= 1'b1; - else if((cpu_addr == 16'hff50) && !cpu_wr_n && cpu_do[0]) - boot_rom_enabled <= 1'b0; + else if((cpu_addr == 16'hff50) && !cpu_wr_n) + if ((isGBC && cpu_do[7:0]==8'h11) || (!isGBC && cpu_do[0])) + boot_rom_enabled <= 1'b0; end // combine boot rom data with cartridge data