-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass the bootrom into the interconnect
We created a fixed length bootrom area, so we can stick with a (fixed length) array. The type of an array is the type of its elements AND its length - [u8; 16] != [u8; 32] The compiler was complaining about not knowing the length, so I stuck with [u8; gameboy::BOOTROM_SIZE] over just using Vec<u8>.
- Loading branch information
Jonathan Dahan
committed
May 30, 2016
1 parent
b0107e3
commit 12328eb
Showing
4 changed files
with
51 additions
and
18 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,13 +1,18 @@ | ||
use gameboy; | ||
const RAM_SIZE: usize = 8 * 1024; | ||
|
||
pub struct Interconnect { | ||
mem: [u8; RAM_SIZE] | ||
boot: [u8; gameboy::BOOTROM_SIZE], | ||
wram: [u8; RAM_SIZE], | ||
vram: [u8; RAM_SIZE] | ||
} | ||
|
||
impl Default for Interconnect { | ||
fn default() -> Interconnect { | ||
impl Interconnect { | ||
pub fn new(boot: [u8; gameboy::BOOTROM_SIZE]) -> Interconnect { | ||
Interconnect { | ||
mem: [0; RAM_SIZE] | ||
boot: boot, | ||
vram: [0; RAM_SIZE], | ||
wram: [0; RAM_SIZE] | ||
} | ||
} | ||
} |
This file contains 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