[OpenBIOS] [PATCH 1/2] display.fs: fix off-by-one errors in color palette initialisation

Mark Cave-Ayland mark.cave-ayland at ilande.co.uk
Thu Apr 20 23:25:41 CEST 2017


Loops in Forth should be inclusive of both the start and end indices. Fix the
uppermost index so that the last entry in the color palette is actually set.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland at ilande.co.uk>
---
 forth/device/display.fs |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/forth/device/display.fs b/forth/device/display.fs
index fff44e0..f7fa2a7 100644
--- a/forth/device/display.fs
+++ b/forth/device/display.fs
@@ -386,7 +386,7 @@ defer fb8-invertrect
   to foreground-color to background-color
 
   \ setup palette
-  10101 ['] color-palette cell+ ff 0 do
+  10101 ['] color-palette cell+ 100 0 do
     dup 2 pick i * swap ! cell+
   loop 2drop
 
@@ -394,7 +394,7 @@ defer fb8-invertrect
   ffffcc ['] color-palette cell+ fe cells + !
 
   \ load palette onto the hardware
-  ['] color-palette cell+ ff 0 do
+  ['] color-palette cell+ 100 0 do
     dup @ ff0000 and d# 16 rshift
     1 pick @ ff00 and d# 8 rshift
     2 pick @ ff and
-- 
1.7.10.4




More information about the OpenBIOS mailing list