Adding RAM display

This commit is contained in:
PeronTheDuck 2020-01-21 20:49:37 -03:00
parent 7c1b805f1a
commit 22fac611d8
5 changed files with 887 additions and 133 deletions

Binary file not shown.

View File

@ -21,4 +21,4 @@ macro_rules! prog_err {
}; };
} }
prog_err!(glib::BoolError, crate::emulator::error::EmulatorError); prog_err!(glib::BoolError, crate::sixty_five::error::EmulatorError);

View File

@ -6,8 +6,8 @@ use gio::prelude::*;
use gtk::prelude::*; use gtk::prelude::*;
use gtk::Builder; use gtk::Builder;
mod emulator; mod sixty_five;
use emulator::Emulator; use sixty_five::Emulator;
mod graphic; mod graphic;
use graphic::{Color, Image}; use graphic::{Color, Image};
@ -30,92 +30,115 @@ impl std::convert::From<&str> for Cmd {
} }
} }
pub fn init(app: &gtk::Application) { pub fn init(app: &gtk::Application) -> Result<(), ProgErr> {
let img = Image::new(); let img = Image::new();
let (img_width, img_height) = (img.width, img.height); let (img_width, img_height) = (img.width, img.height);
use std::sync::{Arc, Mutex}; use std::sync::{Arc, Mutex};
let img_m = Arc::from(Mutex::from(img)); let img_m = Arc::from(Mutex::from(img));
let palette = Arc::from(Mutex::from([Color::default(); 16]));
// Handle emulator CMDs
let (tcmd, rcmd) = std::sync::mpsc::channel::<Cmd>(); let (tcmd, rcmd) = std::sync::mpsc::channel::<Cmd>();
let (tdata, rdata) = glib::MainContext::channel(glib::source::Priority::default()); let (tdata, rdata) = glib::MainContext::channel(glib::source::Priority::default());
let emulator = Arc::from(Mutex::from(Emulator::new())); let emulator = Arc::from(Mutex::from(Emulator::new()));
{ {
let emulator_clone = emulator.clone(); let emulator = emulator.clone();
std::thread::spawn(move || { std::thread::spawn(move || loop {
let emulator = emulator_clone; if let Ok(cmd) = rcmd.recv() {
loop { let mut emulator = match emulator.try_lock() {
if let Ok(cmd) = rcmd.recv() { Err(_) => continue,
let mut emulator = match emulator.try_lock() { Ok(v) => v,
Err(_) => continue, };
Ok(v) => v, match cmd {
}; Cmd::Step => {
match cmd { if let Err(e) = emulator.step() {
Cmd::Step => { println!("{:#?}", e);
}
}
Cmd::Reset => {
emulator.restart();
emulator.ram = *include_bytes!("color.hex");
}
Cmd::Run => loop {
if let Ok(_) = rcmd.recv_timeout(std::time::Duration::from_millis(1)) {
break;
} else {
if let Err(e) = emulator.step() { if let Err(e) = emulator.step() {
println!("{:#?}", e); println!("Emulator error: {:?}", e);
}
}
Cmd::Reset => {
emulator.restart();
emulator.ram = *include_bytes!("color.hex");
}
Cmd::Run => loop {
if let Ok(cmd) = rcmd.recv_timeout(std::time::Duration::from_millis(1))
{
break; break;
} else {
emulator.step();
println!("Tick {}", emulator.cycles);
let page_02 = Vec::from(&emulator.ram[0x200..0x300]);
tdata.send(page_02);
} }
}, println!("Tick {}", emulator.cycles);
_ => {} let page_02 = Vec::from(&emulator.ram[0x200..0x300]);
}; tdata.send(page_02);
println!("Tick {}", emulator.cycles); }
let page_02 = Vec::from(&emulator.ram[0x200..0x300]); },
tdata.send(page_02); _ => {}
} };
println!("Tick {}", emulator.cycles);
let page_02 = Vec::from(&emulator.ram[0x200..0x300]);
tdata.send(page_02);
} }
}); });
} }
let builder: Builder = Builder::new_from_string(include_str!("ui.glade")); let builder: Builder = Builder::new_from_string(include_str!("ui.glade"));
let window: gtk::ApplicationWindow = builder.get_object("Window").unwrap(); let window: gtk::ApplicationWindow = builder.get_object("Window").unwrap();
let da: gtk::DrawingArea = builder.get_object("Display").unwrap(); let drawing_area: gtk::DrawingArea = builder.get_object("Display").unwrap();
let drawing_area = Arc::from(drawing_area);
{ {
da.set_size_request(img_width as i32, img_height as i32); drawing_area.set_size_request(img_width as i32, img_height as i32);
let img_m = img_m.clone(); let img_m = img_m.clone();
da.connect_draw(move |_: &gtk::DrawingArea, ctx: &cairo::Context| { drawing_area.connect_draw(
let img: Result<_, _> = img_m.try_lock(); move |drawing_area: &gtk::DrawingArea, ctx: &cairo::Context| {
if let Ok(img) = img { let widget_width = drawing_area.get_allocated_width();
println!("Redrawing!"); let widget_height = drawing_area.get_allocated_height();
img.draw(&ctx); let img: Result<_, _> = img_m.try_lock();
} if let Ok(img) = img {
glib::signal::Inhibit(false) img.draw(&ctx, (widget_width, widget_height));
}); }
glib::signal::Inhibit(false)
},
);
} }
for widget_name in &["Step", "Reset", "Run"] { for widget_name in &["Step", "Reset", "Run", "Stop"] {
let tcmd_clone = tcmd.clone(); let tcmd_clone = tcmd.clone();
let widget: gtk::Button = builder.get_object(widget_name).expect("Not found"); let widget: gtk::Button = builder.get_object(widget_name).expect("Not found");
widget.connect_clicked(move |s: &gtk::Button| { widget.connect_clicked(move |s: &gtk::Button| {
let name = s.get_widget_name().unwrap(); let name = s.get_widget_name().unwrap();
let name = name.as_str(); let name = name.as_str();
println!("Sending from {}", name); println!("Sending from {}", name);
let cmd = Cmd::from(name); tcmd_clone.send(Cmd::from(name)).expect("Couldn't send cmd");
tcmd_clone.send(cmd).expect("Couldn't send cmd");
}); });
} }
// Ram Display
{
let ram_display_window: gtk::Window = builder.get_object("RamDisplayWindow").unwrap();
let switch: gtk::Switch = builder.get_object("RamDisplay").expect("Not Found");
switch.connect_state_set(move |switch: &gtk::Switch, state: bool| {
if state {
ram_display_window.show_all();
} else {
ram_display_window.close();
}
println!("{}", state);
Inhibit(false)
});
let ram_list: gtk::Window = builder.get_object("RamList").unwrap();
}
let registers: gtk::Label = builder.get_object("Registers").unwrap(); let registers: gtk::Label = builder.get_object("Registers").unwrap();
let registers = Mutex::from(registers); let registers = Mutex::from(registers);
// Receive GPU page
{ {
let drawing_area = drawing_area.clone();
let palette = palette.clone();
let emulator = emulator.clone(); let emulator = emulator.clone();
let img_m = img_m.clone(); let img_m = img_m.clone();
rdata.attach(None, move |data: Vec<_>| { rdata.attach(None, move |data: Vec<_>| {
let img: Result<_, _> = img_m.try_lock();
println!("Received page"); println!("Received page");
for line in data.chunks(16) { for line in data.chunks(16) {
println!( println!(
@ -125,24 +148,14 @@ pub fn init(app: &gtk::Application) {
.collect::<String>() .collect::<String>()
) )
} }
if let Ok(mut img) = img { if let Ok(mut img) = img_m.try_lock() {
println!("Updating image");
let (w, h) = (img.width, img.height); let (w, h) = (img.width, img.height);
let pixels: &mut [Color] = &mut img.pixels; let pixels: &mut [Color] = &mut img.pixels;
let palette = [ let palette = palette.lock().expect("Couldn't get palette");
Color::from(0x00_00_00), for y in 0..h {
Color::from(0xFF_00_00), for x in 0..w {
Color::from(0x00_FF_00),
Color::from(0xFF_FF_00),
Color::from(0x00_00_FF),
Color::from(0xFF_00_FF),
Color::from(0x00_FF_FF),
Color::from(0xFF_FF_FF),
];
for x in 0..w {
for y in 0..h {
let i = y * w + x; let i = y * w + x;
pixels[i] = palette[data[i] as usize & 0b111]; pixels[i] = palette[data[i] as usize & 0x0F];
} }
} }
} }
@ -151,19 +164,39 @@ pub fn init(app: &gtk::Application) {
registers.set_text(&format!("{:#?}", emulator.cpu)); registers.set_text(&format!("{:#?}", emulator.cpu));
} }
} }
da.queue_draw(); drawing_area.queue_draw();
glib::Continue(true) glib::Continue(true)
}); });
} }
// Color palette
{
for i in 0..16 {
let drawing_area = drawing_area.clone();
let palette = palette.clone();
let color_button: gtk::ColorButton =
builder.get_object(&format!("ColorPalette{}", i)).unwrap();
color_button.connect_color_set(move |s: &gtk::ColorButton| {
let color = s.get_rgba();
let color = Color::from((color.red, color.green, color.blue));
let mut palette = palette.lock().expect("Couldn't acquire palette lock");
palette[i] = color;
println!("New color: {:?}", color);
drawing_area.queue_draw();
});
color_button.emit("color-set", &[])?;
}
}
window.set_application(Some(app)); window.set_application(Some(app));
window.show_all(); window.show_all();
Ok(())
} }
fn main() -> Result<(), ProgErr> { fn main() -> Result<(), ProgErr> {
let app: gtk::Application = let app: gtk::Application =
gtk::Application::new(Some("com.ducklings_corp.emulator"), Default::default())?; gtk::Application::new(Some("com.ducklings_corp.emulator"), Default::default())?;
app.connect_activate(move |app| init(app)); app.connect_activate(move |app| init(app).expect("Init failed"));
app.run(&std::env::args().collect::<Vec<_>>()); app.run(&std::env::args().collect::<Vec<_>>());
Ok(()) Ok(())
} }

