10 REM MUSKEY.2

20 REM MUSICAL KEYBOARD

30 D$ = CHR$ (4)

40 PRINT D$;"BLOAD ADA.2 BIN.22"

60 GOSUB 9000

200 GOSUB 8100: GOSUB 8000: GOSUB 930: POKE XS,1: POKE PU,3: POKE MR,0: POKE Q3,0

205 POKE MP,G5 * 16

210 POKE 34,0: HOME : GOTO 1000

300 PRINT : VTAB ME + 6: PRINT "1-";NS;" SEL SOUND : ";NP: RETURN

310 PRINT : VTAB ME + 7: PRINT "O-P CHNGE OCTV: ";MA: RETURN

320 PRINT : VTAB ME + 8: PRINT "U-I CHNGE NOTE: ";MZ;" ": RETURN

400 POKE KS,0

410 IF PEEK (KB) < 128 THEN 410

420 GET A$:A = VAL (A$)

430 IF A < 1 OR A > SE THEN RETURN

440 VTAB 5 + A: INVERSE : PRINT A$: NORMAL : VTAB BO: RETURN

450 PRINT : VTAB BO: CALL - 958: GOTO 1010

500 B = PEEK (KB): IF B > 128 THEN B = B - 128

502 A$ = CHR$ (B):A = VAL (A$): RETURN

505 IF PEEK (KB) < 128 THEN 505

510 GET A$:A = VAL (A$): RETURN

520 PRINT : VTAB BO - 1: CALL - 958: RETURN

530 INPUT A$:A = VAL (A$): IF A$ = "" THEN POP

532 RETURN

600 IF PEEK (T3) OR PEEK (T4) THEN PRINT : VTAB 15: PRINT " * EXT SYNC *"

610 RETURN

900 NS = VAL ( MID$ (NS$,MD,1))

910 IF A > NS THEN VTAB BO: PRINT G$: PRINT NS;" SOUNDS IN THIS MODE ";: GET A$: GOSUB 520: POP : GOTO 1200

920 NP = A

930 NS = VAL ( MID$ (NS$,MD,1)): IF MD = 2 AND NP = 7 OR MD = 2 AND NP = 8 THEN 950

940 POKE SA,SA(MD,NP): POKE LE,SL(MD): RETURN

950 POKE SA,SA(MD,NP): POKE LE,24: RETURN

1000 POKE 34,0: HOME : GOSUB 1500

1010 VTAB 1: PRINT "........................................"

1020 PRINT "............MUSICAL KEYBOARD............"

1030 PRINT "........................................";

1040 VTAB ME

1050 PRINT "Q ADA'S MAIN MENU"

1060 PRINT "W VOLUME (";O1;") "

1070 PRINT "E MODE (";MD;")"

1080 PRINT "R FREERUN"

1100 VTAB ME

1110 HTAB M1 + 5: IF PEEK (PR) = 0 THEN PRINT "<- ";: INVERSE : PRINT "->": NORMAL

1120 IF PEEK (PR) = 255 THEN INVERSE : PRINT "<-";: NORMAL : PRINT " ->"

1130 HTAB M1: PRINT "T REC RATE (";G3;")";: CALL - 868: PRINT

1140 HTAB M1: PRINT "Y TRIG LEV (";G6;")";: CALL - 868: PRINT

1160 HTAB M1: PRINT "- REC/";: INVERSE : PRINT "PLAY": NORMAL

1165 GOSUB 600

1170 PRINT : VTAB ME + 6: PRINT "1-";NS;" SEL SOUND : ";NP

1180 PRINT "O-P CHNGE OCTV: ";MA

1182 PRINT "U-I CHNGE NOTE: ";MZ;" "

1185 PRINT : PRINT " 9 EXT KEYBD"

1190 SE = 10

1200 CALL MM: GOSUB 500

1210 IF A > 0 AND A < 9 THEN GOSUB 900: GOSUB 300: GOTO 1200

1220 IF A$ = "P" THEN GOSUB 5800: GOSUB 310: GOTO 1200

1230 IF A$ = "O" THEN GOSUB 5820: GOSUB 310: GOTO 1200

1240 IF A$ = "-" THEN GOSUB 5500: GOTO 1100

1250 IF A$ = "U" THEN GOSUB 5920: GOSUB 320: GOTO 1200

1260 IF A$ = "I" THEN GOSUB 5900: GOSUB 320: GOTO 1200

