home *** CD-ROM | disk | FTP | other *** search
- #include <mem.h>
- #include <dos.h>
-
- unsigned fontblock[0x1000];
- unsigned buffer[0x1000];
-
- main()
- {
- vid_plane_read(fontblock, 2, 0x1000);
- vid_plane_write(fontblock, 4, 0x1000);
- return;
- }
-
-
-
- //┌───────────────────────────────────────────────────────────────────────┐//
- //│ Saves font block 0 directly from plane 2, EGA/VGA only │//
- //│ Reference: Programmer Guide to EGA/VGA page 357+ │//
- //└───────────────────────────────────────────────────────────────────────┘//
- vid_plane_read(unsigned near *chunk, char plane, unsigned size)
- {
- outp (0x3ce, 4); // Read Map Register (index 5)
- outp (0x3cf, plane); // read from plane 2
-
- outp (0x3ce, 5); // Mode Register (index 5)
- outp (0x3cf, 0); // disable O/E bit 4 for sequential addressing
-
- outp (0x3c4, 4); // Memory Mode (index 4)
- outp (0x3c5, 6); // enable O/E bit 2 for sequential addressing
-
- movedata (0xb800, 0, _DS, (unsigned)chunk, size);
-
- outp (0x3c4, 4); // Memory Mode (index 4)
- outp (0x3c5, 2); // disable O/E Bit 2 for sequential addressing
-
- outp (0x3ce, 5); // Mode Register (index 5)
- outp (0x3cf, 16); // enable O/E bit 4 for sequential addressing
-
- outp (0x3ce, 4); // Read Map Register (index 5)
- outp (0x3cf, 0); // read from plane 0 (default)
-
- return;
- }
-
-
-
- //┌───────────────────────────────────────────────────────────────────────┐//
- //│ Saves font block 0 directly from plane 2, EGA/VGA only │//
- //│ Reference: Programmer Guide to EGA/VGA page 357+ │//
- //└───────────────────────────────────────────────────────────────────────┘//
- vid_plane_write(unsigned near *chunk, char mask, unsigned size)
- {
-
- outp (0x3c4, 4); // Memory Mode (index 4)
- outp (0x3c5, 6); // enable O/E Bit for sequential addressing
-
- outp (0x3ce, 5); // Mode Ragister (index 5)
- outp (0x3cf, 0); // disable O/E bit for sequential addressing
-
- outp (0x3c4, 2); // Map mask for write mode 0 (index 2)
- outp (0x3c5, mask); // Plane mask, 4 = 0100 = plane 2
-
- movedata (_DS, (unsigned)chunk, 0xb800, 0, size);
-
- outp (0x3c4, 4); // Memory Mode (index 4)
- outp (0x3c5, 2); // disable O/E Bit for odd/even addressing
-
- outp (0x3ce, 5); // Mode Ragister (index 5)
- outp (0x3cf, 16); // disable O/E bit for sequential addressing
-
- outp (0x3c4, 2); // Map mask for write mode 0 (index 2)
- outp (0x3c5, 3); // Plane mask, 3 = 0011 = planes 0 and 1
-
- return;
- }
-
-
-
-