Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port proposed t256 bit reuse feature for tile mode palette #106

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/overlay/overlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1399,8 +1399,12 @@ class tmap_visualizer

for (uint32_t i = 0; i < num_dots; i++) {
uint8_t tdat = tile_data[i];
if (tdat > 0 && tdat < 16) // 8bpp quirk handling
if (tdat > 0 && tdat < 16) { // 8bpp quirk handling
tdat += palette_offset;
if (t256c) {
tdat |= 0x80;
}
}
pixels[i] = palette[tdat];
}
} else {
Expand Down Expand Up @@ -1450,8 +1454,13 @@ class tmap_visualizer
for (int tj = 0; tj < tile_width; tj++) {
uint8_t tdat = tile_data[src2];
src2 += src2_add;
if (tdat > 0 && tdat < 16)
if (tdat > 0 && tdat < 16) {
tdat += pal;
if (t256c) {
tdat |= 0x80;
}
}

pixels[dst2++] = palette[tdat];
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/vera/vera_video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
// Version
#define VERA_VERSION_MAJOR 0x00
#define VERA_VERSION_MINOR 0x03
#define VERA_VERSION_PATCH 0x01
#define VERA_VERSION_PATCH 0x02

static bool is_fullscreen = false;

Expand Down Expand Up @@ -761,8 +761,11 @@ static void render_layer_line_tile(uint16_t y)
uint8_t col_index = (s >> color_shift) & props->color_mask;

// Apply Palette Offset
if (palette_offset && col_index > 0 && col_index < 16) {
if (col_index > 0 && col_index < 16) {
col_index += palette_offset;
if (props->text_mode_256c) {
col_index |= 0x80;
}
}
layer_line[layer][i] = col_index;

Expand Down Expand Up @@ -810,8 +813,11 @@ static void render_layer_line_bitmap(uint16_t y)
uint8_t col_index = (s >> (props->first_color_pos - ((xx & props->color_fields_max) << props->color_depth))) & props->color_mask;

// Apply Palette Offset
if (palette_offset && col_index > 0 && col_index < 16) {
if (col_index > 0 && col_index < 16) {
col_index += palette_offset << 4;
if (props->text_mode_256c) {
col_index |= 0x80;
}
}
layer_line[layer][i] = col_index;

Expand Down Expand Up @@ -2109,4 +2115,4 @@ vera_video_rect vera_video_get_scan_visible()
VGA_Y_OFFSET, VGA_Y_OFFSET + SCREEN_HEIGHT
};
}
}
}