Fixed `make install` issues, bugs with VESA rel0.07
authorJohn Hodge <[email protected]>
Thu, 17 Feb 2011 13:19:33 +0000 (21:19 +0800)
committerJohn Hodge <[email protected]>
Thu, 17 Feb 2011 13:19:33 +0000 (21:19 +0800)
Kernel/drv/vterm.c
Kernel/include/tpl_drv_video.h
Makefile
Makefile.cfg
Makefile.i386.cfg
Modules/Display/VESA/main.c
Modules/Makefile.tpl
Usermode/Applications/Makefile.tpl
Usermode/Filesystem/Makefile
Usermode/Libraries/Makefile.tpl
Usermode/Libraries/crt0.o_src/Makefile

index db56f0e..3e47f93 100644 (file)
@@ -1328,34 +1328,113 @@ int    giVT_CharHeight = FONT_HEIGHT;
 
 // === CODE ===
 /**
- * \fn void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Pitch, Uint32 BGC, Uint32 FGC)
  * \brief Render a font character
  */
-void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Pitch, Uint32 BGC, Uint32 FGC)
+void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Depth, int Pitch, Uint32 BGC, Uint32 FGC)
 {
        Uint8   *font;
-       Uint32  *buf = Buffer;
         int    x, y;
        
-       font = VT_Font_GetChar(Codepoint);
-       
-       for(y = 0; y < FONT_HEIGHT; y ++)
+       // 8-bpp and below
+       if( Depth <= 8 )
        {
-               for(x = 0; x < FONT_WIDTH; x ++)
+               Uint8   *buf = Buffer;
+               
+               font = VT_Font_GetChar(Codepoint);
+               
+               for(y = 0; y < FONT_HEIGHT; y ++)
                {
-                       if(*font & (1 << (FONT_WIDTH-x-1)))
-                               buf[x] = FGC;
-                       else
-                               buf[x] = BGC;
+                       for(x = 0; x < FONT_WIDTH; x ++)
+                       {
+                               if(*font & (1 << (FONT_WIDTH-x-1)))
+                                       buf[x] = FGC;
+                               else
+                                       buf[x] = BGC;
+                       }
+                       buf = (void*)( (tVAddr)buf + Pitch );
+                       font ++;
+               }
+       }
+       // 16-bpp and below
+       else if( Depth <= 16 )
+       {
+               Uint16  *buf = Buffer;
+               
+               font = VT_Font_GetChar(Codepoint);
+               
+               for(y = 0; y < FONT_HEIGHT; y ++)
+               {
+                       for(x = 0; x < FONT_WIDTH; x ++)
+                       {
+                               if(*font & (1 << (FONT_WIDTH-x-1)))
+                                       buf[x] = FGC;
+                               else
+                                       buf[x] = BGC;
+                       }
+                       buf = (void*)( (tVAddr)buf + Pitch );
+                       font ++;
+               }
+       }
+       // 24-bpp colour
+       // - Special handling to not overwrite the next pixel
+       //TODO: Endian issues here
+       else if( Depth == 24 )
+       {
+               Uint8   *buf = Buffer;
+               Uint8   bg_r = (BGC >> 16) & 0xFF;
+               Uint8   bg_g = (BGC >>  8) & 0xFF;
+               Uint8   bg_b = (BGC >>  0) & 0xFF;
+               Uint8   fg_r = (FGC >> 16) & 0xFF;
+               Uint8   fg_g = (FGC >>  8) & 0xFF;
+               Uint8   fg_b = (FGC >>  0) & 0xFF;
+               
+               font = VT_Font_GetChar(Codepoint);
+               
+               for(y = 0; y < FONT_HEIGHT; y ++)
+               {
+                       for(x = 0; x < FONT_WIDTH; x ++)
+                       {
+                               Uint8   r, g, b;
+                               
+                               if(*font & (1 << (FONT_WIDTH-x-1))) {
+                                       r = fg_r;       g = fg_g;       b = fg_b;
+                               }
+                               else {
+                                       r = bg_r;       g = bg_g;       b = bg_b;
+                               }
+                               buf[x*3+0] = b;
+                               buf[x*3+1] = g;
+                               buf[x*3+2] = r;
+                       }
+                       buf = (void*)( (tVAddr)buf + Pitch );
+                       font ++;
+               }
+       }
+       // 32-bpp colour (nice and easy)
+       else if( Depth == 32 )
+       {
+               Uint32  *buf = Buffer;
+               
+               font = VT_Font_GetChar(Codepoint);
+               
+               for(y = 0; y < FONT_HEIGHT; y ++)
+               {
+                       for(x = 0; x < FONT_WIDTH; x ++)
+                       {
+                               if(*font & (1 << (FONT_WIDTH-x-1)))
+                                       buf[x] = FGC;
+                               else
+                                       buf[x] = BGC;
+                       }
+                       buf = (Uint32*)( (tVAddr)buf + Pitch );
+                       font ++;
                }
-               buf += Pitch;
-               font ++;
        }
 }
 
 /**
  * \fn Uint32 VT_Colour12to24(Uint16 Col12)
- * \brief Converts a 
+ * \brief Converts a 12-bit colour into 24 bits
  */
 Uint32 VT_Colour12to24(Uint16 Col12)
 {
@@ -1369,6 +1448,66 @@ Uint32 VT_Colour12to24(Uint16 Col12)
        ret |= (tmp << 16) | (tmp << 20);
        return ret;
 }
