ui update
This commit is contained in:
parent
d2537705b7
commit
4e52b5b05a
@ -803,18 +803,24 @@ impl Chip8CpuInstructions {
|
||||
let working_16_or = working_16_x | working_16_y;
|
||||
// shift them back to 8 bit.
|
||||
input.registers.poke(*x, working_16_or as u8);
|
||||
// reset of VF quirk
|
||||
input.registers.poke(0x0f, 0x00);
|
||||
debug!("OrVxVy [0x{x:1x}] [0x{y:1x}]")
|
||||
}
|
||||
// 0x8xy2 Set Vx = Vx AND Vy
|
||||
Chip8CpuInstructions::AND(x, y) => {
|
||||
let lhs_16 = input.registers.peek(*x) as u16;
|
||||
let rhs_16 = input.registers.peek(*y) as u16;
|
||||
// reset of VF quirk
|
||||
input.registers.poke(0x0f, 0x00);
|
||||
input.registers.poke(*x, (lhs_16 & rhs_16) as u8);
|
||||
}
|
||||
// 0x8xy3 Set Vx = Vx XOR Vy
|
||||
Chip8CpuInstructions::ORY(x, y) => {
|
||||
let lhs_16 = input.registers.peek(*x) as u16;
|
||||
let rhs_16 = input.registers.peek(*y) as u16;
|
||||
// reset of VF quirk
|
||||
input.registers.poke(0x0f, 0x00);
|
||||
input.registers.poke(*x, (lhs_16 ^ rhs_16) as u8);
|
||||
}
|
||||
// 0x8xy4 Set Vx = Vx + Vy (SET VF on Carry)
|
||||
@ -1107,7 +1113,7 @@ impl Chip8CpuInstructions {
|
||||
Chip8CpuInstructions::LDIX(x) => {
|
||||
// Store registers V0 through Vx in memory starting at location I.
|
||||
//
|
||||
// The interpreter copies the values of registers V0 through Vx into memory,
|
||||
// The interpreter copi=es the values of registers V0 through Vx into memory,
|
||||
// starting at the address in I.
|
||||
let offset = input.registers.peek_i();
|
||||
for i in 0..=*x {
|
||||
|
||||
@ -22,7 +22,6 @@ fn main() {
|
||||
|
||||
let mut system = Chip8ComputerManager::default();
|
||||
let mut ui_state = ImGuiUiState::default();
|
||||
let target_ips = ui_state.target_ips;
|
||||
|
||||
support::simple_init(file!(), move |_, ui| {
|
||||
let current_time = Instant::now();
|
||||
@ -54,14 +53,14 @@ fn main() {
|
||||
|
||||
let target_ms = ui_state.frame_time;
|
||||
let loop_start_time = Instant::now();
|
||||
while Instant::now().duration_since(current_time).as_millis() < target_ms as u128 && num_cycles < target_ips {
|
||||
while Instant::now().duration_since(current_time).as_millis() < target_ms as u128 && num_cycles < ui_state.target_ips {
|
||||
if system.tick() {
|
||||
num_cycles += 1;
|
||||
}
|
||||
}
|
||||
let cycles_time = Instant::now().duration_since(loop_start_time);
|
||||
if num_cycles > 0 {
|
||||
println!("Ran for {}ms and executed {}/{} cycles.", cycles_time.as_millis(), num_cycles, target_ips);
|
||||
println!("Ran for {}ms and executed {}/{} cycles.", cycles_time.as_millis(), num_cycles, ui_state.target_ips);
|
||||
}
|
||||
// GUI Parts
|
||||
if ui_state.show_video {
|
||||
|
||||
@ -158,6 +158,7 @@ impl GemmaImguiSupport {
|
||||
ui.checkbox("Show Registers", &mut gui_state.show_registers);
|
||||
ui.same_line();
|
||||
ui.checkbox("Show Keypad", &mut gui_state.show_keypad);
|
||||
ui.input_int("Target IPS", &mut gui_state.target_ips).build();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user