Skip to content

Commit 7cf09c2

Browse files
Testing: VGA byte/word/dword
1 parent 0bdcf50 commit 7cf09c2

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

hw/vesa/modeset.c

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242
#include <hw/flatreal/flatreal.h>
4343
#include <hw/dos/doswin.h>
4444

45+
static int vga_setbmode = -1;
4546
static int info = 0; /* show info */
4647
static int sstep = 0; /* single step */
4748

@@ -778,7 +779,16 @@ int main(int argc,char **argv) {
778779
else if (!strcmp(a,"6")) {
779780
md.dac8 = 0;
780781
}
781-
else {
782+
else if (!strcmp(a,"vb")) {
783+
vga_setbmode = 0;//byte mode
784+
}
785+
else if (!strcmp(a,"vw")) {
786+
vga_setbmode = 1;//word mode
787+
}
788+
else if (!strcmp(a,"vd")) {
789+
vga_setbmode = 2;//dword mode
790+
}
791+
else {
782792
printf("I don't know what switch '%s' means\n",a);
783793
return 1;
784794
}
@@ -924,6 +934,31 @@ int main(int argc,char **argv) {
924934
printf(" Failed to set mode\n");
925935
return 1;
926936
}
937+
938+
if (vga_setbmode >= 0) {
939+
/* Test whether SVGA modes are immune or not to the BYTE/WORD/DWORD bits */
940+
unsigned char un,mc;
941+
942+
if (!probe_vga())
943+
return 1;
944+
945+
un = vga_read_CRTC(0x14);
946+
mc = vga_read_CRTC(0x17);
947+
948+
if (vga_setbmode >= 2)//DW BIT
949+
un |= 0x40;
950+
else
951+
un &= ~0x40;
952+
953+
if (vga_setbmode >= 1)//W BIT (set to 0 for word mode)
954+
mc &= ~0x40;
955+
else
956+
mc |= 0x40;
957+
958+
vga_write_CRTC(0x14,un);
959+
vga_write_CRTC(0x17,mc);
960+
}
961+
927962
sstep_wait();
928963
if (!vbe_mode_decision_acceptmode(&md,&mi)) {
929964
vbe_reset_video_to_text();

0 commit comments

Comments
 (0)