1270 IF PEEK (KB) = 21 OR PEEK (KB) = 8 THEN GOSUB 5700: GOTO 1100

1280 IF A$ = "9" THEN POKE Q5,NP: GOTO 4000

1290 IF PEEK (KB) = 2 THEN GOSUB 6500: GOTO 1040

1300 GOSUB 1400

1310 VTAB BO: POKE 34,BO: ON A GOTO 1600,1610,1620,1650,1630,1640

1320 GOTO 1200

1400 FOR V1 = 1 TO 6: IF A$ = ( MID$ (K2$,V1,1)) THEN 1420

1410 NEXT V1: RETURN

1420 A = V1: IF A > 4 THEN 1440

1430 VTAB ME + A - 1: INVERSE : PRINT MID$ (K2$,V1,1): NORMAL : RETURN

1440 VTAB ME + A - 4: INVERSE : HTAB M1: PRINT MID$ (K2$,V1,1): VTAB BO: NORMAL : RETURN

1500 INVERSE :V1 = 12:V2 = 22

1510 FOR V3 = 0 TO 3: VTAB V1 + V3: HTAB V2: PRINT " ": NEXT V3

1520 FOR V3 = 0 TO 2: NORMAL : VTAB V1 + V3: HTAB V2 + 1: PRINT " ";: HTAB V2 + 3: PRINT " ";: HTAB V2 + 7: PRINT " ";: HTAB V2 + 9: PRINT " ";

1530 HTAB V2 + 11: PRINT " ";: HTAB V2 + 15: PRINT " ";: HTAB V2 + 17: PRINT " ": NEXT V3

1540 VTAB V1 + 2: HTAB V2 + 1: PRINT "S";: HTAB V2 + 3: PRINT "D";: HTAB V2 + 7: PRINT "G";: HTAB V2 + 9: PRINT "H";: HTAB V2 + 11: PRINT "J";: HTAB V2 + 15: PRINT "L";: HTAB V2 + 17: PRINT ";"

1550 INVERSE : VTAB V1 + 4: HTAB V2: PRINT "Z X C V B N M , . /": NORMAL : RETURN

1600 GOSUB 6200: GOTO 450

1610 GOSUB 8400: GOTO 450

1620 GOSUB 5000: GOTO 450

1630 GOSUB 8300: GOTO 450

1640 GOSUB 8500: GOTO 450

1650 CALL FR: GOTO 450

4000 VTAB 12: CALL - 958

4005 PRINT : VTAB BO: CALL - 958: POKE KS,0

4010 VTAB ME: PRINT "Q ADA'S MAIN MENU"

4020 PRINT "W VOLUME (";O1;") "

4030 PRINT "E MODE (";MD;")"

4040 PRINT "R FREERUN"

4060 VTAB ME: INVERSE : HTAB M1 + 5: PRINT "-> ->": NORMAL

4070 HTAB M1: PRINT "T REC RATE (";G3;")";: CALL - 868: PRINT

4080 HTAB M1: PRINT "Y TRIG LEV (";G6;")";: CALL - 868: PRINT

4100 HTAB M1: PRINT "- REC/";: INVERSE : PRINT "PLAY": NORMAL

4110 PRINT : VTAB ME + 6: PRINT "SELECTED SOUND: "; PEEK (Q5)

4115 PRINT "O-P CHNGE OCTV: ";MA

4120 PRINT "U-I CHNGE NOTE: ";MZ;" "

4130 GOSUB 4200: GOTO 4237

4200 VTAB ME + 6

4205 HTAB M1: PRINT "1 INTERNAL KEYBD"

4210 HTAB M1: PRINT "2 SYNTAURI KEYBD"

4220 HTAB M1: PRINT "3 PASSPORT KEYBD"

4230 HTAB M1: PRINT "4 KEYBD SLOT: ";G5

4235 RETURN

4237 IF PEEK (MR) = 0 THEN 4300

4240 HTAB M1: VTAB PEEK (MR) + 12: INVERSE : PRINT PEEK (MR) + 1: NORMAL : PRINT

4300 CALL MM: PRINT : GOSUB 500

4310 IF A$ = "P" THEN GOSUB 5800: GOSUB 310: GOTO 4300

4320 IF A$ = "O" THEN GOSUB 5820: GOSUB 310: GOTO 4300

4330 IF A$ = "I" THEN GOSUB 5900: GOSUB 320: GOTO 4300

