diff -Naur allegro/src/win/asmlock.c blah/src/win/asmlock.c
--- allegro/src/win/asmlock.c	Wed Dec 31 16:00:00 1969
+++ blah/src/win/asmlock.c	Wed Feb 28 15:03:57 2007
@@ -0,0 +1,77 @@
+
+#include "allegro.h"
+#include "wddraw.h"
+
+#if defined ALLEGRO_NO_ASM || defined ALLEGRO_USE_C
+
+extern char *wd_dirty_lines;  /* used in WRITE_BANK() */
+extern void (*update_window) (RECT *rect);  /* window updater */
+extern char *gdi_dirty_lines; /* used in WRITE_BANK() */
+void gfx_gdi_autolock (struct BITMAP* bmp);
+void gfx_gdi_unlock (struct BITMAP* bmp);
+void gfx_directx_autolock (struct BITMAP* bmp);
+void gfx_directx_unlock (struct BITMAP* bmp);
+
+static void update_dirty_lines (BITMAP *bmp) {
+	int i;
+	RECT rect;
+	rect.left = 0;
+	rect.right = bmp->w;
+	for (i = 0; i < bmp->h; i++) {
+		if (wd_dirty_lines[i]) {
+			int j = i+1;
+			rect.top = i;
+			for (; wd_dirty_lines[j]; j++) {
+			}
+			rect.bottom = j;
+			update_window(&rect);
+			i = j+1;
+		}
+	}
+}
+
+uintptr_t gfx_directx_write_bank (BITMAP *bmp, int line) {
+	if (!(bmp->id & BMP_ID_LOCKED)) 
+		gfx_directx_autolock(bmp);
+	return (uintptr_t) bmp->line[line];
+}
+
+void gfx_directx_unwrite_bank (BITMAP *bmp) {
+	if (!(bmp->id & BMP_ID_AUTOLOCK)) return;
+	gfx_directx_unlock(bmp);
+	bmp->id &= ~ BMP_ID_AUTOLOCK;
+}
+
+uintptr_t gfx_directx_write_bank_win (BITMAP *bmp, int line) {
+	wd_dirty_lines[bmp->y_ofs+line] = 1;
+	if (!(bmp->id & BMP_ID_LOCKED)) gfx_directx_autolock(bmp);
+	return (uintptr_t) bmp->line[line];
+}
+
+void gfx_directx_unwrite_bank_win (BITMAP *bmp) {
+	if (!(bmp->id & BMP_ID_AUTOLOCK)) return;
+	gfx_directx_unlock(bmp);
+	bmp->id &= ~BMP_ID_AUTOLOCK;
+	update_dirty_lines(gfx_directx_forefront_bitmap);
+	return;
+}
+
+void gfx_directx_unlock_win (BITMAP *bmp) {
+	gfx_directx_unlock(bmp);
+	if (!(gfx_directx_forefront_bitmap->id & BMP_ID_LOCKED))
+		update_dirty_lines(gfx_directx_forefront_bitmap);
+	return;
+}
+
+uintptr_t gfx_gdi_write_bank (BITMAP *bmp, int line) {
+	gdi_dirty_lines[bmp->y_ofs] = 1;
+	if (!(bmp->id & BMP_ID_LOCKED)) gfx_gdi_autolock(bmp);
+	return (uintptr_t) bmp->line[line];
+}
+
+void gfx_gdi_unwrite_bank (BITMAP *bmp) {
+	if (!(bmp->id & BMP_ID_AUTOLOCK)) return;
+	gfx_gdi_unlock(bmp);
+	bmp->id &= ~ BMP_ID_AUTOLOCK;
+}
+#endif//defined ALLEGRO_NO_ASM || defined ALLEGRO_USE_C
diff -Naur allegro/src/win/wddlock.c blah/src/win/wddlock.c
--- allegro/src/win/wddlock.c	Fri Oct 28 06:57:02 2005
+++ blah/src/win/wddlock.c	Wed Feb 28 15:18:04 2007
@@ -23,6 +23,7 @@
 #define PREFIX_E                "al-wddlock ERROR: "
 
 
+//remove these two function pointers when locking stops using asm
 void (*ptr_gfx_directx_autolock) (BITMAP* bmp) = gfx_directx_autolock;
 void (*ptr_gfx_directx_unlock) (BITMAP* bmp) = gfx_directx_unlock;
 
diff -Naur allegro/src/win/wddraw.h blah/src/win/wddraw.h
--- allegro/src/win/wddraw.h	Sun May 15 02:54:52 2005
+++ blah/src/win/wddraw.h	Wed Feb 28 15:18:09 2007
@@ -122,10 +122,11 @@
 AL_FUNC(void, gfx_directx_unlock, (BITMAP *bmp));
 AL_FUNC(void, gfx_directx_unlock_win, (BITMAP *bmp));
 AL_FUNC(void, gfx_directx_release_lock, (BITMAP * bmp));
-AL_FUNC(void, gfx_directx_write_bank, (void));
-AL_FUNC(void, gfx_directx_unwrite_bank, (void));
-AL_FUNC(void, gfx_directx_write_bank_win, (void));
-AL_FUNC(void, gfx_directx_unwrite_bank_win, (void));
+AL_FUNC(uintptr_t, gfx_directx_write_bank, (BITMAP *bmp, int line));
+AL_FUNC(void, gfx_directx_unwrite_bank, (BITMAP *bmp));
+AL_FUNC(uintptr_t, gfx_directx_write_bank_win, (BITMAP *bmp, int line));
+AL_FUNC(void, gfx_directx_unwrite_bank_win, (BITMAP *bmp));
+//remove these two function pointers when locking stops using asm
 AL_FUNCPTR(void, ptr_gfx_directx_autolock, (BITMAP* bmp));
 AL_FUNCPTR(void, ptr_gfx_directx_unlock, (BITMAP* bmp));
 
diff -Naur allegro/src/win/wgdi.c blah/src/win/wgdi.c
--- allegro/src/win/wgdi.c	Sat Jul 29 15:57:58 2006
+++ blah/src/win/wgdi.c	Wed Feb 28 14:46:42 2007
@@ -37,8 +37,9 @@
 extern void gfx_gdi_unwrite_bank(void);
 
 /* exported only for asmlock.s */
-static void gfx_gdi_autolock(struct BITMAP* bmp);
-static void gfx_gdi_unlock(struct BITMAP* bmp);
+void gfx_gdi_autolock(struct BITMAP* bmp);
+void gfx_gdi_unlock(struct BITMAP* bmp);
+//remove these two function pointers when locking stops using asm
 void (*ptr_gfx_gdi_autolock) (struct BITMAP* bmp) = gfx_gdi_autolock;
 void (*ptr_gfx_gdi_unlock) (struct BITMAP* bmp) = gfx_gdi_unlock;
 char *gdi_dirty_lines = NULL; /* used in WRITE_BANK() */
@@ -427,7 +428,7 @@
 
 /* gfx_gdi_autolock:
  */
-static void gfx_gdi_autolock(struct BITMAP *bmp)
+void gfx_gdi_autolock(struct BITMAP *bmp)
 {
    gfx_gdi_lock(bmp);
    bmp->id |= BMP_ID_AUTOLOCK;
@@ -437,7 +438,7 @@
 
 /* gfx_gdi_unlock:
  */
-static void gfx_gdi_unlock(struct BITMAP *bmp)
+void gfx_gdi_unlock(struct BITMAP *bmp)
 {
    if (lock_nesting > 0) {
       lock_nesting--;
