aboutsummaryrefslogtreecommitdiff
path: root/src/ppu/internals.h
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2023-02-24 22:24:50 +0100
committerlonkaars <loek@pipeframe.xyz>2023-02-24 22:24:50 +0100
commit1a2bd8b70c12d497acb2eba548d161b2bfc4f9b6 (patch)
tree593cddcc473aad7a5e55f870893d813f17651a85 /src/ppu/internals.h
parent97dd5f6bd354c8e931778c79c7a421d5bdaafee5 (diff)
background sprites working in ppusim
Diffstat (limited to 'src/ppu/internals.h')
-rw-r--r--src/ppu/internals.h5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/ppu/internals.h b/src/ppu/internals.h
index 7b60255..6e9dda7 100644
--- a/src/ppu/internals.h
+++ b/src/ppu/internals.h
@@ -4,6 +4,11 @@
#include "ppu/types.h"
+/** @brief generate bitmask with `n` bits set to one from LSB */
+#define HH_MASK(n) ((1 << (n))-1)
+/** @brief resize `in` to `upper downto lower` like in vhdl */
+#define HH_RESIZE(in, upper, lower) ((((hh_ppu_data_t)(in)) & (HH_MASK(upper+1-lower) << lower)) >> lower)
+
typedef struct {
hh_ppu_addr_t offset;
hh_ppu_addr_t size;