summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOxore <oxore@protonmail.com>2024-12-11 00:35:58 +0300
committerOxore <oxore@protonmail.com>2024-12-11 00:35:58 +0300
commit0cbf8e55ccc715b383c85cb231de8f5409fdbcc3 (patch)
tree11aa561ce1641390554ea5c97ecd57907fa67eda
parent9d17e4119c9cdee2fc4fa651ef69436f69912448 (diff)
Stick to tabs as project's standard
-rw-r--r--vdp.c114
1 files changed, 57 insertions, 57 deletions
diff --git a/vdp.c b/vdp.c
index 7d6508b..84ef056 100644
--- a/vdp.c
+++ b/vdp.c
@@ -464,40 +464,40 @@ void vdp_print_sprite_table(vdp_context * context)
static void redraw_debug_sprite(vdp_context *context, uint32_t *fb, uint32_t tile_id, uint8_t pal)
{
- // "tl" stands for tiles, "px" stands for pixels, "pt" stands for points,
- // "b" stands for bytes.
- const uint32_t pxppt = 2; // Pixels per point
- const uint32_t ptptl = 8; // Points per tile
- const uint32_t ptpb = 2; // Points per byte
- const uint32_t win_width_tl = 64;
- const uint32_t win_height_tl = 32;
- const uint32_t win_width_pt = win_width_tl * ptptl;
- const uint32_t win_height_pt = win_height_tl * ptptl;
- const uint32_t win_width_px = win_width_pt * pxppt;
- const uint32_t tile_width_b = 4;
- const uint32_t tile_width_pt = ptptl;
- const uint32_t tile_height_pt = ptptl;
- const uint32_t tile_size_b = tile_width_b * tile_height_pt;
- const uint32_t col_tl = tile_id % win_width_tl;
- const uint32_t row_tl = tile_id / win_width_tl;
- for (uint32_t r_pt = 0; r_pt < tile_height_pt; r_pt++) {
- const uint32_t row_pt = row_tl * tile_height_pt + r_pt;
- const uint32_t col_pt = col_tl * tile_width_pt;
- for (uint32_t r_px = 0; r_px < pxppt; r_px++) {
- const uint32_t row_px = row_pt * pxppt + r_px;
- for (uint32_t b = 0; b < tile_width_b; b++) {
- const uint32_t address = tile_id * tile_size_b + r_pt * tile_width_b + b;
- const uint8_t byte = context->vdpmem[address];
- const uint8_t left = byte >> 4;
- const uint8_t right = byte & 0xF;
- const uint32_t line_offset = row_px * win_width_px + col_pt * pxppt + b * ptpb * pxppt;
- fb[line_offset + 0] = context->colors[left | (pal * 16)];
- fb[line_offset + 1] = context->colors[left | (pal * 16)];
- fb[line_offset + 2] = context->colors[right | (pal * 16)];
- fb[line_offset + 3] = context->colors[right | (pal * 16)];
- }
- }
- }
+ // "tl" stands for tiles, "px" stands for pixels, "pt" stands for points,
+ // "b" stands for bytes.
+ const uint32_t pxppt = 2; // Pixels per point
+ const uint32_t ptptl = 8; // Points per tile
+ const uint32_t ptpb = 2; // Points per byte
+ const uint32_t win_width_tl = 64;
+ const uint32_t win_height_tl = 32;
+ const uint32_t win_width_pt = win_width_tl * ptptl;
+ const uint32_t win_height_pt = win_height_tl * ptptl;
+ const uint32_t win_width_px = win_width_pt * pxppt;
+ const uint32_t tile_width_b = 4;
+ const uint32_t tile_width_pt = ptptl;
+ const uint32_t tile_height_pt = ptptl;
+ const uint32_t tile_size_b = tile_width_b * tile_height_pt;
+ const uint32_t col_tl = tile_id % win_width_tl;
+ const uint32_t row_tl = tile_id / win_width_tl;
+ for (uint32_t r_pt = 0; r_pt < tile_height_pt; r_pt++) {
+ const uint32_t row_pt = row_tl * tile_height_pt + r_pt;
+ const uint32_t col_pt = col_tl * tile_width_pt;
+ for (uint32_t r_px = 0; r_px < pxppt; r_px++) {
+ const uint32_t row_px = row_pt * pxppt + r_px;
+ for (uint32_t b = 0; b < tile_width_b; b++) {
+ const uint32_t address = tile_id * tile_size_b + r_pt * tile_width_b + b;
+ const uint8_t byte = context->vdpmem[address];
+ const uint8_t left = byte >> 4;
+ const uint8_t right = byte & 0xF;
+ const uint32_t line_offset = row_px * win_width_px + col_pt * pxppt + b * ptpb * pxppt;
+ fb[line_offset + 0] = context->colors[left | (pal * 16)];
+ fb[line_offset + 1] = context->colors[left | (pal * 16)];
+ fb[line_offset + 2] = context->colors[right | (pal * 16)];
+ fb[line_offset + 3] = context->colors[right | (pal * 16)];
+ }
+ }
+ }
}
static void redraw_debug_sprites_with_correct_colors(vdp_context * context, uint32_t *fb)
@@ -514,17 +514,17 @@ static void redraw_debug_sprites_with_correct_colors(vdp_context * context, uint
uint16_t link = context->sat_cache[cache_address+3] & 0x7F;
uint8_t pal = context->vdpmem[address + 4] >> 5 & 0x3;
uint16_t tile_id = ((context->vdpmem[address + 4] << 8) | context->vdpmem[address + 5]) & 0x7FF;
- uint32_t count = height * width;
- for (uint32_t i = 0; i < count; i++) {
- if (tile_id + i < 2048) {
- redraw_debug_sprite(context, fb, tile_id + i, pal);
- }
- }
+ uint32_t count = height * width;
+ for (uint32_t i = 0; i < count; i++) {
+ if (tile_id + i < 2048) {
+ redraw_debug_sprite(context, fb, tile_id + i, pal);
+ }
+ }
current_index = link;
count++;
} while (current_index != 0 && count < 80);
} else {
- // TODO
+ // TODO
}
}
@@ -901,22 +901,22 @@ static void write_cram(vdp_context * context, uint16_t address, uint16_t value)
context->output[(context->hslot - BG_START_SLOT)*2 + 1] = color;
}
}
- if (0) {
- printf("CRAM\n");
- for (size_t i = 0; i < CRAM_SIZE; i++) {
- printf("%04x ", context->cram[i]);
- if (i % 16u == 15u) {
- printf("\n");
- }
- }
- for (size_t i = 0; i < CRAM_SIZE; i++) {
- printf("%06x ", context->colors[i] & 0xffffff);
- if (i % 8u == 7u) {
- printf("\n");
- }
- }
- printf("\n");
- }
+ if (0) {
+ printf("CRAM\n");
+ for (size_t i = 0; i < CRAM_SIZE; i++) {
+ printf("%04x ", context->cram[i]);
+ if (i % 16u == 15u) {
+ printf("\n");
+ }
+ }
+ for (size_t i = 0; i < CRAM_SIZE; i++) {
+ printf("%06x ", context->colors[i] & 0xffffff);
+ if (i % 8u == 7u) {
+ printf("\n");
+ }
+ }
+ printf("\n");
+ }
}
static void vdp_advance_dma(vdp_context * context)