4340 IF A$ = "U" THEN GOSUB 5920: GOSUB 320: GOTO 4300

4350 GOSUB 4200

4355 IF A$ = "-" THEN GOSUB 5500: POKE KS,0: GOTO 4060

4360 IF PEEK (KB) = 2 THEN GOSUB 6500: GOTO 4010

4370 ON A GOTO 4900,4800,4850,4870

4380 A = 0: GOSUB 1400

4390 VTAB BO: POKE 34,BO: ON A GOTO 4600,4610,4620,4650,4630,4640

4400 GOTO 4110

4600 GOSUB 6200: GOTO 4005

4610 GOSUB 8400: GOTO 4005

4620 GOSUB 5000: GOTO 4005

4630 GOSUB 8300: GOTO 4005

4640 GOSUB 8500: GOTO 4005

4650 CALL FR: GOTO 4005

4800 POKE MR,1: GOTO 4130

4850 POKE MR,2: GOTO 4130

4870 VTAB ME + 9: HTAB M1: INVERSE : PRINT "4": NORMAL : POKE KS,0

4875 GOSUB 520: PRINT "SLOT FOR SYNTAURI OR PASSPORT (0-7) ?";: GOSUB 510

4880 IF A$ = "0" THEN A = 0: GOTO 4885

4882 IF A > 0 AND A < 8 THEN 4885

4883 GOSUB 520: POKE MR,0: GOTO 4130

4885 G5 = A: GOSUB 8000: POKE MP,G5 * 16: GOSUB 520: POKE MR,0: GOTO 4130

4900 VTAB 10: CALL - 958: GOSUB 1500: POKE MR,0:NP = PEEK (Q5): GOTO 1100

5000 PRINT "ENTER NEW MODE (2-7)?";: GOSUB 510

5010 IF A < 2 OR A > 7 THEN RETURN

5020 MD = A:NP = 1: POKE Q5,NP: GOSUB 520: GOSUB 930: GOSUB 8000: RETURN

5500 VTAB ME + 3: HTAB M1 + 3: INVERSE : PRINT "REC";: NORMAL : PRINT "/PLAY"

5510 CALL IG: IF PEEK (KB) = 173 THEN POKE KS,0

5520 RETURN

5700 IF PEEK (KB) = 21 THEN POKE PR,0: RETURN

5710 IF PEEK (KB) = 8 THEN POKE PR,255: RETURN

5720 RETURN

5800 MA = MA + 1: IF MA > 8 THEN MA = 1

5810 POKE PU,MA - 1: RETURN

5820 MA = MA - 1: IF MA < 1 THEN MA = 8

5830 GOTO 5810

5900 MZ = MZ + 1: IF MZ > 13 THEN MZ = 1

5910 POKE Q3,MZ - 1: RETURN

5920 MZ = MZ - 1: IF MZ < 1 THEN MZ = 13

5930 GOTO 5910

6200 PRINT "MAIN MENU (Y/N)? ";

6220 GET A$: IF A$ < > "Y" THEN RETURN

6230 PRINT A$

6240 POKE X2,O1: PRINT D$;"RUN ADA.2"

6500 PRINT : GOSUB 520: PRINT "LOAD SOUNDBASE (1, 2, OR 3) ";

6510 GOSUB 510: IF A < 1 OR A > 3 THEN GOSUB 520: RETURN

6520 PRINT A: PRINT "LOADING SOUNDBASE";A

6530 PRINT D$;"BLOAD SOUNDBASE";A

6540 MD = PEEK (13823): IF MD < 2 OR MD > 7 THEN MD = 2

6550 POKE X9,0:G7 = A:NP = 1: GOSUB 930: GOSUB 8000: GOSUB 520: RETURN

8000 POKE X2,O1: POKE X3,MD: POKE X6,G3: POKE X7,G6: POKE G1,G6: POKE G2,G3

8010 POKE XB,G7: POKE X8,G5: RETURN

8100 SL = PEEK (X1):O1 = PEEK (X2):MD = PEEK (X3):G3 = PEEK (X6):G6 = PEEK (X7)

8110 G5 = PEEK (X8):G7 = PEEK (XB): RETURN

8300 PRINT "REC RATE (1-255) ";: GOSUB 530

8310 IF A > 255 OR A < 1 THEN PRINT G$;: GOTO 8300

8320 G3 = A: GOSUB 8000: RETURN

