Skip to content

Commit

Permalink
Minor VGA fixes.
Browse files Browse the repository at this point in the history
Write mode fixes and updated BIOS.
  • Loading branch information
andreas-jonsson committed Oct 21, 2023
1 parent 40b94a1 commit cdac2dd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
Binary file modified bios/vgabios.bin
Binary file not shown.
18 changes: 12 additions & 6 deletions modules/vga/vga.c
Original file line number Diff line number Diff line change
Expand Up @@ -172,17 +172,16 @@ static vxt_byte read(struct vga_video *v, vxt_pointer addr) {
addr -= MEMORY_START;

if (v->reg.seq_reg[5] & 8) {
VXT_LOG("Readmode 1 is unsupported!");
VXT_LOG("Read mode 1 is unsupported!");
return 0;
}

if ((v->video_mode != 0xD) && (v->video_mode != 0xE) && (v->video_mode != 0x10) && (v->video_mode != 0x12))
return MEMORY(v->mem, addr);

if (!(v->reg.seq_reg[4] & 6))
if (v->reg.seq_reg[4] & 8)
return MEMORY(v->mem, addr);


v->mem_latch[0] = MEMORY(v->mem, addr);
v->mem_latch[1] = MEMORY(v->mem, addr + PLANE_SIZE);
v->mem_latch[2] = MEMORY(v->mem, addr + PLANE_SIZE * 2);
Expand All @@ -205,22 +204,29 @@ static void write(struct vga_video *v, vxt_pointer addr, vxt_byte data) {
}
addr -= MEMORY_START;

if (((v->video_mode != 0xD) && (v->video_mode != 0xE) && (v->video_mode != 0x10) && (v->video_mode != 0x12)) || !(v->reg.seq_reg[4] & 6)) {
if ((v->video_mode != 0xD) && (v->video_mode != 0xE) && (v->video_mode != 0x10) && (v->video_mode != 0x12)) {
MEMORY(v->mem, addr) = data;
return;
}

if (v->reg.seq_reg[4] & 8) {
MEMORY(v->mem, addr) = data;
return;
}

vxt_byte *gr = v->reg.gfx_reg;
vxt_byte bit_mask = gr[8];
vxt_byte map_mask = v->reg.seq_reg[2];
vxt_byte map_mask = v->reg.seq_reg[2] & 0xF;

switch (gr[5] & 3) {
case 0:
ROTATE_OP(gr, data);
FOR_PLANES(map_mask,
vxt_byte value = (data & M) ? 0xFF : 0x0;
vxt_byte value = data;
if (gr[1] & M)
value = (gr[0] & M) ? 0xFF : 0x0;
else
ROTATE_OP(gr, value);
LOGIC_OP(gr, value, v->mem_latch[I]);
MEMORY(v->mem, addr + PLANE_SIZE * I) = (bit_mask & value) | (~bit_mask & v->mem_latch[I]);
);
Expand Down

0 comments on commit cdac2dd

Please sign in to comment.