+/**
+ * \brief Converts a 12-bit colour into 15 bits
+ */
+Uint16 VT_Colour12to15(Uint16 Col12)
+{
+       Uint32  ret;
+        int    tmp;
+       tmp = Col12 & 0xF;
+       ret  = (tmp << 1) | (tmp & 1);
+       tmp = (Col12 & 0xF0) >> 4;
+       ret |= ( (tmp << 1) | (tmp & 1) ) << 5;
+       tmp = (Col12 & 0xF00) >> 8;
+       ret |= ( (tmp << 1) | (tmp & 1) ) << 10;
+       return ret;
+}
+
+/**
+ * \brief Converts a 12-bit colour into any other depth
+ * \param Col12        12-bit source colour
+ * \param Depth        Desired bit deptj
+ * \note Green then blue get the extra avaliable bits (16:5-6-5, 14:4-5-5)
+ */
+Uint32 VT_Colour12toN(Uint16 Col12, int Depth)
+{
+       Uint32  ret;
+       Uint32  r, g, b;
+        int    rSize, gSize, bSize;
+       
+       // Fast returns
+       if( Depth == 24 )       return VT_Colour12to24(Col12);
+       if( Depth == 15 )       return VT_Colour12to15(Col12);
+       
+       // Bounds checks
+       if( Depth < 8 ) return 0;
+       if( Depth > 32 )        return 0;
+       
+       r = Col12 & 0xF;
+       g = (Col12 & 0xF0) >> 4;
+       b = (Col12 & 0xF00) >> 8;
+       
+       rSize = gSize = bSize = Depth / 3;
+       if( rSize + gSize + bSize < Depth )     // Depth % 3 == 1
+               gSize ++;
+       if( rSize + gSize + bSize < Depth )     // Depth % 3 == 2
+               bSize ++;
+       
+       // Expand
+       r <<= rSize - 4;        g <<= gSize - 4;        b <<= bSize - 4;
+       // Fill with the lowest bit
+       if( Col12 & 0x001 )     r |= (1 << (rSize - 4)) - 1;
+       if( Col12 & 0x010 )     r |= (1 << (gSize - 4)) - 1;
+       if( Col12 & 0x100 )     r |= (1 << (bSize - 4)) - 1;
+       
+       // Create output
+       ret  = r;
+       ret |= g << rSize;
+       ret |= b << (rSize + gSize);
+       
+       return ret;
+}
 
 /**
  * \fn Uint8 *VT_Font_GetChar(Uint32 Codepoint)
index bf67e59..1be4f2b 100644 (file)
@@ -244,11 +244,11 @@ extern int        giVT_CharWidth;
 //! \brief Defines the height of a rendered character\r
 extern int     giVT_CharHeight;\r
 /**\r
- * \fn void VT_Font_Render(Uint32 Codepoint, void *Buffer, int Pitch, Uint32 BGC, Uint32 FGC)\r
  * \brief Driver helper that renders a character to a buffer\r
  * \param Codepoint    Unicode character to render\r
- * \param Buffer       Buffer to render to (32-bpp)\r
- * \param Pitch        Number of DWords per line\r
+ * \param Buffer       Buffer to render to\r
+ * \param Depth        Bit depth of the destination buffer\r
+ * \param Pitch        Number of bytes per line\r
  * \param BGC  32-bit Background Colour\r
  * \param FGC  32-bit Foreground Colour\r
  * \r
@@ -256,14 +256,33 @@ extern int        giVT_CharHeight;
  * text mode by keeping the character rendering abstracted from the driver,\r
  * easing the driver development and reducing code duplication.\r
  */\r
