Hi all, about 6 months ago we (Dosemu team and some others) added planar vga mode support (such as the old 16-color EGA/VGA modes) to dosemu running in a window under x (xdos). This is all in 1.0.1 and later versions. This was initially by taking some code from Bochs: reading and writing a byte in VGA video memory. This is not straightforward, as the byte you write is not actually what ends up in video memory, but is manipulated by various registers and the latch, a 32 bit register holding the contents of the 4 planes at the last byte that is read. The initial way was to read/write protect virtual video memory, and act upon a page fault whenever a byte was read or written. This was painfully slow. So we implemented partial cpu emulation to avoid the page fault handling overhead. We quit the cpu emulation after COUNT (presently set at 150) instructions without VGA memory access or at a non-emulated instruction or when dosemu signals to do its main loop. Now Alberto Vignani has written a new JIT cpu emulator, successor of the Willows code and we are (also) going to replace the partial emulator with this one. Maybe this emulator sometime will gives us a method to run Win9x/Linux/whatever OS in dosemu as well. See www.dosemu.org/~alberto/index.htm Anyway the vga memory read and write instructions are in plex86 in plex86/user/plugins/bochs/iodev/vga.cc bx_vga_c::mem_read and bx_vga_c::mem_write I've optimised these in dosemu: directly using 32 bits instead of using two nested for loops for each plane (4 of these) and bit (8 of these) and would like to contribute these back if there's interest; in dosemu they are in src/env/video/vgaemu.c, unsigned char Logical_VGA_read(unsigned offset) and void Logical_VGA_write(unsigned offset, unsigned char value) and helper functions. I think that's fair; there is a GPL (dosemu) vs. LGPL (plex86) issue but these specific optimisations are by me so I can do what I want with them. I'm not very familiar with plex86: how does it deal with this kind of stuff: not at all, page faults or some very smart method? Bart