8400 PRINT "SET VOLUME (0-15) ";: GOSUB 530

8410 IF A > 15 OR A < 0 THEN PRINT G$;: GOTO 8400

8420 O1 = A:O2 = O1 + 1: IF O2 = 1 THEN O2 = - 1

8430 O2 = 1.414 ^ O2:O2 = INT (O2)

8440 DS = SL * 16: POKE OL + DS,O2

8450 GOSUB 8000: RETURN

8500 PRINT "TRIG LEV (0-128) ";: GOSUB 530

8510 IF A > 128 OR A < 0 THEN PRINT G$;: GOTO 8500

8520 G6 = A: GOSUB 8000: RETURN

8888 PRINT : VTAB ME + 6: PRINT " KEYS 1-8 SELECT SOUND: << ";NP;" >>": REM WAS LINE 1128

9000 CL = 11264:FR = CL + 1:IG = FR + 3:J1 = IG + 3

9010 RT = J1 + 3:PS = RT + 3:Q1 = PS + 3:MM = Q1 + 3

9030 SA = 11292:LE = SA + 1:P1 = LE + 1

9040 PD = P1 + 1:Q2 = PD + 1:S1 = Q2 + 1:P2 = S1 + 1

9050 SB = P2 + 1:G1 = SB + 1:G2 = G1 + 1:PU = G2 + 1

9060 R1 = PU + 1:R2 = R1 + 1:R3 = R2 + 1:R4 = R3 + 1

9070 R5 = R4 + 1:R6 = R5 + 1:MP = R6 + 1

9080 Q3 = MP + 1:S2 = Q3 + 1:S3 = S2 + 1

9090 S4 = S3 + 1:D1 = S4 + 1:Q4 = D1 + 1:Q5 = Q4 + 2

9100 X0 = Q5 + 1:X1 = X0 + 1:X2 = X1 + 1:X3 = X2 + 1:X4 = X3 + 1

9110 X5 = X4 + 1:X6 = X5 + 1:X7 = X6 + 1:X8 = X7 + 1:X9 = X8 + 1

9120 XS = X9 + 1:XB = XS + 1:PM = XB + 1

9130 T3 = PM + 1:T4 = T3 + 1:T5 = T4 + 1:T6 = T5 + 1:T7 = T6 + 1

9140 T1 = T7 + 1:PR = T1 + 2:MR = PR + 1

9150 XM = MR + 1:XA = XM + 1:XE = XA + 1:DD = XE + 1

9200 NZ = DD + 1:TZ = NZ + 1

9210 OL = 49285:NP = 1:MA = 4:MZ = 1

9220 ME = 6:SE = 5:BO = 20:MO = 17:M1 = 22

9230 KB = - 16384:KS = - 16368:G$ = ""

9240 BS = PEEK (Q4) + PEEK (Q4 + 1) * 256:T2 = PEEK (T1) + PEEK (T1 + 1) * 256

9250 DIM TT$(15):TT$ = "ZSXDCVGBHNJM,L"

9260 TN$ = "EVENTEMP":K2$ = "QWERTY":NS$ = "1886421"

9270 DIM EC$(12)

9280 EC$(0) = "ERROR":EC$(4) = "WRITE PROTECTED"

9290 EC$(6) = "FILE NOT FOUND":EC$(8) = "I/O ERROR"

9300 EC$(9) = "DISK FULL":EC$(10) = "FILE LOCKED":EC$(11) = "SYNTAX ERROR"

9310 SA(2,1) = 54:SA(2,2) = 62:SA(2,3) = 70:SA(2,4) = 78:SA(2,5) = 86:SA(2,6) = 94:SA(2,7) = 102:SA(2,8) = 126

9320 SA(3,1) = 54:SA(3,2) = 66:SA(3,3) = 78:SA(3,4) = 90:SA(3,5) = 102:SA(3,6) = 114:SA(3,7) = 126:SA(3,8) = 138

9330 SA(4,1) = 54:SA(4,2) = 70:SA(4,3) = 86:SA(4,4) = 102:SA(4,5) = 118:SA(4,6) = 134:SA(5,1) = 54:SA(5,2) = 78:SA(5,3) = 102:SA(5,4) = 126

9340 SA(6,1) = 54:SA(6,2) = 102:SA(7,1) = 54:SL(2) = 8:SL(3) = 12:SL(4) = 16:SL(5) = 24:SL(6) = 48:SL(7) = 96

10099 RETURN