emma now has ability to decode an instruction and to display video and system memory
This commit is contained in:
+31
-19
@@ -9,21 +9,20 @@ impl Chip8Registers {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pub struct Chip8InstructionParameter {
|
||||
mask: u16
|
||||
pub mask: u16
|
||||
}
|
||||
|
||||
struct Chip8Instruction {
|
||||
id: String,
|
||||
mask: u16,
|
||||
pattern: u16,
|
||||
arguments: Vec<Chip8InstructionParameter>,
|
||||
description: Box<str>
|
||||
pub struct Chip8Instruction {
|
||||
pub id: String,
|
||||
pub mask: u16,
|
||||
pub pattern: u16,
|
||||
pub arguments: Vec<Chip8InstructionParameter>,
|
||||
pub description: Box<str>
|
||||
}
|
||||
|
||||
pub fn fill_chip8_instructions() {
|
||||
let full_instruction_set = vec![
|
||||
pub fn fill_chip8_instructions() -> [Chip8Instruction; 34] {
|
||||
[
|
||||
Chip8Instruction {
|
||||
id: "SYS".to_string(),
|
||||
mask: 0x00,
|
||||
@@ -128,7 +127,7 @@ pub fn fill_chip8_instructions() {
|
||||
mask: 0x00ff
|
||||
}
|
||||
],
|
||||
description: "TBD".into()
|
||||
description: "Add value in register 0x0f00 with value 0x00ff".into()
|
||||
},
|
||||
Chip8Instruction {
|
||||
id: "CPY".to_string(),
|
||||
@@ -142,7 +141,7 @@ pub fn fill_chip8_instructions() {
|
||||
mask: 0x00f0
|
||||
}
|
||||
],
|
||||
description: "TBD".into()
|
||||
description: "Copy value between Register X and Y".into()
|
||||
},
|
||||
Chip8Instruction {
|
||||
id: "OR".to_string(),
|
||||
@@ -366,7 +365,7 @@ pub fn fill_chip8_instructions() {
|
||||
mask: 0x0f00
|
||||
}
|
||||
],
|
||||
description: "TBD".into()
|
||||
description: "Wait for a Key to be pressed".into()
|
||||
},
|
||||
Chip8Instruction {
|
||||
id: "LDT".to_string(),
|
||||
@@ -377,7 +376,7 @@ pub fn fill_chip8_instructions() {
|
||||
mask: 0x0f00
|
||||
}
|
||||
],
|
||||
description: "TBD".into()
|
||||
description: "Load Data Timer".into()
|
||||
},
|
||||
Chip8Instruction {
|
||||
id: "LST".to_string(),
|
||||
@@ -388,7 +387,7 @@ pub fn fill_chip8_instructions() {
|
||||
mask: 0x0f00
|
||||
}
|
||||
],
|
||||
description: "TBD".into()
|
||||
description: "Load Sound Timer".into()
|
||||
},
|
||||
Chip8Instruction {
|
||||
id: "ADDI".to_string(),
|
||||
@@ -399,7 +398,7 @@ pub fn fill_chip8_instructions() {
|
||||
mask: 0x0f00
|
||||
}
|
||||
],
|
||||
description: "TBD".into()
|
||||
description: "Add register with value at I".into()
|
||||
},
|
||||
Chip8Instruction {
|
||||
id: "SETI".to_string(),
|
||||
@@ -432,7 +431,7 @@ pub fn fill_chip8_instructions() {
|
||||
mask: 0x0f00
|
||||
}
|
||||
],
|
||||
description: "TBD".into()
|
||||
description: "Store value in register X at offset I".into()
|
||||
},
|
||||
Chip8Instruction {
|
||||
id: "MLOAD".to_string(),
|
||||
@@ -443,7 +442,20 @@ pub fn fill_chip8_instructions() {
|
||||
mask: 0x0f00
|
||||
}
|
||||
],
|
||||
description: "TBD".into()
|
||||
description: "Load value into register X at offset I".into()
|
||||
}
|
||||
];
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
struct Chip8System {
|
||||
|
||||
}
|
||||
|
||||
impl Chip8System {
|
||||
|
||||
}
|
||||
|
||||
trait CpuInstruction {
|
||||
fn execute(input: Chip8System) -> Chip8System;
|
||||
}
|
||||
@@ -7,7 +7,6 @@ pub struct Chip8Display {
|
||||
impl Chip8Display {
|
||||
pub fn tick(self: &Self) {
|
||||
println!("Ticking the display");
|
||||
|
||||
}
|
||||
|
||||
pub fn render_chip8_display(to_render: Chip8Display) {
|
||||
|
||||
Reference in New Issue
Block a user