-extern void    VT_Font_Render(Uint32 Codepoint, void *Buffer, int Pitch, Uint32 BGC, Uint32 FGC);\r
+extern void    VT_Font_Render(Uint32 Codepoint, void *Buffer, int Depth, int Pitch, Uint32 BGC, Uint32 FGC);\r
 /**\r
  * \fn Uint32 VT_Colour12to24(Uint16 Col12)\r
- * \brief Converts a colour from 12bpp to 32bpp\r
+ * \brief Converts a colour from 12bpp to 24bpp\r
  * \param Col12        12-bpp input colour\r
  * \return Expanded 32-bpp (24-bit colour) version of \a Col12\r
  */\r
 extern Uint32  VT_Colour12to24(Uint16 Col12);\r
+/**\r
+ * \brief Converts a colour from 12bpp to 14bpp\r
+ * \param Col12        12-bpp input colour\r
+ * \return 15 bits per pixel value\r
+ */\r
+extern Uint16  VT_Colour12to15(Uint16 Col12);\r
+/**\r
+ * \brief Converts a colour from 12bpp to 32bpp\r
+ * \param Col12        12-bpp input colour\r
+ * \param Depth        Desired bit depth\r
+ * \return \a Depth bit number, denoting Col12\r
+ * \r
+ * Expands the source colour into a \a Depth bits per pixel representation.\r
+ * The colours are expanded with preference to Green, Blue and Red in that order\r
+ * (so, green gets the first spare pixel, blue gets the next, and red never gets\r
+ * the spare). \n\r
+ * The final bit of each component is used to fill the lower bits of the output.\r
+ */\r
+extern Uint32  VT_Colour12toN(Uint16 Col12, int Depth);\r
 \r
 /**\r
  * \brief Handlers for eTplVideo_2DCommands\r
index 2a7f1a9..4cae511 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -48,7 +48,7 @@ clean-user: $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
 all:   $(ALL_DYNMODS) $(ALL_MODULES) all-Kernel $(ALL_USRLIBS) $(ALL_USRAPPS)
 all-install:   $(AI_DYNMODS) $(AI_MODULES) allinstall-Kernel $(AI_USRLIBS) $(AI_USRAPPS)
 clean: $(CLEAN_DYNMODS) $(CLEAN_MODULES) clean-Kernel $(CLEAN_USRLIBS) $(CLEAN_USRAPPS)
-install:       $(INSTALL_DYNMODS) $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS)
+install:       install-Filesystem $(INSTALL_DYNMODS) $(INSTALL_MODULES) install-Kernel $(INSTALL_USRLIBS) $(INSTALL_USRAPPS)
 
 # Compile Only
 $(ALL_DYNMODS): all-%:
@@ -91,6 +91,8 @@ $(INSTALL_DYNMODS): install-%:
        @BUILDTYPE=dynamic $(SUBMAKE) install -C Modules/$*
 $(INSTALL_MODULES): install-%:
        @BUILDTYPE=static $(SUBMAKE) install -C Modules/$*
+install-Filesystem:
+       @$(SUBMAKE) install -C Usermode/Filesystem
 install-Kernel:
        @$(SUBMAKE) install -C Kernel
 $(INSTALL_USRLIBS): install-%:
index 8308829..0ccb74a 100644 (file)
@@ -2,8 +2,10 @@
 # Acess2 Build Configuration
 #
 
-# Source and destination configuration
+# Install destination configuration
 DISTROOT := a:/Acess2
+xCP := mcopy -D o
+xMKDIR := mmd
 
 ACESSDIR := $(dir $(lastword $(MAKEFILE_LIST)))
 ACESSDIR := $(shell cd $(ACESSDIR) && pwd)
@@ -18,8 +20,6 @@ STRIP := strip
 MKDIR := mkdir -p
 RMDIR := rm -rf
 lCP := cp
-xCP := mcopy -D o
-xMKDIR := mmd
 
 # Load Architecture settings
 ifeq ($(ARCH),)
@@ -31,6 +31,10 @@ ifeq ($(ARCHDIR),)
 endif
 -include $(ACESSDIR)/Makefile.$(ARCHDIR).cfg
 
+# Makefile.user.cfg is not part of the Acess git repo,
+# It is for overriding the options in this file
+-include $(ACESSDIR)/Makefile.user.cfg
+
 FILESYSTEMS := 
 DRIVERS := 
 MODULES := Storage/ATA Storage/FDD
index beb3cd7..f72f0bb 100644 (file)
@@ -8,7 +8,6 @@ AS = nasm
 OBJDUMP = i586-elf-objdump
 RM = @rm -f
 STRIP = strip
-MKDIR = mkdir
 
 ARCHDIR = x86
 
index 1cd6a91..9929c35 100644 (file)
@@ -127,7 +127,7 @@ int Vesa_Install(char **Arguments)
                {\r
                        gVesa_Modes[i].flags |= FLAG_LFB;\r
                        gVesa_Modes[i].framebuffer = modeinfo->physbase;\r
-                       gVesa_Modes[i].fbSize = modeinfo->Xres*modeinfo->Yres*modeinfo->bpp/8;\r
+                       gVesa_Modes[i].fbSize = modeinfo->Yres*modeinfo->pitch;\r
                } else {\r
                        gVesa_Modes[i].framebuffer = 0;\r
                        gVesa_Modes[i].fbSize = 0;\r
@@ -233,24 +233,35 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
        case VIDEO_BUFFMT_TEXT:\r
                {\r
                tVT_Char        *chars = Buffer;\r
-                int    pitch = gVesa_Modes[giVesaCurrentMode].width;\r
+                int    pitch = gVesa_Modes[giVesaCurrentMode].pitch;\r
+                int    depth = gVesa_Modes[giVesaCurrentMode].bpp;\r
                 int    widthInChars = gVesa_Modes[giVesaCurrentMode].width/giVT_CharWidth;\r
                 int    heightInChars = gVesa_Modes[giVesaCurrentMode].height/giVT_CharHeight;\r
                 int    x, y;\r
-               Uint32  *dest = (void*)gpVesa_Framebuffer;\r
+               Uint  *dest = (void*)gpVesa_Framebuffer;\r
                 int    i;\r
                \r
                Length /= sizeof(tVT_Char);\r
                Offset /= sizeof(tVT_Char);\r
                \r
-               LOG("gVesa_Modes[%i].width = %i", giVesaCurrentMode, gVesa_Modes[giVesaCurrentMode].width);\r
+               LOG("gVesa_Modes[%i] = {height:%i, width:%i, pitch:%i}",\r
+                       giVesaCurrentMode,\r
+                       gVesa_Modes[giVesaCurrentMode].height,\r
+                       gVesa_Modes[giVesaCurrentMode].width,\r
+                       gVesa_Modes[giVesaCurrentMode].pitch\r
+                       );\r
                x = Offset % widthInChars;\r
                y = Offset / widthInChars;\r
-               LOG("(x,y) = (%i,%i) = [%i,%i]", x, y, x * giVT_CharWidth, y * giVT_CharHeight * pitch);\r
+               LOG("(x,y) = (%i,%i) = [%i,%i]",\r
+                       x,\r
+                       y,\r
+                       x * giVT_CharWidth * depth / 8,\r
+                       y * giVT_CharHeight * pitch\r
+                       );\r
                LOG("(w,h) = (%i,%i) = [%i,%i]",\r
                        (int)(Length % widthInChars),\r
                        (int)(Length / widthInChars),\r
-                       (int)((Length % widthInChars) * giVT_CharWidth),\r
+                       (int)((Length % widthInChars) * giVT_CharWidth * depth / 8),\r
                        (int)((Length / widthInChars) * giVT_CharHeight * pitch)\r
                        );\r
                \r
@@ -273,28 +284,42 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
                }\r
                \r
                dest += y * giVT_CharHeight * pitch;\r
-               dest += x * giVT_CharWidth;\r
                \r
                LOG("dest = %p", dest);\r
                \r
                for( i = 0; i < (int)Length; i++ )\r
                {\r
+                       if(\r
+                           !MM_GetPhysAddr( (tVAddr)dest + x*giVT_CharWidth*depth/8 )\r
+                       // || !MM_GetPhysAddr( (tVAddr)dest + x*giVT_CharWidth*depth/8 + pitch*giVT_CharHeight-1)\r
+                               )\r
+                       {\r
+                               Log_Notice("VESA", "Stopped at %i, not mapped", i);\r
+                               break;\r
+                       }\r
+                       if( y >= heightInChars )\r
+                       {\r
+                               Log_Notice("VESA", "Stopped at %i", i);\r
+                               break;\r
+                       }\r
+                       \r
                        VT_Font_Render(\r
                                chars->Ch,\r
-                               dest + x*giVT_CharWidth, pitch,\r
-                               VT_Colour12to24(chars->BGCol),\r
-                               VT_Colour12to24(chars->FGCol)\r
+                               dest + x*giVT_CharWidth*depth/8, depth, pitch,\r
+                               VT_Colour12toN(chars->BGCol, depth),\r
+                               VT_Colour12toN(chars->FGCol, depth)\r
                                );\r
                        \r
                        chars ++;\r
                        x ++;\r
-                       if( x >= widthInChars ) {\r
+                       if( x >= widthInChars )\r
+                       {\r
                                x = 0;\r
                                y ++;\r
                                dest += pitch*giVT_CharHeight;\r
                        }\r
                }\r
-               Length *= sizeof(tVT_Char);\r
+               Length = i * sizeof(tVT_Char);\r
                }\r
                break;\r
        \r
@@ -312,6 +337,7 @@ Uint64 Vesa_Write(tVFS_Node *Node, Uint64 Offset, Uint64 Length, void *Buffer)
                LOG("buffer = %p", Buffer);\r
                LOG("Updating Framebuffer (%p to %p)", destBuf, destBuf + (Uint)Length);\r
                \r
+               //TODO: Handle non 32-bpp framebuffer modes\r
                \r
                // Copy to Frambuffer\r
                memcpy(destBuf, Buffer, Length);\r
@@ -411,11 +437,15 @@ int Vesa_Ioctl(tVFS_Node *Node, int ID, void *Data)
  * \brief Updates the video mode\r
  */\r
 int Vesa_Int_SetMode(int mode)\r
