diff --git a/src/decoder.rs b/src/decoder.rs index ec958c0..760509f 100644 --- a/src/decoder.rs +++ b/src/decoder.rs @@ -206,8 +206,10 @@ impl Instruction { // LDS32 STS32 pub fn size(&self) -> usize { match *self { - Instruction::JMP(_) | Instruction::CALL(_) | - Instruction::STS16(_, _) | Instruction::LDS16(_, _) => 4, + Instruction::JMP(_) + | Instruction::CALL(_) + | Instruction::STS16(_, _) + | Instruction::LDS16(_, _) => 4, _ => 2, } } @@ -310,12 +312,18 @@ pub fn decode(data: &[u8]) -> Result { let b = (v & 0b0111) as u8; match v & 0b1111_1111_0000_0000 { 0b1001_0110_0000_0000 => { - return Ok(Instruction::ADIW(((d & 0b11) * 2 + 24).into(), u16::from(K))) + return Ok(Instruction::ADIW( + ((d & 0b11) * 2 + 24).into(), + u16::from(K), + )) } 0b0000_0001_0000_0000 => return Ok(Instruction::MOVW((d * 2).into(), (r * 2).into())), 0b0000_0010_0000_0000 => return Ok(Instruction::MULS((d + 16).into(), (r + 16).into())), 0b1001_0111_0000_0000 => { - return Ok(Instruction::SBIW(((d & 0b11) * 2 + 24).into(), u16::from(K))) + return Ok(Instruction::SBIW( + ((d & 0b11) * 2 + 24).into(), + u16::from(K), + )) } 0b1110_1111_0000_0000 => if r == 0b1111 { return Ok(Instruction::SER((d + 16).into())); diff --git a/src/main.rs b/src/main.rs index c9f9536..391855e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -29,7 +29,11 @@ fn main() { ); info!(log, "AVREmu starting up"); - let rom = read_file(std::env::args().nth(1).unwrap_or_else(|| "rom.bin".to_string())).unwrap(); + let rom = read_file( + std::env::args() + .nth(1) + .unwrap_or_else(|| "rom.bin".to_string()), + ).unwrap(); let mut chip = chip::Chip::new(log.clone(), rom);