From 05d9405e7a6a1e9cbc1dd76aecc36c66e7891a87 Mon Sep 17 00:00:00 2001 From: neauoire Date: Sat, 10 Apr 2021 09:32:14 -0700 Subject: [PATCH] Microscopic optimizations --- src/emulator.c | 4 ++-- src/ppu.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/emulator.c b/src/emulator.c index 717673d..0d30e94 100644 --- a/src/emulator.c +++ b/src/emulator.c @@ -214,8 +214,8 @@ screen_poke(Uxn *u, Uint16 ptr, Uint8 b0, Uint8 b1) Uint16 x = mempeek16(u, ptr + 8); Uint16 y = mempeek16(u, ptr + 10); Uint8 *addr = &u->ram.dat[mempeek16(u, ptr + 12)]; - Uint8 *layer = (b1 >> 4 & 0xf) % 2 ? ppu.fg : ppu.bg; - switch((b1 >> 4) / 2) { + Uint8 *layer = b1 >> 4 & 0x1 ? ppu.fg : ppu.bg; + switch(b1 >> 5) { case 0: putpixel(&ppu, layer, x, y, b1 & 0x3); break; case 1: puticn(&ppu, layer, x, y, addr, b1 & 0xf); break; case 2: putchr(&ppu, layer, x, y, addr, b1 & 0xf); break; diff --git a/src/ppu.h b/src/ppu.h index fbfa38c..a99c039 100644 --- a/src/ppu.h +++ b/src/ppu.h @@ -3,6 +3,7 @@ /* Copyright (c) 2021 Devine Lu Linvega +Copyright (c) 2021 Andrew Alderwick Permission to use, copy, modify, and distribute this software for any purpose with or without fee is hereby granted, provided that the above