Skip to content

Commit

Permalink
Release v1.23 Minor update.
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoldUK authored Oct 5, 2023
1 parent 2ad7d17 commit 3f352bf
Show file tree
Hide file tree
Showing 2 changed files with 88 additions and 95 deletions.
2 changes: 1 addition & 1 deletion src/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

#pragma once

#define BUILD_STRING "Faux86-remake v1.22"
#define BUILD_STRING "Faux86-remake v1.23"

//#ifdef RASPPI1
//#error "RASPPI1 DEFINED"
Expand Down
181 changes: 87 additions & 94 deletions src/Video.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,76 +829,62 @@ void Video::vga_update(uint32_t start_x, uint32_t start_y, uint32_t end_x, uint3
uint32_t console_x, console_y;
uint32_t console_cols = (end_x / divx) + 1;
uint32_t console_rows = (end_y / maxscan) + 1;
uint8_t cursor_indicator_begin = vga_crtcd[VGA_REG_DATA_CURSOR_BEGIN] & 31;
uint8_t cursor_indicator_end = vga_crtcd[VGA_REG_DATA_CURSOR_END] & 31;
uint8_t cursor_blink;

uint8_t char_x, char_y;
addr = startaddr + start_x;
y_offset = (VGA_FRAMEBUFFER_WIDTH * start_y) + start_x;
uint16_t vga_attrd_x10_80 = vga_attrd[0x10] & 0x80;
uint16_t vga_attrd_x14_3s4 = (vga_attrd[0x14] & 3) << 4;
uint16_t vga_attrd_x14_Cs4 = (vga_attrd[0x14] & 0xC) << 4;
uint8_t *font_p;
for (console_y = 0; console_y < console_rows; ++console_y) {
for (console_x = 0; console_x < console_cols; ++console_x) {
cc = vga_RAM[0][addr];
attr = vga_RAM[1][addr];
blink = attr >> 7;
cursor_blink = (console_y == cursor_y) && (console_x == cursor_x) && vga_cursor_blink_state && cursorenable;

y_offset = (console_y * maxscan * VGA_FRAMEBUFFER_WIDTH) + (console_x * divx);
if ((console_y == cursor_y) && (console_x == cursor_x) &&
vga_cursor_blink_state && cursorenable) { //cursor should be displayed
color16 = vga_attrd[attr & 0x0F] | ((vga_attrd[0x14] & 0xC) << 4); //UPDATED
if (vga_attrd[0x10] & 0x80) { //P5, P4 replace
color16 = (color16 & 0xCF) | ((vga_attrd[0x14] & 3) << 4);
}
color16 = vgaColor[color16]; //set cursor color
for (char_y = 0; char_y < maxscan; ++char_y) {
for (char_x = 0; char_x < divx; ++char_x) {
//determine index into actual DAC palette
color16 = vga_attrd[(attr & 0x0F)] | vga_attrd_x14_Cs4;
//uint32_t color16_bg = vga_attrd[(attr >> 4)] | vga_attrd_x14_Cs4;
uint16_t color16_bg = vga_attrd[(attr >> 4)] | vga_attrd_x14_Cs4;
if (vga_attrd_x10_80) { //P5, P4 replace
color16 = (color16 & 0xCF) | vga_attrd_x14_3s4;
color16_bg = (color16_bg & 0xCF) | vga_attrd_x14_3s4;
}
color16 = vgaColor[color16]; //FG text color
//color16 = 2;
//color16 = vgaColor[120]; //FG Green
//color16 = vgaColor[7]; //FG Monochrome
//color16 = vgaColor[9]; //FG Blue
//color16 = vgaColor[11]; //FG Cyan
//color16 = vga_attrd_x14_Cs4;

//color16_bg = vgaColor[color16_bg]; //BG text color
color16_bg = vgaColor[color16_bg];

font_p = &vga_RAM[2][fontbase + ((uint32_t)cc << 5)];
for (char_y = 0; char_y < maxscan; ++char_y) {
fontdata = *font_p++;
for (char_x = 0; char_x < divx; ++char_x) {
if ((cursor_blink) && (char_y >= cursor_indicator_begin) && (char_y <= cursor_indicator_end)) {
vga_framebuffer[y_offset + char_x] = color16;
}
y_offset += VGA_FRAMEBUFFER_WIDTH;
}
}
else {
if (blinkenable && blink && !vga_cursor_blink_state) {
//all pixels in character get background color if blink attribute set and blink visible state is false
for (char_y = 0; char_y < maxscan; ++char_y) {
for (char_x = 0; char_x < divx; ++char_x) {
vga_framebuffer[y_offset + char_x] = 0;
else {
if (fontdata & 0b10000000) {
vga_framebuffer[y_offset + char_x] = color16;
}
y_offset += VGA_FRAMEBUFFER_WIDTH;
}
}
else {
//determine index into actual DAC palette
color16 = vga_attrd[(attr & 0x0F)] | ((vga_attrd[0x14] & 0xc) << 4);
//uint32_t color16_bg = vga_attrd[(attr >> 4)] | ((vga_attrd[0x14] & 0xc) << 4);
uint16_t color16_bg = vga_attrd[(attr >> 4)] | ((vga_attrd[0x14] & 0xc) << 4);
if (vga_attrd[0x10] & 0x80) { //P5, P4 replace
color16 = (color16 & 0xCF) | ((vga_attrd[0x14] & 3) << 4);
color16_bg = (color16_bg & 0xCF) | ((vga_attrd[0x14] & 3) << 4);
}
color16 = vgaColor[color16]; //FG text color
//color16 = 2;
//color16 = vgaColor[120]; //FG Green
//color16 = vgaColor[7]; //FG Monochrome
//color16 = vgaColor[9]; //FG Blue
//color16 = vgaColor[11]; //FG Cyan
//color16 =((vga_attrd[0x14] & 0xc) << 4);

//color16_bg = vgaColor[color16_bg]; //BG text color
color16_bg = vgaColor[color16_bg];

font_p = &vga_RAM[2][fontbase + ((uint32_t)cc << 5)];
for (char_y = 0; char_y < maxscan; ++char_y) {
fontdata = *font_p++;
for (char_x = 0; char_x < divx; ++char_x) {
if (fontdata & 0b10000000) {
vga_framebuffer[y_offset + char_x] = color16;
}
else {
vga_framebuffer[y_offset + char_x] = color16_bg;
}
fontdata <<= 1;
else {
vga_framebuffer[y_offset + char_x] = color16_bg;
}
y_offset += VGA_FRAMEBUFFER_WIDTH;
}
fontdata <<= 1;
}
y_offset += VGA_FRAMEBUFFER_WIDTH;
}
++addr;
}
Expand All @@ -921,10 +907,12 @@ void Video::vga_update(uint32_t start_x, uint32_t start_y, uint32_t end_x, uint3
addr = (addr >> 2) + startaddr;
cc = vga_RAM[plane][addr & 0xFFFF];
color16 = vgaColor[cc];
y_offset = scy * VGA_FRAMEBUFFER_WIDTH;
for (yadd = 0; yadd < yscanpixels; yadd++) {
for (xadd = 0; xadd < xscanpixels; xadd++) {
vga_framebuffer[VGA_FRAMEBUFFER_WIDTH * (scy + yadd) + scx + xadd] = color16;
vga_framebuffer[y_offset + scx + xadd] = color16;
}
y_offset += VGA_FRAMEBUFFER_WIDTH;
}
}
}
Expand All @@ -934,9 +922,9 @@ void Video::vga_update(uint32_t start_x, uint32_t start_y, uint32_t end_x, uint3
{
y_offset = VGA_FRAMEBUFFER_WIDTH * start_y;
// Color Plane Enable (AR12)
uint16_t vga_attrd_x10_8 = vga_attrd[0x10] & 0x80;
uint16_t vga_attrd_x10_80 = vga_attrd[0x10] & 0x80;
uint16_t vga_attrd_x12 = vga_attrd[0x12];
uint16_t vga_attrd_x14_Cs4 = (vga_attrd[0x14] & 0xC) << 4;
uint16_t vga_attrd_x14_Cs4 = (vga_attrd[0x14] & 0xC) << 4;
uint16_t vga_attrd_x14_3s4 = (vga_attrd[0x14] & 3) << 4;
uint8_t i;
for (y = start_y; y <= end_y; ++y) {
Expand All @@ -953,7 +941,7 @@ void Video::vga_update(uint32_t start_x, uint32_t start_y, uint32_t end_x, uint3
cc = ((v1 & 0b1) | (v2 & 0b10) | (v3 & 0b100) | (v4 & 0b1000)) & vga_attrd_x12;
//determine index into actual DAC palette
color16 = vga_attrd[cc] | vga_attrd_x14_Cs4; //UPDATED
if (vga_attrd_x10_8) { //P5, P4 replace
if (vga_attrd_x10_80) { //P5, P4 replace
color16 &= 0xCF;
color16 |= vga_attrd_x14_3s4;
}
Expand All @@ -971,44 +959,49 @@ void Video::vga_update(uint32_t start_x, uint32_t start_y, uint32_t end_x, uint3
}
break;
case VGA_MODE_GRAPHICS_2BPP:
// log(Log, "[VIDEO] vga_update VGA_MODE_GRAPHICS_2BPP");
for (scy = start_y; scy <= end_y; scy += yscanpixels) {
uint8_t isodd;
y = scy / yscanpixels;
isodd = y & 1;
y >>= 1;
for (scx = start_x; scx <= end_x; scx += xscanpixels) {
uint32_t yadd, xadd;
x = scx / xscanpixels;
//x += vga_attrd[0x13] & 0x0F;
addr = ((8192 * isodd) + (y * xstride) + (x / pixelsperbyte)) & 0xFFFF;
addr = addr + startaddr;
shift = (3 - (x & 3)) << 1;
cc = (vga_RAM[addr & 1][addr >> 1] >> shift) & 3;

//cc |= ((vga_RAM[2 + addr & 1][addr >> 1] >> shift) & 3) << 2; //ADDED
cc |= ((vga_RAM[(2 + addr) & 1][addr >> 1] >> shift) & 3) << 2; //ADDED
// Color Plane Enable (AR12)
cc &= vga_attrd[0x12]; //ADDED

//determine index into actual DAC palette
//color16 = vga_attrd[cc] | (vga_attrd[0x14] << 4); ORIGINAL
color16 = vga_attrd[cc] | ((vga_attrd[0x14] & 0xc) << 4); //UPDATED

if (vga_attrd[0x10] & 0x80) { //P5, P4 replace
color16 = (color16 & 0xCF) | ((vga_attrd[0x14] & 3) << 4);
}
color16 = vgaColor[color16];
uint32_t i;
uint16_t *p = vga_framebuffer + (scy * VGA_FRAMEBUFFER_WIDTH) + scx;
uint32_t xSkip = VGA_FRAMEBUFFER_WIDTH - xscanpixels;
for (yadd = 0; yadd < yscanpixels; yadd++) {
i = xscanpixels;
while(i--)
{
*p++ = color16;
{
// log(Log, "[VIDEO] vga_update VGA_MODE_GRAPHICS_2BPP");
uint16_t vga_attrd_x10_80 = vga_attrd[0x10] & 0x80;
uint16_t vga_attrd_x14_3s4 = (vga_attrd[0x14] & 3) << 4;
uint16_t vga_attrd_x14_Cs4 = (vga_attrd[0x14] & 0xC) << 4;
for (scy = start_y; scy <= end_y; scy += yscanpixels) {
uint8_t isodd;
y = scy / yscanpixels;
isodd = y & 1;
y >>= 1;
for (scx = start_x; scx <= end_x; scx += xscanpixels) {
uint32_t yadd, xadd;
x = scx / xscanpixels;
//x += vga_attrd[0x13] & 0x0F;
addr = ((8192 * isodd) + (y * xstride) + (x / pixelsperbyte)) & 0xFFFF;
addr = addr + startaddr;
shift = (3 - (x & 3)) << 1;
cc = (vga_RAM[addr & 1][addr >> 1] >> shift) & 3;

//cc |= ((vga_RAM[2 + addr & 1][addr >> 1] >> shift) & 3) << 2; //ADDED
cc |= ((vga_RAM[(2 + addr) & 1][addr >> 1] >> shift) & 3) << 2; //ADDED
// Color Plane Enable (AR12)
cc &= vga_attrd[0x12]; //ADDED

//determine index into actual DAC palette
//color16 = vga_attrd[cc] | (vga_attrd[0x14] << 4); ORIGINAL
color16 = vga_attrd[cc] | vga_attrd_x14_Cs4; //UPDATED

if (vga_attrd_x10_80) { //P5, P4 replace
color16 = (color16 & 0xCF) | vga_attrd_x14_3s4;
}
color16 = vgaColor[color16];
uint32_t i;
uint16_t *p = vga_framebuffer + (scy * VGA_FRAMEBUFFER_WIDTH) + scx;
uint32_t xSkip = VGA_FRAMEBUFFER_WIDTH - xscanpixels;
for (yadd = 0; yadd < yscanpixels; yadd++) {
i = xscanpixels;
while(i--)
{
*p++ = color16;
}
p += xSkip;
}
p += xSkip;
}
}
}
Expand Down

0 comments on commit 3f352bf

Please sign in to comment.