Add option to skip bios code so I can start checking out test roms
Former-commit-id: b78c8d9807ba3097d641a57ec7fcd500b32b4d96
This commit is contained in:
parent
36dba78c55
commit
6dd48c6238
|
@ -15,4 +15,7 @@ subcommands:
|
||||||
long: game-rom
|
long: game-rom
|
||||||
takes_value: true
|
takes_value: true
|
||||||
help: Sets the game-rom file to use
|
help: Sets the game-rom file to use
|
||||||
required: true
|
required: true
|
||||||
|
- skip_bios:
|
||||||
|
long: skip-bios
|
||||||
|
help: Skip running bios and start from the ROM instead.
|
|
@ -12,6 +12,11 @@ use rustboyadvance_ng::util::read_bin_file;
|
||||||
use rustboyadvance_ng::{GBAResult, GameBoyAdvance};
|
use rustboyadvance_ng::{GBAResult, GameBoyAdvance};
|
||||||
|
|
||||||
fn run_debug(matches: &ArgMatches) -> GBAResult<()> {
|
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 bios_bin = read_bin_file(matches.value_of("bios").unwrap_or_default())?;
|
||||||
let rom_bin = read_bin_file(matches.value_of("game_rom").unwrap())?;
|
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();
|
let mut core = Core::new();
|
||||||
core.reset();
|
core.reset();
|
||||||
core.set_verbose(true);
|
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);
|
let gba = GameBoyAdvance::new(core, bios_bin, gamepak);
|
||||||
|
|
||||||
|
|
Reference in a new issue