View File

@ -2,6 +2,112 @@
<!-- Generated with glade 3.22.1 --> <!-- Generated with glade 3.22.1 -->
<interface> <interface>
<requires lib="gtk+" version="3.20"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="RamDisplayWindow">
<property name="name">RamDisplayWindow</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">15</property>
<property name="margin_right">15</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">Jump to: </property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Address</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .A. B. C. D. E .F</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkApplicationWindow" id="Window"> <object class="GtkApplicationWindow" id="Window">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="default_width">800</property> <property name="default_width">800</property>
@ -10,20 +116,33 @@
<placeholder/> <placeholder/>
</child> </child>
<child> <child>
<object class="GtkGrid"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="orientation">vertical</property>
<property name="vexpand">True</property>
<child> <child>
<object class="GtkBox"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="hexpand">True</property>
<property name="label" translatable="yes">6502 Emulator</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">expand</property>
<child> <child>
<object class="GtkButton" id="Reset"> <object class="GtkButton" id="Run">
<property name="label" translatable="yes">Reset</property> <property name="label" translatable="yes">Run</property>
<property name="name">Reset</property> <property name="name">Run</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
@ -35,9 +154,9 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="Run"> <object class="GtkButton" id="Stop">
<property name="label" translatable="yes">Run</property> <property name="label" translatable="yes">Stop</property>
<property name="name">Run</property> <property name="name">Stop</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
@ -62,10 +181,37 @@
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="Reset">
<property name="label" translatable="yes">Reset</property>
<property name="name">Reset</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="RamDisplay">
<property name="name">RamDisplay</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="expand">False</property>
<property name="top_attach">1</property> <property name="fill">True</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -76,21 +222,9 @@
<property name="vexpand">True</property> <property name="vexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="expand">True</property>
<property name="top_attach">1</property> <property name="fill">True</property>
</packing> <property name="position">2</property>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">6502 Emulator</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -98,15 +232,234 @@
<property name="name">Registers</property> <property name="name">Registers</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">A: 0x00 X: 0x00 Y: 0x00 PC: 0x000</property> <property name="label" translatable="yes">Registers' status (Reset to see)</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="expand">False</property>
<property name="top_attach">2</property> <property name="fill">True</property>
<property name="position">3</property>
</packing> </packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkGrid" id="ColorPalette">
<property name="name">ColorPalette</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<child>
<object class="GtkColorButton" id="ColorPalette0">
<property name="name">ColorPalette0</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(0,0,0)</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette1">
<property name="name">ColorPalette1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(127,0,0)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette2">
<property name="name">ColorPalette2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(0,127,0)</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette3">
<property name="name">ColorPalette3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(127,127,0)</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette4">
<property name="name">ColorPalette4</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(0,0,127)</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette5">
<property name="name">ColorPalette5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(127,0,127)</property>
</object>
<packing>
<property name="left_attach">5</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette6">
<property name="name">ColorPalette6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(0,127,127)</property>
</object>
<packing>
<property name="left_attach">6</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette7">
<property name="name">ColorPalette7</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(127,127,127)</property>
</object>
<packing>
<property name="left_attach">7</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette8">
<property name="name">ColorPalette8</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(85,85,85)</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette9">
<property name="name">ColorPalette9</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgba(255,85,85,0.9)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette10">
<property name="name">ColorPalette10</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(85,255,85)</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette11">
<property name="name">ColorPalette11</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(255,255,85)</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette12">
<property name="name">ColorPalette12</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(85,85,255)</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette13">
<property name="name">ColorPalette13</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(255,85,255)</property>
</object>
<packing>
<property name="left_attach">5</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette14">
<property name="name">ColorPalette14</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(85,255,255)</property>
</object>
<packing>
<property name="left_attach">6</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette15">
<property name="name">ColorPalette15</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(255,255,255)</property>
</object>
<packing>
<property name="left_attach">7</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child> </child>
</object> </object>
</child> </child>

