diff --git a/src/bin/cli.yml b/src/bin/cli.yml index 86245da..949460a 100644 --- a/src/bin/cli.yml +++ b/src/bin/cli.yml @@ -15,4 +15,7 @@ subcommands: long: game-rom takes_value: true help: Sets the game-rom file to use - required: true \ No newline at end of file + required: true + - skip_bios: + long: skip-bios + help: Skip running bios and start from the ROM instead. \ No newline at end of file diff --git a/src/bin/main.rs b/src/bin/main.rs index 61e2a6c..a1c14b2 100644 --- a/src/bin/main.rs +++ b/src/bin/main.rs @@ -12,6 +12,11 @@ use rustboyadvance_ng::util::read_bin_file; use rustboyadvance_ng::{GBAResult, GameBoyAdvance}; fn run_debug(matches: &ArgMatches) -> GBAResult<()> { + let skip_bios = match matches.occurrences_of("skip_bios") { + 0 => false, + _ => true + }; + let bios_bin = read_bin_file(matches.value_of("bios").unwrap_or_default())?; let rom_bin = read_bin_file(matches.value_of("game_rom").unwrap())?; @@ -21,6 +26,19 @@ fn run_debug(matches: &ArgMatches) -> GBAResult<()> { let mut core = Core::new(); core.reset(); core.set_verbose(true); + if skip_bios { + core.gpr[13] = 0x0300_7f00; + core.gpr_banked_r13[0] = 0x0300_7f00; // USR/SYS + core.gpr_banked_r13[0] = 0x0300_7f00; // FIQ + core.gpr_banked_r13[0] = 0x0300_7fa0; // IRQ + core.gpr_banked_r13[0] = 0x0300_7fe0; // SVC + core.gpr_banked_r13[0] = 0x0300_7f00; // ABT + core.gpr_banked_r13[0] = 0x0300_7f00; // UND + + core.pc = 0x0800_0000; + + core.cpsr.set(0x5f); + } let gba = GameBoyAdvance::new(core, bios_bin, gamepak);