diff --git a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c index 381c62b3c4b..d428476fc18 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/hardware.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/hardware.c @@ -2292,11 +2292,6 @@ PcHwDetect(VOID) DetectAcpiBios(SystemKey, &BusNumber); DbgPrint((DPRINT_HWDETECT, "DetectHardware() Done\n")); - -#if 0 - printf("*** System stopped ***\n"); - for (;;); -#endif } /* EOF */ diff --git a/reactos/boot/freeldr/freeldr/freeldr_base.rbuild b/reactos/boot/freeldr/freeldr/freeldr_base.rbuild index bb8de485233..c8634d46176 100644 --- a/reactos/boot/freeldr/freeldr/freeldr_base.rbuild +++ b/reactos/boot/freeldr/freeldr/freeldr_base.rbuild @@ -62,10 +62,8 @@ ui.c - bank.c fade.c palette.c - pixel.c video.c diff --git a/reactos/boot/freeldr/freeldr/reactos/reactos.c b/reactos/boot/freeldr/freeldr/reactos/reactos.c index adb7f3cc024..bb6889d2710 100644 --- a/reactos/boot/freeldr/freeldr/reactos/reactos.c +++ b/reactos/boot/freeldr/freeldr/reactos/reactos.c @@ -762,18 +762,15 @@ LoadAndBootReactOS(PCSTR OperatingSystemName) strcat(szHalName, value); } - /* Load the kernel */ - LoadBase = FrLdrLoadImage(szKernelName, 5, 1); - if (!LoadBase) return; + /* Load the kernel */ + LoadBase = FrLdrLoadImage(szKernelName, 5, 1); + if (!LoadBase) return; - printf("Kernel loaded at %x\n", LoadBase); - - /* Get the NT header, kernel base and kernel entry */ - NtHeader = RtlImageNtHeader(LoadBase); - KernelBase = SWAPD(NtHeader->OptionalHeader.ImageBase); - KernelEntryPoint = KernelBase + SWAPD(NtHeader->OptionalHeader.AddressOfEntryPoint); - printf("KernelEntryPoint is %x (base %x)\n", KernelEntryPoint, KernelBase); - LoaderBlock.KernelBase = KernelBase; + /* Get the NT header, kernel base and kernel entry */ + NtHeader = RtlImageNtHeader(LoadBase); + KernelBase = SWAPD(NtHeader->OptionalHeader.ImageBase); + KernelEntryPoint = KernelBase + SWAPD(NtHeader->OptionalHeader.AddressOfEntryPoint); + LoaderBlock.KernelBase = KernelBase; /* * Load the System hive from disk @@ -836,7 +833,7 @@ LoadAndBootReactOS(PCSTR OperatingSystemName) */ if (!FrLdrLoadNlsFiles(szBootPath, MsgBuffer)) { - UiMessageBox(MsgBuffer); + UiMessageBox(MsgBuffer); return; } UiDrawProgressBarCenter(30, 100, szLoadingMsg); @@ -844,19 +841,15 @@ LoadAndBootReactOS(PCSTR OperatingSystemName) /* * Load boot drivers */ - printf("FrLdrLoadBootDrivers\n"); FrLdrLoadBootDrivers(szBootPath, 40); - printf("FrLdrLoadBootDrivers end\n"); //UiUnInitialize("Booting ReactOS..."); /* * Now boot the kernel */ DiskStopFloppyMotor(); - printf("MachVideoPrepareForReactOS\n"); - MachVideoPrepareForReactOS(FALSE); - printf("FrLdrStartup\n"); - FrLdrStartup(0x2badb002); + MachVideoPrepareForReactOS(FALSE); + FrLdrStartup(0x2badb002); } #undef DbgPrint diff --git a/reactos/boot/freeldr/freeldr/reactos/registry.c b/reactos/boot/freeldr/freeldr/reactos/registry.c index b1af9b2b481..f5062b6e62b 100644 --- a/reactos/boot/freeldr/freeldr/reactos/registry.c +++ b/reactos/boot/freeldr/freeldr/reactos/registry.c @@ -27,11 +27,6 @@ static FRLDRHKEY RootKey; VOID RegInitializeRegistry (VOID) { -#if 0 - FRLDRHKEY TestKey; - WCHAR szTestString[] = L"TestString"; -#endif - /* Create root key */ RootKey = (FRLDRHKEY) MmAllocateMemory (sizeof(KEY)); @@ -74,19 +69,6 @@ RegInitializeRegistry (VOID) RegCreateKey (RootKey, L"Registry\\Machine\\HARDWARE\\RESOURCEMAP", NULL); - -/* Testcode */ -#if 0 - RegCreateKey (RootKey, - L"Registry\\Machine\\HARDWARE\\DESCRIPTION\\TestKey", - &TestKey); - - RegSetValue (TestKey, - L"TestValue", - REG_SZ, - szTestString, - sizeof(szTestString)); -#endif } diff --git a/reactos/boot/freeldr/freeldr/video/bank.c b/reactos/boot/freeldr/freeldr/video/bank.c deleted file mode 100644 index 6b835d0d392..00000000000 --- a/reactos/boot/freeldr/freeldr/video/bank.c +++ /dev/null @@ -1,112 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include - -#if 0 /* This stuff isn't used and as far as I'm concerned it can go - GvG */ -U32 CurrentMemoryBank = 0; - -VOID VideoSetMemoryBank(U16 BankNumber) -{ - if (CurrentMemoryBank != BankNumber) - { - BiosVesaSetBank(BankNumber); - CurrentMemoryBank = BankNumber; - } -} - -U32 VideoGetMemoryBankForPixel(U32 X, U32 Y) -{ - U32 Bank; - U32 MemoryPos; - U32 BankSize; - U32 BytesPerPixel; - - //BytesPerPixel = ROUND_UP(VesaVideoModeInformation.BitsPerPixel, 8) / 8; - BytesPerPixel = (VesaVideoModeInformation.BitsPerPixel + 7) >> 3; - MemoryPos = (Y * VideoGetBytesPerScanLine()) + (X * BytesPerPixel); - //BankSize = VesaVideoModeInformation.WindowGranularity * 1024; - BankSize = VesaVideoModeInformation.WindowGranularity << 10; - Bank = MemoryPos / BankSize; - - return Bank; -} - -U32 VideoGetMemoryBankForPixel16(U32 X, U32 Y) -{ - U32 Bank; - U32 MemoryPos; - U32 BankSize; - - MemoryPos = (Y * VideoGetBytesPerScanLine()) + (X / 2); - //BankSize = VesaVideoModeInformation.WindowGranularity * 1024; - BankSize = VesaVideoModeInformation.WindowGranularity << 10; - Bank = MemoryPos / BankSize; - - return Bank; -} - -U32 VideoGetBankOffsetForPixel(U32 X, U32 Y) -{ - U32 BankOffset; - U32 MemoryPos; - U32 BankSize; - U32 BytesPerPixel; - - //BytesPerPixel = ROUND_UP(VesaVideoModeInformation.BitsPerPixel, 8) / 8; - BytesPerPixel = (VesaVideoModeInformation.BitsPerPixel + 7) >> 3; - MemoryPos = (Y * VideoGetBytesPerScanLine()) + (X * BytesPerPixel); - //BankSize = VesaVideoModeInformation.WindowGranularity * 1024; - BankSize = VesaVideoModeInformation.WindowGranularity << 10; - BankOffset = MemoryPos % BankSize; - - return BankOffset; -} - -U32 VideoGetBankOffsetForPixel16(U32 X, U32 Y) -{ - U32 BankOffset; - U32 MemoryPos; - U32 BankSize; - - MemoryPos = (Y * VideoGetBytesPerScanLine()) + (X / 2); - //BankSize = VesaVideoModeInformation.WindowGranularity * 1024; - BankSize = VesaVideoModeInformation.WindowGranularity << 10; - BankOffset = MemoryPos % BankSize; - - return BankOffset; -} - -U32 VideoGetOffScreenMemoryOffsetForPixel(U32 X, U32 Y) -{ - U32 MemoryPos; - U32 BytesPerPixel; - - //BytesPerPixel = ROUND_UP(VesaVideoModeInformation.BitsPerPixel, 8) / 8; - BytesPerPixel = (VesaVideoModeInformation.BitsPerPixel + 7) >> 3; - MemoryPos = (Y * VesaVideoModeInformation.BytesPerScanLine) + (X * BytesPerPixel); - - return MemoryPos; -} -#endif - -VOID VideoCopyOffScreenBufferToVRAM(VOID) -{ - MachVideoCopyOffScreenBufferToVRAM(VideoOffScreenBuffer); -} diff --git a/reactos/boot/freeldr/freeldr/video/pixel.c b/reactos/boot/freeldr/freeldr/video/pixel.c deleted file mode 100644 index 4b798feb0d9..00000000000 --- a/reactos/boot/freeldr/freeldr/video/pixel.c +++ /dev/null @@ -1,335 +0,0 @@ -/* - * FreeLoader - * Copyright (C) 1998-2003 Brian Palmer - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#include - -#if 0 /* This stuff isn't used and as far as I'm concerned it can go - GvG */ -// -// Arrrggh! -// I really really hate 16 color bit plane modes. -// They should all burn in hell for what they've -// done to my sleeping habits. And I still can't -// get this code to work and I have absolutely -// no idea why... -// -// Someone else can take up this portion of the -// boot loader because my give up... -// -// I was going to store the offscreen buffer as -// a big array of bytes (as opposed to four bits) -// and that makes it a bit easier to set a pixel -// on the offscreen buffer, but will have to be -// handled in the VideoCopyOffScreenBufferToVRAM() -// function. -// -VOID VideoSetPixel16(U32 X, U32 Y, U8 Color) -{ - //U8 CurrentColor; - U8* MemoryPointer; - U32 ByteOffset; - U8 BitInByte; - U8 ReadByte; - U8 BitToChange; - - MemoryPointer = (U8*)(VIDEOVGA_MEM_ADDRESS); - - // Calculate the byte offset into the bit-plane - // where the pixel is to be set and the bit - // offset in that byte. - //ByteOffset = (Y * VideoGetBytesPerScanLine()) + (X >> 3); - //ByteOffset = (Y * 80) + (X >> 3); - ByteOffset = (Y * 640) + X; - BitInByte = ByteOffset & 7; - ByteOffset = ByteOffset >> 3; - //BitToChange = 0x80 >> BitInByte; - BitToChange = 0x80; - - DbgPrint((DPRINT_WARNING, "X = %d Y = %d Color = %d ByteOffset = %d BitInByte = %d BitToChange = %d\n", X, Y, Color, ByteOffset, BitInByte, BitToChange)); - //getch(); - - // Read the byte of memory to be changed. This is a - // read for the video card latches and the data read - // from memory does not need to be used. - ReadByte = MemoryPointer[ByteOffset]; - - // Select the bit or bits in the byte that need to be - // changed through index 8 of the VGA card address - // register by sending an 8 out to I/O port 3CEh. - // Next get the bits to be changed (a one-bit represents - // a bit to be changed) and send this out to I/O - // port 3CFh, the bit mask register (BMR). - //WRITE_PORT_USHORT((U16*)0x3CE, (((U16)BitToChange) << 8) + 0x08); - WRITE_PORT_UCHAR((U8*)0x3CE, 0x08); - //WRITE_PORT_UCHAR((U8*)0x3CF, BitToChange); - WRITE_PORT_UCHAR((U8*)0x3CF, BitInByte); - - // Next set all mask bits to 1111 in the map mask register - // (MMR) at sequencer offset 2, and write color 0 to the - // VGA card to set the color to black. The mask bits select - // the bit planes to be changed. If all are selected and a - // color of 0 is written, all four bit-planes are clear to zero. - WRITE_PORT_USHORT((U16*)0x3C4, 0x0F02); - //WRITE_PORT_UCHAR((U8*)0x3C4, 0x02); - //WRITE_PORT_UCHAR((U8*)0x3C5, 0x0F); // Mask to 1111 binary - MemoryPointer[ByteOffset] = 0x00; - - // Send the desired color number to the map mask register and - // write an FFh to the video memory. This places a logic one - // in only the selected bit planes to write a new color to - // a pixel or dot on the screen. - WRITE_PORT_UCHAR((U8*)0x3C4, 0x02); - //WRITE_PORT_UCHAR((U8*)0x3C5, Color); - WRITE_PORT_UCHAR((U8*)0x3C5, 0x0F); - //WRITE_PORT_USHORT((U16*)0x3C4, 0x0A02); - MemoryPointer[ByteOffset] = 0xFF; - - - /*CurrentColor = Color; - - MemoryPointer = (U8*)(VIDEOVGA_MEM_ADDRESS); - - WRITE_PORT_USHORT((U16*)0x3CE, 0x00 | (CurrentColor << 8)); - WRITE_PORT_USHORT((U16*)0x3CE, 0x08 | 0x8000 >> (X & 7)); - - MemoryPointer += (Y * VideoGetBytesPerScanLine()) + (X >> 3); - - *MemoryPointer = *MemoryPointer; - getch();*/ - - - // First select the color plane - //ColorPlane = Color; - //ColorPlane = (ColorPlane << 8) + 0x02; - //WRITE_PORT_USHORT((U16*)0x3C4, ColorPlane); - - // Now calculate the byte offset in the - // color plane that contains our pixel - // Since there are 8 pixels per byte we - // have to adjust accordingly - /*ByteOffset = (Y * VideoGetCurrentModeResolutionX()) + X; - BitInByte = ByteOffset % 8; - ByteOffset = ByteOffset / 8; - - // Shift the color to the right bit - Color = 1; - Color = Color << BitInByte; - - // Get the current color - CurrentColor = MemoryPointer[ByteOffset]; - - // Add the new color - CurrentColor = CurrentColor | Color; - - // Now set the color - MemoryPointer[ByteOffset] = CurrentColor;*/ -} - -VOID VideoSetPixel256(U32 X, U32 Y, U8 Color) -{ - U32 Bank; - U32 Offset; - U8* MemoryPointer; - - MemoryPointer = (U8*)(VIDEOVGA_MEM_ADDRESS); - - Bank = VideoGetMemoryBankForPixel(X, Y); - Offset = VideoGetBankOffsetForPixel(X, Y); - - VideoSetMemoryBank(Bank); - - MemoryPointer[Offset] = Color; -} - -VOID VideoSetPixelRGB_15Bit(U32 X, U32 Y, U8 Red, U8 Green, U8 Blue) -{ - U32 Bank; - U32 Offset; - U8* MemoryPointer; - U16 Pixel; - - MemoryPointer = (U8*)(VIDEOVGA_MEM_ADDRESS); - - Bank = VideoGetMemoryBankForPixel(X, Y); - Offset = VideoGetBankOffsetForPixel(X, Y); - - VideoSetMemoryBank(Bank); - - Red = Red >> 3; - Green = Green >> 3; - Blue = Blue >> 3; - - Pixel = Red << 11 | Green << 6 | Blue << 1; - - MemoryPointer[Offset] = Pixel & 0xFF; - MemoryPointer[Offset+1] = Pixel >> 8; -} - -VOID VideoSetPixelRGB_16Bit(U32 X, U32 Y, U8 Red, U8 Green, U8 Blue) -{ - U32 Bank; - U32 Offset; - U8* MemoryPointer; - U16 Pixel; - - MemoryPointer = (U8*)(VIDEOVGA_MEM_ADDRESS); - - Bank = VideoGetMemoryBankForPixel(X, Y); - Offset = VideoGetBankOffsetForPixel(X, Y); - - VideoSetMemoryBank(Bank); - - Red = Red >> 3; - Green = Green >> 2; - Blue = Blue >> 3; - - Pixel = (U16)Red << 11 | (U16)Green << 5 | (U16)Blue << 0; - - MemoryPointer[Offset] = Pixel & 0xFF; - MemoryPointer[Offset+1] = Pixel >> 8; -} - -VOID VideoSetPixelRGB_24Bit(U32 X, U32 Y, U8 Red, U8 Green, U8 Blue) -{ - U32 Bank; - U32 Offset; - U8* MemoryPointer; - - MemoryPointer = (U8*)(VIDEOVGA_MEM_ADDRESS); - - Bank = VideoGetMemoryBankForPixel(X, Y); - Offset = VideoGetBankOffsetForPixel(X, Y); - - VideoSetMemoryBank(Bank); - - MemoryPointer[Offset] = Blue; - MemoryPointer[Offset+1] = Green; - MemoryPointer[Offset+2] = Red; -} - -VOID VideoSetPixelRGB(U32 X, U32 Y, U8 Red, U8 Green, U8 Blue) -{ - U32 Width, Height, Depth; - - MachVideoGetDisplaySize(&Width, &Height, &Depth); - if (Depth >= 24) - { - VideoSetPixelRGB_24Bit(X, Y, Red, Green, Blue); - } - else if (Depth >= 16) - { - VideoSetPixelRGB_16Bit(X, Y, Red, Green, Blue); - } - else if (Depth == 15) - { - VideoSetPixelRGB_15Bit(X, Y, Red, Green, Blue); - } - else - { - BugCheck((DPRINT_UI, "This function does not support %d bits per pixel!", Depth)); - } -} - -VOID VideoSetPixel16_OffScreen(U32 X, U32 Y, U8 Color) -{ -} - -VOID VideoSetPixel256_OffScreen(U32 X, U32 Y, U8 Color) -{ - U8* MemoryPointer; - - MemoryPointer = (U8*)(VideoOffScreenBuffer + VideoGetOffScreenMemoryOffsetForPixel(X, Y)); - - *MemoryPointer = Color; -} - -VOID VideoSetPixelRGB_15Bit_OffScreen(U32 X, U32 Y, U8 Red, U8 Green, U8 Blue) -{ - U32 Offset; - U8* MemoryPointer; - U16 Pixel; - - MemoryPointer = (U8*)(VideoOffScreenBuffer); - Offset = VideoGetOffScreenMemoryOffsetForPixel(X, Y); - - Red = Red >> 3; - Green = Green >> 3; - Blue = Blue >> 3; - - Pixel = Red << 11 | Green << 6 | Blue << 1; - - MemoryPointer[Offset] = Pixel & 0xFF; - MemoryPointer[Offset+1] = Pixel >> 8; -} - -VOID VideoSetPixelRGB_16Bit_OffScreen(U32 X, U32 Y, U8 Red, U8 Green, U8 Blue) -{ - U32 Offset; - U8* MemoryPointer; - U16 Pixel; - - MemoryPointer = (U8*)(VideoOffScreenBuffer); - Offset = VideoGetOffScreenMemoryOffsetForPixel(X, Y); - - Red = Red >> 3; - Green = Green >> 2; - Blue = Blue >> 3; - - Pixel = (U16)Red << 11 | (U16)Green << 5 | (U16)Blue << 0; - - MemoryPointer[Offset] = Pixel & 0xFF; - MemoryPointer[Offset+1] = Pixel >> 8; -} - -VOID VideoSetPixelRGB_24Bit_OffScreen(U32 X, U32 Y, U8 Red, U8 Green, U8 Blue) -{ - U32 Offset; - U8* MemoryPointer; - - MemoryPointer = (U8*)(VideoOffScreenBuffer); - Offset = VideoGetOffScreenMemoryOffsetForPixel(X, Y); - - MemoryPointer[Offset] = Blue; - MemoryPointer[Offset+1] = Green; - MemoryPointer[Offset+2] = Red; -} - -VOID VideoSetPixelRGB_OffScreen(U32 X, U32 Y, U8 Red, U8 Green, U8 Blue) -{ - U32 Width, Height, Depth; - - MachVideoGetDisplaySize(&Width, &Height, &Depth); - if (Depth >= 24) - { - VideoSetPixelRGB_24Bit_OffScreen(X, Y, Red, Green, Blue); - } - else if (Depth >= 16) - { - VideoSetPixelRGB_16Bit_OffScreen(X, Y, Red, Green, Blue); - } - else if (Depth == 15) - { - VideoSetPixelRGB_15Bit_OffScreen(X, Y, Red, Green, Blue); - } - else - { - BugCheck((DPRINT_UI, "This function does not support %d bits per pixel!", Depth)); - } -} - -#endif diff --git a/reactos/boot/freeldr/freeldr/video/video.c b/reactos/boot/freeldr/freeldr/video/video.c index 80f94cea7cc..58e74a1fae6 100644 --- a/reactos/boot/freeldr/freeldr/video/video.c +++ b/reactos/boot/freeldr/freeldr/video/video.c @@ -37,3 +37,8 @@ PVOID VideoAllocateOffScreenBuffer(VOID) return VideoOffScreenBuffer; } + +VOID VideoCopyOffScreenBufferToVRAM(VOID) +{ + MachVideoCopyOffScreenBufferToVRAM(VideoOffScreenBuffer); +}