View File

@ -2,6 +2,127 @@
<!-- Generated with glade 3.22.1 --> <!-- Generated with glade 3.22.1 -->
<interface> <interface>
<requires lib="gtk+" version="3.20"/> <requires lib="gtk+" version="3.20"/>
<object class="GtkWindow" id="RamDisplayWindow">
<property name="name">RamDisplayWindow</property>
<property name="can_focus">False</property>
<child>
<placeholder/>
</child>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_left">15</property>
<property name="margin_right">15</property>
<property name="margin_top">10</property>
<property name="margin_bottom">10</property>
<property name="label" translatable="yes">Jump to: </property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton">
<property name="label" translatable="yes">button</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="pack_type">end</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="vexpand">True</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Address</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">.0 .1 .2 .3 .4 .5 .6 .7 .8 .9 .A. B. C. D. E .F</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkApplicationWindow" id="Window"> <object class="GtkApplicationWindow" id="Window">
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="default_width">800</property> <property name="default_width">800</property>
@ -10,20 +131,33 @@
<placeholder/> <placeholder/>
</child> </child>
<child> <child>
<object class="GtkGrid"> <object class="GtkBox">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="hexpand">True</property> <property name="orientation">vertical</property>
<property name="vexpand">True</property>
<child> <child>
<object class="GtkBox"> <object class="GtkLabel">
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="orientation">vertical</property> <property name="hexpand">True</property>
<property name="label" translatable="yes">6502 Emulator</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButtonBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<property name="layout_style">expand</property>
<child> <child>
<object class="GtkButton" id="Reset"> <object class="GtkButton" id="Run">
<property name="label" translatable="yes">Reset</property> <property name="label" translatable="yes">Run</property>
<property name="name">Reset</property> <property name="name">Run</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
@ -35,9 +169,9 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkButton" id="Run"> <object class="GtkButton" id="Stop">
<property name="label" translatable="yes">Run</property> <property name="label" translatable="yes">Stop</property>
<property name="name">Run</property> <property name="name">Stop</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="receives_default">True</property> <property name="receives_default">True</property>
@ -62,10 +196,37 @@
<property name="position">2</property> <property name="position">2</property>
</packing> </packing>
</child> </child>
<child>
<object class="GtkButton" id="Reset">
<property name="label" translatable="yes">Reset</property>
<property name="name">Reset</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkSwitch" id="RamDisplay">
<property name="name">RamDisplay</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
</object> </object>
<packing> <packing>
<property name="left_attach">1</property> <property name="expand">False</property>
<property name="top_attach">1</property> <property name="fill">True</property>
<property name="position">1</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -76,21 +237,9 @@
<property name="vexpand">True</property> <property name="vexpand">True</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="expand">True</property>
<property name="top_attach">1</property> <property name="fill">True</property>
</packing> <property name="position">2</property>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">True</property>
<property name="label" translatable="yes">6502 Emulator</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
<property name="width">2</property>
</packing> </packing>
</child> </child>
<child> <child>
@ -98,15 +247,234 @@
<property name="name">Registers</property> <property name="name">Registers</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">False</property> <property name="can_focus">False</property>
<property name="label" translatable="yes">A: 0x00 X: 0x00 Y: 0x00 PC: 0x000</property> <property name="label" translatable="yes">Registers' status (Reset to see)</property>
</object> </object>
<packing> <packing>
<property name="left_attach">0</property> <property name="expand">False</property>
<property name="top_attach">2</property> <property name="fill">True</property>
<property name="position">3</property>
</packing> </packing>
</child> </child>
<child> <child>
<placeholder/> <object class="GtkGrid" id="ColorPalette">
<property name="name">ColorPalette</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hexpand">False</property>
<child>
<object class="GtkColorButton" id="ColorPalette0">
<property name="name">ColorPalette0</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(0,0,0)</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette1">
<property name="name">ColorPalette1</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(127,0,0)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette2">
<property name="name">ColorPalette2</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(0,127,0)</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette3">
<property name="name">ColorPalette3</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(127,127,0)</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette4">
<property name="name">ColorPalette4</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(0,0,127)</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette5">
<property name="name">ColorPalette5</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(127,0,127)</property>
</object>
<packing>
<property name="left_attach">5</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette6">
<property name="name">ColorPalette6</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(0,127,127)</property>
</object>
<packing>
<property name="left_attach">6</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette7">
<property name="name">ColorPalette7</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(127,127,127)</property>
</object>
<packing>
<property name="left_attach">7</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette8">
<property name="name">ColorPalette8</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(85,85,85)</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette9">
<property name="name">ColorPalette9</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgba(255,85,85,0.9)</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette10">
<property name="name">ColorPalette10</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(85,255,85)</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette11">
<property name="name">ColorPalette11</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(255,255,85)</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette12">
<property name="name">ColorPalette12</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(85,85,255)</property>
</object>
<packing>
<property name="left_attach">4</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette13">
<property name="name">ColorPalette13</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(255,85,255)</property>
</object>
<packing>
<property name="left_attach">5</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette14">
<property name="name">ColorPalette14</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(85,255,255)</property>
</object>
<packing>
<property name="left_attach">6</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkColorButton" id="ColorPalette15">
<property name="name">ColorPalette15</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="rgba">rgb(255,255,255)</property>
</object>
<packing>
<property name="left_attach">7</property>
<property name="top_attach">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child> </child>
</object> </object>
</child> </child>