-{\r
-       Log_Log("VESA", "Setting mode to %i", mode);\r
-       \r
+{      \r
        // Sanity Check values\r
        if(mode < 0 || mode > giVesaModeCount)  return -1;\r
+\r
+       Log_Log("VESA", "Setting mode to %i (%ix%i %ibpp)",\r
+               mode,\r
+               gVesa_Modes[mode].width, gVesa_Modes[mode].height,\r
+               gVesa_Modes[mode].bpp\r
+               );\r
        \r
        // Check for fast return\r
        if(mode == giVesaCurrentMode)   return 1;\r
@@ -441,8 +471,8 @@ int Vesa_Int_SetMode(int mode)
        giVesaPageCount = (gVesa_Modes[mode].fbSize + 0xFFF) >> 12;\r
        gpVesa_Framebuffer = (void*)MM_MapHWPages(gVesa_Modes[mode].framebuffer, giVesaPageCount);\r
        \r
-       Log_Log("VESA", "Framebuffer (Phys) = 0x%x", gVesa_Modes[mode].framebuffer);\r
-       Log_Log("VESA", "Framebuffer (Virt) = 0x%x", gpVesa_Framebuffer);\r
+       Log_Log("VESA", "Framebuffer (Phys) = 0x%x, (Virt) = 0x%x, Size = 0x%x",\r
+               gVesa_Modes[mode].framebuffer, gpVesa_Framebuffer, giVesaPageCount << 12);\r
        \r
        // Record Mode Set\r
        giVesaCurrentMode = mode;\r
@@ -465,13 +495,15 @@ int Vesa_Int_FindMode(tVideo_IOCtl_Mode *data)
        {\r
                LOG("Mode %i (%ix%ix%i)", i, gVesa_Modes[i].width, gVesa_Modes[i].height, gVesa_Modes[i].bpp);\r
        \r
-               if(gVesa_Modes[i].width == data->width\r
-               && gVesa_Modes[i].height == data->height\r
-               && gVesa_Modes[i].bpp == data->bpp)\r
+               if(gVesa_Modes[i].width == data->width && gVesa_Modes[i].height == data->height)\r
                {\r
-                       LOG("Perfect!");\r
-                       best = i;\r
-                       break;\r
+                       if( (data->bpp == 32 || data->bpp == 24)\r
+                        && (gVesa_Modes[i].bpp == 32 || gVesa_Modes[i].bpp == 24) )\r
+                       {\r
+                               LOG("Perfect!");\r
+                               best = i;\r
+                               break;\r
+                       }\r
                }\r
                \r
                tmp = gVesa_Modes[i].width * gVesa_Modes[i].height;\r
@@ -519,26 +551,58 @@ int Vesa_Int_ModeInfo(tVideo_IOCtl_Mode *data)
  */\r
 void Vesa_FlipCursor(void *Arg)\r
 {\r
-        int    pitch = gpVesaCurMode->pitch/4;\r
+        int    pitch = gpVesaCurMode->pitch;\r
+        int    bytes_per_px = (gpVesaCurMode->bpp + 7) / 8;\r
         int    x = giVesaCursorX*giVT_CharWidth;\r
         int    y = giVesaCursorY*giVT_CharHeight;\r
         int    i;\r
-       Uint32  *fb = (void*)gpVesa_Framebuffer;\r
+       Uint  *fb = (void*)gpVesa_Framebuffer;\r
        \r
        //Debug("Cursor flip");\r
        \r
        // Sanity check\r
        if(giVesaCursorX < 0 || giVesaCursorY < 0\r
-       || y*pitch + x + (giVT_CharHeight-1)*pitch > (int)gpVesaCurMode->fbSize/4) {\r
+       || y*pitch + x + (giVT_CharHeight-1)*pitch > (int)gpVesaCurMode->fbSize) {\r
                Log_Notice("VESA", "Cursor OOB (%i,%i)", x, y);\r
                giVesaCursorTimer = -1;\r
                return;\r
        }\r
        \r
        // Draw cursor\r
-       fb += (y+1)*pitch + x;\r
-       for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch )\r
-               *fb = ~*fb;\r
+       fb += (y+1)*pitch + x*bytes_per_px;\r
+       \r
+       switch(bytes_per_px)\r
+       {\r
+       case 1:\r
+               for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch )\r
+                       *fb = ~*fb;\r
+               break;\r
+       case 2:\r
+               for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch ) {\r
+                       fb[0] = ~fb[0];\r
+                       fb[1] = ~fb[1];\r
+               }\r
+               break;\r
+       case 3:\r
+               for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch ) {\r
+                       fb[0] = ~fb[0];\r
+                       fb[1] = ~fb[1];\r
+                       fb[2] = ~fb[2];\r
+               }\r
+               break;\r
+       case 4:\r
+               for( i = 1; i < giVT_CharHeight-1; i++, fb += pitch ) {\r
+                       fb[0] = ~fb[0];\r
+                       fb[1] = ~fb[1];\r
+                       fb[2] = ~fb[2];\r
+                       fb[3] = ~fb[3];\r
+               }\r
+               break;\r
+       default:\r
+               Log_Error("VESA", "Vesa_FlipCursor - Bug Report, unknown bytes_per_px (%i)", bytes_per_px);\r
+               giVesaCursorTimer = -1;\r
+               return ;\r
+       }\r
        \r
        #if BLINKING_CURSOR\r
        giVesaCursorTimer = Time_CreateTimer(VESA_CURSOR_PERIOD, Vesa_FlipCursor, Arg);\r
