Function spectrusty::video::frame_cache::color_address_coords
source · pub fn color_address_coords(addr: u16) -> CellCoords
Expand description
Returns cell coordinates of a screen attribute cell ignoring the highest 6 address bits.
Examples found in repository?
src/chip/ula/video.rs (line 156)
149 150 151 152 153 154 155 156 157 158 159 160 161
pub(super) fn update_frame_cache(&mut self, addr: u16, ts: VideoTs) {
match addr {
0x4000..=0x57FF => {
let coords = pixel_address_coords(addr);
self.frame_cache.update_frame_pixels(&self.memory, coords, addr, ts);
}
0x5800..=0x5AFF => {
let coords = color_address_coords(addr);
self.frame_cache.update_frame_colors(&self.memory, coords, addr, ts);
}
_ => {}
}
}
More examples
src/chip/scld/video.rs (line 90)
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
pub(super) fn update_frame_cache(&mut self, addr: u16, ts: VideoTs) {
let frame_cache = match addr {
0x4000..=0x5AFF if self.mem_paged & 4 == 0 => &mut self.ula.frame_cache,
0x6000..=0x7AFF if self.mem_paged & 8 == 0 => &mut self.sec_frame_cache,
_ => return
};
if addr & 0x1800 != 0x1800 {
let coords = pixel_address_coords(addr);
frame_cache.update_frame_pixels(&self.ula.memory, coords, addr, ts);
}
else {
let coords = color_address_coords(addr);
frame_cache.update_frame_colors(&self.ula.memory, coords, addr, ts);
}
}
src/chip/ula128/video.rs (line 168)
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171
pub(super) fn update_frame_cache(&mut self, addr: u16, ts: VideoTs) {
let frame_cache = match addr {
0x4000..=0x5AFF => &mut self.ula.frame_cache,
0xC000..=0xDAFF => match self.page3_screen_shadow_bank() {
Some(false) => &mut self.ula.frame_cache,
Some(true) => &mut self.shadow_frame_cache,
None => return
}
_ => return
};
if addr & 0x1800 != 0x1800 {
let coords = pixel_address_coords(addr);
frame_cache.update_frame_pixels(&self.ula.memory, coords, addr, ts);
}
else {
let coords = color_address_coords(addr);
frame_cache.update_frame_colors(&self.ula.memory, coords, addr, ts);
}
}
src/chip/ula3/video.rs (line 142)
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
pub(super) fn update_frame_cache(&mut self, addr: u16, ts: VideoTs) {
let maybe_shadow = match addr {
0x4000..=0x5AFF => self.page1_screen_shadow_bank(),
0xC000..=0xDAFF => self.page3_screen_shadow_bank(),
_ => return
};
let frame_cache = match maybe_shadow {
Some(false) => &mut self.ula.frame_cache,
Some(true) => &mut self.shadow_frame_cache,
None => return
};
if addr & 0x1800 != 0x1800 {
let coords = pixel_address_coords(addr);
frame_cache.update_frame_pixels(&self.ula.memory, coords, addr, ts);
}
else {
let coords = color_address_coords(addr);
frame_cache.update_frame_colors(&self.ula.memory, coords, addr, ts);
}
}
src/chip/plus/video.rs (line 106)
76 77 78 79 80 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
pub(super) fn update_frame_cache(&mut self, addr: u16, ts: VideoTs) {
let (frame_cache, memory_ref): (&mut UlaFrameCache<_>, _) = match addr {
0x4000..=0x5AFF => match self.ula.page1_screen0_shadow_bank() {
Some(false) => self.ula.frame_cache_mut_mem_ref(),
Some(true) => self.ula.shadow_frame_cache_mut_mem_ref(),
None => return
}
0x6000..=0x7AFF => match self.ula.page1_screen1_shadow_bank() {
Some(false) => (&mut self.sec_frame_cache, self.ula.memory_ref()),
Some(true) => (&mut self.shadow_sec_frame_cache, self.ula.memory_ref()),
None => return
}
0xC000..=0xDAFF => match self.ula.page3_screen0_shadow_bank() {
Some(false) => self.ula.frame_cache_mut_mem_ref(),
Some(true) => self.ula.shadow_frame_cache_mut_mem_ref(),
None => return
}
0xE000..=0xFAFF => match self.ula.page3_screen1_shadow_bank() {
Some(false) => (&mut self.sec_frame_cache, self.ula.memory_ref()),
Some(true) => (&mut self.shadow_sec_frame_cache, self.ula.memory_ref()),
None => return
}
_ => return
};
if addr & 0x1800 != 0x1800 {
let coords = pixel_address_coords(addr);
frame_cache.update_frame_pixels(memory_ref, coords, addr, ts);
}
else {
let coords = color_address_coords(addr);
frame_cache.update_frame_colors(memory_ref, coords, addr, ts);
}
}