Light Show 2000

Developer(s): Michael Carver
Date: 1986
Type: Program
Platform(s): TS 2068
Tags: Music

A music-driven light show for the TS2068. Plug a stereo, tape deck or other music source into the computer’s EAR jack, and a machine code routine polls the EAR port and sorts each pulse into one of four tone groups by its length (the shorter the pulse, the higher the note). Each tone lights its own color pattern on the screen.

A menu sets the display mode (a pattern stays lit only during its pulse, or until the next one), the color of each tone, the upper limit of each tone group, and the pulse and tempo timing, each with a coarse and a fine value. Settings can be compiled into up to four named set-ups besides the default, viewed, and saved to or loaded from tape. Press q to leave the light show.

As printed, the listing is typed in with a loader: RUN 9000 POKEs the 296 bytes of machine code from hex DATA lines, checks them against printed checksums, sets up user graphic A, deletes the loader lines and saves the finished program and code to tape. This file is that finished tape, made by running the printed listing’s own loader.

Published in Time Designs September/October 1986 (Light Show 2000).

Related Articles

Light Show 2000 will allow your cassette deck (or any other musical source) control your computer. LS 200 will poll the ear port of the TS2068 and decipher any pulse detected into one of four tonal groups. Depending on the note detected, a corresponding color pattern will be displayed on the screen.

Image Gallery

Source Code