@@ -550,6 +614,7 @@ void Vesa_FlipCursor(void *Arg)
 // ------------------------\r
 void Vesa_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colour)\r
 {\r
+       // TODO: Handle non-32bit modes\r
         int    pitch = gpVesaCurMode->pitch/4;\r
        Uint32  *buf = (Uint32*)gpVesa_Framebuffer + Y*pitch + X;\r
        while( H -- ) {\r
@@ -560,7 +625,8 @@ void Vesa_2D_Fill(void *Ent, Uint16 X, Uint16 Y, Uint16 W, Uint16 H, Uint32 Colo
 \r
 void Vesa_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY, Uint16 W, Uint16 H)\r
 {\r
-        int    scrnpitch = gVesa_Modes[giVesaCurrentMode].pitch;\r
+        int    scrnpitch = gpVesaCurMode->pitch;\r
+        int    bytes_per_px = (gpVesaCurMode->bpp + 7) / 8;\r
         int    dst = DstY*scrnpitch + DstX;\r
         int    src = SrcY*scrnpitch + SrcX;\r
         int    tmp;\r
@@ -568,14 +634,14 @@ void Vesa_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY,
        //Log("Vesa_2D_Blit: (Ent=%p, DstX=%i, DstY=%i, SrcX=%i, SrcY=%i, W=%i, H=%i)",\r
        //      Ent, DstX, DstY, SrcX, SrcY, W, H);\r
        \r
-       if(SrcX + W > gVesa_Modes[giVesaCurrentMode].width)\r
-               W = gVesa_Modes[giVesaCurrentMode].width - SrcX;\r
-       if(DstX + W > gVesa_Modes[giVesaCurrentMode].width)\r
-               W = gVesa_Modes[giVesaCurrentMode].width - DstX;\r
-       if(SrcY + H > gVesa_Modes[giVesaCurrentMode].height)\r
-               H = gVesa_Modes[giVesaCurrentMode].height - SrcY;\r
-       if(DstY + H > gVesa_Modes[giVesaCurrentMode].height)\r
-               H = gVesa_Modes[giVesaCurrentMode].height - DstY;\r
+       if(SrcX + W > gpVesaCurMode->width)\r
+               W = gpVesaCurMode->width - SrcX;\r
+       if(DstX + W > gpVesaCurMode->width)\r
+               W = gpVesaCurMode->width - DstX;\r
+       if(SrcY + H > gpVesaCurMode->height)\r
+               H = gpVesaCurMode->height - SrcY;\r
+       if(DstY + H > gpVesaCurMode->height)\r
+               H = gpVesaCurMode->height - DstY;\r
        \r
        //Debug("W = %i, H = %i", W, H);\r
        \r
@@ -586,18 +652,19 @@ void Vesa_2D_Blit(void *Ent, Uint16 DstX, Uint16 DstY, Uint16 SrcX, Uint16 SrcY,
                while( H -- ) {\r
                        dst -= scrnpitch;\r
                        src -= scrnpitch;\r
-                       tmp = W;\r
+                       tmp = W*bytes_per_px;\r
                        for( tmp = W; tmp --; ) {\r
-                               *(Uint32*)(gpVesa_Framebuffer + dst + tmp) = *(Uint32*)(gpVesa_Framebuffer + src + tmp);\r
+                               *(Uint8*)(gpVesa_Framebuffer + dst + tmp) = *(Uint8*)(gpVesa_Framebuffer + src + tmp);\r
                        }\r
                }\r
        }\r
        else {\r
                // Normal copy is OK\r
                while( H -- ) {\r
-                       memcpy((void*)gpVesa_Framebuffer + dst, (void*)gpVesa_Framebuffer + src, W*sizeof(Uint32));\r
+                       memcpy((void*)gpVesa_Framebuffer + dst, (void*)gpVesa_Framebuffer + src, W*bytes_per_px);\r
                        dst += scrnpitch;\r
                        src += scrnpitch;\r
                }\r
        }\r
+       //Log("Vesa_2D_Blit: RETURN");\r
 }\r
index 750f2dc..dc5d6f9 100644 (file)
@@ -4,12 +4,7 @@
 
 _CPPFLAGS := $(CPPFLAGS)
 
-CFGFILES := 
-CFGFILES += $(shell test -f ../../../Makefile.cfg && echo ../../../Makefile.cfg)
-CFGFILES += $(shell test -f ../../Makefile.cfg && echo ../../Makefile.cfg)
-CFGFILES += $(shell test -f ../Makefile.cfg && echo ../Makefile.cfg)
-CFGFILES += $(shell test -f Makefile.cfg && echo Makefile.cfg)
--include $(CFGFILES)
+-include $(dir $(lastword $(MAKEFILE_LIST)))../Makefile.cfg
 
 CPPFLAGS := -I$(ACESSDIR)/Kernel/include -I$(ACESSDIR)/Kernel/arch/$(ARCHDIR)/include -DARCH=$(ARCH) $(_CPPFLAGS)
 CFLAGS := -Wall -Werror -fno-stack-protector -g -O3 -fno-builtin
@@ -46,7 +41,8 @@ clean:
 
 install: $(BIN)
 ifneq ($(BUILDTYPE),static)
-       $(xCP) $(BIN) $(DISTROOT)/Modules/$(NAME).kmd.$(ARCH)
+       $(xMKDIR) $(DISTROOT)/Modules/$(ARCH)
+       $(xCP) $(BIN) $(DISTROOT)/Modules/$(ARCH)/$(NAME).kmd
 else
 endif
 
index d18dc77..07bef0f 100644 (file)
@@ -18,6 +18,7 @@ clean:
        @$(RM) $(OBJ) $(DEPFILES) $(_BIN) $(BIN).dsm Map.txt
 
 install: $(_BIN)
+       @$(xMKDIR) $(DISTROOT)/$(DIR)
        $(xCP) $(_BIN) $(DISTROOT)/$(DIR)/
 
 $(_BIN): $(OBJ)
index b9b85f0..4cf24a3 100644 (file)
@@ -3,16 +3,18 @@
 
 -include ../../Makefile.cfg
 
-DIRS  = Bin SBin Libs Modules Applications
+DIRS  = Bin SBin Libs Modules Apps
 DIRS += Conf Conf/Auth
-FILES = Conf/BootConf.cfg Conf/Auth/Users Conf/Auth/Passwords Conf/Auth/Groups
+FILES = Conf/BootConf.cfg
+# Conf/Auth/Users Conf/Auth/Passwords Conf/Auth/Groups
 
 #DIRS  := $(addprefix $(DISTROOT)/,$(DIRS))
 #FILES := $(addprefix $(DISTROOT)/,$(FILES))
 
 .PHONY: all clean
+.PHONY: $(DIRS) $(FILES)
 
-all:   $(DIRS) $(FILES)
+install:       $(DIRS) $(FILES)
 
 clean:
 
@@ -20,6 +22,6 @@ $(DIRS):
        $(xMKDIR) $(DISTROOT)/$@
 
 $(FILES):
-       $(xCP) $< $(DISTROOT)/$@
+       $(xCP) $@ $(DISTROOT)/$@
 
 force: ;
index 51e404d..ec94066 100644 (file)
@@ -15,6 +15,7 @@ clean:
        $(RM) $(_BIN) $(_XBIN) $(OBJ) $(_BIN).dsm $(DEPFILES)
 
 install: all
+       @$(xMKDIR) $(DISTROOT)/Libs
        $(xCP) $(_BIN) $(_XBIN) $(DISTROOT)/Libs/
 
 $(_BIN): $(OBJ)
index a69be9b..36ce011 100644 (file)
@@ -17,5 +17,5 @@ clean:
        $(RM) $(BIN)
 
 $(BIN): crt0.$(ARCHDIR).asm
-       @$(MKDIR) $(dir $(BIN))
+       @mkdir -p $(dir $(BIN))
        $(AS) $(ASFLAGS) $< -o $@

UCC git Repository :: git.ucc.asn.au