Better derivation of framebuffer macros

This commit is contained in:
Aaron Culliney 2015-05-28 23:19:11 -07:00
parent 1ca1e7d2cc
commit aee1111cb0
2 changed files with 19 additions and 22 deletions

View File

@ -300,10 +300,10 @@ static void _initialize_hires_values(void) {
static void _initialize_row_col_tables(void) {
for (unsigned int y = 0; y < TEXT_ROWS; y++) {
for (unsigned int off = 0; off < 8; off++) {
for (unsigned int y2 = 0; y2 < FONT_GLYPH_Y; y2++) {
for (unsigned int x = 0; x < 40; x++) {
video__screen_addresses[video__line_offset[y] + (0x400*off) + x] = (y*16 + 2*off /* + 8*/) * SCANWIDTH + x*14 + 4;
video__columns [video__line_offset[y] + (0x400*off) + x] = (uint8_t)x;
video__screen_addresses[video__line_offset[y] + (0x400*y2) + x] = ((y*FONT_HEIGHT_PIXELS + 2*y2) * SCANWIDTH) + (x*FONT_WIDTH_PIXELS) + _INTERPOLATED_PIXEL_ADJUSTMENT_PRE;
video__columns [video__line_offset[y] + (0x400*y2) + x] = (uint8_t)x;
}
}
}
@ -945,6 +945,8 @@ static inline void _plot_hires(uint16_t ea, uint8_t b, bool is_even, uint8_t *fb
}
// calculate interpolated/bleed colors
// NOTE that this doesn't check under/overflow of ea (for example at 0x2000, 0x4000, 0x3FFF, 0x5FFF)
// ... but don't think this really matters much here =P
_calculate_interp_color(color_buf, 1, interp_altbase, ea-1);
_calculate_interp_color(color_buf, 2, interp_base, ea);
_calculate_interp_color(color_buf, 8, interp_base, ea);

View File

@ -144,31 +144,26 @@ uint16_t video_scanner_get_address(bool *vblBarOut);
uint8_t floating_bus(void);
uint8_t floating_bus_hibit(const bool hibit);
#define TEXT_ROWS 24
#define BEGIN_MIX 20
#define TEXT_COLS 40
#define TEXT80_COLS (TEXT_COLS*2)
/*
* 640x400 mode really isn't what it advertises. It's really 560x384 with 4
* extra bytes on each side for color interpolation hack. This is yet another
* area where I've traded the optimization gain (especially on older slower
* machines) for a standard resolution.
*/
#define _SCANWIDTH 560
#define FONT_HEIGHT_PIXELS 16
#define FONT_WIDTH_PIXELS 14
#define FONT80_WIDTH_PIXELS (FONT_WIDTH_PIXELS>>1)
#define _SCANWIDTH (TEXT_COLS * FONT_WIDTH_PIXELS) // 560
#define SCANHEIGHT (TEXT_ROWS * FONT_HEIGHT_PIXELS) // 384
// Extra bytes on each side of internal framebuffers for color interpolation hack
#define _INTERPOLATED_PIXEL_ADJUSTMENT_PRE 4
#define _INTERPOLATED_PIXEL_ADJUSTMENT_POST 4
#define INTERPOLATED_PIXEL_ADJUSTMENT (_INTERPOLATED_PIXEL_ADJUSTMENT_PRE+_INTERPOLATED_PIXEL_ADJUSTMENT_POST)
#define SCANWIDTH (_SCANWIDTH+INTERPOLATED_PIXEL_ADJUSTMENT)
#define SCANHEIGHT 384
#define TEXT_ROWS 24
#define BEGIN_MIX 20
#define TEXT_COLS 40
#define TEXT80_COLS 80
#define FONT_GLYPH_X 8
#define FONT_GLYPH_Y FONT_GLYPH_X
#define FONT_HEIGHT_PIXELS 16
#define FONT_WIDTH_PIXELS 14
#define FONT80_WIDTH_PIXELS 7
#define FONT_GLYPH_X (7+/*unused*/1) // generated font.c uses a single byte (8bits) per font glyph line
#define FONT_GLYPH_Y (FONT_HEIGHT_PIXELS>>1) // ... 8 bytes total for whole glyph
#define MOUSETEXT_BEGIN 0x80 // offset + 0x20 length
#define MOUSETEXT_UP (MOUSETEXT_BEGIN+0x0b)