1
0
Fork 0

Fix ROM checksum. (was broken as setupvesa modifies the rom as well)

Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2476
This commit is contained in:
Peter Veenstra 2006-02-08 15:13:06 +00:00
parent 3be8dfc37a
commit b2ca61030e
3 changed files with 16 additions and 7 deletions

View file

@ -546,5 +546,6 @@ void INT10_Init(Section* sec) {
INT10_SetupRomMemory();
INT10_Seg40Init();
INT10_SetupVESA();
INT10_SetupRomMemoryChecksum();//SetupVesa modifies the rom as well.
INT10_SetVideoMode(machine==MCH_HERC ? 0x7 : 0x3);
};

View file

@ -201,6 +201,7 @@ Bit8u VESA_GetPalette(PhysPt data,Bitu index,Bitu count);
/* Sup Groups */
void INT10_SetupRomMemory(void);
void INT10_SetupRomMemoryChecksum(void);
void INT10_SetupVESA(void);
/* EGA RIL */

View file

@ -72,6 +72,7 @@ void INT10_LoadFont(PhysPt font,bool reload,Bitu count,Bitu offset,Bitu map,Bitu
}
}
static Bitu checksumlocation = 0; //Same type as int10.rom.used
void INT10_SetupRomMemory(void) {
/* This should fill up certain structures inside the Video Bios Rom Area */
PhysPt rom_base=PhysMake(0xc000,0);
@ -113,16 +114,22 @@ void INT10_SetupRomMemory(void) {
RealSetVec(0x1F,int10.rom.font_8_second);
if (machine == MCH_VGA) { //EGA/VGA. Just to be safe
/* Sum of all bytes in rom module 256 should be 0 */
Bit8u sum = 0;
for (i = 0;i < 32 * 1024;i++) //32 KB romsize
sum += phys_readb(rom_base + i); //OVERFLOW IS OKAY
sum = 256 - sum;
phys_writeb(rom_base+int10.rom.used++,sum);
//Reserve checksum location
checksumlocation = int10.rom.used++;
}
};
void INT10_SetupRomMemoryChecksum(void) {
if (machine == MCH_VGA) { //EGA/VGA. Just to be safe
/* Sum of all bytes in rom module 256 should be 0 */
Bit8u sum = 0;
PhysPt rom_base = PhysMake(0xc000,0);
for (Bitu i = 0;i < 32 * 1024;i++) //32 KB romsize
sum += phys_readb(rom_base + i); //OVERFLOW IS OKAY
sum = 256 - sum;
phys_writeb(rom_base + checksumlocation,sum);
}
}
Bit8u int10_font_08[256 * 8] = {