Skip to content

Commit

Permalink
Move gameboy to lib
Browse files Browse the repository at this point in the history
  • Loading branch information
choffmann committed Dec 30, 2023
1 parent 14cfdc1 commit bacc6d0
Show file tree
Hide file tree
Showing 18 changed files with 50 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/target
**/target
/rom
4 changes: 4 additions & 0 deletions .idea/gameboy.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 14 additions & 0 deletions gameboy-bin/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions gameboy-bin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[package]
name = "gameboy-bin"
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
gameboy = { path = "../gameboy-lib" }
11 changes: 11 additions & 0 deletions gameboy-bin/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
extern crate gameboy;

fn main() {
let boot_rom = load_boot_rom();
boot_rom.iter().for_each(|n|println!("{:x}", n));
gameboy::start_gameboy(boot_rom);
}

fn load_boot_rom() -> Vec<u8> {
return std::fs::read("/mnt/datahub/projects/emulation/gameboy/rom/dmg_boot.bin").expect("Error while reading boot rom")
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 11 additions & 0 deletions gameboy-lib/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
use crate::cpu::cpu::CPU;

pub mod cpu;
mod memory;

pub fn start_gameboy(boot_rom: Vec<u8>) {
let mut cpu = CPU::boot(boot_rom);
loop {
cpu.step();
}
}
File renamed without changes.
16 changes: 0 additions & 16 deletions src/main.rs

This file was deleted.

0 comments on commit bacc6d0

Please sign in to comment.