rename to gemma
add gemmaegui
This commit is contained in:
1 parent
067164c657
commit
4217571ded
31 files changed
+2240
-84
No files matched your search
Generated
-5
@@ -1,5 +0,0 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# Editor-based HTTP Client requests
|
||||
/httpRequests/
|
||||
Generated
-8
@@ -1,8 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/trevors_chip8_toy.iml" filepath="$PROJECT_DIR$/.idea/trevors_chip8_toy.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
Generated
-6
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
Binary file not shown.
Generated
+2115
-57
File diff suppressed because it is too large.
Load diff
+3
-2
@@ -1,3 +1,4 @@
|
||||
[workspace]
|
||||
members = ["emma"]
|
||||
resolver = "2"
|
||||
members = ["gemma", "gemmaegui"]
|
||||
resolver = "2"
|
||||
|
||||
Binary file not shown.
Whitespace-only changes.
@@ -1,5 +1,5 @@
|
||||
[package]
|
||||
name = "emmaemu"
|
||||
name = "gemmaemu"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
autobenches = true
|
||||
File renamed without changes.
@@ -1,7 +1,7 @@
|
||||
use std::default::Default;
|
||||
use std::fs::DirEntry;
|
||||
use std::time::Instant;
|
||||
use emmaemu::{
|
||||
use gemmaemu::{
|
||||
chip8::computer::Chip8Computer,
|
||||
constants::{CHIP8_MEMORY_SIZE, CHIP8_VIDEO_HEIGHT, CHIP8_VIDEO_WIDTH},
|
||||
};
|
||||
@@ -9,7 +9,7 @@ use imgui::*;
|
||||
use ratatui::symbols::half_block;
|
||||
use sys::{ImColor, ImVec2, ImVector_ImU32};
|
||||
use rand::random;
|
||||
use emmaemu::chip8::system_memory::Chip8SystemMemory;
|
||||
use gemmaemu::chip8::system_memory::Chip8SystemMemory;
|
||||
use support::emmagui_support::EmmaGui;
|
||||
mod support;
|
||||
|
||||
File renamed without changes.
File renamed without changes.
@@ -5,9 +5,9 @@ use std::thread::sleep;
|
||||
use std::time::Duration;
|
||||
use imgui::{Condition, ImColor32, Ui};
|
||||
use log::debug;
|
||||
use emmaemu::chip8::computer::Chip8Computer;
|
||||
use emmaemu::chip8::system_memory::Chip8SystemMemory;
|
||||
use emmaemu::constants::{CHIP8_VIDEO_HEIGHT, CHIP8_VIDEO_WIDTH};
|
||||
use gemmaemu::chip8::computer::Chip8Computer;
|
||||
use gemmaemu::chip8::system_memory::Chip8SystemMemory;
|
||||
use gemmaemu::constants::{CHIP8_VIDEO_HEIGHT, CHIP8_VIDEO_WIDTH};
|
||||
use crate::UiState;
|
||||
|
||||
|
||||
File renamed without changes.
@@ -41,6 +41,9 @@ impl Default for Chip8Computer {
|
||||
}
|
||||
|
||||
impl Chip8Computer {
|
||||
pub fn reset(&mut self) -> Self{
|
||||
Self::default()
|
||||
}
|
||||
|
||||
pub fn dump_keypad_to_string(&self) -> String {
|
||||
self.keypad.format_as_string()
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "gemmaegui"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
gemmaemu = { path = "../gemma" }
|
||||
egui = "0.29.1"
|
||||
eframe = "0.29.1"
|
||||
@@ -0,0 +1,104 @@
|
||||
|
||||
use eframe::egui;
|
||||
use egui::Ui;
|
||||
use gemmaemu::chip8::computer::Chip8Computer;
|
||||
|
||||
struct EmmaEGuiState {
|
||||
pub display_video: bool,
|
||||
pub display_memory: bool,
|
||||
pub display_registers: bool
|
||||
}
|
||||
|
||||
impl Default for EmmaEGuiState {
|
||||
fn default() -> Self {
|
||||
Self { display_video: true,
|
||||
display_memory: true,
|
||||
display_registers: true }
|
||||
}
|
||||
}
|
||||
|
||||
fn controls_view(mut system: &mut Chip8Computer, state: &mut EmmaEGuiState, ui: &mut Ui) {
|
||||
if ui.button("Step").clicked() {
|
||||
system.step_system();
|
||||
}
|
||||
if ui.button("Start").clicked() {
|
||||
println!("Start");
|
||||
}
|
||||
if ui.button("Stop").clicked() {
|
||||
println!("STOP");
|
||||
|
||||
}
|
||||
if ui.button("Reset").clicked() {
|
||||
|
||||
}
|
||||
|
||||
ui.checkbox(&mut state.display_memory, "Display Memory");
|
||||
ui.checkbox(&mut state.display_video, "Display Video");
|
||||
ui.checkbox(&mut state.display_registers, "Display Registers");
|
||||
|
||||
}
|
||||
|
||||
fn registers_view(system: &Chip8Computer, ui:& mut Ui) {
|
||||
ui.label(format!("V0-7: {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} ",
|
||||
system.registers.peek(0x00),
|
||||
system.registers.peek(0x01),
|
||||
system.registers.peek(0x02),
|
||||
system.registers.peek(0x03),
|
||||
system.registers.peek(0x04),
|
||||
system.registers.peek(0x05),
|
||||
system.registers.peek(0x06),
|
||||
system.registers.peek(0x07)
|
||||
));
|
||||
ui.label(format!("V8-F: {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} {:02x} ",
|
||||
system.registers.peek(0x08),
|
||||
system.registers.peek(0x09),
|
||||
system.registers.peek(0x0A),
|
||||
system.registers.peek(0x0B),
|
||||
system.registers.peek(0x0C),
|
||||
system.registers.peek(0x0D),
|
||||
system.registers.peek(0x0E),
|
||||
system.registers.peek(0x0F)
|
||||
));
|
||||
ui.label(format!("PC: {:04x}\tI: {:04x}" , system.registers.peek_pc(), system.registers.peek_i()));
|
||||
}
|
||||
|
||||
fn video_view(system: &Chip8Computer, ui: &mut Ui) {
|
||||
ui.label("Video goes here");
|
||||
}
|
||||
|
||||
fn memory_view(system: &Chip8Computer, ui: &mut Ui) {
|
||||
ui.label("Memory View");
|
||||
}
|
||||
|
||||
|
||||
fn main() -> eframe::Result {
|
||||
println!("Taxation is Theft");
|
||||
|
||||
let options = eframe::NativeOptions {
|
||||
viewport: egui::ViewportBuilder::default().with_inner_size([320.0, 240.0]),
|
||||
..Default::default()
|
||||
};
|
||||
|
||||
let mut state = EmmaEGuiState::default();
|
||||
let mut computer = Chip8Computer::new();
|
||||
|
||||
eframe::run_simple_native("EGUI Emma", options, move |ctx, _frame| {
|
||||
egui::CentralPanel::default().show(ctx, |ui| {
|
||||
ui.heading("Gemma");
|
||||
|
||||
controls_view(&mut computer, &mut state, ui);
|
||||
|
||||
if state.display_memory {
|
||||
memory_view(&computer, ui);
|
||||
}
|
||||
|
||||
if state.display_video {
|
||||
video_view(&computer, ui);
|
||||
}
|
||||
|
||||
if state.display_registers {
|
||||
registers_view(&computer, ui);
|
||||
}
|
||||
});
|
||||
})
|
||||
}
|
||||
Reference in new issue
Block a user