Reading VGA memory in planar mode
Posted: Sun Nov 11, 2018 6:01 am
Hi all,
I'm trying to get an understanding about the how various registers control the way data read/writes to vga memory work
odd/even, chain4, etc. I'm writing some basic assembly programs to test my understanding of the documentation.
Referring to the Wiki https://wiki.osdev.org/VGA_Fonts (the section titled Get from VGA RAM directly), I've managed to write to the vga memory in text mode, turn off odd/even mode, and read from plane 0, expecting to get back the text I've already written.
My problem is, no matter what I try, the data read back is always the same - font data from plane 2 (I know it's font data because I've used it to render text output). For testing I'm using Dosbox 0.74, with the setting "machine=vgaonly".
The basic steps I use are:
[*]Disable odd/even mode - Clear bit 1 of Graphics controller Miscellaneous Graphics Register (0x3ce Index 06)
[*]Graphics mode (Shift256/Shift Reg/Host O/E/Read Mode/Write Mode) all to 0 (0x3ce Index 05)
[*]Sequencer - Disable Chain 4/Disable Odd/Even Host Memory Write Addressing (0x3c4 Index 04) - Clear bit 3, Set bits 2 and 1
[*]Graphics controller Read Map Select (0x3ce Index 04) - set to 0 to select plane 0 (this is not mentioned in the Wiki)
Curiously the last step isn't in the Wiki code snippet I mentioned, however 0x3ce Index 02 (Memory Plane Write Enable) is. This has me puzzled since we're reading from vga memory not writing. I've tried setting this register to various values as well but it has no effect.
Right now I'm stuck and don't know what else to try. I've put the current nasm source file at https://bitbucket.org/snippets/DrSly/Ee ... ext-mode-3 if anyone is interested in having a look.
I really hope someone here still remembers how to read from vga in planar mode
I'm trying to get an understanding about the how various registers control the way data read/writes to vga memory work
odd/even, chain4, etc. I'm writing some basic assembly programs to test my understanding of the documentation.
Referring to the Wiki https://wiki.osdev.org/VGA_Fonts (the section titled Get from VGA RAM directly), I've managed to write to the vga memory in text mode, turn off odd/even mode, and read from plane 0, expecting to get back the text I've already written.
My problem is, no matter what I try, the data read back is always the same - font data from plane 2 (I know it's font data because I've used it to render text output). For testing I'm using Dosbox 0.74, with the setting "machine=vgaonly".
The basic steps I use are:
[*]Disable odd/even mode - Clear bit 1 of Graphics controller Miscellaneous Graphics Register (0x3ce Index 06)
[*]Graphics mode (Shift256/Shift Reg/Host O/E/Read Mode/Write Mode) all to 0 (0x3ce Index 05)
[*]Sequencer - Disable Chain 4/Disable Odd/Even Host Memory Write Addressing (0x3c4 Index 04) - Clear bit 3, Set bits 2 and 1
[*]Graphics controller Read Map Select (0x3ce Index 04) - set to 0 to select plane 0 (this is not mentioned in the Wiki)
Curiously the last step isn't in the Wiki code snippet I mentioned, however 0x3ce Index 02 (Memory Plane Write Enable) is. This has me puzzled since we're reading from vga memory not writing. I've tried setting this register to various values as well but it has no effect.
Right now I'm stuck and don't know what else to try. I've put the current nasm source file at https://bitbucket.org/snippets/DrSly/Ee ... ext-mode-3 if anyone is interested in having a look.
I really hope someone here still remembers how to read from vga in planar mode