Add code to use the charset in ROM

This commit is contained in:
hkz 2025-07-22 14:59:09 +02:00
commit 4ea5c7147e
9 changed files with 60 additions and 4 deletions

View file

@ -8,6 +8,7 @@
#include "line_data.h"
#include "game_logic.h"
#include "tiles.h"
#include "charset.h"
#include "monitor_subroutines.h"
#define SCREEN_WIDTH_B 40
@ -61,6 +62,20 @@ void ddraw_single_tile(uint8_t offset) {
}
}
void draw_number(uint16_t n, uint8_t len, uint8_t x, uint8_t y) {
uint8_t buf[len];
// Decode the number into the buffer
num_to_decbuf(n, len, buf);
for(uint8_t row = 0; row < CHAR_HEIGHT; row++) {
uint16_t offset = line_offset_map[y + row];
for(uint8_t col = 0; col < len; col++) {
back_buf[(offset + (len - 1) - col) + x] = CHARSET[NUM_OFFSET + (buf[col] * CHAR_HEIGHT) + row];
}
}
}
void draw_tiles(void) {
uint8_t* grid = get_front_grid();