Ensure COLOR= gives Illegal Quantity Error for > 255. Fixes #30

This commit is contained in:
Joshua Bell 2020-05-03 21:04:36 -07:00
parent b11acbe1fb
commit af0a7eb886
2 changed files with 5 additions and 1 deletions

View File

@ -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);
},

View File

@ -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