home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
MIDI
/
MIDI-CNV.LBR
/
MIDI-BW.BZS
/
MIDI-BW.BAS
Wrap
BASIC Source File
|
2000-06-30
|
2KB
|
91 lines
100 REM MIDI TEST PROGRAM
110 REM
120 REM DERIVED FROM ELECTRONIC MUSICIAN 5/86
130 REM
140 REM MODIFIED FOR BONDWELL 14 - SERIAL PORT B
150 REM
160 REM (REQUIRES RS232 TO MIDI CONVERTER)
170 :
180 REM INITIALISE SERIAL PORT
190 GOSUB 770
200 :
210 REM SELECT MODE
220 :
230 PRINT:PRINT "Select mode: (T)ransmit or (R)eceive ? ";
240 MODE$=INPUT$(1)
250 PRINT MODE$:PRINT
260 IF MODE$="t" OR MODE$="T" THEN 450
270 :
280 REM RECEIVE MODE
290 :
300 REM CHECK FOR VALID CHARACTER
310 A=INP(CR)
320 IF A AND 1=0 THEN 310
330 :
340 REM GET CHARACTER
350 A=INP(TDR)
360 :
370 REM IGNORE MIDI RUNNING STATUS
380 IF A=254 THEN 310
390 PRINT A,
400 GOTO 310
410 :
420 REM TRANSMIT MODE
430 :
440 REM SET MIDI CHANNEL 1, MAX VELOCITY
450 CHL=0
460 VEL=127
470 :
480 REM DEFINE MIDI NOTE ON, NOTE OFF CODES
490 OFF=128+0+CHL
500 SPEAK=128+16+CHL
510 :
520 OLD=0
530 N$=INPUT$(1) :REM GET A KEY
540 IF OLD=0 THEN 610
550 :
560 REM TURN PREVIOUS NOTE OFF
570 OUT TDR,OFF
580 OUT TDR,OLD
590 OUT TDR,VEL
600 :
610 VALUE=ASC(N$)
620 PRINT VALUE,
630 :
640 REM IF SPACE, TURN NOTE OFF
650 IF VALUE=32 THEN OLD=0:GOTO 530
660 :
670 REM SOUND NOTE
680 IF VALUE>127 THEN VALUE=127
690 OUT TDR,SPEAK
700 OUT TDR,VALUE
710 OUT TDR,VEL
720 :
730 OLD=VALUE
740 GOTO 530
750 :
760 REM DEFINE REGISTERS
770 TDR=66 :REM SIO PORT B DATA
780 CR=67 :REM SIO PORT B CONTROL
790 TCH=97 :REM 8253 TIMER 1
800 TCR=99 :REM 8253 CONTROL
810 :
820 REM INITIALISE BAUD GENERATOR
830 OUT TCR,118 :REM COUNTER 1, COUNT (2 BYTES), MODE 3, BINARY
840 OUT TCH,4 :REM LOAD COUNT LSB
850 OUT TCH,0 :REM LOAD COUNT MSB
860 :
870 REM INITIALISE SERIAL PORT B
880 OUT CR,0 :REM WR0
890 OUT CR,24 :REM RESET CHANNEL
900 OUT CR,4 :REM WR4
910 OUT CR,68 :REM X16, 1 STOP BIT, NO PARITY
920 OUT CR,5 :REM WR5
930 OUT CR,234 :REM 8 BITS, TX ENABLE
940 OUT CR,3 :REM WR3
950 OUT CR,193 :REM 8 BITS, RX ENABLE
960 :
970 RETURN
WR5
930 OUT CR,234 :REM 8 BITS, TX ENABLE
940 OUT CR,