reorganize files
This commit is contained in:
parent
c5079fd307
commit
b3d45f8abd
@ -1,9 +1,11 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
|
|
||||||
mod vm;
|
mod vm;
|
||||||
|
use crate::vm::vm::*;
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
let lc3 = vm::VM::new();
|
let lc3 = VM::new();
|
||||||
// let mut lc3 = VM::new();
|
// let mut lc3 = VM::new();
|
||||||
// let args: Vec<String> = env::args().collect();
|
// let args: Vec<String> = env::args().collect();
|
||||||
// let path = args.get(1).expect("a file must be specified");
|
// let path = args.get(1).expect("a file must be specified");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![allow(unused_variables)]
|
#![allow(unused_variables)]
|
||||||
|
|
||||||
use crate::vm::VM;
|
use crate::vm::vm::VM;
|
||||||
|
|
||||||
enum Opcode {
|
enum Opcode {
|
||||||
BR = 0,
|
BR = 0,
|
@ -1,3 +1,3 @@
|
|||||||
pub mod virtmem;
|
|
||||||
pub mod isa;
|
pub mod isa;
|
||||||
|
pub mod mem;
|
||||||
pub mod vm;
|
pub mod vm;
|
@ -1,21 +1,21 @@
|
|||||||
#![allow(dead_code)]
|
#![allow(dead_code)]
|
||||||
#![allow(unused)]
|
#![allow(unused)]
|
||||||
|
|
||||||
use crate::virtmem::Memory;
|
use crate::vm::mem::*;
|
||||||
|
|
||||||
const PC_START: u16 = 0x300;
|
const PC_START: u16 = 0x300;
|
||||||
|
|
||||||
pub struct Registers {
|
struct Registers {
|
||||||
pub r0: u16,
|
r0: u16,
|
||||||
pub r1: u16,
|
r1: u16,
|
||||||
pub r2: u16,
|
r2: u16,
|
||||||
pub r3: u16,
|
r3: u16,
|
||||||
pub r4: u16,
|
r4: u16,
|
||||||
pub r5: u16,
|
r5: u16,
|
||||||
pub r6: u16,
|
r6: u16,
|
||||||
pub r7: u16,
|
r7: u16,
|
||||||
pub pc: u16,
|
pc: u16,
|
||||||
pub cond: u16,
|
cond: u16,
|
||||||
}
|
}
|
||||||
|
|
||||||
enum ConditionFlags {
|
enum ConditionFlags {
|
||||||
@ -86,8 +86,8 @@ impl Registers {
|
|||||||
|
|
||||||
|
|
||||||
pub struct VM {
|
pub struct VM {
|
||||||
pub memory: Memory,
|
memory: Memory,
|
||||||
pub registers: Registers,
|
registers: Registers,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl VM {
|
impl VM {
|
||||||
@ -99,7 +99,7 @@ impl VM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub fn execute(&mut self) {
|
// fn execute(&mut self) {
|
||||||
// while self.registers.pc < 0x3010 {
|
// while self.registers.pc < 0x3010 {
|
||||||
// let instruction = self.memory.get(self.registers.pc);
|
// let instruction = self.memory.get(self.registers.pc);
|
||||||
// match instruction >> 12 {
|
// match instruction >> 12 {
|
Loading…
x
Reference in New Issue
Block a user