fixed glaring flaw where emulator ignores -b flag. Keyboard polling isn't that important, this emulator is now usable

This commit is contained in:
abbie 2022-06-14 19:12:05 +01:00
parent a71da555bd
commit 13b3ec4b8d
No known key found for this signature in database
GPG key ID: 04DDE463F9200F87
2 changed files with 3 additions and 4 deletions

View file

@ -328,7 +328,6 @@ fn execute(opcode: u32, instruction: Instruction, mut cpu: Cpu) -> Cpu {
i = i + 1; i = i + 1;
} }
} }
if instruction.name == "NOP" { if instruction.name == "NOP" {
cpu.incrementpc(); cpu.incrementpc();
} else if instruction.name == "LOAD_MEM_REG" { } else if instruction.name == "LOAD_MEM_REG" {
@ -532,7 +531,7 @@ fn uperipherals(mut cpu: Cpu) -> Cpu {
#[allow(unreachable_code)] #[allow(unreachable_code)]
pub fn emulate(debug: bool, keyboarddisable: bool) -> io::Result<()> { pub fn emulate(debug: bool, keyboarddisable: bool, file: String) -> io::Result<()> {
let stdin = 0; let stdin = 0;
let mut stdout = io::stdout(); let mut stdout = io::stdout();
@ -546,7 +545,7 @@ pub fn emulate(debug: bool, keyboarddisable: bool) -> io::Result<()> {
println!("If you see anything about opcodes above, there's a bug!"); println!("If you see anything about opcodes above, there's a bug!");
} }
let mut f = File::open("program.rom")?; let mut f = File::open(file)?;
let mut buffer: Vec<u8> = vec![]; let mut buffer: Vec<u8> = vec![];
if debug { println!("Buffer initialised!"); } if debug { println!("Buffer initialised!"); }

View file

@ -28,6 +28,6 @@ fn main() {
let args = Args::parse(); let args = Args::parse();
if args.platform == "food8" { if args.platform == "food8" {
food8::emulate(args.debug, args.keyboarddisable); food8::emulate(args.debug, args.keyboarddisable, args.binary);
} }
} }