MIDI-SID-CON.C
FILE INFORMATION
FILENAME(S): MIDI-SID-CON.C
FILE TYPE(S): SEQ
FILE SIZE: 10.9K
FIRST SEEN: 2025-10-20 14:31:50
APPEARS ON: 1 disk(s)
FILE HASH
bb46d96089ab0b9ae5bd8130fefa36eb2d358f67f98fef4ebd3ccc8a9b0773cf
FOUND ON DISKS (1 DISKS)
| DISK TITLE | FILENAME | FILE TYPE | COLLECTION | TRACK | SECTOR | ACTIONS |
|---|---|---|---|---|---|---|
| MIDI SID CONNECT | MIDI-SID-CON.C | SEQ | Treasure Chest - Klaus Der Suhler | 28 | 1 | DOWNLOAD FILE |
FILE CONTENT & ANALYSIS
00000000: 2F 2A CD C9 C4 C9 20 54 4F 20 D3 C9 C4 20 C3 4F |/*.... TO ... .O|
00000010: 4E 56 45 52 54 45 52 20 22 CD C9 C4 C9 2D D3 C9 |NVERTER "....-..|
00000020: C4 2D C3 CF CE 22 2A 2F 0D 2F 2A 43 4F 4E 56 45 |.-..."*/./*CONVE|
00000030: 52 54 53 20 CD C9 C4 C9 2D D3 C9 C4 20 53 45 51 |RTS ....-... SEQ|
00000040: 55 45 4E 43 45 20 46 49 4C 45 20 4D 41 44 45 2A |UENCE FILE MADE*|
00000050: 2F 0D 2F 2A 42 59 20 CD C9 C4 C9 2D D3 C9 C4 2D |/./*BY ....-...-|
00000060: D3 C5 D1 20 49 4E 54 4F 20 4E 4F 52 4D 41 4C 20 |... INTO NORMAL |
00000070: 45 4E 48 41 4E 43 45 44 2A 2F 0D 2F 2A D3 C9 C4 |ENHANCED*/./*...|
00000080: 50 4C 41 59 45 52 20 46 49 4C 45 53 20 20 28 4D |PLAYER FILES (M|
00000090: 4F 4E 4F 20 4F 52 20 53 54 45 52 45 4F 20 41 53 |ONO OR STEREO AS|
000000A0: 20 2A 2F 0D 2F 2A 44 49 43 54 41 54 45 44 20 42 | */./*DICTATED B|
000000B0: 59 20 53 45 51 55 45 4E 43 45 20 46 49 4C 45 20 |Y SEQUENCE FILE |
000000C0: 49 54 53 45 4C 46 2E 2A 2F 0D 0D 2F 2A D6 45 52 |ITSELF.*/../*.ER|
000000D0: 53 49 4F 4E 20 31 2E 30 2C 20 42 59 20 C6 52 41 |SION 1.0, BY .RA|
000000E0: 4E 4B 20 D0 52 49 4E 44 4C 45 2C 20 37 20 D3 45 |NK .RINDLE, 7 .E|
000000F0: 50 20 38 39 2A 2F 0D 2F 2A D6 45 52 53 49 4F 4E |P 89*/./*.ERSION|
00000100: 20 32 2E 30 2C 20 42 59 20 C6 52 41 4E 4B 20 D0 | 2.0, BY .RANK .|
00000110: 52 49 4E 44 4C 45 2C 20 31 35 20 C6 45 42 20 39 |RINDLE, 15 .EB 9|
00000120: 30 2A 2F 0D 0D 23 49 4E 43 4C 55 44 45 20 3C 53 |0*/..#INCLUDE <S|
00000130: 54 44 49 4F 2E 48 3E 0D 0D 2F 2A 44 45 46 41 55 |TDIO.H>../*DEFAU|
00000140: 4C 54 20 54 4F 20 36 20 56 4F 49 43 45 53 20 55 |LT TO 6 VOICES U|
00000150: 4E 4C 45 53 53 20 53 45 51 55 45 4E 43 45 20 46 |NLESS SEQUENCE F|
00000160: 49 4C 45 20 48 41 53 20 53 4F 4D 45 20 4F 54 48 |ILE HAS SOME OTH|
00000170: 45 52 20 4E 55 4D 42 45 52 2A 2F 0D 49 4E 54 20 |ER NUMBER*/.INT |
00000180: CE D6 CF C9 C3 C5 D3 3D 36 3B 0D 0D 2F 2A 44 45 |.......=6;../*DE|
00000190: 46 49 4E 45 20 54 48 45 20 D3 C9 C4 50 4C 41 59 |FINE THE ...PLAY|
000001A0: 45 52 20 4E 4F 54 45 20 43 4F 44 45 53 2A 2F 0D |ER NOTE CODES*/.|
000001B0: 23 44 45 46 49 4E 45 20 C3 20 31 0D 23 44 45 46 |#DEFINE . 1.#DEF|
000001C0: 49 4E 45 20 C4 20 32 0D 23 44 45 46 49 4E 45 20 |INE . 2.#DEFINE |
000001D0: C5 20 33 0D 23 44 45 46 49 4E 45 20 C6 20 34 0D |. 3.#DEFINE . 4.|
000001E0: 23 44 45 46 49 4E 45 20 C7 20 35 0D 23 44 45 46 |#DEFINE . 5.#DEF|
000001F0: 49 4E 45 20 C1 20 36 0D 23 44 45 46 49 4E 45 20 |INE . 6.#DEFINE |
00000200: C2 20 37 0D 23 44 45 46 49 4E 45 20 D2 C5 D3 D4 |. 7.#DEFINE ....|
00000210: 20 30 58 39 38 0D 23 44 45 46 49 4E 45 20 D3 C8 | 0X98.#DEFINE ..|
00000220: C1 D2 D0 20 30 58 34 30 0D 23 44 45 46 49 4E 45 |... 0X40.#DEFINE|
00000230: 20 C6 CC C1 D4 20 30 58 43 30 0D 23 44 45 46 49 | .... 0XC0.#DEFI|
00000240: 4E 45 20 CE C1 D4 D5 D2 C1 CC 20 30 58 38 30 0D |NE ....... 0X80.|
00000250: 0D 2F 2A 53 59 53 54 45 4D 20 53 54 55 46 46 2A |./*SYSTEM STUFF*|
00000260: 2F 0D 23 44 45 46 49 4E 45 20 42 41 43 4B 47 52 |/.#DEFINE BACKGR|
00000270: 4F 55 4E 44 20 28 2A 28 28 43 48 41 52 20 2A 29 |OUND (*((CHAR *)|
00000280: 35 33 32 38 31 29 29 20 2F 2A D6 C9 C3 20 43 48 |53281)) /*... CH|
00000290: 49 50 20 42 41 43 4B 47 52 4F 55 4E 44 20 43 4F |IP BACKGROUND CO|
000002A0: 4C 4F 52 2A 2F 0D 23 44 45 46 49 4E 45 20 42 4F |LOR*/.#DEFINE BO|
000002B0: 52 44 45 52 20 28 2A 28 28 43 48 41 52 20 2A 29 |RDER (*((CHAR *)|
000002C0: 35 33 32 38 30 29 29 20 20 20 20 20 2F 2A D6 C9 |53280)) /*..|
000002D0: C3 20 43 48 49 50 20 42 4F 52 44 45 52 20 43 4F |. CHIP BORDER CO|
000002E0: 4C 4F 52 2A 2F 0D 23 44 45 46 49 4E 45 20 43 55 |LOR*/.#DEFINE CU|
000002F0: 52 52 45 4E 54 A4 4B 45 59 20 28 2A 28 28 43 48 |RRENT.KEY (*((CH|
00000300: 41 52 20 2A 29 31 39 37 29 29 20 20 2F 2A 43 55 |AR *)197)) /*CU|
00000310: 52 52 45 4E 54 20 4B 45 59 53 43 41 4E 20 43 4F |RRENT KEYSCAN CO|
00000320: 44 45 2A 2F 0D 23 44 45 46 49 4E 45 20 D2 D5 CE |DE*/.#DEFINE ...|
00000330: A4 D3 D4 CF D0 A4 CB C5 D9 20 36 33 20 20 20 20 |......... 63 |
00000340: 20 20 20 20 20 20 20 20 20 20 20 2F 2A 4B 45 59 | /*KEY|
00000350: 53 43 41 4E 20 43 4F 44 45 20 46 4F 52 20 52 55 |SCAN CODE FOR RU|
00000360: 4E 2F 53 54 4F 50 2A 2F 0D 23 44 45 46 49 4E 45 |N/STOP*/.#DEFINE|
00000370: 20 D2 C5 D3 C5 D4 20 36 34 37 33 38 20 20 20 20 | ..... 64738 |
00000380: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2F | /|
00000390: 2A 4B 45 52 4E 41 4C 20 43 4F 4C 44 20 53 54 41 |*KERNAL COLD STA|
000003A0: 52 54 20 45 4E 54 52 59 20 50 4F 49 4E 54 2A 2F |RT ENTRY POINT*/|
000003B0: 0D 23 44 45 46 49 4E 45 20 C2 CC C1 C3 CB A4 D6 |.#DEFINE .......|
000003C0: C1 CC D5 C5 20 30 20 20 20 20 20 20 20 20 20 20 |.... 0 |
000003D0: 20 20 20 20 20 20 20 2F 2A 43 4F 4C 4F 52 20 43 | /*COLOR C|
000003E0: 4F 44 45 20 46 4F 52 20 42 4C 41 43 4B 2A 2F 0D |ODE FOR BLACK*/.|
000003F0: 23 44 45 46 49 4E 45 20 C3 CC C5 C1 D2 20 31 34 |#DEFINE ..... 14|
00000400: 37 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |7 |
00000410: 20 20 20 20 20 20 2F 2A 43 48 41 52 41 43 54 45 | /*CHARACTE|
00000420: 52 20 43 4F 44 45 20 46 4F 52 20 43 4C 45 41 52 |R CODE FOR CLEAR|
00000430: 20 53 43 52 45 45 4E 2A 2F 0D 23 44 45 46 49 4E | SCREEN*/.#DEFIN|
00000440: 45 20 C3 D9 C1 CE 20 31 35 39 20 20 20 20 20 20 |E .... 159 |
00000450: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00000460: 2F 2A 43 48 41 52 41 43 54 45 52 20 43 4F 44 45 |/*CHARACTER CODE|
00000470: 20 46 4F 52 20 43 59 41 4E 2A 2F 0D 23 44 45 46 | FOR CYAN*/.#DEF|
00000480: 49 4E 45 20 CC CF D7 C5 D2 20 31 34 20 20 20 20 |INE ..... 14 |
00000490: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000004A0: 20 20 2F 2A 43 48 41 52 41 43 54 45 52 20 43 4F | /*CHARACTER CO|
000004B0: 44 45 20 46 4F 52 20 4C 4F 57 45 52 20 43 41 53 |DE FOR LOWER CAS|
000004C0: 45 2A 2F 0D 23 44 45 46 49 4E 45 20 D5 D0 20 31 |E*/.#DEFINE .. 1|
000004D0: 34 35 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |45 |
000004E0: 20 20 20 20 20 20 20 20 20 20 2F 2A 43 48 41 52 | /*CHAR|
000004F0: 41 43 54 45 52 20 43 4F 44 45 20 46 4F 52 20 43 |ACTER CODE FOR C|
00000500: 55 52 53 4F 52 20 55 50 2A 2F 0D 23 44 45 46 49 |URSOR UP*/.#DEFI|
00000510: 4E 45 20 CC C5 C6 D4 20 31 35 37 20 20 20 20 20 |NE .... 157 |
00000520: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00000530: 20 2F 2A 43 48 41 52 41 43 54 45 52 20 43 4F 44 | /*CHARACTER COD|
00000540: 45 20 46 4F 52 20 43 55 52 53 4F 52 20 4C 45 46 |E FOR CURSOR LEF|
00000550: 54 2A 2F 0D 0D 43 48 41 52 20 2A 53 49 44 50 54 |T*/..CHAR *SIDPT|
00000560: 52 5B 33 5D 3B 20 20 20 20 20 20 20 20 20 20 20 |R[3]; |
00000570: 20 20 20 20 20 20 20 20 20 20 20 2F 2A 52 55 4E | /*RUN|
00000580: 4E 49 4E 47 20 50 4F 49 4E 54 45 52 53 20 49 4E |NING POINTERS IN|
00000590: 54 4F 20 36 20 D3 C9 C4 20 42 55 46 46 45 52 53 |TO 6 ... BUFFERS|
000005A0: 2A 2F 0D 43 48 41 52 20 53 49 44 42 55 46 5B 33 |*/.CHAR SIDBUF[3|
000005B0: 5D 5B 31 30 30 30 30 5D 3B 20 20 20 20 20 20 20 |][10000]; |
000005C0: 20 20 20 20 20 20 20 20 20 20 2F 2A 53 50 41 43 | /*SPAC|
000005D0: 45 20 46 4F 52 20 36 20 D3 C9 C4 20 42 55 46 46 |E FOR 6 ... BUFF|
000005E0: 45 52 53 2A 2F 0D 43 48 41 52 20 4D 49 44 49 54 |ERS*/.CHAR MIDIT|
000005F0: 4F 53 49 44 5B 31 32 38 5D 3B 20 20 20 20 20 20 |OSID[128]; |
00000600: 20 20 20 20 20 20 20 20 20 20 20 20 2F 2A D3 C9 | /*..|
00000610: C4 20 4E 4F 54 45 20 43 4F 44 45 53 20 46 4F 52 |. NOTE CODES FOR|
00000620: 20 45 41 43 48 20 CD C9 C4 C9 20 4E 4F 54 45 2A | EACH .... NOTE*|
00000630: 2F 0D 49 4E 54 20 4F 4E 54 49 4D 45 5B 33 5D 3B |/.INT ONTIME[3];|
00000640: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00000650: 20 20 20 20 20 20 20 20 2F 2A 4D 4F 53 54 20 52 | /*MOST R|
00000660: 45 43 45 4E 54 20 4F 4E 20 54 49 4D 45 20 46 4F |ECENT ON TIME FO|
00000670: 52 20 45 41 43 48 20 56 4F 49 43 45 2A 2F 0D 49 |R EACH VOICE*/.I|
00000680: 4E 54 20 4F 46 46 54 49 4D 45 5B 33 5D 3B 20 20 |NT OFFTIME[3]; |
00000690: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000006A0: 20 20 20 20 20 2F 2A 4D 4F 53 54 20 52 45 43 45 | /*MOST RECE|
000006B0: 4E 54 20 4F 46 46 20 54 49 4D 45 20 46 4F 52 20 |NT OFF TIME FOR |
000006C0: 45 41 43 48 20 56 4F 49 43 45 2A 2F 0D 43 48 41 |EACH VOICE*/.CHA|
000006D0: 52 20 4F 4C 44 4E 4F 54 45 5B 33 5D 3B 20 20 20 |R OLDNOTE[3]; |
000006E0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
000006F0: 20 20 20 2F 2A CD C9 C4 C9 20 4E 4F 54 45 20 54 | /*.... NOTE T|
00000700: 48 41 54 20 49 53 20 4E 4F 57 20 4F 4E 2A 2F 0D |HAT IS NOW ON*/.|
00000710: 43 48 41 52 20 4D 49 44 49 4E 41 4D 45 5B 33 30 |CHAR MIDINAME[30|
00000720: 5D 3D 22 4D 49 44 49 53 45 51 31 22 3B 20 20 20 |]="MIDISEQ1"; |
00000730: 20 20 20 20 20 20 2F 2A 44 45 46 41 55 4C 54 20 | /*DEFAULT |
00000740: 46 49 52 53 54 20 46 49 4C 45 20 4E 41 4D 45 20 |FIRST FILE NAME |
00000750: 54 4F 20 50 52 4F 43 45 53 53 2A 2F 0D 43 48 41 |TO PROCESS*/.CHA|
00000760: 52 20 53 49 44 4E 41 4D 45 5B 31 39 5D 3B 20 20 |R SIDNAME[19]; |
00000770: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 | |
00000780: 20 20 20 2F 2A D3 C9 C4 20 46 49 4C 45 20 4E 41 | /*... FILE NA|
00000790: 4D 45 53 20 42 55 49 4C 54 20 48 45 52 45 2A 2F |MES BUILT HERE*/|
000007A0: 0D 43 48 41 52 20 50 52 45 46 41 43 45 5B 31 38 |.CHAR PREFACE[18|
000007B0: 5D 3D 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |]= |
000007C0: 20 20 20 20 20 20 20 2F 2A D3 C9 C4 20 43 4F 44 | /*... COD|
000007D0: 45 53 20 54 4F 20 47 4F 20 41 54 20 53 54 41 52 |ES TO GO AT STAR|
000007E0: 54 20 4F 46 20 45 41 43 48 20 56 4F 49 43 45 2A |T OF EACH VOICE*|
000007F0: 2F 0D 20 20 DB 0D 20 20 30 58 30 31 2C 20 30 58 |/. .. 0X01, 0X|
00000800: 43 45 2C 0D 20 20 30 58 30 31 2C 20 30 58 34 42 |CE,. 0X01, 0X4B|
00000810: 2C 0D 20 20 30 58 30 31 2C 20 30 58 38 37 2C 0D |,. 0X01, 0X87,.|
00000820: 20 20 30 58 35 32 2C 20 30 58 44 43 2C 0D 20 20 | 0X52, 0XDC,. |
00000830: 30 58 30 31 2C 20 30 58 30 34 2C 0D 20 20 30 58 |0X01, 0X04,. 0X|
00000840: 30 31 2C 20 30 58 42 30 2C 0D 20 20 30 58 30 31 |01, 0XB0,. 0X01|
00000850: 2C 20 30 58 38 43 2C 0D 20 20 30 58 30 31 2C 20 |, 0X8C,. 0X01, |
00000860: 30 58 39 38 2C 0D 20 20 30 58 32 36 2C 20 30 58 |0X98,. 0X26, 0X|
00000870: 30 31 0D 20 20 DD 3B 0D 0D 2F 2A 42 45 47 49 4E |01. .;../*BEGIN|
00000880: 20 50 52 4F 47 52 41 4D 2A 2F 0D 4D 41 49 4E 28 | PROGRAM*/.MAIN(|
00000890: 29 0D 20 20 DB 0D 20 20 2F 2A 4C 4F 4F 50 20 46 |). .. /*LOOP F|
000008A0: 4F 52 20 4D 41 4E 59 20 46 49 4C 45 53 2A 2F 0D |OR MANY FILES*/.|
000008B0: 20 20 46 4F 52 28 3B 3B 29 0D 20 20 20 20 DB 0D | FOR(;;). ..|
000008C0: 20 20 20 20 2F 2A 44 4F 20 4F 4E 45 20 46 49 4C | /*DO ONE FIL|
000008D0: 45 2A 2F 0D 20 20 20 20 4D 41 49 4E 32 28 29 3B |E*/. MAIN2();|
000008E0: 0D 0D 20 20 20 20 2F 2A 53 45 45 20 49 46 20 4D |.. /*SEE IF M|
000008F0: 4F 52 45 20 46 49 4C 45 53 2A 2F 0D 20 20 20 20 |ORE FILES*/. |
00000900: 50 52 49 4E 54 46 28 22 C3 4F 4E 56 45 52 54 20 |PRINTF(".ONVERT |
00000910: 41 4E 4F 54 48 45 52 20 46 49 4C 45 3F 20 4E 25 |ANOTHER FILE? N%|
00000920: 43 22 2C CC C5 C6 D4 29 3B 0D 20 20 20 20 47 45 |C",....);. GE|
00000930: 54 53 28 53 49 44 4E 41 4D 45 29 3B 0D 20 20 20 |TS(SIDNAME);. |
00000940: 20 49 46 28 53 49 44 4E 41 4D 45 5B 30 5D 21 3D | IF(SIDNAME[0]!=|
00000950: 27 59 27 29 0D 20 20 20 20 20 20 DB 0D 20 20 20 |'Y'). .. |
00000960: 20 20 20 2F 2A 4E 4F 20 4D 4F 52 45 20 46 49 4C | /*NO MORE FIL|
00000970: 45 53 2C 20 43 4F 4C 44 20 53 54 41 52 54 20 43 |ES, COLD START C|
00000980: 36 34 2A 2F 0D 20 20 20 20 20 20 53 59 53 28 D2 |64*/. SYS(.|
00000990: C5 D3 C5 D4 29 3B 0D 20 20 20 20 20 20 DD 0D 0D |....);. ...|
000009A0: 20 20 20 20 2F 2A 4D 4F 52 45 20 46 49 4C 45 53 | /*MORE FILES|
000009B0: 20 2D 20 42 55 4D 50 20 44 45 46 41 55 4C 54 20 | - BUMP DEFAULT |
000009C0: 4E 41 4D 45 20 55 50 20 42 59 20 31 2A 2F 0D 20 |NAME UP BY 1*/. |
000009D0: 20 20 20 4D 49 44 49 4E 41 4D 45 5B 53 54 52 4C | MIDINAME[STRL|
000009E0: 45 4E 28 4D 49 44 49 4E 41 4D 45 29 2D 31 5D 2B |EN(MIDINAME)-1]+|
000009F0: 2B 3B 0D 20 20 20 20 DD 0D 20 20 DD 0D 0D 2F 2A |+;. .. .../*|
00000A00: 52 45 41 4C 20 57 4F 52 4B 20 44 4F 4E 45 20 48 |REAL WORK DONE H|
00000A10: 45 52 45 20 46 4F 52 20 4F 4E 45 20 46 49 4C 45 |ERE FOR ONE FILE|
00000A20: 2A 2F 0D 4D 41 49 4E 32 28 29 0D 20 DB 0D 20 49 |*/.MAIN2(). .. I|
00000A30: 4E 54 20 49 3B 0D 20 49 4E 54 20 4F 43 54 41 56 |NT I;. INT OCTAV|
00000A40: 45 3B 0D 20 49 4E 54 20 43 31 2C 43 32 2C 43 33 |E;. INT C1,C2,C3|
00000A50: 2C 56 4F 49 43 45 2C 44 55 52 41 54 49 4F 4E 2C |,VOICE,DURATION,|
00000A60: 4F 46 46 53 45 54 3B 0D 20 C6 C9 CC C5 20 2A 53 |OFFSET;. .... *S|
00000A70: 49 44 46 49 4C 45 3B 0D 20 C6 C9 CC C5 20 2A 4D |IDFILE;. .... *M|
00000A80: 49 44 49 46 49 4C 45 3B 0D 20 49 4E 54 20 46 49 |IDIFILE;. INT FI|
00000A90: 52 53 54 4E 4F 54 45 3B 0D 20 43 48 41 52 20 4E |RSTNOTE;. CHAR N|
00000AA0: 4F 4E 41 4D 45 3D 31 3B 0D 20 49 4E 54 20 4C 49 |ONAME=1;. INT LI|
00000AB0: 4D 49 54 3D 39 39 39 32 3B 0D 0D 20 2F 2A 50 52 |MIT=9992;.. /*PR|
00000AC0: 4F 4D 50 54 20 46 4F 52 20 46 49 4C 45 20 4E 41 |OMPT FOR FILE NA|
00000AD0: 4D 45 2A 2F 0D 20 42 41 43 4B 47 52 4F 55 4E 44 |ME*/. BACKGROUND|
00000AE0: 3D C2 CC C1 C3 CB A4 D6 C1 CC D5 C5 3B 0D 20 42 |=...........;. B|
00000AF0: 4F 52 44 45 52 3D C2 CC C1 C3 CB A4 D6 C1 CC D5 |ORDER=..........|
00000B00: C5 3B 0D 20 57 48 49 4C 45 28 4E 4F 4E 41 4D 45 |.;. WHILE(NONAME|
00000B10: 29 0D 20 20 20 DB 0D 20 20 20 50 52 49 4E 54 46 |). .. PRINTF|
00000B20: 28 22 25 43 5C 4E 25 43 25 43 20 20 20 20 20 20 |("%C\N%C%C |
00000B30: 20 20 20 CD C9 C4 C9 2D 54 4F 2D D3 49 44 20 C3 | ....-TO-.ID .|
00000B40: 4F 4E 56 45 52 54 45 52 5C 4E 22 2C 0D 20 20 20 |ONVERTER\N",. |
00000B50: 20 C3 CC C5 C1 D2 2C C3 D9 C1 CE 2C CC CF D7 C5 | .....,....,....|
00000B60: D2 29 3B 0D 20 20 20 50 52 49 4E 54 46 28 22 20 |.);. PRINTF(" |
00000B70: 20 20 20 20 20 20 20 20 D6 32 2E 30 20 42 59 20 | .2.0 BY |
00000B80: C6 52 41 4E 4B 20 D0 52 49 4E 44 4C 45 5C 4E 5C |.RANK .RINDLE\N\|
00000B90: 4E 22 29 3B 0D 20 20 20 50 52 49 4E 54 46 28 22 |N");. PRINTF("|
00000BA0: C5 4E 54 45 52 20 CD C9 C4 C9 20 53 45 51 20 46 |.NTER .... SEQ F|
00000BB0: 49 4C 45 20 4E 41 4D 45 3A 20 22 29 3B 0D 20 20 |ILE NAME: ");. |
00000BC0: 20 49 20 3D 20 2A 4D 49 44 49 4E 41 4D 45 3B 0D | I = *MIDINAME;.|
00000BD0: 20 20 20 47 45 54 53 28 4D 49 44 49 4E 41 4D 45 | GETS(MIDINAME|
00000BE0: 29 3B 0D 20 20 20 49 46 28 2A 4D 49 44 49 4E 41 |);. IF(*MIDINA|
00000BF0: 4D 45 3D 3D 30 29 2A 4D 49 44 49 4E 41 4D 45 3D |ME==0)*MIDINAME=|
00000C00: 49 3B 0D 20 20 20 49 46 28 53 54 52 4C 45 4E 28 |I;. IF(STRLEN(|
00000C10: 4D 49 44 49 4E 41 4D 45 29 3C 3D 31 32 29 4E 4F |MIDINAME)<=12)NO|
00000C20: 4E 41 4D 45 2D 2D 3B 0D 20 20 20 DD 0D 0D 20 2F |NAME--;. ... /|
00000C30: 2A 49 4E 49 54 49 41 4C 49 5A 45 20 CD C9 C4 C9 |*INITIALIZE ....|
00000C40: 20 4E 4F 54 45 20 54 4F 20 D3 C9 C4 20 4E 4F 54 | NOTE TO ... NOT|
00000C50: 45 20 43 4F 4E 56 45 52 53 49 4F 4E 20 54 41 42 |E CONVERSION TAB|
00000C60: 4C 45 2A 2F 0D 20 46 4F 52 28 49 3D 31 32 3B 49 |LE*/. FOR(I=12;I|
00000C70: 3C 31 30 38 3B 49 2B 3D 31 32 29 0D 20 20 20 DB |<108;I+=12). .|
00000C80: 0D 20 20 20 4F 43 54 41 56 45 3D 28 38 2D 28 49 |. OCTAVE=(8-(I|
00000C90: 2F 31 32 29 29 3C 3C 33 3B 0D 20 20 20 4D 49 44 |/12))<<3;. MID|
00000CA0: 49 54 4F 53 49 44 5B 49 2B 30 5D 3D C3 DF CE C1 |ITOSID[I+0]=....|
00000CB0: D4 D5 D2 C1 CC DF 4F 43 54 41 56 45 3B 0D 20 20 |......OCTAVE;. |
00000CC0: 20 4D 49 44 49 54 4F 53 49 44 5B 49 2B 31 5D 3D | MIDITOSID[I+1]=|
00000CD0: C3 DF D3 C8 C1 D2 D0 DF 4F 43 54 41 56 45 3B 0D |........OCTAVE;.|
00000CE0: 20 20 20 4D 49 44 49 54 4F 53 49 44 5B 49 2B 32 | MIDITOSID[I+2|
00000CF0: 5D 3D C4 DF CE C1 D4 D5 D2 C1 CC DF 4F 43 54 41 |]=..........OCTA|
00000D00: 56 45 3B 0D 20 20 20 4D 49 44 49 54 4F 53 49 44 |VE;. MIDITOSID|
00000D10: 5B 49 2B 33 5D 3D C5 DF C6 CC C1 D4 DF 4F 43 54 |[I+3]=.......OCT|
00000D20: 41 56 45 3B 0D 20 20 20 4D 49 44 49 54 4F 53 49 |AVE;. MIDITOSI|
00000D30: 44 5B 49 2B 34 5D 3D C5 DF CE C1 D4 D5 D2 C1 CC |D[I+4]=.........|
00000D40: DF 4F 43 54 41 56 45 3B 0D 20 20 20 4D 49 44 49 |.OCTAVE;. MIDI|
00000D50: 54 4F 53 49 44 5B 49 2B 35 5D 3D C6 DF CE C1 D4 |TOSID[I+5]=.....|
00000D60: D5 D2 C1 CC DF 4F 43 54 41 56 45 3B 0D 20 20 20 |.....OCTAVE;. |
00000D70: 4D 49 44 49 54 4F 53 49 44 5B 49 2B 36 5D 3D C6 |MIDITOSID[I+6]=.|
00000D80: DF D3 C8 C1 D2 D0 DF 4F 43 54 41 56 45 3B 0D 20 |.......OCTAVE;. |
00000D90: 20 20 4D 49 44 49 54 4F 53 49 44 5B 49 2B 37 5D | MIDITOSID[I+7]|
00000DA0: 3D C7 DF CE C1 D4 D5 D2 C1 CC DF 4F 43 54 41 56 |=..........OCTAV|
00000DB0: 45 3B 0D 20 20 20 4D 49 44 49 54 4F 53 49 44 5B |E;. MIDITOSID[|
00000DC0: 49 2B 38 5D 3D C7 DF D3 C8 C1 D2 D0 DF 4F 43 54 |I+8]=........OCT|
00000DD0: 41 56 45 3B 0D 20 20 20 4D 49 44 49 54 4F 53 49 |AVE;. MIDITOSI|
00000DE0: 44 5B 49 2B 39 5D 3D C1 DF CE C1 D4 D5 D2 C1 CC |D[I+9]=.........|
00000DF0: DF 4F 43 54 41 56 45 3B 0D 20 20 20 4D 49 44 49 |.OCTAVE;. MIDI|
00000E00: 54 4F 53 49 44 5B 49 2B 31 30 5D 3D C2 DF C6 CC |TOSID[I+10]=....|
00000E10: C1 D4 DF 4F 43 54 41 56 45 3B 0D 20 20 20 4D 49 |...OCTAVE;. MI|
00000E20: 44 49 54 4F 53 49 44 5B 49 2B 31 31 5D 3D C2 DF |DITOSID[I+11]=..|
00000E30: CE C1 D4 D5 D2 C1 CC DF 4F 43 54 41 56 45 3B 0D |........OCTAVE;.|
00000E40: 20 20 20 DD 0D 0D 20 2F 2A 4F 50 45 4E 20 54 48 | ... /*OPEN TH|
00000E50: 45 20 53 45 51 55 45 4E 43 45 20 46 49 4C 45 2A |E SEQUENCE FILE*|
00000E60: 2F 0D 20 4D 49 44 49 46 49 4C 45 3D 46 4F 50 45 |/. MIDIFILE=FOPE|
00000E70: 4E 28 4D 49 44 49 4E 41 4D 45 2C 22 52 22 29 3B |N(MIDINAME,"R");|
00000E80: 0D 20 49 46 28 4D 49 44 49 46 49 4C 45 3D 3D CE |. IF(MIDIFILE==.|
00000E90: D5 CC CC 20 DF DF 20 46 45 52 52 4F 52 28 4D 49 |... .. FERROR(MI|
00000EA0: 44 49 46 49 4C 45 29 29 0D 20 20 20 DB 0D 20 20 |DIFILE)). .. |
00000EB0: 20 50 52 49 4E 54 46 28 0D 20 20 20 20 22 5C 4E | PRINTF(. "\N|
00000EC0: C3 41 4E 27 54 20 4F 50 45 4E 20 25 53 20 54 4F |.AN'T OPEN %S TO|
00000ED0: 20 52 45 41 44 5C 4E 5C 4E 22 2C 4D 49 44 49 4E | READ\N\N",MIDIN|
00000EE0: 41 4D 45 29 3B 0D 20 20 20 50 52 49 4E 54 46 28 |AME);. PRINTF(|
00000EF0: 22 25 58 5C 4E 22 2C 53 49 44 4E 41 4D 45 29 3B |"%X\N",SIDNAME);|
00000F00: 0D 20 20 20 52 45 54 55 52 4E 3B 0D 20 20 20 DD |. RETURN;. .|
00000F10: 0D 20 46 43 4C 4F 53 45 28 4D 49 44 49 46 49 4C |. FCLOSE(MIDIFIL|
00000F20: 45 29 3B 0D 0D 20 2F 2A 54 45 4C 4C 20 55 53 45 |E);.. /*TELL USE|
00000F30: 52 20 57 48 41 54 20 49 53 20 48 41 50 50 45 4E |R WHAT IS HAPPEN|
00000F40: 49 4E 47 2A 2F 0D 20 50 52 49 4E 54 46 28 22 25 |ING*/. PRINTF("%|
00000F50: 43 D0 52 4F 43 45 53 53 49 4E 47 20 25 53 2E 2E |C.ROCESSING %S..|
00000F60: 2E 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 |. |
00000F70: 20 20 20 20 20 20 20 20 20 20 20 20 20 5C 4E 22 | \N"|
00000F80: 2C 0D 20 20 D5 D0 2C 4D 49 44 49 4E 41 4D 45 29 |,. ..,MIDINAME)|
00000F90: 3B 0D 20 50 52 49 4E 54 46 28 22 C8 4F 4C 44 20 |;. PRINTF(".OLD |
00000FA0: D2 D5 CE 2F D3 D4 CF D0 20 4B 45 59 20 54 4F 20 |.../.... KEY TO |
00000FB0: 51 55 49 54 2E 5C 4E 5C 4E 22 29 3B 0D 0D 20 2F |QUIT.\N\N");.. /|
00000FC0: 2A 4C 4F 4F 50 20 41 53 20 4E 45 43 45 53 53 41 |*LOOP AS NECESSA|
00000FD0: 52 59 20 46 4F 52 20 2E 4D 55 53 2F 2E 53 54 52 |RY FOR .MUS/.STR|
00000FE0: 20 46 49 4C 45 53 2A 2F 0D 20 46 4F 52 28 4F 46 | FILES*/. FOR(OF|
00000FF0: 46 53 45 54 3D 30 3B 4F 46 46 53 45 54 3C CE D6 |FSET=0;OFFSET<..|
00001000: CF C9 C3 C5 D3 3B 4F 46 46 53 45 54 2B 3D 33 29 |.....;OFFSET+=3)|
00001010: 0D 20 20 DB 0D 20 20 49 4E 54 20 4E 56 4F 49 43 |. .. INT NVOIC|
00001020: 45 53 3D 33 3B 0D 20 20 46 49 52 53 54 4E 4F 54 |ES=3;. FIRSTNOT|
00001030: 45 3D 31 3B 0D 0D 20 20 2F 2A 52 45 4F 50 45 4E |E=1;.. /*REOPEN|
00001040: 20 4D 49 44 49 20 53 45 51 55 45 4E 43 45 20 46 | MIDI SEQUENCE F|
00001050: 49 4C 45 2A 2F 0D 20 20 4D 49 44 49 46 49 4C 45 |ILE*/. MIDIFILE|
00001060: 3D 46 4F 50 45 4E 28 4D 49 44 49 4E 41 4D 45 2C |=FOPEN(MIDINAME,|
00001070: 22 52 22 29 3B 0D 0D 20 20 2F 2A 53 45 54 20 41 |"R");.. /*SET A|
00001080: 4C 4C 20 52 55 4E 4E 49 4E 47 20 50 4F 49 4E 54 |LL RUNNING POINT|
00001090: 45 52 53 20 54 4F 20 53 54 41 52 54 20 4F 46 20 |ERS TO START OF |
000010A0: 52 45 53 50 45 43 54 49 56 45 20 42 55 46 46 45 |RESPECTIVE BUFFE|
000010B0: 52 53 2A 2F 0D 20 20 46 4F 52 28 49 3D 30 3B 49 |RS*/. FOR(I=0;I|
000010C0: 3C 33 3B 49 2B 2B 29 0D 20 20 20 20 DB 0D 20 20 |<3;I++). .. |
000010D0: 20 20 53 49 44 50 54 52 5B 49 5D 20 3D 20 26 53 | SIDPTR[I] = &S|
000010E0: 49 44 42 55 46 5B 49 5D 5B 30 5D 3B 0D 20 20 20 |IDBUF[I][0];. |
000010F0: 20 DD 0D 0D 20 20 2F 2A 50 52 4F 43 45 53 53 20 | ... /*PROCESS |
00001100: 53 45 51 55 45 4E 43 45 20 46 49 4C 45 20 54 4F |SEQUENCE FILE TO|
00001110: 20 C5 CF C6 2A 2F 0D 20 20 57 48 49 4C 45 28 28 | ...*/. WHILE((|
00001120: 43 31 3D 46 47 45 54 42 59 54 45 28 4D 49 44 49 |C1=FGETBYTE(MIDI|
00001130: 46 49 4C 45 29 29 21 3D C5 CF C6 29 0D 20 20 20 |FILE))!=...). |
00001140: 20 DB 0D 20 20 20 20 2F 2A 54 45 53 54 20 46 4F | .. /*TEST FO|
00001150: 52 20 53 45 4E 54 49 4E 45 4C 2A 2F 0D 20 20 20 |R SENTINEL*/. |
00001160: 20 49 46 28 28 43 31 26 30 58 46 30 29 3D 3D 30 | IF((C1&0XF0)==0|
00001170: 58 46 30 29 0D 20 20 20 20 20 20 DB 0D 20 20 20 |XF0). .. |
00001180: 20 20 20 2F 2A 53 45 4E 54 49 4E 45 4C 20 46 4F | /*SENTINEL FO|
00001190: 55 4E 44 20 2D 20 53 45 54 20 CE D6 CF C9 C3 C5 |UND - SET ......|
000011A0: D3 20 54 4F 20 4E 55 4D 42 45 52 20 4F 46 20 56 |. TO NUMBER OF V|
000011B0: 4F 49 43 45 53 20 52 45 43 4F 52 44 45 44 2A 2F |OICES RECORDED*/|
000011C0: 0D 20 20 20 20 20 20 CE D6 CF C9 C3 C5 D3 3D 43 |. .......=C|
000011D0: 31 26 30 58 37 3B 0D 0D 20 20 20 20 20 20 2F 2A |1&0X7;.. /*|
000011E0: 43 4F 4D 50 55 54 45 20 48 4F 57 20 4D 41 4E 59 |COMPUTE HOW MANY|
000011F0: 20 56 4F 49 43 45 53 20 54 4F 20 50 52 4F 43 45 | VOICES TO PROCE|
00001200: 53 53 20 54 48 49 53 20 47 4F 20 41 52 4F 55 4E |SS THIS GO AROUN|
00001210: 44 2A 2F 0D 20 20 20 20 20 20 4E 56 4F 49 43 45 |D*/. NVOICE|
00001220: 53 3D CE D6 CF C9 C3 C5 D3 2D 4F 46 46 53 45 54 |S=.......-OFFSET|
00001230: 3B 0D 20 20 20 20 20 20 49 46 28 4E 56 4F 49 43 |;. IF(NVOIC|
00001240: 45 53 3E 33 29 4E 56 4F 49 43 45 53 3D 33 3B 0D |ES>3)NVOICES=3;.|
00001250: 0D 20 20 20 20 20 20 2F 2A 47 45 54 20 41 4E 4F |. /*GET ANO|
00001260: 54 48 45 52 20 42 59 54 45 20 46 52 4F 4D 20 46 |THER BYTE FROM F|
00001270: 49 4C 45 20 54 4F 20 52 45 50 4C 41 43 45 20 53 |ILE TO REPLACE S|
00001280: 45 4E 54 49 4E 45 4C 2A 2F 0D 20 20 20 20 20 20 |ENTINEL*/. |
00001290: 43 31 3D 46 47 45 54 42 59 54 45 28 4D 49 44 49 |C1=FGETBYTE(MIDI|
000012A0: 46 49 4C 45 29 3B 0D 20 20 20 20 20 20 DD 0D 0D |FILE);. ...|
000012B0: 20 20 20 20 2F 2A 43 48 45 43 4B 20 54 4F 20 53 | /*CHECK TO S|
000012C0: 45 45 20 49 46 20 55 53 45 52 20 57 41 4E 54 53 |EE IF USER WANTS|
000012D0: 20 54 4F 20 53 54 4F 50 2A 2F 0D 20 20 20 20 49 | TO STOP*/. I|
000012E0: 46 28 43 55 52 52 45 4E 54 A4 4B 45 59 3D 3D D2 |F(CURRENT.KEY==.|
000012F0: D5 CE A4 D3 D4 CF D0 A4 CB C5 D9 29 0D 20 20 20 |...........). |
00001300: 20 20 20 DB 0D 20 20 20 20 20 20 2F 2A 41 42 4F | .. /*ABO|
00001310: 52 54 20 50 52 4F 43 45 53 53 49 4E 47 20 50 45 |RT PROCESSING PE|
00001320: 52 20 55 53 45 52 2A 2F 0D 20 20 20 20 20 20 46 |R USER*/. F|
00001330: 43 4C 4F 53 45 28 4D 49 44 49 46 49 4C 45 29 3B |CLOSE(MIDIFILE);|
00001340: 0D 20 20 20 20 20 20 50 52 49 4E 54 46 28 22 C1 |. PRINTF(".|
00001350: 42 4F 52 54 45 44 21 5C 4E 5C 4E 22 29 3B 0D 20 |BORTED!\N\N");. |
00001360: 20 20 20 20 20 52 45 54 55 52 4E 3B 0D 20 20 20 | RETURN;. |
00001370: 20 20 20 DD 0D 0D 20 20 20 20 2F 2A 42 4F 54 48 | ... /*BOTH|
00001380: 20 4E 4F 54 45 2D 4F 4E 20 41 4E 44 20 4E 4F 54 | NOTE-ON AND NOT|
00001390: 45 2D 4F 46 46 20 45 56 45 4E 54 53 20 48 41 56 |E-OFF EVENTS HAV|
000013A0: 45 20 41 54 20 4C 45 41 53 54 20 54 57 4F 20 42 |E AT LEAST TWO B|
000013B0: 59 54 45 53 2A 2F 0D 20 20 20 20 43 32 3D 46 47 |YTES*/. C2=FG|
000013C0: 45 54 42 59 54 45 28 4D 49 44 49 46 49 4C 45 29 |ETBYTE(MIDIFILE)|
000013D0: 3B 0D 0D 20 20 20 20 2F 2A 4E 4F 54 45 2D 4F 4E |;.. /*NOTE-ON|
000013E0: 20 42 59 54 45 53 20 48 41 56 45 20 33 20 42 59 | BYTES HAVE 3 BY|
000013F0: 54 45 53 2A 2F 0D 20 20 20 20 49 46 28 28 43 31 |TES*/. IF((C1|
00001400: 26 30 58 38 30 29 3D 3D 30 29 43 33 3D 46 47 45 |&0X80)==0)C3=FGE|
00001410: 54 42 59 54 45 28 4D 49 44 49 46 49 4C 45 29 3B |TBYTE(MIDIFILE);|
00001420: 0D 0D 20 20 20 20 2F 2A 49 53 4F 4C 41 54 45 20 |.. /*ISOLATE |
00001430: D3 C9 C4 20 56 4F 49 43 45 20 4E 55 4D 42 45 52 |... VOICE NUMBER|
00001440: 2A 2F 0D 20 20 20 20 56 4F 49 43 45 3D 28 28 43 |*/. VOICE=((C|
00001450: 31 3E 3E 34 29 26 37 29 2D 4F 46 46 53 45 54 3B |1>>4)&7)-OFFSET;|
00001460: 0D 0D 20 20 20 20 2F 2A 53 4B 49 50 20 56 4F 49 |.. /*SKIP VOI|
00001470: 43 45 53 20 4E 4F 54 20 42 45 49 4E 47 20 50 52 |CES NOT BEING PR|
00001480: 4F 43 45 53 53 45 44 20 54 48 49 53 20 47 4F 20 |OCESSED THIS GO |
00001490: 41 52 4F 55 4E 44 2A 2F 0D 20 20 20 20 2F 2A 45 |AROUND*/. /*E|
000014A0: 58 43 45 50 54 20 46 4F 52 20 46 49 52 53 54 20 |XCEPT FOR FIRST |
000014B0: 4E 4F 54 45 2A 2F 0D 20 20 20 20 49 46 28 21 46 |NOTE*/. IF(!F|
000014C0: 49 52 53 54 4E 4F 54 45 20 26 26 20 28 56 4F 49 |IRSTNOTE && (VOI|
000014D0: 43 45 3C 30 20 DF DF 20 56 4F 49 43 45 3E 32 29 |CE<0 .. VOICE>2)|
000014E0: 29 43 4F 4E 54 49 4E 55 45 3B 0D 0D 20 20 20 20 |)CONTINUE;.. |
000014F0: 2F 2A 43 48 45 43 4B 20 46 4F 52 20 D3 C9 C4 20 |/*CHECK FOR ... |
00001500: 42 55 46 46 45 52 20 46 55 4C 4C 20 46 4F 52 20 |BUFFER FULL FOR |
00001510: 54 48 49 53 20 56 4F 49 43 45 2A 2F 0D 20 20 20 |THIS VOICE*/. |
00001520: 20 49 46 28 21 46 49 52 53 54 4E 4F 54 45 29 0D | IF(!FIRSTNOTE).|
00001530: 20 20 20 20 20 20 DB 0D 20 20 20 20 20 20 49 46 | .. IF|
00001540: 28 53 49 44 50 54 52 5B 56 4F 49 43 45 5D 2D 53 |(SIDPTR[VOICE]-S|
00001550: 49 44 42 55 46 5B 56 4F 49 43 45 5D 3E 4C 49 4D |IDBUF[VOICE]>LIM|
00001560: 49 54 29 0D 20 20 20 20 20 20 20 20 DB 0D 20 20 |IT). .. |
00001570: 20 20 20 20 20 20 2F 2A 46 55 4C 4C 20 2D 20 43 | /*FULL - C|
00001580: 41 4E 4E 4F 54 20 50 52 4F 43 45 53 53 20 54 48 |ANNOT PROCESS TH|
00001590: 49 53 20 45 56 45 4E 54 2A 2F 0D 20 20 20 20 20 |IS EVENT*/. |
000015A0: 20 20 20 50 52 49 4E 54 46 28 22 D3 C9 C4 20 42 | PRINTF("... B|
000015B0: 55 46 46 45 52 20 4F 56 45 52 46 4C 4F 57 21 5C |UFFER OVERFLOW!\|
000015C0: 4E 5C 4E 22 29 3B 0D 20 20 20 20 20 20 20 20 46 |N\N");. F|
000015D0: 43 4C 4F 53 45 28 4D 49 44 49 46 49 4C 45 29 3B |CLOSE(MIDIFILE);|
000015E0: 0D 20 20 20 20 20 20 20 20 52 45 54 55 52 4E 3B |. RETURN;|
000015F0: 0D 20 20 20 20 20 20 20 20 DD 0D 20 20 20 20 20 |. .. |
00001600: 20 DD 0D 0D 20 20 20 20 2F 2A 43 48 45 43 4B 20 | ... /*CHECK |
00001610: 46 4F 52 20 4E 4F 54 45 2D 4F 4E 20 4F 52 20 4E |FOR NOTE-ON OR N|
00001620: 4F 54 45 2D 4F 46 46 2A 2F 0D 20 20 20 20 49 46 |OTE-OFF*/. IF|
00001630: 28 28 43 31 26 30 58 38 30 29 3D 3D 30 29 0D 20 |((C1&0X80)==0). |
00001640: 20 20 20 20 20 DB 0D 20 20 20 20 20 20 49 4E 54 | .. INT|
00001650: 20 4F 4E 54 45 4D 50 3B 0D 0D 20 20 20 20 20 20 | ONTEMP;.. |
00001660: 2F 2A 54 48 49 53 20 49 53 20 4E 4F 54 45 2D 4F |/*THIS IS NOTE-O|
00001670: 4E 2C 20 49 53 4F 4C 41 54 45 20 54 49 4D 45 2A |N, ISOLATE TIME*|
00001680: 2F 0D 20 20 20 20 20 20 4F 4E 54 45 4D 50 3D 28 |/. ONTEMP=(|
00001690: 28 43 31 26 30 58 46 29 3C 3C 38 29 DF 43 32 3B |(C1&0XF)<<8).C2;|
000016A0: 0D 20 20 20 20 20 20 49 46 28 56 4F 49 43 45 3E |. IF(VOICE>|
000016B0: 3D 30 20 26 26 20 56 4F 49 43 45 3C 3D 32 29 4F |=0 && VOICE<=2)O|
000016C0: 4E 54 49 4D 45 5B 56 4F 49 43 45 5D 3D 4F 4E 54 |NTIME[VOICE]=ONT|
000016D0: 45 4D 50 3B 0D 0D 20 20 20 20 20 20 2F 2A 53 50 |EMP;.. /*SP|
000016E0: 45 43 49 41 4C 20 50 52 4F 43 45 53 53 49 4E 47 |ECIAL PROCESSING|
000016F0: 20 46 4F 52 20 46 49 52 53 54 20 4E 4F 54 45 2A | FOR FIRST NOTE*|
00001700: 2F 0D 20 20 20 20 20 20 49 46 28 46 49 52 53 54 |/. IF(FIRST|
00001710: 4E 4F 54 45 29 0D 20 20 20 20 20 20 20 20 DB 0D |NOTE). ..|
00001720: 20 20 20 20 20 20 20 20 46 49 52 53 54 4E 4F 54 | FIRSTNOT|
00001730: 45 3D 30 3B 0D 0D 20 20 20 20 20 20 20 20 2F 2A |E=0;.. /*|
00001740: 41 4C 4C 20 4F 54 48 45 52 20 56 4F 49 43 45 53 |ALL OTHER VOICES|
00001750: 20 4E 45 45 44 20 41 20 52 45 53 54 20 49 4E 53 | NEED A REST INS|
00001760: 45 52 54 45 44 20 41 54 20 42 45 47 49 4E 4E 49 |ERTED AT BEGINNI|
00001770: 4E 47 2A 2F 0D 20 20 20 20 20 20 20 20 46 4F 52 |NG*/. FOR|
00001780: 28 49 3D 30 3B 49 3C 4E 56 4F 49 43 45 53 3B 49 |(I=0;I<NVOICES;I|
00001790: 2B 2B 29 0D 20 20 20 20 20 20 20 20 20 20 DB 0D |++). ..|
000017A0: 20 20 20 20 20 20 20 20 20 20 49 46 28 49 20 21 | IF(I !|
000017B0: 3D 20 56 4F 49 43 45 29 0D 20 20 20 20 20 20 20 |= VOICE). |
000017C0: 20 20 20 20 20 DB 0D 20 20 20 20 20 20 20 20 20 | .. |
000017D0: 20 20 20 2F 2A 49 4E 53 45 52 54 20 52 45 53 54 | /*INSERT REST|
000017E0: 20 57 48 49 43 48 20 42 45 47 49 4E 53 20 41 54 | WHICH BEGINS AT|
000017F0: 20 42 45 47 49 4E 4E 49 4E 47 20 4F 46 20 53 4F | BEGINNING OF SO|
00001800: 4E 47 2A 2F 0D 20 20 20 20 20 20 20 20 20 20 20 |NG*/. |
00001810: 20 4F 46 46 54 49 4D 45 5B 49 5D 3D 4F 4E 54 45 | OFFTIME[I]=ONTE|
00001820: 4D 50 3B 0D 20 20 20 20 20 20 20 20 20 20 20 20 |MP;. |
00001830: 2A 53 49 44 50 54 52 5B 49 5D 2B 2B 20 3D 20 30 |*SIDPTR[I]++ = 0|
00001840: 58 46 36 3B 0D 20 20 20 20 20 20 20 20 20 20 20 |XF6;. |
00001850: 20 53 49 44 50 54 52 5B 49 5D 2B 2B 3B 20 2F 2A | SIDPTR[I]++; /*|
00001860: 44 55 52 41 54 49 4F 4E 20 54 4F 20 42 45 20 44 |DURATION TO BE D|
00001870: 45 54 45 52 4D 49 4E 45 44 20 4C 41 54 45 52 2A |ETERMINED LATER*|
00001880: 2F 0D 20 20 20 20 20 20 20 20 20 20 20 20 2A 53 |/. *S|
00001890: 49 44 50 54 52 5B 49 5D 2B 2B 20 3D 20 30 58 32 |IDPTR[I]++ = 0X2|
000018A0: 34 3B 0D 20 20 20 20 20 20 20 20 20 20 20 20 2A |4;. *|
000018B0: 53 49 44 50 54 52 5B 49 5D 2B 2B 20 3D 20 D2 C5 |SIDPTR[I]++ = ..|
000018C0: D3 D4 3B 0D 20 20 20 20 20 20 20 20 20 20 20 20 |..;. |
000018D0: DD 0D 20 20 20 20 20 20 20 20 20 20 DD 0D 0D 20 |.. ... |
000018E0: 20 20 20 20 20 20 20 2F 2A 4E 4F 57 20 53 4B 49 | /*NOW SKI|
000018F0: 50 20 52 45 53 54 20 4F 46 20 50 52 4F 43 45 53 |P REST OF PROCES|
00001900: 53 49 4E 47 20 46 4F 52 20 56 4F 49 43 45 53 20 |SING FOR VOICES |
00001910: 4E 4F 54 20 46 4F 52 20 54 48 49 53 20 47 4F 20 |NOT FOR THIS GO |
00001920: 41 52 4F 55 4E 44 2A 2F 0D 20 20 20 20 20 20 20 |AROUND*/. |
00001930: 20 49 46 28 56 4F 49 43 45 3C 30 20 DF DF 20 56 | IF(VOICE<0 .. V|
00001940: 4F 49 43 45 3E 32 29 43 4F 4E 54 49 4E 55 45 3B |OICE>2)CONTINUE;|
00001950: 0D 0D 20 20 20 20 20 20 20 20 2F 2A 45 4E 44 20 |.. /*END |
00001960: 53 50 45 43 49 41 4C 20 50 52 4F 43 45 53 53 49 |SPECIAL PROCESSI|
00001970: 4E 47 20 46 4F 52 20 46 49 52 53 54 20 4E 4F 54 |NG FOR FIRST NOT|
00001980: 45 2A 2F 0D 20 20 20 20 20 20 20 20 DD 0D 0D 20 |E*/. ... |
00001990: 20 20 20 20 20 2F 2A 49 46 20 54 48 49 53 20 49 | /*IF THIS I|
000019A0: 53 20 4E 4F 54 20 46 49 52 53 54 20 45 4E 54 52 |S NOT FIRST ENTR|
000019B0: 59 20 46 4F 52 20 54 48 49 53 20 56 4F 49 43 45 |Y FOR THIS VOICE|
000019C0: 2A 2F 0D 20 20 20 20 20 20 49 46 28 53 49 44 50 |*/. IF(SIDP|
000019D0: 54 52 5B 56 4F 49 43 45 5D 21 3D 20 26 53 49 44 |TR[VOICE]!= &SID|
000019E0: 42 55 46 5B 56 4F 49 43 45 5D 5B 30 5D 29 0D 20 |BUF[VOICE][0]). |
000019F0: 20 20 20 20 20 20 20 DB 0D 20 20 20 20 20 20 20 | .. |
00001A00: 20 2F 2A 46 49 4C 4C 20 49 4E 20 44 55 52 41 54 | /*FILL IN DURAT|
00001A10: 49 4F 4E 20 4F 46 20 50 52 45 56 49 4F 55 53 20 |ION OF PREVIOUS |
00001A20: 52 45 53 54 2A 2F 0D 20 20 20 20 20 20 20 20 44 |REST*/. D|
00001A30: 55 52 41 54 49 4F 4E 3D 4F 4E 54 49 4D 45 5B 56 |URATION=ONTIME[V|
00001A40: 4F 49 43 45 5D 2D 4F 46 46 54 49 4D 45 5B 56 4F |OICE]-OFFTIME[VO|
00001A50: 49 43 45 5D 3B 0D 20 20 20 20 20 20 20 20 49 46 |ICE];. IF|
00001A60: 28 44 55 52 41 54 49 4F 4E 3C 30 29 44 55 52 41 |(DURATION<0)DURA|
00001A70: 54 49 4F 4E 2B 3D 30 58 31 30 30 30 3B 20 2F 2A |TION+=0X1000; /*|
00001A80: 48 41 4E 44 4C 45 20 31 32 20 42 49 54 20 43 4C |HANDLE 12 BIT CL|
00001A90: 4F 43 4B 20 57 52 41 50 41 52 4F 55 4E 44 2A 2F |OCK WRAPAROUND*/|
00001AA0: 0D 0D 20 20 20 20 20 20 20 20 2F 2A 46 4F 52 20 |.. /*FOR |
00001AB0: 44 55 52 41 54 49 4F 4E 20 3E 20 32 35 35 2C 20 |DURATION > 255, |
00001AC0: 49 4E 53 45 52 54 20 4D 55 4C 54 49 50 4C 45 20 |INSERT MULTIPLE |
00001AD0: 52 45 53 54 53 20 54 4F 20 4D 41 4B 45 20 4F 4E |RESTS TO MAKE ON|
00001AE0: 45 20 4C 4F 4E 47 20 52 45 53 54 2A 2F 0D 20 20 |E LONG REST*/. |
00001AF0: 20 20 20 20 20 20 57 48 49 4C 45 28 44 55 52 41 | WHILE(DURA|
00001B00: 54 49 4F 4E 3E 32 35 35 29 0D 20 20 20 20 20 20 |TION>255). |
00001B10: 20 20 20 20 DB 0D 20 20 20 20 20 20 20 20 20 20 | .. |
00001B20: 2A 28 53 49 44 50 54 52 5B 56 4F 49 43 45 5D 2D |*(SIDPTR[VOICE]-|
00001B30: 33 29 3D 32 35 35 3B 20 2F 2A 44 55 52 41 54 49 |3)=255; /*DURATI|
00001B40: 4F 4E 20 4F 46 20 50 52 45 56 49 4F 55 53 20 52 |ON OF PREVIOUS R|
00001B50: 45 53 54 20 32 35 35 2A 2F 0D 20 20 20 20 20 20 |EST 255*/. |
00001B60: 20 20 20 20 2A 53 49 44 50 54 52 5B 56 4F 49 43 | *SIDPTR[VOIC|
00001B70: 45 5D 2B 2B 3D 30 58 46 36 3B 20 2F 2A 49 4E 53 |E]++=0XF6; /*INS|
00001B80: 45 52 54 20 4E 45 57 20 52 45 53 54 2A 2F 0D 20 |ERT NEW REST*/. |
00001B90: 20 20 20 20 20 20 20 20 20 53 49 44 50 54 52 5B | SIDPTR[|
00001BA0: 56 4F 49 43 45 5D 2B 2B 3B 20 2F 2A 44 55 52 41 |VOICE]++; /*DURA|
00001BB0: 54 49 4F 4E 20 54 4F 20 42 45 20 44 45 54 45 52 |TION TO BE DETER|
00001BC0: 4D 49 4E 45 44 20 4C 41 54 45 52 2A 2F 0D 20 20 |MINED LATER*/. |
00001BD0: 20 20 20 20 20 20 20 20 2A 53 49 44 50 54 52 5B | *SIDPTR[|
00001BE0: 56 4F 49 43 45 5D 2B 2B 3D 30 58 32 34 3B 0D 20 |VOICE]++=0X24;. |
00001BF0: 20 20 20 20 20 20 20 20 20 2A 53 49 44 50 54 52 | *SIDPTR|
00001C00: 5B 56 4F 49 43 45 5D 2B 2B 3D D2 C5 D3 D4 3B 0D |[VOICE]++=....;.|
00001C10: 20 20 20 20 20 20 20 20 20 20 44 55 52 41 54 49 | DURATI|
00001C20: 4F 4E 20 2D 3D 20 32 35 35 3B 0D 20 20 20 20 20 |ON -= 255;. |
00001C30: 20 20 20 20 20 DD 0D 0D 20 20 20 20 20 20 20 20 | ... |
00001C40: 2F 2A 48 41 4E 44 4C 45 20 5A 45 52 4F 20 44 55 |/*HANDLE ZERO DU|
00001C50: 52 41 54 49 4F 4E 20 43 41 53 45 2A 2F 0D 20 20 |RATION CASE*/. |
00001C60: 20 20 20 20 20 20 49 46 28 44 55 52 41 54 49 4F | IF(DURATIO|
00001C70: 4E 3D 3D 30 29 0D 20 20 20 20 20 20 20 20 20 20 |N==0). |
00001C80: DB 0D 20 20 20 20 20 20 20 20 20 20 2F 2A 5A 45 |.. /*ZE|
00001C90: 52 4F 20 44 55 52 41 54 49 4F 4E 20 2D 20 55 4E |RO DURATION - UN|
00001CA0: 49 4E 53 45 52 54 20 4C 41 53 54 20 52 45 53 54 |INSERT LAST REST|
00001CB0: 2A 2F 0D 20 20 20 20 20 20 20 20 20 20 53 49 44 |*/. SID|
00001CC0: 50 54 52 5B 56 4F 49 43 45 5D 2D 3D 34 3B 0D 20 |PTR[VOICE]-=4;. |
00001CD0: 20 20 20 20 20 20 20 20 20 DD 0D 20 20 20 20 20 | .. |
00001CE0: 20 20 20 45 4C 53 45 0D 20 20 20 20 20 20 20 20 | ELSE. |
00001CF0: 20 20 DB 0D 20 20 20 20 20 20 20 20 20 20 2F 2A | .. /*|
00001D00: 4E 4F 54 20 5A 45 52 4F 20 44 55 52 41 54 49 4F |NOT ZERO DURATIO|
00001D10: 4E 20 2D 20 46 49 4C 4C 20 49 4E 20 4C 41 53 54 |N - FILL IN LAST|
00001D20: 20 52 45 53 54 2A 2F 0D 20 20 20 20 20 20 20 20 | REST*/. |
00001D30: 20 20 2A 28 53 49 44 50 54 52 5B 56 4F 49 43 45 | *(SIDPTR[VOICE|
00001D40: 5D 2D 33 29 3D 44 55 52 41 54 49 4F 4E 3B 0D 20 |]-3)=DURATION;. |
00001D50: 20 20 20 20 20 20 20 20 20 DD 0D 20 20 20 20 20 | .. |
00001D60: 20 20 20 DD 0D 0D 20 20 20 20 20 20 2F 2A 4E 4F | ... /*NO|
00001D70: 57 20 41 43 54 55 41 4C 4C 59 20 49 4E 53 45 52 |W ACTUALLY INSER|
00001D80: 54 20 D3 C9 C4 20 4E 4F 54 45 20 45 56 45 4E 54 |T ... NOTE EVENT|
00001D90: 2A 2F 0D 20 20 20 20 20 20 2A 53 49 44 50 54 52 |*/. *SIDPTR|
00001DA0: 5B 56 4F 49 43 45 5D 2B 2B 20 3D 20 30 58 46 36 |[VOICE]++ = 0XF6|
00001DB0: 3B 0D 20 20 20 20 20 20 53 49 44 50 54 52 5B 56 |;. SIDPTR[V|
00001DC0: 4F 49 43 45 5D 2B 2B 3B 20 2F 2A 44 55 52 41 54 |OICE]++; /*DURAT|
00001DD0: 49 4F 4E 20 54 4F 20 42 45 20 44 45 54 45 52 4D |ION TO BE DETERM|
00001DE0: 49 4E 45 44 20 4C 41 54 45 52 2A 2F 0D 20 20 20 |INED LATER*/. |
00001DF0: 20 20 20 2A 53 49 44 50 54 52 5B 56 4F 49 43 45 | *SIDPTR[VOICE|
00001E00: 5D 2B 2B 20 3D 20 30 58 32 34 3B 0D 20 20 20 20 |]++ = 0X24;. |
00001E10: 20 20 4F 4C 44 4E 4F 54 45 5B 56 4F 49 43 45 5D | OLDNOTE[VOICE]|
00001E20: 20 3D 20 4D 49 44 49 54 4F 53 49 44 5B 43 33 5D | = MIDITOSID[C3]|
00001E30: 3B 0D 20 20 20 20 20 20 2A 53 49 44 50 54 52 5B |;. *SIDPTR[|
00001E40: 56 4F 49 43 45 5D 2B 2B 20 3D 20 4F 4C 44 4E 4F |VOICE]++ = OLDNO|
00001E50: 54 45 5B 56 4F 49 43 45 5D 3B 0D 0D 20 20 20 20 |TE[VOICE];.. |
00001E60: 20 20 2F 2A 45 4E 44 20 4F 46 20 50 52 4F 43 45 | /*END OF PROCE|
00001E70: 53 53 49 4E 47 20 46 4F 52 20 4E 4F 54 45 2D 4F |SSING FOR NOTE-O|
00001E80: 4E 20 45 56 45 4E 54 2A 2F 0D 20 20 20 20 20 20 |N EVENT*/. |
00001E90: DD 0D 20 20 20 20 45 4C 53 45 0D 20 20 20 20 20 |.. ELSE. |
00001EA0: 20 DB 0D 20 20 20 20 20 20 2F 2A 4E 4F 54 45 2D | .. /*NOTE-|
00001EB0: 4F 46 46 20 45 56 45 4E 54 20 2D 20 49 47 4E 4F |OFF EVENT - IGNO|
00001EC0: 52 45 20 4E 4F 54 45 20 41 4C 52 45 41 44 59 20 |RE NOTE ALREADY |
00001ED0: 4F 4E 20 41 54 20 42 45 47 49 4E 4E 49 4E 47 2A |ON AT BEGINNING*|
00001EE0: 2F 0D 20 20 20 20 20 20 49 46 28 46 49 52 53 54 |/. IF(FIRST|
00001EF0: 4E 4F 54 45 29 43 4F 4E 54 49 4E 55 45 3B 0D 0D |NOTE)CONTINUE;..|
00001F00: 20 20 20 20 20 20 2F 2A 49 53 4F 4C 41 54 45 20 | /*ISOLATE |
00001F10: 54 49 4D 45 2A 2F 0D 20 20 20 20 20 20 4F 46 46 |TIME*/. OFF|
00001F20: 54 49 4D 45 5B 56 4F 49 43 45 5D 3D 28 28 43 31 |TIME[VOICE]=((C1|
00001F30: 26 30 58 46 29 3C 3C 38 29 DF 43 32 3B 0D 0D 20 |&0XF)<<8).C2;.. |
00001F40: 20 20 20 20 20 2F 2A 43 4F 4D 50 55 54 45 20 44 | /*COMPUTE D|
00001F50: 55 52 41 54 49 4F 4E 20 4F 46 20 50 52 45 56 49 |URATION OF PREVI|
00001F60: 4F 55 53 20 4E 4F 54 45 2A 2F 0D 20 20 20 20 20 |OUS NOTE*/. |
00001F70: 20 44 55 52 41 54 49 4F 4E 3D 4F 46 46 54 49 4D | DURATION=OFFTIM|
00001F80: 45 5B 56 4F 49 43 45 5D 2D 4F 4E 54 49 4D 45 5B |E[VOICE]-ONTIME[|
00001F90: 56 4F 49 43 45 5D 3B 0D 0D 20 20 20 20 20 20 2F |VOICE];.. /|
00001FA0: 2A 48 41 4E 44 4C 45 20 57 52 41 50 41 52 4F 55 |*HANDLE WRAPAROU|
00001FB0: 4E 44 20 4F 46 20 31 32 20 42 49 54 20 43 4C 4F |ND OF 12 BIT CLO|
00001FC0: 43 4B 2A 2F 0D 20 20 20 20 20 20 49 46 28 44 55 |CK*/. IF(DU|
00001FD0: 52 41 54 49 4F 4E 3C 30 29 44 55 52 41 54 49 4F |RATION<0)DURATIO|
00001FE0: 4E 2B 3D 30 58 31 30 30 30 3B 0D 0D 20 20 20 20 |N+=0X1000;.. |
00001FF0: 20 20 2F 2A 46 4F 52 20 44 55 52 41 54 49 4F 4E | /*FOR DURATION|
00002000: 20 3E 20 32 35 35 2C 20 49 4E 53 45 52 54 20 4D | > 255, INSERT M|
00002010: 55 4C 54 49 50 4C 45 20 4E 4F 54 45 53 20 54 4F |ULTIPLE NOTES TO|
00002020: 20 4D 41 4B 45 20 4F 4E 45 20 4C 4F 4E 47 20 4E | MAKE ONE LONG N|
00002030: 4F 54 45 2A 2F 0D 20 20 20 20 20 20 57 48 49 4C |OTE*/. WHIL|
00002040: 45 28 44 55 52 41 54 49 4F 4E 3E 32 35 35 29 0D |E(DURATION>255).|
00002050: 20 20 20 20 20 20 20 20 DB 0D 20 20 20 20 20 20 | .. |
00002060: 20 20 2A 28 53 49 44 50 54 52 5B 56 4F 49 43 45 | *(SIDPTR[VOICE|
00002070: 5D 2D 32 29 3D 30 58 36 34 3B 20 2F 2A 50 52 45 |]-2)=0X64; /*PRE|
00002080: 56 49 4F 55 53 20 4E 4F 54 45 20 54 49 45 44 20 |VIOUS NOTE TIED |
00002090: 54 4F 20 4E 45 58 54 2A 2F 0D 20 20 20 20 20 20 |TO NEXT*/. |
000020A0: 20 20 2A 28 53 49 44 50 54 52 5B 56 4F 49 43 45 | *(SIDPTR[VOICE|
000020B0: 5D 2D 33 29 3D 32 35 35 3B 20 2F 2A 50 52 45 56 |]-3)=255; /*PREV|
000020C0: 49 4F 55 53 20 4E 4F 54 45 20 44 55 52 41 54 49 |IOUS NOTE DURATI|
000020D0: 4F 4E 20 32 35 35 2A 2F 0D 20 20 20 20 20 20 20 |ON 255*/. |
000020E0: 20 2A 53 49 44 50 54 52 5B 56 4F 49 43 45 5D 2B | *SIDPTR[VOICE]+|
000020F0: 2B 3D 30 58 46 36 3B 20 2F 2A 49 4E 53 45 52 54 |+=0XF6; /*INSERT|
00002100: 20 41 4E 4F 54 48 45 52 20 4F 46 20 53 41 4D 45 | ANOTHER OF SAME|
00002110: 20 4E 4F 54 45 2A 2F 0D 20 20 20 20 20 20 20 20 | NOTE*/. |
00002120: 53 49 44 50 54 52 5B 56 4F 49 43 45 5D 2B 2B 3B |SIDPTR[VOICE]++;|
00002130: 20 2F 2A 44 55 52 41 54 49 4F 4E 20 54 4F 20 42 | /*DURATION TO B|
00002140: 45 20 44 45 54 45 52 4D 49 4E 45 44 20 4C 41 54 |E DETERMINED LAT|
00002150: 45 52 2A 2F 0D 20 20 20 20 20 20 20 20 2A 53 49 |ER*/. *SI|
00002160: 44 50 54 52 5B 56 4F 49 43 45 5D 2B 2B 3D 30 58 |DPTR[VOICE]++=0X|
00002170: 32 34 3B 0D 20 20 20 20 20 20 20 20 2A 53 49 44 |24;. *SID|
00002180: 50 54 52 5B 56 4F 49 43 45 5D 2B 2B 3D 4F 4C 44 |PTR[VOICE]++=OLD|
00002190: 4E 4F 54 45 5B 56 4F 49 43 45 5D 3B 0D 20 20 20 |NOTE[VOICE];. |
000021A0: 20 20 20 20 20 44 55 52 41 54 49 4F 4E 20 2D 3D | DURATION -=|
000021B0: 20 32 35 35 3B 0D 20 20 20 20 20 20 20 20 DD 0D | 255;. ..|
000021C0: 0D 20 20 20 20 20 20 2F 2A 48 41 4E 44 4C 45 20 |. /*HANDLE |
000021D0: 5A 45 52 4F 20 44 55 52 41 54 49 4F 4E 20 43 41 |ZERO DURATION CA|
000021E0: 53 45 2A 2F 0D 20 20 20 20 20 20 49 46 28 44 55 |SE*/. IF(DU|
000021F0: 52 41 54 49 4F 4E 3D 3D 30 29 0D 20 20 20 20 20 |RATION==0). |
00002200: 20 20 20 DB 0D 20 20 20 20 20 20 20 20 2F 2A 5A | .. /*Z|
00002210: 45 52 4F 20 44 55 52 41 54 49 4F 4E 20 2D 20 55 |ERO DURATION - U|
00002220: 4E 49 4E 53 45 52 54 20 4E 4F 54 45 2A 2F 0D 20 |NINSERT NOTE*/. |
00002230: 20 20 20 20 20 20 20 53 49 44 50 54 52 5B 56 4F | SIDPTR[VO|
00002240: 49 43 45 5D 2D 3D 34 3B 0D 20 20 20 20 20 20 20 |ICE]-=4;. |
00002250: 20 DD 0D 20 20 20 20 20 20 45 4C 53 45 0D 20 20 | .. ELSE. |
00002260: 20 20 20 20 20 20 DB 0D 20 20 20 20 20 20 20 20 | .. |
00002270: 2F 2A 4E 4F 54 20 5A 45 52 4F 20 44 55 52 41 54 |/*NOT ZERO DURAT|
00002280: 49 4F 4E 20 2D 20 46 49 4C 4C 20 49 4E 20 44 55 |ION - FILL IN DU|
00002290: 52 41 54 49 4F 4E 20 4F 46 20 4C 41 53 54 20 4E |RATION OF LAST N|
000022A0: 4F 54 45 2A 2F 0D 20 20 20 20 20 20 20 20 2A 28 |OTE*/. *(|
000022B0: 53 49 44 50 54 52 5B 56 4F 49 43 45 5D 2D 33 29 |SIDPTR[VOICE]-3)|
000022C0: 3D 44 55 52 41 54 49 4F 4E 3B 0D 20 20 20 20 20 |=DURATION;. |
000022D0: 20 20 20 DD 0D 0D 20 20 20 20 20 20 2F 2A 4E 4F | ... /*NO|
000022E0: 57 20 41 43 54 55 41 4C 4C 59 20 49 4E 53 45 52 |W ACTUALLY INSER|
000022F0: 54 20 41 20 52 45 53 54 2A 2F 0D 20 20 20 20 20 |T A REST*/. |
00002300: 20 2A 53 49 44 50 54 52 5B 56 4F 49 43 45 5D 2B | *SIDPTR[VOICE]+|
00002310: 2B 20 3D 20 30 58 46 36 3B 0D 20 20 20 20 20 20 |+ = 0XF6;. |
00002320: 53 49 44 50 54 52 5B 56 4F 49 43 45 5D 2B 2B 3B |SIDPTR[VOICE]++;|
00002330: 20 2F 2A 44 55 52 41 54 49 4F 4E 20 54 4F 20 42 | /*DURATION TO B|
00002340: 45 20 44 45 54 45 52 4D 49 4E 45 44 20 4C 41 54 |E DETERMINED LAT|
00002350: 45 52 2A 2F 0D 20 20 20 20 20 20 2A 53 49 44 50 |ER*/. *SIDP|
00002360: 54 52 5B 56 4F 49 43 45 5D 2B 2B 20 3D 20 30 58 |TR[VOICE]++ = 0X|
00002370: 32 34 3B 0D 20 20 20 20 20 20 2A 53 49 44 50 54 |24;. *SIDPT|
00002380: 52 5B 56 4F 49 43 45 5D 2B 2B 20 3D 20 D2 C5 D3 |R[VOICE]++ = ...|
00002390: D4 3B 0D 0D 20 20 20 20 20 20 2F 2A 45 4E 44 20 |.;.. /*END |
000023A0: 50 52 4F 43 45 53 53 49 4E 47 20 46 4F 52 20 4E |PROCESSING FOR N|
000023B0: 4F 54 45 2D 4F 46 46 20 45 56 45 4E 54 2A 2F 0D |OTE-OFF EVENT*/.|
000023C0: 20 20 20 20 20 20 DD 0D 20 20 20 20 2F 2A 45 4E | .. /*EN|
000023D0: 44 20 4F 46 20 4C 4F 4F 50 20 54 4F 20 C5 CF C6 |D OF LOOP TO ...|
000023E0: 2A 2F 0D 20 20 20 20 DD 0D 0D 20 20 2F 2A 41 4C |*/. ... /*AL|
000023F0: 4C 20 50 52 4F 43 45 53 53 45 44 20 2D 20 43 4C |L PROCESSED - CL|
00002400: 4F 53 45 20 46 49 4C 45 2A 2F 0D 20 20 46 43 4C |OSE FILE*/. FCL|
00002410: 4F 53 45 28 4D 49 44 49 46 49 4C 45 29 3B 0D 0D |OSE(MIDIFILE);..|
00002420: 20 20 2F 2A 46 49 4C 4C 20 49 4E 20 44 55 52 41 | /*FILL IN DURA|
00002430: 54 49 4F 4E 20 4F 46 20 46 49 4E 41 4C 20 52 45 |TION OF FINAL RE|
00002440: 53 54 20 46 4F 52 20 41 4C 4C 20 56 4F 49 43 45 |ST FOR ALL VOICE|
00002450: 53 20 54 48 41 54 20 48 41 56 45 20 41 4E 59 20 |S THAT HAVE ANY |
00002460: 44 41 54 41 2A 2F 0D 20 20 46 4F 52 28 49 3D 30 |DATA*/. FOR(I=0|
00002470: 3B 49 3C 4E 56 4F 49 43 45 53 3B 49 2B 2B 29 0D |;I<NVOICES;I++).|
00002480: 20 20 20 20 DB 0D 20 20 20 20 49 46 28 53 49 44 | .. IF(SID|
00002490: 50 54 52 5B 49 5D 21 3D 26 53 49 44 42 55 46 5B |PTR[I]!=&SIDBUF[|
000024A0: 49 5D 5B 30 5D 29 0D 20 20 20 20 20 20 DB 0D 20 |I][0]). .. |
000024B0: 20 20 20 20 20 2A 28 53 49 44 50 54 52 5B 49 5D | *(SIDPTR[I]|
000024C0: 2D 33 29 3D 36 30 3B 0D 20 20 20 20 20 20 DD 0D |-3)=60;. ..|
000024D0: 20 20 20 20 DD 0D 0D 20 20 2F 2A 46 4F 52 4D 20 | ... /*FORM |
000024E0: 4E 41 4D 45 20 4F 46 20 2E 4D 55 53 2F 2E 53 54 |NAME OF .MUS/.ST|
000024F0: 52 20 46 49 4C 45 20 41 4E 44 20 4F 50 45 4E 20 |R FILE AND OPEN |
00002500: 49 54 2A 2F 0D 20 20 49 46 28 4F 46 46 53 45 54 |IT*/. IF(OFFSET|
00002510: 29 0D 20 20 20 20 DB 0D 20 20 20 20 53 50 52 49 |). .. SPRI|
00002520: 4E 54 46 28 53 49 44 4E 41 4D 45 2C 22 25 53 2E |NTF(SIDNAME,"%S.|
00002530: 53 54 52 2C 50 22 2C 4D 49 44 49 4E 41 4D 45 29 |STR,P",MIDINAME)|
00002540: 3B 0D 20 20 20 20 DD 0D 20 20 45 4C 53 45 0D 20 |;. .. ELSE. |
00002550: 20 20 20 DB 0D 20 20 20 20 53 50 52 49 4E 54 46 | .. SPRINTF|
00002560: 28 53 49 44 4E 41 4D 45 2C 22 25 53 2E 4D 55 53 |(SIDNAME,"%S.MUS|
00002570: 2C 50 22 2C 4D 49 44 49 4E 41 4D 45 29 3B 0D 20 |,P",MIDINAME);. |
00002580: 20 20 20 DD 0D 20 20 53 49 44 46 49 4C 45 3D 46 | .. SIDFILE=F|
00002590: 4F 50 45 4E 28 53 49 44 4E 41 4D 45 2C 22 57 22 |OPEN(SIDNAME,"W"|
000025A0: 29 3B 0D 20 20 49 46 28 53 49 44 46 49 4C 45 3D |);. IF(SIDFILE=|
000025B0: 3D CE D5 CC CC 20 DF DF 20 46 45 52 52 4F 52 28 |=.... .. FERROR(|
000025C0: 53 49 44 46 49 4C 45 29 29 0D 20 20 20 20 DB 0D |SIDFILE)). ..|
000025D0: 20 20 20 20 50 52 49 4E 54 46 28 0D 20 20 20 20 | PRINTF(. |
000025E0: 22 C3 41 4E 27 54 20 4F 50 45 4E 20 25 53 20 54 |".AN'T OPEN %S T|
000025F0: 4F 20 57 52 49 54 45 5C 4E 5C 4E 22 2C 53 49 44 |O WRITE\N\N",SID|
00002600: 4E 41 4D 45 29 3B 0D 20 20 20 20 52 45 54 55 52 |NAME);. RETUR|
00002610: 4E 3B 0D 20 20 20 20 DD 0D 20 20 50 52 49 4E 54 |N;. .. PRINT|
00002620: 46 28 22 D7 52 49 54 49 4E 47 20 25 53 2E 2E 2E |F(".RITING %S...|
00002630: 5C 4E 5C 4E 22 2C 53 49 44 4E 41 4D 45 29 3B 0D |\N\N",SIDNAME);.|
00002640: 0D 20 20 2F 2A 57 52 49 54 45 20 54 48 45 20 43 |. /*WRITE THE C|
00002650: 4F 4E 54 45 4E 54 53 20 4F 46 20 54 48 45 20 2E |ONTENTS OF THE .|
00002660: 4D 55 53 2F 2E 53 54 52 20 46 49 4C 45 2A 2F 0D |MUS/.STR FILE*/.|
00002670: 20 20 50 55 54 57 28 30 58 30 36 42 32 2C 53 49 | PUTW(0X06B2,SI|
00002680: 44 46 49 4C 45 29 3B 20 2F 2A D3 C9 C4 20 46 49 |DFILE); /*... FI|
00002690: 4C 45 20 50 53 45 55 44 4F 20 4C 4F 41 44 20 41 |LE PSEUDO LOAD A|
000026A0: 44 44 52 45 53 53 2A 2F 0D 20 20 50 55 54 57 28 |DDRESS*/. PUTW(|
000026B0: 53 49 44 50 54 52 5B 30 5D 2D 26 53 49 44 42 55 |SIDPTR[0]-&SIDBU|
000026C0: 46 5B 30 5D 5B 30 5D 2B 32 30 2C 53 49 44 46 49 |F[0][0]+20,SIDFI|
000026D0: 4C 45 29 3B 20 2F 2A 56 4F 49 43 45 20 31 20 43 |LE); /*VOICE 1 C|
000026E0: 4F 55 4E 54 2A 2F 0D 20 20 50 55 54 57 28 53 49 |OUNT*/. PUTW(SI|
000026F0: 44 50 54 52 5B 31 5D 2D 26 53 49 44 42 55 46 5B |DPTR[1]-&SIDBUF[|
00002700: 31 5D 5B 30 5D 2B 32 30 2C 53 49 44 46 49 4C 45 |1][0]+20,SIDFILE|
00002710: 29 3B 20 2F 2A 56 4F 49 43 45 20 32 20 43 4F 55 |); /*VOICE 2 COU|
00002720: 4E 54 2A 2F 0D 20 20 50 55 54 57 28 53 49 44 50 |NT*/. PUTW(SIDP|
00002730: 54 52 5B 32 5D 2D 26 53 49 44 42 55 46 5B 32 5D |TR[2]-&SIDBUF[2]|
00002740: 5B 30 5D 2B 32 30 2C 53 49 44 46 49 4C 45 29 3B |[0]+20,SIDFILE);|
00002750: 20 2F 2A 56 4F 49 43 45 20 33 20 43 4F 55 4E 54 | /*VOICE 3 COUNT|
00002760: 2A 2F 0D 0D 20 20 2F 2A 56 4F 49 43 45 20 31 2A |*/.. /*VOICE 1*|
00002770: 2F 0D 20 20 46 57 52 49 54 45 28 50 52 45 46 41 |/. FWRITE(PREFA|
00002780: 43 45 2C 31 38 2C 31 2C 53 49 44 46 49 4C 45 29 |CE,18,1,SIDFILE)|
00002790: 3B 20 2F 2A 50 52 45 46 41 43 45 20 45 53 54 41 |; /*PREFACE ESTA|
000027A0: 42 4C 49 53 48 45 53 20 D3 C9 C4 50 4C 41 59 45 |BLISHES ...PLAYE|
000027B0: 52 20 50 41 52 41 4D 45 54 45 52 53 2A 2F 0D 20 |R PARAMETERS*/. |
000027C0: 20 46 57 52 49 54 45 28 26 53 49 44 42 55 46 5B | FWRITE(&SIDBUF[|
000027D0: 30 5D 5B 30 5D 2C 53 49 44 50 54 52 5B 30 5D 2D |0][0],SIDPTR[0]-|
000027E0: 26 53 49 44 42 55 46 5B 30 5D 5B 30 5D 2C 31 2C |&SIDBUF[0][0],1,|
000027F0: 53 49 44 46 49 4C 45 29 3B 20 2F 2A D3 C9 C4 20 |SIDFILE); /*... |
00002800: 42 55 46 46 45 52 20 49 54 53 45 4C 46 2A 2F 0D |BUFFER ITSELF*/.|
00002810: 20 20 50 55 54 57 28 30 58 34 46 30 31 2C 53 49 | PUTW(0X4F01,SI|
00002820: 44 46 49 4C 45 29 3B 20 2F 2A 45 4E 44 20 4F 46 |DFILE); /*END OF|
00002830: 20 56 4F 49 43 45 20 53 45 4E 54 49 4E 45 4C 2A | VOICE SENTINEL*|
00002840: 2F 0D 0D 20 20 2F 2A 56 4F 49 43 45 20 32 2A 2F |/.. /*VOICE 2*/|
00002850: 0D 20 20 46 57 52 49 54 45 28 50 52 45 46 41 43 |. FWRITE(PREFAC|
00002860: 45 2C 31 38 2C 31 2C 53 49 44 46 49 4C 45 29 3B |E,18,1,SIDFILE);|
00002870: 0D 20 20 46 57 52 49 54 45 28 26 53 49 44 42 55 |. FWRITE(&SIDBU|
00002880: 46 5B 31 5D 5B 30 5D 2C 53 49 44 50 54 52 5B 31 |F[1][0],SIDPTR[1|
00002890: 5D 2D 26 53 49 44 42 55 46 5B 31 5D 5B 30 5D 2C |]-&SIDBUF[1][0],|
000028A0: 31 2C 53 49 44 46 49 4C 45 29 3B 0D 20 20 50 55 |1,SIDFILE);. PU|
000028B0: 54 57 28 30 58 34 46 30 31 2C 53 49 44 46 49 4C |TW(0X4F01,SIDFIL|
000028C0: 45 29 3B 0D 0D 20 20 2F 2A 56 4F 49 43 45 20 33 |E);.. /*VOICE 3|
000028D0: 2A 2F 0D 20 20 46 57 52 49 54 45 28 50 52 45 46 |*/. FWRITE(PREF|
000028E0: 41 43 45 2C 31 38 2C 31 2C 53 49 44 46 49 4C 45 |ACE,18,1,SIDFILE|
000028F0: 29 3B 0D 20 20 46 57 52 49 54 45 28 26 53 49 44 |);. FWRITE(&SID|
00002900: 42 55 46 5B 32 5D 5B 30 5D 2C 53 49 44 50 54 52 |BUF[2][0],SIDPTR|
00002910: 5B 32 5D 2D 26 53 49 44 42 55 46 5B 32 5D 5B 30 |[2]-&SIDBUF[2][0|
00002920: 5D 2C 31 2C 53 49 44 46 49 4C 45 29 3B 0D 20 20 |],1,SIDFILE);. |
00002930: 50 55 54 57 28 30 58 34 46 30 31 2C 53 49 44 46 |PUTW(0X4F01,SIDF|
00002940: 49 4C 45 29 3B 0D 0D 20 20 2F 2A 4E 55 4C 4C 20 |ILE);.. /*NULL |
00002950: 54 45 58 54 20 4C 49 4E 45 53 2A 2F 0D 20 20 46 |TEXT LINES*/. F|
00002960: 50 55 54 43 28 30 2C 53 49 44 46 49 4C 45 29 3B |PUTC(0,SIDFILE);|
00002970: 0D 0D 20 20 2F 2A 41 4C 4C 20 57 52 49 54 54 45 |.. /*ALL WRITTE|
00002980: 4E 20 2D 20 43 4C 4F 53 45 20 2E 4D 55 53 20 46 |N - CLOSE .MUS F|
00002990: 49 4C 45 2A 2F 0D 20 20 46 43 4C 4F 53 45 28 53 |ILE*/. FCLOSE(S|
000029A0: 49 44 46 49 4C 45 29 3B 0D 20 20 DD 0D 0D 20 2F |IDFILE);. ... /|
000029B0: 2A 54 48 49 53 20 46 49 4C 45 20 41 4C 4C 20 50 |*THIS FILE ALL P|
000029C0: 52 4F 43 45 53 53 45 44 20 2D 20 52 45 54 55 52 |ROCESSED - RETUR|
000029D0: 4E 2A 2F 0D 20 50 52 49 4E 54 46 28 22 D3 C9 C4 |N*/. PRINTF("...|
000029E0: 20 46 49 4C 45 53 20 43 52 45 41 54 45 44 21 5C | FILES CREATED!\|
000029F0: 4E 5C 4E 22 29 3B 0D 20 DD 0D 0D 2F 2A 54 48 49 |N\N");. .../*THI|
00002A00: 53 20 49 53 20 4A 55 53 54 20 41 20 46 41 53 54 |S IS JUST A FAST|
00002A10: 45 52 20 28 49 2E 45 2E 20 42 55 46 46 45 52 45 |ER (I.E. BUFFERE|
00002A20: 44 29 20 56 45 52 53 49 4F 4E 20 4F 46 20 46 47 |D) VERSION OF FG|
00002A30: 45 54 43 28 29 2A 2F 0D 49 4E 54 20 46 47 45 54 |ETC()*/.INT FGET|
00002A40: 42 59 54 45 28 57 48 49 43 48 46 49 4C 45 29 0D |BYTE(WHICHFILE).|
00002A50: C6 C9 CC C5 20 2A 57 48 49 43 48 46 49 4C 45 3B |.... *WHICHFILE;|
00002A60: 0D 20 20 DB 0D 20 20 53 54 41 54 49 43 20 43 48 |. .. STATIC CH|
00002A70: 41 52 20 42 55 46 46 45 52 5B 32 35 34 5D 3B 0D |AR BUFFER[254];.|
00002A80: 20 20 53 54 41 54 49 43 20 49 4E 54 20 4E 45 58 | STATIC INT NEX|
00002A90: 54 3D 32 35 34 3B 0D 20 20 53 54 41 54 49 43 20 |T=254;. STATIC |
00002AA0: 49 4E 54 20 4C 49 4D 49 54 3D 32 35 34 3B 0D 20 |INT LIMIT=254;. |
00002AB0: 20 49 46 28 4E 45 58 54 3C 4C 49 4D 49 54 29 52 | IF(NEXT<LIMIT)R|
00002AC0: 45 54 55 52 4E 28 42 55 46 46 45 52 5B 4E 45 58 |ETURN(BUFFER[NEX|
00002AD0: 54 2B 2B 5D 29 3B 0D 20 20 49 46 28 4C 49 4D 49 |T++]);. IF(LIMI|
00002AE0: 54 3C 32 35 34 29 0D 20 20 20 20 DB 0D 20 20 20 |T<254). .. |
00002AF0: 20 4E 45 58 54 3D 4C 49 4D 49 54 3D 32 35 34 3B | NEXT=LIMIT=254;|
00002B00: 0D 20 20 20 20 52 45 54 55 52 4E 20 2D 31 3B 0D |. RETURN -1;.|
00002B10: 20 20 20 20 DD 0D 20 20 4C 49 4D 49 54 3D 46 52 | .. LIMIT=FR|
00002B20: 45 41 44 28 42 55 46 46 45 52 2C 31 2C 32 35 34 |EAD(BUFFER,1,254|
00002B30: 2C 57 48 49 43 48 46 49 4C 45 29 3B 0D 20 20 4E |,WHICHFILE);. N|
00002B40: 45 58 54 3D 31 3B 0D 20 20 49 46 28 4C 49 4D 49 |EXT=1;. IF(LIMI|
00002B50: 54 29 52 45 54 55 52 4E 20 2A 42 55 46 46 45 52 |T)RETURN *BUFFER|
00002B60: 3B 0D 20 20 4E 45 58 54 3D 4C 49 4D 49 54 3D 32 |;. NEXT=LIMIT=2|
00002B70: 35 34 3B 0D 20 20 52 45 54 55 52 4E 20 2D 31 3B |54;. RETURN -1;|
00002B80: 0D 20 20 DD 0D |. .. |
/*MIDI TO SID CONVERTER "MIDI-SID-CON"*/
./*CONVERTS MIDI-SID SEQUENCE FILE MADE*
/./*BY MIDI-SID-SEQ INTO NORMAL ENHANCED
*/./*SIDPLAYER FILES (MONO OR STEREO AS
*/./*DICTATED BY SEQUENCE FILE ITSELF.*
/../*VERSION 1.0, BY FRANK PRINDLE, 7 SE
P 89*/./*VERSION 2.0, BY FRANK PRINDLE,
15 FEB 90*/..#INCLUDE <STDIO.H>../*DEFAU
LT TO 6 VOICES UNLESS SEQUENCE FILE HAS
SOME OTHER NUMBER*/.INT NVOICES=6;../*DE
FINE THE SIDPLAYER NOTE CODES*/.#DEFINE
C 1.#DEFINE D 2.#DEFINE E 3.#DEFINE F 4.
#DEFINE G 5.#DEFINE A 6.#DEFINE B 7.#DEF
INE REST 0X98.#DEFINE SHARP 0X40.#DEFINE
FLAT 0XC0.#DEFINE NATURAL 0X80../*SYSTE
M STUFF*/.#DEFINE BACKGROUND (*((CHAR *)
53281)) /*VIC CHIP BACKGROUND COLOR*/.#D
EFINE BORDER (*((CHAR *)53280)) /*VI
C CHIP BORDER COLOR*/.#DEFINE CURRENT.KE
Y (*((CHAR *)197)) /*CURRENT KEYSCAN CO
DE*/.#DEFINE RUN.STOP.KEY 63
/*KEYSCAN CODE FOR RUN/STOP*/.#DEFINE
RESET 64738 /*KERNAL
COLD START ENTRY POINT*/.#DEFINE BLACK.V
ALUE 0 /*COLOR CODE FOR
BLACK*/.#DEFINE CLEAR 147
/*CHARACTER CODE FOR CLEAR SCREEN*
/.#DEFINE CYAN 159
/*CHARACTER CODE FOR CYAN*/.#DEFINE LOWE
R 14 /*CHARACTER CO
DE FOR LOWER CASE*/.#DEFINE UP 145
/*CHARACTER CODE FOR C
URSOR UP*/.#DEFINE LEFT 157
/*CHARACTER CODE FOR CURSOR LEF
T*/..CHAR *SIDPTR[3];
/*RUNNING POINTERS INTO 6 SID BUFFERS
*/.CHAR SIDBUF[3][10000];
/*SPACE FOR 6 SID BUFFERS*/.CHAR MIDIT
OSID[128]; /*SID NOTE C
ODES FOR EACH MIDI NOTE*/.INT ONTIME[3];
/*MOST RECENT ON
TIME FOR EACH VOICE*/.INT OFFTIME[3];
/*MOST RECENT OFF T
IME FOR EACH VOICE*/.CHAR OLDNOTE[3];
/*MIDI NOTE THAT IS N
OW ON*/.CHAR MIDINAME[30]="MIDISEQ1";
/*DEFAULT FIRST FILE NAME TO PROCE
SS*/.CHAR SIDNAME[19];
/*SID FILE NAMES BUILT HERE*/.CHAR PR
EFACE[18]= /*SID COD
ES TO GO AT START OF EACH VOICE*/. ..
0X01, 0XCE,. 0X01, 0X4B,. 0X01, 0X87,.
0X52, 0XDC,. 0X01, 0X04,. 0X01, 0XB0
,. 0X01, 0X8C,. 0X01, 0X98,. 0X26, 0X
01. .;../*BEGIN PROGRAM*/.MAIN(). ..
/*LOOP FOR MANY FILES*/. FOR(;;). ..
/*DO ONE FILE*/. MAIN2();.. /*
SEE IF MORE FILES*/. PRINTF("CONVERT
ANOTHER FILE? N%C",LEFT);. GETS(SIDNA
ME);. IF(SIDNAME[0]!='Y'). ..
/*NO MORE FILES, COLD START C64*/.
SYS(RESET);. ... /*MORE FILES
- BUMP DEFAULT NAME UP BY 1*/. MIDIN
AME[STRLEN(MIDINAME)-1]++;. .. .../*
REAL WORK DONE HERE FOR ONE FILE*/.MAIN2
(). .. INT I;. INT OCTAVE;. INT C1,C2,C3
,VOICE,DURATION,OFFSET;. FILE *SIDFILE;.
FILE *MIDIFILE;. INT FIRSTNOTE;. CHAR N
ONAME=1;. INT LIMIT=9992;.. /*PROMPT FOR
FILE NAME*/. BACKGROUND=BLACK.VALUE;. B
ORDER=BLACK.VALUE;. WHILE(NONAME). ..
PRINTF("%C\N%C%C MIDI-TO-SID C
ONVERTER\N",. CLEAR,CYAN,LOWER);. P
RINTF(" V2.0 BY FRANK PRINDLE\N\
N");. PRINTF("ENTER MIDI SEQ FILE NAME
: ");. I = *MIDINAME;. GETS(MIDINAME
);. IF(*MIDINAME==0)*MIDINAME=I;. IF
(STRLEN(MIDINAME)<=12)NONAME--;. ... /
*INITIALIZE MIDI NOTE TO SID NOTE CONVER
SION TABLE*/. FOR(I=12;I<108;I+=12). .
. OCTAVE=(8-(I/12))<<3;. MIDITOSID[I
+0]=C.NATURAL.OCTAVE;. MIDITOSID[I+1]=
C.SHARP.OCTAVE;. MIDITOSID[I+2]=D.NATU
RAL.OCTAVE;. MIDITOSID[I+3]=E.FLAT.OCT
AVE;. MIDITOSID[I+4]=E.NATURAL.OCTAVE;
. MIDITOSID[I+5]=F.NATURAL.OCTAVE;.
MIDITOSID[I+6]=F.SHARP.OCTAVE;. MIDITO
SID[I+7]=G.NATURAL.OCTAVE;. MIDITOSID[
I+8]=G.SHARP.OCTAVE;. MIDITOSID[I+9]=A
.NATURAL.OCTAVE;. MIDITOSID[I+10]=B.FL
AT.OCTAVE;. MIDITOSID[I+11]=B.NATURAL.
OCTAVE;. ... /*OPEN THE SEQUENCE FILE*
/. MIDIFILE=FOPEN(MIDINAME,"R");. IF(MID
IFILE==NULL .. FERROR(MIDIFILE)). ..
PRINTF(. "\NCAN'T OPEN %S TO READ\N\
N",MIDINAME);. PRINTF("%X\N",SIDNAME);
. RETURN;. .. FCLOSE(MIDIFILE);.. /*
TELL USER WHAT IS HAPPENING*/. PRINTF("%
CPROCESSING %S...
\N",. UP,MIDINAME);. PRINTF("HOLD
RUN/STOP KEY TO QUIT.\N\N");.. /*LOOP AS
NECESSARY FOR .MUS/.STR FILES*/. FOR(OF
FSET=0;OFFSET<NVOICES;OFFSET+=3). .. I
NT NVOICES=3;. FIRSTNOTE=1;.. /*REOPEN
MIDI SEQUENCE FILE*/. MIDIFILE=FOPEN(M
IDINAME,"R");.. /*SET ALL RUNNING POINT
ERS TO START OF RESPECTIVE BUFFERS*/. F
OR(I=0;I<3;I++). .. SIDPTR[I] = &S
IDBUF[I][0];. ... /*PROCESS SEQUENCE
FILE TO EOF*/. WHILE((C1=FGETBYTE(MIDI
FILE))!=EOF). .. /*TEST FOR SENTIN
EL*/. IF((C1&0XF0)==0XF0). ..
/*SENTINEL FOUND - SET NVOICES TO NUM
BER OF VOICES RECORDED*/. NVOICES=C
1&0X7;.. /*COMPUTE HOW MANY VOICES
TO PROCESS THIS GO AROUND*/. NVOICE
S=NVOICES-OFFSET;. IF(NVOICES>3)NVO
ICES=3;.. /*GET ANOTHER BYTE FROM F
ILE TO REPLACE SENTINEL*/. C1=FGETB
YTE(MIDIFILE);. ... /*CHECK TO S
EE IF USER WANTS TO STOP*/. IF(CURREN
T.KEY==RUN.STOP.KEY). .. /*ABO
RT PROCESSING PER USER*/. FCLOSE(MI
DIFILE);. PRINTF("ABORTED!\N\N");.
RETURN;. ... /*BOTH NOTE-ON
AND NOTE-OFF EVENTS HAVE AT LEAST TWO B
YTES*/. C2=FGETBYTE(MIDIFILE);.. /
*NOTE-ON BYTES HAVE 3 BYTES*/. IF((C1
&0X80)==0)C3=FGETBYTE(MIDIFILE);.. /*
ISOLATE SID VOICE NUMBER*/. VOICE=((C
1>>4)&7)-OFFSET;.. /*SKIP VOICES NOT
BEING PROCESSED THIS GO AROUND*/. /*E
XCEPT FOR FIRST NOTE*/. IF(!FIRSTNOTE
&& (VOICE<0 .. VOICE>2))CONTINUE;..
/*CHECK FOR SID BUFFER FULL FOR THIS VOI
CE*/. IF(!FIRSTNOTE). .. IF
(SIDPTR[VOICE]-SIDBUF[VOICE]>LIMIT).
.. /*FULL - CANNOT PROCESS TH
IS EVENT*/. PRINTF("SID BUFFER OV
ERFLOW!\N\N");. FCLOSE(MIDIFILE);
. RETURN;. .. ...
/*CHECK FOR NOTE-ON OR NOTE-OFF*/. IF
((C1&0X80)==0). .. INT ONTEMP;
.. /*THIS IS NOTE-ON, ISOLATE TIME*
/. ONTEMP=((C1&0XF)<<8).C2;. I
F(VOICE>=0 && VOICE<=2)ONTIME[VOICE]=ONT
EMP;.. /*SPECIAL PROCESSING FOR FIR
ST NOTE*/. IF(FIRSTNOTE). ..
FIRSTNOTE=0;.. /*ALL OTHE
R VOICES NEED A REST INSERTED AT BEGINNI
NG*/. FOR(I=0;I<NVOICES;I++).
.. IF(I != VOICE).
.. /*INSERT REST WHICH B
EGINS AT BEGINNING OF SONG*/.
OFFTIME[I]=ONTEMP;. *SIDPTR[
I]++ = 0XF6;. SIDPTR[I]++; /*
DURATION TO BE DETERMINED LATER*/.
*SIDPTR[I]++ = 0X24;. *
SIDPTR[I]++ = REST;. ..
... /*NOW SKIP REST OF PROCES
SING FOR VOICES NOT FOR THIS GO AROUND*/
. IF(VOICE<0 .. VOICE>2)CONTINUE;
.. /*END SPECIAL PROCESSING FOR F
IRST NOTE*/. ... /*IF THIS I
S NOT FIRST ENTRY FOR THIS VOICE*/.
IF(SIDPTR[VOICE]!= &SIDBUF[VOICE][0]).
.. /*FILL IN DURATION OF P
REVIOUS REST*/. DURATION=ONTIME[V
OICE]-OFFTIME[VOICE];. IF(DURATIO
N<0)DURATION+=0X1000; /*HANDLE 12 BIT CL
OCK WRAPAROUND*/.. /*FOR DURATION
> 255, INSERT MULTIPLE RESTS TO MAKE ON
E LONG REST*/. WHILE(DURATION>255
). .. *(SIDPTR[VOICE]-
3)=255; /*DURATION OF PREVIOUS REST 255*
/. *SIDPTR[VOICE]++=0XF6; /*INS
ERT NEW REST*/. SIDPTR[VOICE]++
; /*DURATION TO BE DETERMINED LATER*/.
*SIDPTR[VOICE]++=0X24;.
*SIDPTR[VOICE]++=REST;. DURATI
ON -= 255;. ... /*HANDLE
ZERO DURATION CASE*/. IF(DURATIO
N==0). .. /*ZERO DURAT
ION - UNINSERT LAST REST*/. SID
PTR[VOICE]-=4;. .. ELSE.
.. /*NOT ZERO DURATIO
N - FILL IN LAST REST*/. *(SIDP
TR[VOICE]-3)=DURATION;. ..
... /*NOW ACTUALLY INSERT SID NO
TE EVENT*/. *SIDPTR[VOICE]++ = 0XF6
;. SIDPTR[VOICE]++; /*DURATION TO B
E DETERMINED LATER*/. *SIDPTR[VOICE
]++ = 0X24;. OLDNOTE[VOICE] = MIDIT
OSID[C3];. *SIDPTR[VOICE]++ = OLDNO
TE[VOICE];.. /*END OF PROCESSING FO
R NOTE-ON EVENT*/. .. ELSE.
.. /*NOTE-OFF EVENT - IGNORE NOTE
ALREADY ON AT BEGINNING*/. IF(FIRST
NOTE)CONTINUE;.. /*ISOLATE TIME*/.
OFFTIME[VOICE]=((C1&0XF)<<8).C2;..
/*COMPUTE DURATION OF PREVIOUS NOTE
*/. DURATION=OFFTIME[VOICE]-ONTIME[
VOICE];.. /*HANDLE WRAPAROUND OF 12
BIT CLOCK*/. IF(DURATION<0)DURATIO
N+=0X1000;.. /*FOR DURATION > 255,
INSERT MULTIPLE NOTES TO MAKE ONE LONG N
OTE*/. WHILE(DURATION>255).
.. *(SIDPTR[VOICE]-2)=0X64; /*PRE
VIOUS NOTE TIED TO NEXT*/. *(SIDP
TR[VOICE]-3)=255; /*PREVIOUS NOTE DURATI
ON 255*/. *SIDPTR[VOICE]++=0XF6;
/*INSERT ANOTHER OF SAME NOTE*/.
SIDPTR[VOICE]++; /*DURATION TO BE DETERM
INED LATER*/. *SIDPTR[VOICE]++=0X
24;. *SIDPTR[VOICE]++=OLDNOTE[VOI
CE];. DURATION -= 255;. ..
. /*HANDLE ZERO DURATION CASE*/.
IF(DURATION==0). .. /*Z
ERO DURATION - UNINSERT NOTE*/. S
IDPTR[VOICE]-=4;. .. ELSE.
.. /*NOT ZERO DURATION - FI
LL IN DURATION OF LAST NOTE*/. *(
SIDPTR[VOICE]-3)=DURATION;. ...
/*NOW ACTUALLY INSERT A REST*/.
*SIDPTR[VOICE]++ = 0XF6;. SIDPTR[V
OICE]++; /*DURATION TO BE DETERMINED LAT
ER*/. *SIDPTR[VOICE]++ = 0X24;.
*SIDPTR[VOICE]++ = REST;.. /*END
PROCESSING FOR NOTE-OFF EVENT*/. ..
/*END OF LOOP TO EOF*/. ... /*AL
L PROCESSED - CLOSE FILE*/. FCLOSE(MIDI
FILE);.. /*FILL IN DURATION OF FINAL RE
ST FOR ALL VOICES THAT HAVE ANY DATA*/.
FOR(I=0;I<NVOICES;I++). .. IF(SID
PTR[I]!=&SIDBUF[I][0]). .. *(S
IDPTR[I]-3)=60;. .. ... /*FORM
NAME OF .MUS/.STR FILE AND OPEN IT*/. I
F(OFFSET). .. SPRINTF(SIDNAME,"%S.
STR,P",MIDINAME);. .. ELSE. ..
SPRINTF(SIDNAME,"%S.MUS,P",MIDINAME);.
.. SIDFILE=FOPEN(SIDNAME,"W");. IF(
SIDFILE==NULL .. FERROR(SIDFILE)). ..
PRINTF(. "CAN'T OPEN %S TO WRITE\
N\N",SIDNAME);. RETURN;. .. PRINT
F("WRITING %S...\N\N",SIDNAME);.. /*WRI
TE THE CONTENTS OF THE .MUS/.STR FILE*/.
PUTW(0X06B2,SIDFILE); /*SID FILE PSEUD
O LOAD ADDRESS*/. PUTW(SIDPTR[0]-&SIDBU
F[0][0]+20,SIDFILE); /*VOICE 1 COUNT*/.
PUTW(SIDPTR[1]-&SIDBUF[1][0]+20,SIDFILE
); /*VOICE 2 COUNT*/. PUTW(SIDPTR[2]-&S
IDBUF[2][0]+20,SIDFILE); /*VOICE 3 COUNT
*/.. /*VOICE 1*/. FWRITE(PREFACE,18,1,
SIDFILE); /*PREFACE ESTABLISHES SIDPLAYE
R PARAMETERS*/. FWRITE(&SIDBUF[0][0],SI
DPTR[0]-&SIDBUF[0][0],1,SIDFILE); /*SID
BUFFER ITSELF*/. PUTW(0X4F01,SIDFILE);
/*END OF VOICE SENTINEL*/.. /*VOICE 2*/
. FWRITE(PREFACE,18,1,SIDFILE);. FWRIT
E(&SIDBUF[1][0],SIDPTR[1]-&SIDBUF[1][0],
1,SIDFILE);. PUTW(0X4F01,SIDFILE);.. /
*VOICE 3*/. FWRITE(PREFACE,18,1,SIDFILE
);. FWRITE(&SIDBUF[2][0],SIDPTR[2]-&SID
BUF[2][0],1,SIDFILE);. PUTW(0X4F01,SIDF
ILE);.. /*NULL TEXT LINES*/. FPUTC(0,S
IDFILE);.. /*ALL WRITTEN - CLOSE .MUS F
ILE*/. FCLOSE(SIDFILE);. ... /*THIS FI
LE ALL PROCESSED - RETURN*/. PRINTF("SID
FILES CREATED!\N\N");. .../*THIS IS JUS
T A FASTER (I.E. BUFFERED) VERSION OF FG
ETC()*/.INT FGETBYTE(WHICHFILE).FILE *WH
ICHFILE;. .. STATIC CHAR BUFFER[254];.
STATIC INT NEXT=254;. STATIC INT LIMI
T=254;. IF(NEXT<LIMIT)RETURN(BUFFER[NEX
T++]);. IF(LIMIT<254). .. NEXT=LI
MIT=254;. RETURN -1;. .. LIMIT=FR
EAD(BUFFER,1,254,WHICHFILE);. NEXT=1;.
IF(LIMIT)RETURN *BUFFER;. NEXT=LIMIT=2
54;. RETURN -1;. ..
×
C64 Image
> CLICK IMAGE PREVIEW FOR FULL MODAL