[Mit-cadr-cvs] r366 - trunk/emulator/usim
ggilley at common-lisp.net
ggilley at common-lisp.net
Wed Nov 28 03:57:44 UTC 2012
Author: ggilley
Date: Tue Nov 27 19:57:44 2012
New Revision: 366
Log:
change ubuntu to x11 and speed up drawing a little
Modified:
trunk/emulator/usim/Makefile
trunk/emulator/usim/x11.c
Modified: trunk/emulator/usim/Makefile
==============================================================================
--- trunk/emulator/usim/Makefile Tue Nov 27 18:43:29 2012 (r365)
+++ trunk/emulator/usim/Makefile Tue Nov 27 19:57:44 2012 (r366)
@@ -33,6 +33,11 @@
KEYBOARD = OLD
endif
+ifeq ($(OS_NAME), Linux)
+DISPLAY = X11
+KEYBOARD = OLD
+endif
+
#----------- code ------------
USIM_SRC = main.c decode.c ucode.c disk.c iob.c chaos.c ether.c uart.c syms.c config.c
@@ -46,7 +51,7 @@
ifeq ($(DISPLAY), X11)
DISPLAY_SRC = x11.c
-USIM_LIBS = -L/usr/X11R6/lib -lX11
+USIM_LIBS = -L/usr/X11R6/lib -lX11 -lpthread
DEFINES = -DDISPLAY_X11
endif
@@ -71,7 +76,7 @@
ifeq ($(DISPLAY), X11)
LFLAGS = -m32
-USIM_LIBS = -L/usr/X11R6/lib -lX11
+USIM_LIBS = -L/usr/X11R6/lib -lX11 -lpthread
endif
# Linux
@@ -85,6 +90,7 @@
LFLAGS = $(M32) -ldl -L/usr/lib
USIM_SRC += Files.c glob.c
USIM_HDR += Files.h glob.h
+USIM_LIBS += -lrt
endif
# NetBSD
@@ -106,7 +112,7 @@
endif
#DEFINES=-DLASHUP
-DEFINES=-DCADR2
+DEFINES += -DCADR2
USIM_OBJ = $(USIM_SRC:.c=.o) $(DISPLAY_SRC:.c=.o) $(KEYBOARD_SRC:.c=.o)
Modified: trunk/emulator/usim/x11.c
==============================================================================
--- trunk/emulator/usim/x11.c Tue Nov 27 18:43:29 2012 (r365)
+++ trunk/emulator/usim/x11.c Tue Nov 27 19:57:44 2012 (r366)
@@ -103,6 +103,9 @@
XEvent e;
int mod_state;
int keysym;
+ void send_accumulated_updates(void);
+
+ send_accumulated_updates();
while (XCheckWindowEvent(display, window, USIM_EVENT_MASK, &e)) {
@@ -247,6 +250,40 @@
}
}
+int u_minh = 0x7fffffff, u_maxh, u_minv = 0x7fffffff, u_maxv;
+
+void
+accumulate_update(int h, int v, int hs, int vs)
+{
+#if 0
+ SDL_UpdateRect(screen, h, v, 32, 1);
+#else
+ if (h < u_minh) u_minh = h;
+ if (h+hs > u_maxh) u_maxh = h+hs;
+ if (v < u_minv) u_minv = v;
+ if (v+vs > u_maxv) u_maxv = v+vs;
+#endif
+}
+
+void
+send_accumulated_updates(void)
+{
+ int hs, vs;
+
+ hs = u_maxh - u_minh;
+ vs = u_maxv - u_minv;
+ if (u_minh != 0x7fffffff && u_minv != 0x7fffffff && u_maxh && u_maxv)
+ {
+ XPutImage(display, window, gc, ximage, u_minh, u_minv, u_minh, u_minv, hs, vs);
+ XFlush(display);
+ }
+
+ u_minh = 0x7fffffff;
+ u_maxh = 0;
+ u_minv = 0x7fffffff;
+ u_maxv = 0;
+}
+
void
video_write(int offset, unsigned int bits)
{
@@ -267,8 +304,9 @@
bits >>= 1;
}
- XPutImage(display, window, gc, ximage, h, v, h, v, 32, 1);
- XFlush(display);
+ // XPutImage(display, window, gc, ximage, h, v, h, v, 32, 1);
+ // XFlush(display);
+ accumulate_update(h, v, 32, 1);
}
}
More information about the mit-cadr-cvs
mailing list