Function spectrusty_core::video::color_line_offset
source · pub fn color_line_offset<T>(y: T) -> Twhere
T: Copy + From<u16> + Shr<u16, Output = T> + Shl<u16, Output = T>,
Expand description
Returns an offset into attributes memory of the given vertical coordinate y
[0, 192) (0 on top).
Examples found in repository?
src/video.rs (line 250)
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260
fn floating_bus_screen_address(VideoTs { vc, hc }: VideoTs) -> Option<u16> {
let line = vc - Self::VSL_PIXELS.start;
if line >= 0 && vc < Self::VSL_PIXELS.end {
Self::floating_bus_offset(hc).map(|offs| {
let y = line as u16;
let col = (offs >> 3) << 1;
// println!("got offs: {} col:{} y:{}", offs, col, y);
match offs & 3 {
0 => pixel_line_offset(y) + col,
1 => 0x1800 + color_line_offset(y) + col,
2 => 0x0001 + pixel_line_offset(y) + col,
3 => 0x1801 + color_line_offset(y) + col,
_ => unsafe { core::hint::unreachable_unchecked() }
}
})
}
else {
None
}
}