chirp: Update chirp for changes in cpu.rs
This commit is contained in:
parent
04736f1153
commit
5b5c5b41ab
@ -47,7 +47,7 @@ struct Arguments {
|
|||||||
#[options(help = "Enable pause mode at startup.")]
|
#[options(help = "Enable pause mode at startup.")]
|
||||||
pub pause: bool,
|
pub pause: bool,
|
||||||
|
|
||||||
#[options(help = "Set the instructions-per-delay rate, or use realtime.")]
|
#[options(help = "Set the instructions-per-delay rate. If unspecified, use realtime.")]
|
||||||
pub speed: Option<usize>,
|
pub speed: Option<usize>,
|
||||||
#[options(help = "Set the instructions-per-frame rate.")]
|
#[options(help = "Set the instructions-per-frame rate.")]
|
||||||
pub step: Option<usize>,
|
pub step: Option<usize>,
|
||||||
@ -76,16 +76,19 @@ struct Arguments {
|
|||||||
help = "Use CHIP-48 style DMA instructions, which don't touch I."
|
help = "Use CHIP-48 style DMA instructions, which don't touch I."
|
||||||
)]
|
)]
|
||||||
pub memory: bool,
|
pub memory: bool,
|
||||||
|
|
||||||
#[options(
|
#[options(
|
||||||
short = "v",
|
short = "v",
|
||||||
help = "Use CHIP-48 style bit-shifts, which don't touch vY."
|
help = "Use CHIP-48 style bit-shifts, which don't touch vY."
|
||||||
)]
|
)]
|
||||||
pub shift: bool,
|
pub shift: bool,
|
||||||
|
|
||||||
#[options(
|
#[options(
|
||||||
short = "b",
|
short = "b",
|
||||||
help = "Use SUPER-CHIP style indexed jump, which is indexed relative to v[adr]."
|
help = "Use SUPER-CHIP style indexed jump, which is indexed relative to v[adr]."
|
||||||
)]
|
)]
|
||||||
pub jumping: bool,
|
pub jumping: bool,
|
||||||
|
|
||||||
#[options(
|
#[options(
|
||||||
long = "break",
|
long = "break",
|
||||||
help = "Set breakpoints for the emulator to stop at.",
|
help = "Set breakpoints for the emulator to stop at.",
|
||||||
@ -93,12 +96,14 @@ struct Arguments {
|
|||||||
meta = "BP"
|
meta = "BP"
|
||||||
)]
|
)]
|
||||||
pub breakpoints: Vec<u16>,
|
pub breakpoints: Vec<u16>,
|
||||||
|
|
||||||
#[options(
|
#[options(
|
||||||
help = "Load additional word at address 0x1fe",
|
help = "Load additional word at address 0x1fe",
|
||||||
parse(try_from_str = "parse_hex"),
|
parse(try_from_str = "parse_hex"),
|
||||||
meta = "WORD"
|
meta = "WORD"
|
||||||
)]
|
)]
|
||||||
pub data: u16,
|
pub data: u16,
|
||||||
|
|
||||||
#[options(help = "Set the target framerate.", default = "60", meta = "FR")]
|
#[options(help = "Set the target framerate.", default = "60", meta = "FR")]
|
||||||
pub frame_rate: u64,
|
pub frame_rate: u64,
|
||||||
}
|
}
|
||||||
@ -131,7 +136,7 @@ impl State {
|
|||||||
Screen [0x1000..0x1100],
|
Screen [0x1000..0x1100],
|
||||||
},
|
},
|
||||||
cpu: CPU::new(
|
cpu: CPU::new(
|
||||||
0x1000,
|
&options.file,
|
||||||
0x50,
|
0x50,
|
||||||
0x200,
|
0x200,
|
||||||
Dis::default(),
|
Dis::default(),
|
||||||
@ -143,7 +148,7 @@ impl State {
|
|||||||
monotonic: options.speed,
|
monotonic: options.speed,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
),
|
)?,
|
||||||
},
|
},
|
||||||
ui: UIBuilder::new(128, 64, &options.file).build()?,
|
ui: UIBuilder::new(128, 64, &options.file).build()?,
|
||||||
ft: Instant::now(),
|
ft: Instant::now(),
|
||||||
@ -189,9 +194,9 @@ impl State {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
fn wait_for_next_frame(&mut self) {
|
fn wait_for_next_frame(&mut self) {
|
||||||
let rate = 1_000_000_000 / self.rate + 1;
|
let rate = Duration::from_nanos(1_000_000_000 / self.rate + 1);
|
||||||
std::thread::sleep(Duration::from_nanos(rate).saturating_sub(self.ft.elapsed()));
|
std::thread::sleep(rate.saturating_sub(self.ft.elapsed()));
|
||||||
self.ft = Instant::now();
|
self.ft = self.ft + rate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,8 +80,10 @@ pub struct FrameBufferFormat {
|
|||||||
impl Default for FrameBufferFormat {
|
impl Default for FrameBufferFormat {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
FrameBufferFormat {
|
FrameBufferFormat {
|
||||||
fg: 0x0011a434,
|
// fg: 0x0011a434,
|
||||||
bg: 0x001E2431,
|
// bg: 0x001E2431,
|
||||||
|
fg: 0x00FFFF00,
|
||||||
|
bg: 0x00623701,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user