I have this code which is supposed to disable screen, and it worx fine on my Win98:

mov dx, 03c4h
mov al, 01h
out dx, al
inc dx
in al, dx
or al, 20h
out dx, al

The problem is that I would like to turn it back on, but I don't know how?
Also, could someone pls explain what this code does exactly?
Posted on 2001-11-07 16:28:21 by DZA
Hi Dza,

I did a little bit of searching and came up with this. Port 3C4h Index 1 is the VGA Sequencer Clocking Mode. If bit 5 is set this turns off the screen and gives all memory cycles to the CPU interface.


3C4h is the VGA Sequencer Index Register (SEQX).
This register is loaded with a binary value that indexes the sequencer register for read/write data. This value is referred to as the "Index Number" of the SR register.

Bits 4-0 : SEQ ADDRESS - Sequencer Register Index
A binary value indexing the register where data is to be accessed.
Bits 7-5 : Reserved

Index 0: reset register
Index 2: map mask register
Index 3: character map select register
Index 4: memory mode register


3C5h is the VGA Sequencer Data Register (SEQ_DATA).
This register is the data port for the sequencer register indexed by the
Sequencer Index register (3C4h).

Bits 7-0 : SEQ DATA - Sequencer Register Data
Data to the sequencer register indexed by the sequencer address index.

.......1 8/9 dot clocks (9 bits for mda-compatibility)
.....1.. 16/8 bits shift mode (see also 3cf.5)
....1... 40/80 column mode
...1.... 32/8 bits shift mode (see also 3cf.5)
..1..... disable the display, to give the cpu more access to video memory


So I roughly interpret the code as:

mov dx, 03c4h ; VGA Sequencer Index Register (SEQX)
mov al, 01h ; Index 1 (clocking mode register)
out dx, al ; write index to 3C4h register
inc dx ; point to Data Register (SEQ_DATA)
in al, dx ; read indexed Data Register into accumulator
or al, 20h ; set bit 5 (20h = 100000)
out dx, al ; output to Data Register

I would assume to reverse it you would just need to unset bit 5 again with xor 20h. I think the ASM I/O commands In and Out will only work on Win9x.

Posted on 2001-11-08 03:36:36 by Kayaker