Skip to content

Commit

Permalink
Added additional tests to the ANSI code tester
Browse files Browse the repository at this point in the history
  • Loading branch information
davewalker5 committed Feb 11, 2024
1 parent d1f1c7f commit bbd9580
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 7 deletions.
Binary file modified Applications/ANSI/ansi.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 24 additions & 7 deletions Applications/ANSI/ansi_test.bas
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,29 @@
90 REM Read the colour/effect name and if it is "END"
100 REM then stop
110 READ N$
120 IF N$ = "END" THEN GOTO 200
120 IF N$ = "END" THEN END
130 REM Read the colour/effect code
140 READ C$
150 REM Print the colour/effect name using that effect
160 PRINT CHR$(27);"[";C$;"m";N$;
170 REM Clear colours and effects
180 PRINT CHR$(27);"[0m"
190 GOTO 90
200 END
150 PRINT "" : PRINT "Code ";C$; " ";
160 REM Print the colour/effect name using that effect
170 GOSUB 330
180 REM If this is an effect, rather than a colour, move
190 REM to the next one
200 LET C = VAL(C$)
210 IF C < 30 OR C > 37 THEN GOTO 90
220 REM Output the "background" colour effect. Note that
230 REM the string conversion of the new code adds a leading
240 REM space that must be removed
250 LET C = C + 10 : LET C$ = STR$(C)
260 LET C$ = RIGHT$(C$, LEN(C$) - 1)
270 PRINT " ";C$;" "; : GOSUB 330
280 REM Output the "bright foreground" effect
290 LET C = C + 50 : LET C$ = STR$(C)
300 LET C$ = RIGHT$(C$, LEN(C$) - 1)
310 PRINT " ";C$;" "; : GOSUB 330
320 GOTO 90
330 REM Output the current colour/effect
340 PRINT CHR$(27);"[";C$;"m";N$;
350 REM Clear all effects
360 PRINT CHR$(27);"[0m";
370 RETURN

0 comments on commit bbd9580

Please sign in to comment.