aboutsummaryrefslogtreecommitdiffstats
path: root/src/renderer.c
diff options
context:
space:
mode:
authorBad Diode <bd@badd10de.dev>2021-06-04 10:30:53 +0200
committerBad Diode <bd@badd10de.dev>2021-06-04 10:30:53 +0200
commit76343003abd8bc686e6bb5ca4bcb77cb33b76e10 (patch)
treee3fbcd37b5697396ffea25f2fe4eac3b1f5f5433 /src/renderer.c
parent5ca4491aa46b7090189685fecf422ee7316de724 (diff)
downloadstepper-76343003abd8bc686e6bb5ca4bcb77cb33b76e10.tar.gz
stepper-76343003abd8bc686e6bb5ca4bcb77cb33b76e10.zip
Add text drawing support for framebuffer
Diffstat (limited to 'src/renderer.c')
-rw-r--r--src/renderer.c26
1 files changed, 1 insertions, 25 deletions
diff --git a/src/renderer.c b/src/renderer.c
index 500cc78..f950a4d 100644
--- a/src/renderer.c
+++ b/src/renderer.c
@@ -16,31 +16,7 @@
16// 16//
17 17
18#include "text.h" 18#include "text.h"
19 19#include "renderer.h"
20// The frontbuffer is located at the beginning of the VRAM, and requires 20KB of
21// video memory for 32 * 20 tiles at 4bpp.
22#define FRONTBUF ((u32*)(MEM_VRAM))
23
24// Adjust both of these if the location of the map changes. Each screnblock
25// requires less than 2KB.
26#define FRONTBUF_TILEMAP ((u16*)(MEM_VRAM + KB(20)))
27#define FRONTBUF_SB 10
28
29// The backbuffer is located at the end of the VRAM. This can allow us to use
30// more backgrounds but eats into the available memory for sprites. This should
31// be fine for non sprite intensive applications. If more sprite memory is
32// needed, the backbuffer can be located at the end of the background memory
33// instead (64KB - 20KB).
34#define BACKBUF ((u32*)(MEM_VRAM + KB(96) - KB(20)))
35
36// The font data is located at the end of the frontbuffer memory, after the tile
37// map and requires 8KB for 256 8x8 characters at 4bpp. This, along with the
38// tilemap information allow us to store the frontbuffer and font for a text
39// background in the first 2 charblocks (32KB).
40#define FONT_DATA ((u32*)(MEM_VRAM + KB(22)))
41#define FONT_TILEMAP ((u16*)(MEM_VRAM + KB(30)))
42#define FONT_SB 15
43#define FONT_OFFSET 192
44 20
45// Keep track of which tiles need to be copied to the frontbuffer. 21// Keep track of which tiles need to be copied to the frontbuffer.
46static u32 dirty_tiles[21] = {0}; 22static u32 dirty_tiles[21] = {0};