diff --git a/basic.js b/basic.js index a1ca971..a58b55f 100644 --- a/basic.js +++ b/basic.js @@ -856,7 +856,7 @@ this.basic = (function() { if (!env.lores) { runtime_error('Lores graphics not supported'); } n = n >> 0; - if (n < 0) { runtime_error(ERRORS.ILLEGAL_QUANTITY); } + if (n < 0 || n > 255) { runtime_error(ERRORS.ILLEGAL_QUANTITY); } env.lores.setColor(n); }, diff --git a/samples/sample.unittests.txt b/samples/sample.unittests.txt index 83e181a..3afb5cc 100644 --- a/samples/sample.unittests.txt +++ b/samples/sample.unittests.txt @@ -411,6 +411,10 @@ 7020 T$ = "COLOR=" : T = 0 : U = 0 : FOR I = 0 TO 15 : COLOR= I : PLOT 0,0 : T = T + I : U = U + SCRN(0,0) : NEXT : S = (T=U) : GOSUB 1 +: T = 1 : ONERR GOTO 7022 +7021 COLOR=256 +: T = 2 +7022 S = (T=1) AND (PEEK(222)=53) : GOSUB 1 7030 T$ = "PLOT" : COLOR= 5 : PLOT 0,0 : PLOT 39,0 : PLOT 0,47 : PLOT 39,47