The raster effects engine in some places multiplied a negative number by the unsigned Bpp value, and added it to a pointer. The intention was probably to subtract, which doesn't happen because of the implicit conversion to unsigned. However, with 32-bit pointers the value wrapped around, leading to the intended result. Convert the result to a signed integer so it will subtract when intended. Index: dgen-1.23/ras-drawplane.h =================================================================== --- dgen-1.23.orig/ras-drawplane.h 2007-12-09 20:27:28.000000000 -0200 +++ dgen-1.23/ras-drawplane.h 2007-12-09 20:27:41.000000000 -0200 @@ -67,7 +67,7 @@ tile_line = tiles + xsize * yoff; scan = yscroll & 7; - where = dest + (xstart + (xscroll & 7)) * Bpp; + where = dest + (signed)((xstart + (xscroll & 7)) * Bpp); for(x = -1; x < w; ++x) { Index: dgen-1.23/ras.cpp =================================================================== --- dgen-1.23.orig/ras.cpp 2007-12-09 20:27:28.000000000 -0200 +++ dgen-1.23/ras.cpp 2007-12-09 20:27:41.000000000 -0200 @@ -546,7 +546,7 @@ start = 24; } add = -2; - where = dest + (start * Bpp); + where = dest + (signed)(start * Bpp); for(x=-1; x= x; tx -= 8) { if(tx > -8 && tx < 320) @@ -620,7 +620,7 @@ where -= Bpp_times8; } } else { - where = dest + (x * Bpp); + where = dest + (signed)(x * Bpp); for(tx = x; tx <= xend; tx += 8) { if(tx > -8 && tx < 320)