1 BRIGHT 0: BORDER 0: RESTORE : PAPER 0: INK 0: CLS : LET x=2
2 FOR a=1 TO 69: READ y: IF y=255 THEN LET x=x+1: NEXT a
3 PRINT AT x,y;"\a": NEXT a
10 POKE 23658,0: RANDOMIZE USR 45056: INK 9: GO TO 1000
100 DATA 15,255,12,18,255,15,255,10,13,17,20,255,15,255,8,12,14,16,18,22,255,10,15,20,255,12,14,16,18
110 DATA 255,7,9,11,13,15,17,19,21,23
120 DATA 255,12,14,16,18,255,10,15,20,255,8,12,14,16,18,22,255,15,255,10,13,17,20,255,15,255,12,18,255,15
130 DATA 0,BIN 1000010,BIN 111100,BIN 11000,BIN 11000,BIN 111100,BIN 1000010,0
140 RESTORE 150: DIM s(5,14): FOR a=1 TO 14: READ b: LET s(1,a)=b: NEXT a: DIM s$(5,31): LET s$(1)="DEFAULT SETTING................": LET d$="...............................": FOR a=2 TO 5: LET s$(a)=d$: NEXT a
150 DATA 1,0,240,208,192,160,6,3,5,2,10,0,1,1
160 LET current=1: DIM b$(32): DIM c$(3)
1000 PAPER 1: BORDER 1: CLS : PRINT AT 0,8; INVERSE 1;"LIGHT SHOW MENU";AT 4,0; INVERSE 0;"ENTER LIGHT SHOW...............0"''"SYSTEM SET-UP..................1"''"SET MODE.......................2"''"SET COLORS.....................3"''"TONE CONTROL...................4"''"SET PULSE......................5"''"SET TEMPO......................6"''"SAVE/LOAD SET-UPS..............7"
1005 PRINT #0;"  ""q"" Returns from Light Show": ON ERR RESET
1010 GO SUB 8000: GO TO 1010+(990 AND k$="1")-(1009 AND k$="0")+(1990 AND k$="2")+(2090 AND k$="3")+(2190 AND k$="4")+(2290 AND (k$="5" OR k$="6"))+(2990 AND k$="7")
2000 PAPER 2: BORDER 2: CLS : REM system set-up********
2010 INPUT INKEY$: PRINT INVERSE 1;AT 0,9;"SYSTEM SET-UP"; INVERSE 0;'''''
2020 FOR a=1 TO 5: PRINT (s$(a) AND s(a,1))+("SETTING NOT DEFINED............" AND NOT s(a,1));a'': NEXT a
2030 PRINT "COMPILE CURRENT SET-UP.........S"''"VIEW SET-UP....................V"''"RETURN TO MAIN MENU............M"
2040 IF current THEN PRINT BRIGHT 1; OVER 1;AT current*2+3,0;b$
2100 GO SUB 8000: GO TO 2100+(100 AND (k$="s" OR k$="S"))+(200 AND (k$>="1" AND k$<="5"))+(300 AND (k$="v" OR k$="V"))-(1100 AND (k$="m" OR k$="M"))
2200 REM compile set-up
2210 PRINT AT 15,0; OVER 1; PAPER 3;b$: PRINT #0;"Set-Up # (2-5)": GO SUB 8000: IF k$<="1" OR k$>="6" THEN INPUT INKEY$: BEEP .35,10: GO TO 2010
2220 LET k=VAL k$: PRINT AT k*2+3,0; OVER 1; FLASH 1;b$: RESTORE 2999: LET s(k,1)=1: FOR a=2 TO 14: READ b: LET s(k,a)=PEEK b: NEXT a
2230 INPUT "Set-Up Name? "; LINE k$: LET s$(k)=d$: LET s$(k, TO (LEN k$ AND LEN k$<30)+(30 AND LEN k$>=30))=k$
2240 LET current=k: GO TO 2010
2300 REM make set-up current
2310 LET k=VAL INKEY$: IF s(k,1)=0 THEN PRINT AT k*2+3,0; OVER 1; FLASH 1;b$: BEEP .35,10: FOR a=1 TO 50: NEXT a: INPUT INKEY$: GO TO 2010
2320 RESTORE 2999: LET current=k: FOR a=2 TO 14: READ b: POKE b,s(k,a): NEXT a: GO TO 2010
2400 REM View Set-Up
2410 ON ERR GO TO 1000: PRINT PAPER 3; OVER 1;AT 17,0;b$;#1;"View Set-Up # (1-5)": GO SUB 8000: IF k$<="0" OR k$>="6" THEN INPUT INKEY$: BEEP .35,10: GO TO 2010
2420 LET k=VAL INKEY$: IF s(k,1)=0 THEN PRINT AT k*2+3,0; OVER 1; FLASH 1;b$: FOR a=1 TO 100: NEXT a: BEEP .35,10: INPUT INKEY$: PRINT AT k*2+3,0; OVER 1; FLASH 0;b$: GO TO 2010
2430 CLS : PRINT INVERSE 1;s$(k);k; INVERSE 0''"MODE ";s(k,2)''"Tone Color and Limit": PRINT PAPER 0; INK s(k,7);AT 6,3;"TONE 0 ";CHR$ 144;" ";s(k,3), INK s(k,8);" TONE 1 ";CHR$ 144;" ";s(k,4);AT 7,3; INK s(k,9);"TONE 2 ";CHR$ 144;" ";s(k,5), INK s(k,10);" TONE 3 ";CHR$ 144;" ";s(k,6): PAPER 2
2440 PRINT ''"Timing"''TAB 4;"Course"," Fine"''"Tempo  ";s(k,11)+(256 AND s(k,11)=256);TAB 18;s(k,12)+(256 AND s(k,12)=0)'"Pulse  ";s(k,13)+(256 AND s(k,13)=0);TAB 18;s(k,14)+(256 AND s(k,14)=0)
2450 PRINT #0;"Press any key to return to Menu": GO SUB 8000: GO TO 2000
2999 DATA 45351,45076,45080,45084,45088,45129,45117,45105,45093,45213,45216,45196,45199
3000 REM set mode
3005 ON ERR GO TO 1000: PAPER 3: BORDER 3: CLS : PRINT TAB 11; INVERSE 1;"SET MODE"
3010 PRINT ''''"Mode 0 -- Tone Pattern will staylit only during ON Period."''"Mode 1 -- Tone Pattern will staylit until next Tone Pulse."''"Currently set at "; INVERSE 1;"MODE ";PEEK 45351
3020 PRINT #0; BRIGHT 1;"Enter Desired Mode (0 or 1)     ""M"" for Menu";b$(13 TO )
3030 GO SUB 8000: IF k$<>"0" AND k$<>"1" AND k$<>"M" AND k$<>"m" THEN GO TO 3030
3040 IF k$="1" OR k$="0" THEN POKE 45351,VAL k$: LET current=0: INPUT INKEY$: PRINT AT 0,0: GO TO 3010
3050 GO TO 1000
3100 REM set colors
3110 ON ERR GO TO 1000: PAPER 4: BORDER 4: CLS : PRINT INVERSE 1;AT 0,10;"SET COLORS"''
3120 PRINT BRIGHT 1; INK PEEK 45129; PAPER (4 AND PEEK 45129=0);AT 6,3;"TONE 0 ";CHR$ 144;" ", INK PEEK 45117; PAPER (4 AND PEEK 45117=0);" TONE 1 ";CHR$ 144;" ";AT 7,3; INK PEEK 45105; PAPER (4 AND PEEK 45105=0);"TONE 2 ";CHR$ 144;" ", INK PEEK 45093; PAPER (4 AND PEEK 45093=0);" TONE 3 ";CHR$ 144;" "
3130 INPUT INKEY$: PRINT #0;" Tone # (0-3)  -- ""M"" for Menu"
3140 GO SUB 8000: IF k$<"0" OR k$>"3" AND (k$<>"M" AND k$<>"m") THEN GO TO 3140
3150 IF k$="m" OR k$="M" THEN GO TO 1000
3160 LET a=VAL k$: INPUT INKEY$: PRINT #0;"New color for TONE ";k$;"   (0-7)"
3170 GO SUB 8000: IF k$<"0" OR k$>"7" THEN GO TO 3170
3180 POKE 45000+(129 AND a=0)+(117 AND a=1)+(105 AND a=2)+(93 AND a=3),VAL k$: LET current=0: GO TO 3120
3200 REM tone control
3210 ON ERR GO TO 1000: PAPER 5: BORDER 5: CLS : PRINT INVERSE 1;AT 0,9;"TONE CONTROL"''
3220 BRIGHT 1: PAPER 0: PRINT INK PEEK 45129;AT 6,3;"TONE 0 ";CHR$ 144;" ";: LET c$=STR$ PEEK 45076: PRINT c$;, INK PEEK 45117;" TONE 1 ";CHR$ 144;" ";: LET c$=STR$ PEEK 45080: PRINT c$;AT 7,3; INK PEEK 45105;"TONE 2 ";CHR$ 144;" ";: LET c$=STR$ PEEK 45084: PRINT c$, INK PEEK 45093;" TONE 3 ";CHR$ 144;" ";: LET c$=STR$ PEEK 45088: PRINT c$
3225 PAPER 5: BRIGHT 0
3230 INPUT INKEY$: PRINT #0;" Tone # (0-3)  -- ""M"" for Menu"
3240 GO SUB 8000: IF k$<"0" OR k$>"3" AND (k$<>"M" AND k$<>"m") THEN GO TO 3240
3250 IF k$="m" OR k$="M" THEN GO TO 1000
3260 LET a=VAL k$: LET limit1=5-a: LET limit2=(254 AND a=0)+(PEEK 45076-1 AND a=1)+(PEEK 45080-1 AND a=2)+(PEEK 45084-1 AND a=3)
3265 INPUT ;"New limit for TONE "+STR$ a+" ("+STR$ limit1+"-"+STR$ limit2+")?   "; LINE k$
3270 LET k=VAL k$: IF k<limit1 OR k>limit2 THEN GO TO 3265
3280 POKE 45000+(76 AND a=0)+(80 AND a=1)+(84 AND a=2)+(88 AND a=3),VAL k$: LET current=0: GO TO 3220
3300 REM pulse and tempo control
3310 ON ERR GO TO 1000: LET a=VAL k$: PAPER 6+(a=6): BORDER 6+(a=6): CLS
3320 PRINT INVERSE 1;AT 0,9;("PULSE" AND a=5)+("TEMPO" AND a=6)+" CONTROL"
3330 LET course=PEEK (45196+(17 AND a=6)): LET fine=PEEK (45199+(17 AND a=6)): PRINT ''"Current "+("Pulse" AND a=5)+("Tempo" AND a=6)''TAB 4;"Course","Fine"'TAB 6;course+(256 AND course=0);"   ";TAB 17;fine+(256 AND fine=0);"   "
3340 PRINT ''"Course -- Number of times ""Fine""period is repeated"''"Fine -- Sets timing via nano-   seconds"
3350 PRINT AT 18,0;("Pulse -- Length of time needed  to place Tone pattern on screen." AND a=5)+("Tempo -- Length of pause betweenreading Tones" AND a=6)
3360 PRINT #0;"Set Course or Fine (C or F)?    ""M"" for Menu"
3370 GO SUB 8000: IF k$<>"C" AND k$<>"c" AND k$<>"F" AND k$<>"f" AND k$<>"m" AND k$<>"M" THEN GO TO 3370
3380 LET i$=k$: IF i$="m" OR i$="M" THEN GO TO 1000
3390 PRINT OVER 1; FLASH 1;AT 5,4+(12 AND i$="f" OR i$="F");"    "+("  " AND (i$="c" OR i$="C")): INPUT "Enter # (1-256) "; LINE k$: LET k=VAL k$: IF k<1 OR k>256 THEN GO TO 3390
3400 POKE 45196+(3 AND (i$="f" OR i$="F"))+(17 AND a=6),k-(256 AND k=256): LET current=0: GO TO 3320
4000 REM save/load set-ups
4010 ON ERR GO TO 1000: CLS : PRINT TAB 7; INVERSE 1;"SAVE/LOAD SET-UPS";#0; BRIGHT 1;"S = SAVE    L = LOAD    M = MENU"
4020 GO SUB 8000: IF k$<>"S" AND k$<>"s" AND k$<>"L" AND k$<>"l" AND k$<>"M" AND k$<>"m" THEN GO TO 4020
4030 IF k$="S" OR k$="s" THEN GO TO 4100
4035 IF k$="M" OR k$="m" THEN GO TO 1000
4040 PRINT ''"Ready to LOAD Set-Ups": INPUT "Load title ?";n$: PRINT ''"Loading ";n$: PRINT #0;"Start tape, then press any key.": GO SUB 8000: INPUT INKEY$
4050 IF LEN n$>10 THEN LET n$=n$( TO 10)
4060 ON ERR GO TO 4200: LOAD n$ DATA s$(): LOAD n$ DATA s(): GO TO 1000
4100 PRINT ''"Ready to SAVE Set-Ups": INPUT "SAVE title ?";n$: LET n$=("Set-Ups" AND n$="")+n$( TO LEN n$-(LEN n$-10 AND LEN n$>10)): PRINT AT 6,0;"Saving """;n$;""""
4110 SAVE n$ DATA s$(): SAVE n$ DATA s(): PRINT #0;"Verify (Y or N)?": GO SUB 8000
4120 IF k$="N" OR k$="n" THEN GO TO 1000
4130 INPUT INKEY$: PRINT AT 6,0;"Verifying  """;n$;"""  "''"Rewind tape";#0;"Start tape and press any key.": GO SUB 8000
4140 ON ERR GO TO 4200: VERIFY n$ DATA s$(): VERIFY n$ DATA s(): GO TO 1000
4200 CLS : PRINT FLASH 1;AT 5,7;"Tape Loading Error": PRINT '''TAB 6; INVERSE 1;"Please Attempt Again"; INVERSE 0;#0;"Press any key for Menu": GO SUB 8000: GO TO 1000
8000 REM keyboard scan
8010 IF INKEY$<>"" THEN GO TO 8010
8020 IF INKEY$="" THEN GO TO 8020
8030 LET k$=INKEY$: RETURN
9000 CLEAR 45055: LET a$="": RESTORE 9100: FOR i=0 TO 36: READ d$: LET a$=a$+d$: NEXT i
9010 IF LEN a$<>592 THEN PRINT FLASH 1;"Error in Machine Code DATA      Lines 9100 - 9136"'' FLASH 0;"There are too "+("few " AND LEN a$<592)+("many " AND LEN a$>592)+"Data items!"''"PLEASE CORRECT BEFORE CONTINUING"
9020 LET address=45056: FOR i=1 TO LEN a$-1 STEP 2
9030 POKE address + INT ((i-1)/2),(CODE a$(i)-(48 AND CODE a$(i)<58)-(55 AND CODE a$(i)>64))*16+CODE a$(i+1)-(48 AND CODE a$(i+1)<58)-(55 AND CODE a$(i+1)>64)
9040 NEXT i
9100 DATA "3A085CFE712001C9"
9101 DATA "16FF15AFDBFECB77"
9102 DATA "20F87AFEF030E9FE"
9103 DATA "C8302CFEA0301CFE"
9104 DATA "78300C110002ED53"
9105 DATA "B05C21A7B0182211"
9106 DATA "0005ED53B05C21C7"
9107 DATA "B01816110003ED53"
9108 DATA "B05C21E7B0180A11"
9109 DATA "0006ED53B05C2107"
9110 DATA "B13A27B1FE012805"
9111 DATA "E5CD7FB0E1CD7FB0"
9112 DATA "189E7EE638577EE6"
9113 DATA "07070707BA2006ED"
9114 DATA "5BB05C18053A8D5C"
9115 DATA "77C9E6F88277C906"
9116 DATA "105E235623E52100"
9117 DATA "5819C50601C50601"
9118 DATA "10FEC110F8C1CD62"
9119 DATA "B0E110E5060CC506"
9120 DATA "0010FEC110F8C90F"
9121 DATA "0151018F014D01CF"
9122 DATA "005301CF014B018F"
9123 DATA "0055010F0249014F"
9124 DATA "0057014F02470130"
9125 DATA "0170016E012E01F2"
9126 DATA "00B201AC01EC00B4"
9127 DATA "00F401EA01AA0081"
9128 DATA "0481048104810432"
9129 DATA "0172016C012C0114"
9130 DATA "0194018A010A01F6"
9131 DATA "00B601A801E80081"
9132 DATA "048104810481044F"
9133 DATA "01F000B001AE01EE"
9134 DATA "00B100F101ED01AD"
9135 DATA "00720032022C026C"
9136 DATA "0081048104810400"
9200 RESTORE 9300: LET tally=0: FOR i=0 TO 36: READ d: LET tally=tally+d: NEXT i: IF tally<>26767 THEN PRINT FLASH 0;"ERROR"; FLASH 0;" in DATA Lines 9300 - 9350"''"Please correct and <RUN 9200>": STOP
9230 RESTORE 9300: LET address=45056: FOR i=0 TO 36: LET check=0: FOR j=1 TO 8: LET check=check+PEEK address: LET address=address+1
9240 NEXT j: READ tally: IF check<>tally THEN PRINT FLASH 1;"ERROR"; FLASH 0;" -- in DATA"'"Check for an Error in Line ";9100+i'"And then procede by <RUN 9000>": STOP
9250 NEXT i
9300 DATA 759,1268,1431,1036,519,719,825
9310 DATA 562,759,634,751,1470,1037,489
9320 DATA 679,1254,528,521,1223,867,943
9330 DATA 512,511,256,289,514,768,779
9340 DATA 453,290,546,713,482,831,830
9350 DATA 320,399
9400 CLS : PRINT "Machine Code has been Loaded    into memory."''"Press any key to SAVE & VERIFY  Light Show 2000!": PAUSE 0
9410 INK 9: RESTORE 130: FOR a=USR "a" TO USR "a"+7: READ y: POKE a,y: NEXT a
9420 CLEAR : DELETE 9000,9500
9998 SAVE "ls 2000" LINE 9999: SAVE "ls 2000"CODE 45056,296: CLS : PRINT "Rewind Tape and Play to Verify": VERIFY "": VERIFY ""CODE : GO TO 140
9999 CLEAR 45055: LOAD "ls 2000"CODE 45056,296: INK 9: RESTORE 130: FOR a=USR "a" TO USR "a"+7: READ y: POKE a,y: NEXT a: GO TO 140

Note: Type-in program listings on this website use ZMAKEBAS notation for graphics characters.