[OpenBIOS] r603 - cpu/x86/Linux forth/wrapper

svn at openbios.org svn at openbios.org
Tue Sep 18 00:44:57 CEST 2007


Author: wmb
Date: 2007-09-18 00:44:57 +0200 (Tue, 18 Sep 2007)
New Revision: 603

Added:
   cpu/x86/Linux/graphdev.fth
Modified:
   cpu/x86/Linux/Makefile
   forth/wrapper/wrapper.c
Log:
Added X graphics support, disabled by default.


Modified: cpu/x86/Linux/Makefile
===================================================================
--- cpu/x86/Linux/Makefile	2007-09-11 17:13:15 UTC (rev 602)
+++ cpu/x86/Linux/Makefile	2007-09-17 22:44:57 UTC (rev 603)
@@ -6,6 +6,7 @@
 BP=../../..
 
 CFLAGS	= -O -g -m32 -DUNIX -D${OS} -DX86
+# CFLAGS += -DUSE_XCB
 
 WRTAIL = forth/wrapper
 WRDIR = ${BP}/${WRTAIL}

Added: cpu/x86/Linux/graphdev.fth
===================================================================
--- cpu/x86/Linux/graphdev.fth	                        (rev 0)
+++ cpu/x86/Linux/graphdev.fth	2007-09-17 22:44:57 UTC (rev 603)
@@ -0,0 +1,42 @@
+purpose: Simulation of OFW graphics using X
+
+dev /  new-device
+  " xgraphics" device-name
+  : open  ( -- okay? )  d# 1200 d# 900  d# 392 syscall  2drop retval  0=  ;
+  : close ( -- )   d# 396 syscall  ;
+
+  : fill-rectangle  ( color565 x y w h -- )  d# 404 syscall  4drop drop  ;
+finish-device
+
+: get-color  ( r g b -- color )
+   d# 400 syscall  3drop  retval
+;
+  
+: open-screen
+   " /xgraphics" open-dev to screen-ih
+;
+
+0 value xred
+0 value xgreen
+0 value xblue
+0 value xmagenta
+0 value xblack
+0 value xmagenta
+
+: demo  ( -- )
+   open-screen
+
+   h# ff  h# 00  h# 00  get-color to xred
+   h# 00  h# ff  h# 00  get-color to xgreen
+   h# 00  h# 00  h# ff  get-color to xblue
+   h# ff  h# 00  h# ff  get-color to xmagenta
+       0      0      0  get-color to xblack
+   h# ff  h# ff  h# ff  get-color to xmagenta
+
+   d# 500        0  do  i xred     show-state  loop
+   d# 1000 d#  500  do  i xblue    show-state  loop
+   d# 1500 d# 1000  do  i xgreen   show-state  loop
+   d# 2000 d# 1500  do  i xmagenta show-state  loop
+
+   xblack  d# 400 d# 300  d# 50 d# 60  " fill-rectangle" $call-screen
+;

Modified: forth/wrapper/wrapper.c
===================================================================
--- forth/wrapper/wrapper.c	2007-09-11 17:13:15 UTC (rev 602)
+++ forth/wrapper/wrapper.c	2007-09-17 22:44:57 UTC (rev 603)
@@ -371,6 +371,10 @@
 extern   long	dlopen(), dlsym(), dlerror(), dlclose();
 #endif
 
+#ifdef USE_XCB
+extern   long   open_window(), close_window(), rgbcolor(), fill_rectangle();
+#endif
+
 #ifdef JTAG
 #include "jtag.h"
 #endif
@@ -493,7 +497,12 @@
 #endif
 
           /* 376       380      384		388 */
-          m_inflate,   m_map,   m_unmap,	s_ioperm
+          m_inflate,   m_map,   m_unmap,	s_ioperm,
+
+#ifdef USE_XCB
+          /* 392       396           400       404 */
+          open_window, close_window, rgbcolor, fill_rectangle,
+#endif
 };
 /*
  * Function semantics:




More information about the OpenBIOS mailing list