[OpenBIOS] [PATCH 13/14] video: remove video_set_color()

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Thu Aug 8 00:51:17 CEST 2013


Since all of the colour state is now held in Forth, remove the hack
that was video_set_color(). Anything that needs to change the pallette
(including MOL) can just call "color!" on the driver package.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 openbios-devel/drivers/tcx.fs              |   12 ++++--------
 openbios-devel/drivers/vga.fs              |   10 +++-------
 openbios-devel/forth/device/display.fs     |    2 +-
 openbios-devel/include/libopenbios/video.h |    1 -
 openbios-devel/libopenbios/video_common.c  |   29 ----------------------------
 5 files changed, 8 insertions(+), 46 deletions(-)

diff --git a/openbios-devel/drivers/tcx.fs b/openbios-devel/drivers/tcx.fs
index 2ae1c4e..ad21ff9 100644
--- a/openbios-devel/drivers/tcx.fs
+++ b/openbios-devel/drivers/tcx.fs
@@ -143,6 +143,8 @@ h# 1 constant /tcx-off13-8
   >r dup 2dup bljoin r> tcx-dac + l!
 ;
 
+external
+
 : color!  ( r g b c# -- )
   0 dac!       ( r g b )
   swap rot     ( b g r )
@@ -151,6 +153,8 @@ h# 1 constant /tcx-off13-8
   4 dac!       (  )
 ;
 
+headerless
+
 \
 \ Mapping
 \
@@ -167,14 +171,6 @@ h# 1 constant /tcx-off13-8
   dac-map fb-map
 ;
 
-external
-
-: hw-set-color
-  color!
-;
-
-headerless
-
 \
 \ Installation
 \
diff --git a/openbios-devel/drivers/vga.fs b/openbios-devel/drivers/vga.fs
index d359923..3579532 100644
--- a/openbios-devel/drivers/vga.fs
+++ b/openbios-devel/drivers/vga.fs
@@ -133,7 +133,7 @@ defer mol-color!
 \ Perhaps for neatness this there should be a separate molvga.fs
 \ but let's leave it here for now.
 
-: hw-set-color  ( r g b index -- )
+: color!  ( r g b index -- )
   mol-color!
 ;
 
@@ -141,16 +141,12 @@ defer mol-color!
 
 \ Standard VGA
 
-: hw-set-color  ( r g b index -- )
+: color!  ( r g b index -- )
   vga-color!
 ;
 
 [THEN]
 
-: color!  ( r g b index -- )
-  hw-set-color
-;
-
 : fill-rectangle  ( color_ind x y width height -- )
   fb8-fillrect
 ;
@@ -166,7 +162,7 @@ defer mol-color!
     c@ swap 1+      \ ( table start r table-g )
     dup c@ swap 1+  \ ( table start r g table-b )
     c@ 3 pick       \ ( table start r g b index )
-    hw-set-color    \ ( table start )
+    color!          \ ( table start )
     1+
     swap 3 + swap   \ ( table+3 start+1 )
   loop
diff --git a/openbios-devel/forth/device/display.fs b/openbios-devel/forth/device/display.fs
index 5779ca8..fff44e0 100644
--- a/openbios-devel/forth/device/display.fs
+++ b/openbios-devel/forth/device/display.fs
@@ -399,7 +399,7 @@ defer fb8-invertrect
     1 pick @ ff00 and d# 8 rshift
     2 pick @ ff and
     i
-    s" hw-set-color" $find if
+    s" color!" $find if
       execute
     else
       2drop
diff --git a/openbios-devel/include/libopenbios/video.h b/openbios-devel/include/libopenbios/video.h
index 8c32858..44d7456 100644
--- a/openbios-devel/include/libopenbios/video.h
+++ b/openbios-devel/include/libopenbios/video.h
@@ -21,7 +21,6 @@
 
 void setup_video(void);
 unsigned long video_get_color(int col_ind);
-void video_set_color(int ind, unsigned long color);
 void video_mask_blit(void);
 void video_invert_rect(void);
 void video_fill_rect(void);
diff --git a/openbios-devel/libopenbios/video_common.c b/openbios-devel/libopenbios/video_common.c
index 51596e8..9bbc18c 100644
--- a/openbios-devel/libopenbios/video_common.c
+++ b/openbios-devel/libopenbios/video_common.c
@@ -43,35 +43,6 @@ video_get_color( int col_ind )
 	return 0;
 }
 
-void
-video_set_color( int ind, unsigned long color )
-{
-	xt_t hw_xt = 0;
-
-	if( !VIDEO_DICT_VALUE(video.ih) || ind < 0 || ind > 255 )
-		return;
-	video.pal[ind] = color;
-
-	/* Call the low-level hardware setter in the
-	   display package */
-	hw_xt = find_ih_method("hw-set-color", VIDEO_DICT_VALUE(video.ih));
-	if (hw_xt) {
-		PUSH((color >> 16) & 0xff);  // Red
-		PUSH((color >> 8) & 0xff);  // Green
-		PUSH(color & 0xff);  // Blue
-		PUSH(ind);
-		PUSH(hw_xt);
-		fword("execute");
-	}
-
-	/* Call the low-level palette update if required */
-	hw_xt = find_ih_method("hw-refresh-palette", VIDEO_DICT_VALUE(video.ih));
-	if (hw_xt) {
-		PUSH(hw_xt);
-		fword("execute");
-	}
-}
-
 /* ( fbaddr maskaddr width height fgcolor bgcolor -- ) */
 
 void
-- 
1.7.10.4




More information about the OpenBIOS mailing list