Skip to content

Commit 4851ce6

Browse files
Write directly to 0x3DA to control blink attribute in PCjr mode, note lack of blink control via INT 10h, in PCjr mode
1 parent da512b2 commit 4851ce6

File tree

1 file changed

+23
-6
lines changed

1 file changed

+23
-6
lines changed

test-fw/video/pc/test.c

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1879,10 +1879,9 @@ void alphanumeric_test(unsigned int w,unsigned int h) {
18791879
uint16_t crtbase;
18801880
uint16_t sv;
18811881

1882-
// emulation bug check:
1883-
//
1884-
// DOSBox SVN & DOSBox-X, machine=pcjr, INT 10h doesn't do anything to control blink attribute,
1885-
// nor does the text mode come up with blink enabled by default.
1882+
// NTS: The PCjr puts the CGA "mode register" in 0x3DA register 0 instead of 0x3D8.
1883+
// We have to write it directly to control blinking. INT 10h does not provide
1884+
// the blink control function on PCjr.
18861885

18871886
// real hardware vs emulation check:
18881887
//
@@ -2012,13 +2011,22 @@ void alphanumeric_test(unsigned int w,unsigned int h) {
20122011
for (i=0;tmp[i] != 0;i++)
20132012
vmem[i+w] = 0x0700 + ((unsigned char)tmp[i]);
20142013

2015-
if ((vga_state.vga_flags & (VGA_IS_EGA|VGA_IS_MCGA|VGA_IS_VGA|VGA_IS_PCJR))) {
2014+
if ((vga_state.vga_flags & (VGA_IS_EGA|VGA_IS_MCGA|VGA_IS_VGA))) {
20162015
__asm {
20172016
mov ax,0x1003
20182017
mov bl,0x01
20192018
int 10h
20202019
}
20212020
}
2021+
else if ((vga_state.vga_flags & (VGA_IS_PCJR))) {
2022+
uint8_t mb = int10_bd_read_cga_mode_byte();
2023+
2024+
LOG(LOG_DEBUG "Switching on blink attribute PCjr method, port=0x%03x, BIOS mode byte was 0x%02x\n",
2025+
crtbase+6u,mb);
2026+
2027+
outp(crtbase+6u,0x00);
2028+
outp(crtbase+6u,mb | 0x20);/*turn on bit 5*/
2029+
}
20222030
else {
20232031
uint8_t mb = int10_bd_read_cga_mode_byte();
20242032

@@ -2037,13 +2045,22 @@ void alphanumeric_test(unsigned int w,unsigned int h) {
20372045
for (i=0;tmp[i] != 0;i++)
20382046
vmem[i+w] = 0x0700 + ((unsigned char)tmp[i]);
20392047

2040-
if ((vga_state.vga_flags & (VGA_IS_EGA|VGA_IS_MCGA|VGA_IS_VGA|VGA_IS_PCJR))) {
2048+
if ((vga_state.vga_flags & (VGA_IS_EGA|VGA_IS_MCGA|VGA_IS_VGA))) {
20412049
__asm {
20422050
mov ax,0x1003
20432051
mov bl,0x00
20442052
int 10h
20452053
}
20462054
}
2055+
else if ((vga_state.vga_flags & (VGA_IS_PCJR))) {
2056+
uint8_t mb = int10_bd_read_cga_mode_byte();
2057+
2058+
LOG(LOG_DEBUG "Switching on blink attribute PCjr method, port=0x%03x, BIOS mode byte was 0x%02x\n",
2059+
crtbase+6u,mb);
2060+
2061+
outp(crtbase+6u,0x00);
2062+
outp(crtbase+6u,mb & 0xDF);/*turn off bit 5*/
2063+
}
20472064
else {
20482065
uint8_t mb = int10_bd_read_cga_mode_byte();
20492066

0 commit comments

Comments
 (0)