Trait spectrusty::chip::ula::UlaControlExt
source · pub trait UlaControlExt: Video {
fn prepare_next_frame<C: MemoryContention>(
&mut self,
vtsc: VFrameTsCounter<Self::VideoFrame, C>
) -> VFrameTsCounter<Self::VideoFrame, C>;
fn ensure_next_frame_vtsc(
&mut self
) -> VFrameTsCounter<Self::VideoFrame, Self::Contention> { ... }
}
Required Methods§
sourcefn prepare_next_frame<C: MemoryContention>(
&mut self,
vtsc: VFrameTsCounter<Self::VideoFrame, C>
) -> VFrameTsCounter<Self::VideoFrame, C>
fn prepare_next_frame<C: MemoryContention>(
&mut self,
vtsc: VFrameTsCounter<Self::VideoFrame, C>
) -> VFrameTsCounter<Self::VideoFrame, C>
This method is used by wrappers with a different contention scheme.
Provided Methods§
sourcefn ensure_next_frame_vtsc(
&mut self
) -> VFrameTsCounter<Self::VideoFrame, Self::Contention>
fn ensure_next_frame_vtsc(
&mut self
) -> VFrameTsCounter<Self::VideoFrame, Self::Contention>
Examples found in repository?
More examples
src/chip/ula/cpuext.rs (line 82)
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
fn ula_nmi<C: Cpu>(&mut self, cpu: &mut C) -> bool {
let mut vtsc = self.ensure_next_frame_vtsc();
let res = cpu.nmi(self, &mut vtsc);
self.set_video_ts(vtsc.into());
self.bus_device_mut().update_timestamp(vtsc.vts.into());
res
}
fn ula_execute_next_frame_with_breaks<C: Cpu>(
&mut self,
cpu: &mut C
) -> bool
{
let mut vtsc = self.ensure_next_frame_vtsc();
while !vtsc.is_eof() {
let vc_limit = if vtsc.vc < 1 { 1 }
else {
Self::VideoFrame::VSL_COUNT
};
match cpu.execute_with_limit(self, &mut vtsc, vc_limit) {
Ok(()) => {
**vtsc = Self::ula_check_halt(vtsc.into(), cpu);
},
Err(BreakCause::Halt) => {
if vtsc.vc < 1 {
// if before frame interrupt
continue
}
}
Err(_) => {
**vtsc = Self::ula_check_halt(vtsc.into(), cpu);
if vtsc.is_eof() {
break
}
self.set_video_ts(vtsc.into());
return false
}
}
if cpu.is_halt() {
vtsc = execute_halted_state_until_eof(vtsc, cpu);
break;
}
}
self.set_video_ts(vtsc.into());
self.bus_device_mut().update_timestamp(vtsc.vts.into());
true
}
fn ula_execute_single_step<C: Cpu, F>(
&mut self,
cpu: &mut C,
debug: Option<F>
) -> Result<(),()>
where F: FnOnce(CpuDebug),
{
let mut vtsc = self.ensure_next_frame_vtsc();
let res = cpu.execute_next(self, &mut vtsc, debug);
**vtsc = Self::ula_check_halt(vtsc.into(), cpu);
self.set_video_ts(vtsc.into());
self.bus_device_mut().update_timestamp(vtsc.vts.into());
res
}
fn ula_execute_instruction<C: Cpu>(
&mut self,
cpu: &mut C,
code: u8
) -> Result<(), ()>
{
const DEBUG: Option<CpuDebugFn> = None;
let mut vtsc = self.ensure_next_frame_vtsc();
let res = cpu.execute_instruction(self, &mut vtsc, DEBUG, code);
**vtsc = Self::ula_check_halt(vtsc.into(), cpu);
self.set_video_ts(vtsc.into());
self.bus_device_mut().update_timestamp(vtsc.vts.into());
res
}