From 86d21e5f434ec1f8415b014a601c96e8b91a1f10 Mon Sep 17 00:00:00 2001 From: Matthew Berry Date: Fri, 6 Nov 2020 00:39:11 -0800 Subject: [PATCH] ppu mode 5 because why not --- src/crab/ppu.cr | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/crab/ppu.cr b/src/crab/ppu.cr index e9cfdd1..1d922e6 100644 --- a/src/crab/ppu.cr +++ b/src/crab/ppu.cr @@ -101,6 +101,15 @@ class PPU @framebuffer[idx * 2 + 1] = @pram[pal_idx * 2 + 1] end @gba.display.draw @framebuffer + when 5 + base = @dispcnt.display_frame_select ? 0xA000 : 0 + 128.times do |row| + 160.times do |col| + @framebuffer[base + (row * 240 + col) * 2] = @vram[base + (row * 160 + col) * 2] + @framebuffer[base + (row * 240 + col) * 2 + 1] = @vram[base + (row * 160 + col) * 2 + 1] + end + end + @gba.display.draw @framebuffer else abort "Invalid background mode: #{@dispcnt.bg_mode}" end end