Skip to content

Commit

Permalink
Implement Vertical Scrolling
Browse files Browse the repository at this point in the history
  • Loading branch information
Miwgt committed Jun 14, 2024
1 parent 45a7782 commit 67516c2
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/rendering/line_rendering.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,17 @@ pub fn draw_pixels(cpu: &mut CPU, game_diplay: &mut Image, palette: &[Color; 4])
let high_map: bool = false;
let high_addressing: bool = !cpu.get_lcdc_bg_window_tile_data();

let _scx = cpu.get_lcd_scx();
let _scy = cpu.get_lcd_scy();
let scx = cpu.get_lcd_scx();
let scy = cpu.get_lcd_scy();
let line: u8 = cpu.get_lcd_y_coordinate();

for xtile in 0..20 {
let tile_index = cpu.get_vram_tile_map(high_map, (line as u16 / 8) * 32 + xtile);
let tile_index = cpu.get_vram_tile_map(
high_map,
(((line + scy) / 8) as u16 % 0x100) * 32 + (xtile + (scx as u16 / 8)) % 32,
);
let line_data =
cpu.get_vram_tile_line(high_addressing, tile_index as u16, line % 8);
cpu.get_vram_tile_line(high_addressing, tile_index as u16, (line + scy) % 8);

for x_pixel in 0..8 {
//log::info!("Drawing pixel at x: {}, y: {}, xtile: {}, line: {}, color: {}", xtile as u32 * 8 + x_pixel, line as u32, xtile, line, line_data[x_pixel as usize]);
Expand Down

0 comments on commit 67516c2

Please sign in to comment.