{
int i, j, base = 0;
int nBlocks, rem;
- Uint32 bmp;
Size = (Size + 127) & ~127;
- nBlocks = Size >> 7;
+ nBlocks = Size / 128;
if(Size > 4096) return NULL;
for( i = 0; i < VM8086_PAGES_PER_INST; i++ )
{
if( State->Internal->AllocatedPages[i].VirtBase == 0 ) continue;
- bmp = State->Internal->AllocatedPages[i].Bitmap;
+
+
+ //Log_Debug("VM8086", "AllocatedPages[%i].Bitmap = 0b%b", i, State->Internal->AllocatedPages[i].Bitmap);
+
rem = nBlocks;
base = 0;
// Scan the bitmap for a free block
- for( j = 0; j < 32-nBlocks; j++ ) {
- if( bmp & (1 << j) ) {
- base = 0;
+ for( j = 0; j < 32; j++ ) {
+ if( State->Internal->AllocatedPages[i].Bitmap & (1 << j) ) {
+ base = j;
rem = nBlocks;
}
else {
State->Internal->AllocatedPages[i].Bitmap |= 1 << (base + j);
*Segment = State->Internal->AllocatedPages[i].PhysAddr / 16 + base * 8;
*Offset = 0;
+ //Log_Debug("VM8086", "Allocated at #%i,%04x", i, base*128);
return (void*)( State->Internal->AllocatedPages[i].VirtBase + base * 128 );
}
}
for( j = 0; j < nBlocks; j++ )
State->Internal->AllocatedPages[i].Bitmap |= 1 << j;
+ //Log_Debug("VM8086", "AllocatedPages[%i].Bitmap = 0b%b", i, State->Internal->AllocatedPages[i].Bitmap);
*Segment = State->Internal->AllocatedPages[i].PhysAddr / 16;
*Offset = 0;
return (void*) State->Internal->AllocatedPages[i].VirtBase;
*/
void Log_Int_PrintMessage(tLogEntry *Entry)
{
- LogF("%018lli%s [%8s] %s\n",
+ LogF("%018lli%s [%+8s] %s\n",
Entry->Time,
csaLevelCodes[Entry->Level],
Entry->Ident,
return MODULE_ERR_NOTNEEDED;\r
}\r
\r
+ Log_Debug("Vesa", "info->VideoModes = %04x:%04x", info->VideoModes.seg, info->VideoModes.ofs);\r
modes = (Uint16 *) VM8086_GetPointer(gpVesa_BiosState, info->VideoModes.seg, info->VideoModes.ofs);\r
\r
// Read Modes\r
- for( giVesaModeCount = 1; modes[giVesaModeCount] != 0xFFFF; giVesaModeCount++ );\r
+ for( giVesaModeCount = 0; modes[giVesaModeCount] != 0xFFFF; giVesaModeCount++ );\r
gVesa_Modes = (tVesa_Mode *)malloc( giVesaModeCount * sizeof(tVesa_Mode) );\r
\r
// Insert Text Mode\r
gpVesa_BiosState->DI = modeinfoPtr.ofs;\r
VM8086_Int(gpVesa_BiosState, 0x10);\r
\r
- Log_Debug("Vesa", "gpVesa_BiosState->AX = 0x%04x", gpVesa_BiosState->AX);\r
- \r
// Parse Info\r
gVesa_Modes[i].flags = 0;\r
if ( (modeinfo->attributes & 0x90) == 0x90 )\r