mirror of
https://github.com/jscrane/r65emu.git
synced 2025-02-08 07:30:47 +00:00
add bit-depth 1 for vga; cleanup colour handling
This commit is contained in:
parent
9223b08fc1
commit
ee672ccfed
@ -54,20 +54,15 @@ static const fabgl::RGB888 rgb(colour_t c) {
|
|||||||
static VGA6Bit vga;
|
static VGA6Bit vga;
|
||||||
#elif VGA_BIT_DEPTH == 3
|
#elif VGA_BIT_DEPTH == 3
|
||||||
static VGA3Bit vga;
|
static VGA3Bit vga;
|
||||||
|
#elif VGA_BIT_DEPTH == 1
|
||||||
|
static VGA1BitI vga;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static uint8_t rgb(colour_t c) {
|
static uint8_t rgb(colour_t c) {
|
||||||
switch(c) {
|
uint8_t r = ((c & 0xf800) >> 11);
|
||||||
case BLACK: return vga.RGB(0, 0, 0);
|
uint8_t g = ((c & 0x07e0) >> 5);
|
||||||
case RED: return vga.RGB(255, 0, 0);
|
uint8_t b = (c & 0x001f);
|
||||||
case GREEN: return vga.RGB(0, 255, 0);
|
return vga.RGB(r << 3, g << 2, b << 3);
|
||||||
case YELLOW: return vga.RGB(255, 255, 0);
|
|
||||||
case BLUE: return vga.RGB(0, 0, 255);
|
|
||||||
case MAGENTA: return vga.RGB(255, 0, 255);
|
|
||||||
case CYAN: return vga.RGB(0, 255, 255);
|
|
||||||
case WHITE: return vga.RGB(255, 255, 255);
|
|
||||||
}
|
|
||||||
return vga.RGB(255, 255, 255);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif defined(USE_DVI)
|
#elif defined(USE_DVI)
|
||||||
@ -145,7 +140,7 @@ void Display::setScreen(unsigned sx, unsigned sy) {
|
|||||||
_dx = _w - _xoff;
|
_dx = _w - _xoff;
|
||||||
}
|
}
|
||||||
if (sy < _h) {
|
if (sy < _h) {
|
||||||
_yoff = (_h - sy) / 2;
|
_yoff = (_h - sy - _cy) / 2;
|
||||||
_dy = _h - _yoff;
|
_dy = _h - _yoff;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -240,7 +235,7 @@ void Display::begin(colour_t bg, colour_t fg, orientation_t orient) {
|
|||||||
#if VGA_BIT_DEPTH == 6
|
#if VGA_BIT_DEPTH == 6
|
||||||
Mode mode = VGA_RESOLUTION;
|
Mode mode = VGA_RESOLUTION;
|
||||||
vga.init(mode, R0, R1, G0, G1, B0, B1, HSYNC, VSYNC);
|
vga.init(mode, R0, R1, G0, G1, B0, B1, HSYNC, VSYNC);
|
||||||
#elif VGA_BIT_DEPTH == 3
|
#elif VGA_BIT_DEPTH == 3 || VGA_BIT_DEPTH == 1
|
||||||
vga.init(VGA_RESOLUTION, R0, G0, B0, HSYNC, VSYNC);
|
vga.init(VGA_RESOLUTION, R0, G0, B0, HSYNC, VSYNC);
|
||||||
#endif
|
#endif
|
||||||
init = true;
|
init = true;
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#define VGA_BIT_DEPTH 3
|
#define VGA_BIT_DEPTH 3
|
||||||
#endif
|
#endif
|
||||||
#if !defined(VGA_RESOLUTION)
|
#if !defined(VGA_RESOLUTION)
|
||||||
#define VGA_RESOLUTION VGAMode::MODE400x300
|
#define VGA_RESOLUTION VGAMode::MODE320x200
|
||||||
#endif
|
#endif
|
||||||
#if !defined(VGA_DEFAULT_FONT)
|
#if !defined(VGA_DEFAULT_FONT)
|
||||||
#define VGA_DEFAULT_FONT &Font6x8
|
#define VGA_DEFAULT_FONT &Font6x8
|
||||||
|
Loading…
x
Reference in New Issue
Block a user