diff options
author | Oxore <oxore@protonmail.com> | 2020-03-05 00:51:20 +0300 |
---|---|---|
committer | Oxore <oxore@protonmail.com> | 2020-03-05 00:51:20 +0300 |
commit | 64858ac87fe13b877682e7b8813c06359e45a0fc (patch) | |
tree | 008f9da5cb29fb82632a40be46ea540f76ab2a78 | |
parent | 19e0e4cb5f26df537bf07b428700bea30460fd5b (diff) |
-rw-r--r-- | src/cpu8051.rs | 8 | ||||
-rw-r--r-- | src/main.rs | 6 | ||||
-rw-r--r-- | src/ram.rs | 4 |
3 files changed, 9 insertions, 9 deletions
diff --git a/src/cpu8051.rs b/src/cpu8051.rs index 8702484..c76e9b6 100644 --- a/src/cpu8051.rs +++ b/src/cpu8051.rs @@ -4,9 +4,9 @@ use super::ram::Ram; use super::ram::RAM_OFFSET_ACC; use super::ram::RAM_OFFSET_SP; +use std::cell::RefCell; use std::fmt; use std::rc::Rc; -use std::cell::RefCell; #[derive(Debug, Clone, Copy)] pub enum Opname { @@ -486,7 +486,9 @@ impl Cpu8051 { fn fetch_operand(&self, operand: IncompleteOperand, offset: u16) -> Operand { match operand { IncompleteOperand::Acc => Operand::Acc, - IncompleteOperand::Direct => Operand::Direct(self.progmem.borrow().get(self.pc + offset)), + IncompleteOperand::Direct => { + Operand::Direct(self.progmem.borrow().get(self.pc + offset)) + } IncompleteOperand::Data => Operand::Data(self.progmem.borrow().get(self.pc + offset)), IncompleteOperand::Data16 => Operand::Data16({ let high = self.progmem.borrow().get(self.pc + offset); @@ -586,7 +588,7 @@ impl Cpu8051 { other ), }; - self.extmem.borrow_mut().set(dest as u16 ,value); + self.extmem.borrow_mut().set(dest as u16, value); } fn push(&mut self, operand: Operand) { diff --git a/src/main.rs b/src/main.rs index 5aa3307..cc5b707 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,16 +1,16 @@ extern crate clap; +use std::cell::RefCell; use std::fs; use std::io; use std::io::prelude::*; +use std::rc::Rc; use std::sync::mpsc::{channel, Receiver, Sender}; use std::thread; use std::time::Duration; -use std::rc::Rc; -use std::cell::RefCell; -mod cpu8051; mod bus; +mod cpu8051; mod progmem; mod ram; @@ -33,9 +33,7 @@ impl Ram { let mut array = [0; u8::max_value() as usize + 1]; array[RAM_OFFSET_SP as usize] = RESET_VALUE_SP; array[RAM_OFFSET_ACC as usize] = RESET_VALUE_ACC; - Self { - array, - } + Self { array } } } |