Compucolor.org – Virtual Media

Listing of file='KEYBRD.BAS;01' on disk='vmedia/soundware_II-sector.ccvf'

100 REM   KEYBOARD  BY CAP
200 REM     SET UP SOUND PROGRAM
203 POKE 32940,255:POKE 32941,159:CLEAR 50
205 LOAD "NEWML5.DAT;1"
210 PLOT 6,4,12,15,27,11
220 TM= PEEK (32940)+ 256* PEEK (32941)+ 1
230 X= INT ((TM+ 7)/ 256):Y= TM- 256* X+ 7
240 POKE 33283,Y:POKE 33284,X
250 POKE TM,50:POKE TM+ 1,0:POKE TM+ 2,15:POKE TM+ 3,0:POKE TM+ 4,0
300 REM  SET UP ARRAYS
305 OUT 8,247
310 DIM  KE(26),NT(47),KB(47)
315 RESTORE 325
320 FOR N= 1TO 26:READ KE(N):NEXT
325 DATA 1,0,0,5,4,7,9,11,0,13,15,0,0,0,0,0,0,0,3,8,12,0,2,0,10,0
330 FOR N= 0TO 47:READ NT(N):NEXT
335 DATA 0,154,146,138,130,122,0,115,109,103,97,91,86,81,0,77
340 DATA 0,77,72,68,64,60,0,57,54,51,48,45,42,39,0,37
345 DATA 0,37,35,33,31,29,0,27,25,24,22,21,20,18,0,17
350 FOR N= 0TO 47
355 IF NAND 1THEN KB(N)= 31487+ N* 3:GOTO 365
360 KB(N)= 30974+ N* 3
365 IF N> 15THEN KB(N)= KB(N)- 6
366 IF N> 31THEN KB(N)= KB(N)- 6
375 NEXT
400 GOSUB 1000
500 REM  KEYBOARD WATCHER AND NOTE PLAYER
504 X= 0:PLOT 6,0
505 TP= 4* 4335/ (X+ 3)
510 PRINT "     KEYBOARD IS READY"
515 PLOT 6,0
520 OUT 8,255:X= CALL (2):OUT 8,247:X= X- 64
521 PLOT 8
525 IF X< 0OR X> 27THEN 585
530 IF KE(X)= 0THEN 520
532 SA= KE(X)+ OC
535 NT= NT(SA):DU= INT (TP/ NT)
537 IF DU> 255THEN D1= INT (DU/ 256):DU= DU- D1* 256:POKE TM+ 3,D1
560 IF SAAND 1THEN POKE KB(SA),240:GOTO 570
565 POKE KB(SA),15
570 POKE TM,NT:POKE TM+ 2,DU:X= CALL (0)
575 POKE KB(SA),255
580 GOTO 520
585 X= X+ 16
590 IF X< 1OR X> 9THEN X= X+ 48:GOTO 605
595 TP= 16* 4335/ (X+ 3)
600 GOTO 520
605 IF X= 28THEN OC= OC+ 16:IF OC> 32THEN OC= 32
610 IF X= 10THEN OC= OC- 16:IF OC< 0THEN OC= 0
615 IF X= 26THEN OUT 8,255:PLOT 6,6:END
620 GOTO 520
837 IF DU< 1OR DU> 255THEN D2= INT (DU* 256):DU= DU- 256* D2:POKE TM+ 3,D2
1000 REM  SET UP GRAPHICS
1200 PLOT 12,6,7
1210 FOR X= 0TO 125STEP 6
1211 SA= X/ 3+ 1:IF SA> 15THEN SA= SA+ 2:IF SA> 31THEN SA= SA+ 2
1212 POKE TM,NT(SA):XX= CALL (0)
1220 PLOT 2,246,23,X,79,243,8,136,8,255
1230 NEXT
1240 PLOT 6,56
1250 FOR X= 0TO 120STEP 6
1260 IF X= 12OR X= 36THEN NEXT
1270 IF X= 54OR X= 78THEN NEXT
1280 IF X= 96OR X= 120THEN 1300
1281 SA= X/ 3+ 2:IF SA> 15THEN SA= SA+ 2:IF SA> 31THEN SA= SA+ 2
1282 POKE TM,NT(SA):XX= CALL (0)
1290 PLOT 2,246,48,X+ 3,79,243,8,136,8,255
1300 NEXT
1310 PLOT 6,6
1320 PLOT 6,1,3,0,27
1330 PRINT " C  D  E  F  G  A  B  C  D  E  F  G  A  B  C  D  E  F  G  A  B "
1340 PLOT 8
1370 PLOT 6,6
1380 FOR X= 4TO 116STEP 4
1390 PLOT 2,246,87,X,119,243,136,255
1400 NEXT
1410 PLOT 6,48
1420 FOR X= 4TO 108STEP 4
1430 IF X= 12OR X= 28THEN 1480
1440 IF X= 40OR X= 56THEN 1480
1450 IF X= 68OR X= 84THEN 1480
1460 IF X= 96OR X= 84THEN 1480
1470 PLOT 2,246,104,X+ 3,119,243,8,255
1480 NEXT
1490 PLOT 6,6
1500 PLOT 6,1,3,0,10
1510 PRINT "  C D E F G A B C D E F G A B C D E F G A B C D E F G A B C "
1520 PLOT 8
1530 RETURN