Skip to content

Commit

Permalink
show last keyboard byte in ppi viewer
Browse files Browse the repository at this point in the history
  • Loading branch information
dbalsom committed Jan 27, 2024
1 parent 7fe836c commit 63278af
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
5 changes: 5 additions & 0 deletions core/src/devices/ppi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ pub struct Ppi {
kb_resets_counter: u32,
pb_byte: u8,
kb_byte: u8,
kb_byte_last: u8,
keyboard_clear_scheduled: bool,
ksr_cleared: bool,
kb_enabled: bool,
Expand Down Expand Up @@ -203,6 +204,7 @@ pub struct PpiStringState {
pub port_a_value_hex: String,
pub port_b_value_bin: String,
pub kb_byte_value_hex: String,
pub kb_last_byte_value_hex: String,
pub kb_resets_counter: String,
pub port_c_mode: String,
pub port_c_value: String,
Expand Down Expand Up @@ -277,6 +279,7 @@ impl Ppi {
kb_resets_counter: 0,
pb_byte: 0,
kb_byte: 0,
kb_byte_last: 0,
keyboard_clear_scheduled: false,
ksr_cleared: true,
kb_enabled: true,
Expand Down Expand Up @@ -561,6 +564,7 @@ impl Ppi {
port_a_value_hex: format!("{:02X}", port_a_value),
port_b_value_bin: format!("{:08b}", port_b_value),
kb_byte_value_hex: format!("{:02X}", self.kb_byte),
kb_last_byte_value_hex: format!("{:02X}", self.kb_byte_last),
kb_resets_counter: format!("{}", self.kb_resets_counter),
port_c_mode: format!("{:?}", self.port_c_mode),
port_c_value: format!("{:08b}", port_c_value),
Expand Down Expand Up @@ -598,6 +602,7 @@ impl Ppi {
if self.keyboard_clear_scheduled {
self.keyboard_clear_scheduled = false;
self.ksr_cleared = true;
self.kb_byte_last = self.kb_byte;
self.kb_byte = 0;
pic.clear_interrupt(1);
//log::trace!("PPI: Clearing keyboard");
Expand Down
42 changes: 16 additions & 26 deletions lib/frontend/marty_egui/src/windows/ppi_viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
*/

use marty_core::devices::ppi::PpiStringState;
use crate::GuiEventQueue;
use marty_core::devices::ppi::PpiStringState;

pub struct PpiViewerControl {
ppi_state: PpiStringState,
Expand All @@ -49,59 +49,52 @@ impl PpiViewerControl {
.spacing([40.0, 4.0])
.show(ui, |ui| {
ui.label(egui::RichText::new("Port A Mode: ").text_style(egui::TextStyle::Monospace));
ui.add(
egui::TextEdit::singleline(&mut self.ppi_state.port_a_mode)
.font(egui::TextStyle::Monospace),
);
ui.add(egui::TextEdit::singleline(&mut self.ppi_state.port_a_mode).font(egui::TextStyle::Monospace));
ui.end_row();

ui.label(egui::RichText::new("Port A Value: ").text_style(egui::TextStyle::Monospace));
ui.add(
egui::TextEdit::singleline(&mut self.ppi_state.port_a_value_bin)
.font(egui::TextStyle::Monospace),
egui::TextEdit::singleline(&mut self.ppi_state.port_a_value_bin).font(egui::TextStyle::Monospace),
);
ui.end_row();

ui.label(egui::RichText::new("Port A Value: ").text_style(egui::TextStyle::Monospace));
ui.add(
egui::TextEdit::singleline(&mut self.ppi_state.port_a_value_hex)
.font(egui::TextStyle::Monospace),
egui::TextEdit::singleline(&mut self.ppi_state.port_a_value_hex).font(egui::TextStyle::Monospace),
);
ui.end_row();

ui.label(egui::RichText::new("Port B Value: ").text_style(egui::TextStyle::Monospace));
ui.add(
egui::TextEdit::singleline(&mut self.ppi_state.port_b_value_bin)
.font(egui::TextStyle::Monospace),
egui::TextEdit::singleline(&mut self.ppi_state.port_b_value_bin).font(egui::TextStyle::Monospace),
);
ui.end_row();

ui.label(egui::RichText::new("Keyboard byte:").text_style(egui::TextStyle::Monospace));
ui.label(egui::RichText::new("Keyboard Byte:").text_style(egui::TextStyle::Monospace));
ui.add(
egui::TextEdit::singleline(&mut self.ppi_state.kb_byte_value_hex)
.font(egui::TextStyle::Monospace),
egui::TextEdit::singleline(&mut self.ppi_state.kb_byte_value_hex).font(egui::TextStyle::Monospace),
);
ui.end_row();

ui.label(egui::RichText::new("Keyboard resets:").text_style(egui::TextStyle::Monospace));
ui.label(egui::RichText::new("Last Keyboard Byte:").text_style(egui::TextStyle::Monospace));
ui.add(
egui::TextEdit::singleline(&mut self.ppi_state.kb_resets_counter)
egui::TextEdit::singleline(&mut self.ppi_state.kb_last_byte_value_hex)
.font(egui::TextStyle::Monospace),
);
ui.end_row();

ui.label(egui::RichText::new("Port C Mode: ").text_style(egui::TextStyle::Monospace));
ui.label(egui::RichText::new("Keyboard Resets:").text_style(egui::TextStyle::Monospace));
ui.add(
egui::TextEdit::singleline(&mut self.ppi_state.port_c_mode)
.font(egui::TextStyle::Monospace),
egui::TextEdit::singleline(&mut self.ppi_state.kb_resets_counter).font(egui::TextStyle::Monospace),
);
ui.end_row();

ui.label(egui::RichText::new("Port C Mode: ").text_style(egui::TextStyle::Monospace));
ui.add(egui::TextEdit::singleline(&mut self.ppi_state.port_c_mode).font(egui::TextStyle::Monospace));
ui.end_row();

ui.label(egui::RichText::new("Port C Value: ").text_style(egui::TextStyle::Monospace));
ui.add(
egui::TextEdit::singleline(&mut self.ppi_state.port_c_value)
.font(egui::TextStyle::Monospace),
);
ui.add(egui::TextEdit::singleline(&mut self.ppi_state.port_c_value).font(egui::TextStyle::Monospace));
ui.end_row();
});
}
Expand All @@ -110,6 +103,3 @@ impl PpiViewerControl {
self.ppi_state = state;
}
}



0 comments on commit 63278af

Please sign in to comment.