	.386p
	ifndef	??version
?debug	macro
	endm
publicdll macro	name
	public	name
	endm
	endif
	?debug	V 300h
	?debug	S "TMIDI.C"
	?debug	C E96174963207544D4944492E43
	?debug	C E9CA6396320A495F4454494D45522E48
	?debug	C E9666496320A495F44534F554E442E48
	?debug	C E99C69963209495F444D4944492E43
	?debug	C E9C19D6F301F443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C535444494F2E48
	?debug	C E9B99D6F301F443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C5F444546532E48
	?debug	C E9B99D6F3020443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C5F4E46494C452E48
	?debug	C E9B99D6F301F443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C5F4E554C4C2E48
	?debug	C E9C19D6F3020443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C5354444C49422E48
	?debug	C E9C19D6F3020443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C535452494E472E48
	?debug	C E9BA9D6F301F443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C434F4E494F2E48
	?debug	C E9BB9D6F301D443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C444F532E48
	?debug	C E9BC9D6F3020443A5C4445565C424F524C414E44435C494E434C55+
	?debug	C 44455C4C494D4954532E48
	?debug	C E9B466963209495F444D4944492E48
	?debug	C E9666496320A495F44534F554E442E48
	?debug	C E9CA6396320A495F4454494D45522E48
TMIDI_TEXT	segment byte public use16 'CODE'
TMIDI_TEXT	ends
	assume	cs:TMIDI_TEXT,ds:TMIDI_DATA
TMIDI_DATA	segment word public use16 'FAR_DATA'
d@	label	byte
d@w	label	word
b@	label	byte
b@w	label	word
TMIDI_DATA	ends
TMIDI_TEXT	segment byte public use16 'CODE'
	?debug	C E80209495F444D4944492E48B4669632
   ;	
   ;	static int _dummy_load_patches(char *patches, char *drums) {patches = drums;drums = patches; return 0; }
   ;	
	?debug	L 145
	assume	cs:TMIDI_TEXT
_dummy_load_patches	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E318000400160200
	?debug	C E6056472756D73180A0A00000770617463686573+
	?debug	C 180A060000
	?debug	B
	mov	eax,dword ptr [bp+10]
	mov	dword ptr [bp+6],eax
	mov	eax,dword ptr [bp+6]
	mov	dword ptr [bp+10],eax
	xor	ax,ax
	jmp	short @1@58
@1@58:
	pop	ds
	pop	bp
	ret	
	?debug	C E60770617463686573180A060000056472756D73+
	?debug	C 180A0A0000
	?debug	E
	?debug	E
_dummy_load_patches	endp
   ;	
   ;	static void _dummy_adjust_patches(char *patches, char *drums) { patches = drums; drums = patches; }
   ;	
	?debug	L 146
	assume	cs:TMIDI_TEXT
_dummy_adjust_patches	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6056472756D73180A0A00000770617463686573+
	?debug	C 180A060000
	?debug	B
	mov	eax,dword ptr [bp+10]
	mov	dword ptr [bp+6],eax
	mov	eax,dword ptr [bp+6]
	mov	dword ptr [bp+10],eax
	pop	ds
	pop	bp
	ret	
	?debug	C E60770617463686573180A060000056472756D73+
	?debug	C 180A0A0000
	?debug	E
	?debug	E
_dummy_adjust_patches	endp
   ;	
   ;	static void _dummy_key_on(int inst, int note, int bend, int vol, int pan) { inst=inst; note=note; bend=bend; vol=vol;pan=pan; }
   ;	
	?debug	L 147
	assume	cs:TMIDI_TEXT
_dummy_key_on	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	si
	push	di
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E60370616E040A0E000003766F6C040A0C000004+
	?debug	C 62656E64040A0A0000046E6F7465040A08000004+
	?debug	C 696E7374040A060000
	mov	dx,word ptr [bp+6]
	mov	bx,word ptr [bp+8]
	mov	cx,word ptr [bp+10]
	mov	si,word ptr [bp+12]
	mov	di,word ptr [bp+14]
	?debug	B
	pop	ds
	pop	di
	pop	si
	pop	bp
	ret	
	?debug	C E604696E7374040C0200046E6F7465040C030004+
	?debug	C 62656E64040C010003766F6C040C06000370616E+
	?debug	C 040C0700
	?debug	E
	?debug	E
_dummy_key_on	endp
   ;	
   ;	static void _dummy_noop1(int p1) {p1=p1;}
   ;	
	?debug	L 148
	assume	cs:TMIDI_TEXT
_dummy_noop1	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6027031040A060000
	mov	dx,word ptr [bp+6]
	?debug	B
	pop	ds
	pop	bp
	ret	
	?debug	C E6027031040C0200
	?debug	E
	?debug	E
_dummy_noop1	endp
   ;	
   ;	static void _dummy_noop2(int p1, int p2) {p1=p1;p2=p2;}
   ;	
	?debug	L 149
	assume	cs:TMIDI_TEXT
_dummy_noop2	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6027032040A080000027031040A060000
	mov	dx,word ptr [bp+6]
	mov	bx,word ptr [bp+8]
	?debug	B
	pop	ds
	pop	bp
	ret	
	?debug	C E6027031040C0200027032040C0300
	?debug	E
	?debug	E
_dummy_noop2	endp
   ;	
   ;	static void _dummy_noop3(int p1, int p2, int p3) {p1=p1;p2=p2;p3=p3;}
   ;	
	?debug	L 150
	assume	cs:TMIDI_TEXT
_dummy_noop3	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6027033040A0A0000027032040A080000027031+
	?debug	C 040A060000
	mov	dx,word ptr [bp+6]
	mov	bx,word ptr [bp+8]
	mov	cx,word ptr [bp+10]
	?debug	B
	pop	ds
	pop	bp
	ret	
	?debug	C E6027031040C0200027032040C0300027033040C+
	?debug	C 0100
	?debug	E
	?debug	E
_dummy_noop3	endp
	?debug	C E9CA6396320A495F4454494D45522E48
TMIDI_TEXT	ends
TMIDI_DATA	segment word public use16 'FAR_DATA'
_midi_pos	label	word
	db	255
	db	255
	db	255
	db	255
__midi_tick	label	word
	db	0
	db	0
	db	0
	db	0
midifile	label	dword
	db	0
	db	0
	db	0
	db	0
midi_loop	label	word
	db	0
	db	0
_midi_loop_start	label	word
	db	255
	db	255
	db	255
	db	255
_midi_loop_end	label	word
	db	255
	db	255
	db	255
	db	255
midi_semaphore	label	word
	db	0
	db	0
	db	0
	db	0
midi_loaded_patches	label	word
	db	0
	db	0
	db	0
	db	0
old_midi_volume	label	word
	db	255
	db	255
	db	255
	db	255
_id_midi_volume	label	word
	db	255
	db	0
_midi_msg_callback	label	dword
	db	0
	db	0
	db	0
	db	0
_midi_meta_callback	label	dword
	db	0
	db	0
	db	0
	db	0
_midi_sysex_callback	label	dword
	db	0
	db	0
	db	0
	db	0
iw_midi_Flag	label	byte
	db	0
TMIDI_DATA	ends
TMIDI_TEXT	segment byte public use16 'CODE'
	?debug	C E80309495F444D4944492E439C699632
   ;	
   ;	char iw_midi_init(char driver)
   ;	
	?debug	L 177
	assume	cs:TMIDI_TEXT
_iw_midi_init	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E606647269766572020A060000
	?debug	B
   ;	
   ;	{ 
   ;		if (iw_midi_Flag) return 1;
   ;	
	?debug	L 179
	cmp	byte ptr iw_midi_Flag,0
	je	short @7@114
@7@58:
	mov	al,1
@7@86:
	jmp	short @7@254
@7@114:
   ;	
   ;		if (!iw_sb_port) { sprintf(iw_message,"Sound card init failed\n"); return 0; }
   ;	
	?debug	L 180
	mov	ax,seg _iw_sb_port
	mov	es,ax
	cmp	word ptr es:_iw_sb_port,0
	jne	short @7@170
	push	ds
	push	offset s@
	push	seg _iw_message
	push	offset _iw_message
	call	far ptr _sprintf
	add	sp,8
	jmp	short @7@198
@7@170:
   ;	
   ;		if (!midi_init(driver)) return FALSE;
   ;	
	?debug	L 181
	mov	al,byte ptr [bp+6]
	push	ax
	call	far ptr midi_init
	pop	cx
	or	ax,dx
	jne	short @7@226
@7@198:
	mov	al,0
	jmp	short @7@86
@7@226:
   ;	
   ;		iw_midi_Flag=1; 
   ;	
	?debug	L 182
	mov	byte ptr iw_midi_Flag,1
	jmp	short @7@58
@7@254:
   ;	
   ;		return 1;
   ;	}
   ;	
	?debug	L 184
	pop	ds
	pop	bp
	ret	
	?debug	C E606647269766572020A060000
	?debug	E
	?debug	E
_iw_midi_init	endp
   ;	
   ;	char iw_midi_rest(void)
   ;	
	?debug	L 189
	assume	cs:TMIDI_TEXT
_iw_midi_rest	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
   ;	
   ;	{ 
   ;		if (!iw_midi_Flag) return 0;
   ;	
	?debug	L 191
	mov	al,byte ptr iw_midi_Flag
	cbw	
	or	ax,ax
	jne	short @8@114
	mov	al,0
@8@86:
	jmp	short @8@142
@8@114:
   ;	
   ;		midi_exit(); 
   ;	
	?debug	L 192
	call	far ptr midi_exit
   ;	
   ;		iw_midi_Flag=0;
   ;	
	?debug	L 193
	mov	byte ptr iw_midi_Flag,0
   ;	
   ;		return 1;
   ;	
	?debug	L 194
	mov	al,1
	jmp	short @8@86
@8@142:
   ;	
   ;	}
   ;	
	?debug	L 195
	pop	ds
	pop	bp
	ret	
	?debug	E
	?debug	E
_iw_midi_rest	endp
   ;	
   ;	static long   mfgetw(FILE *f)
   ;	
	?debug	L 200
	assume	cs:TMIDI_TEXT
mfgetw	proc	far
	?debug	B
	enter	4,0
	push	si
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E31A0014001E01
	?debug	C E31B000400160800
	?debug	C E319000400161A00
	?debug	C E60166190A060000
	?debug	B
   ;	
   ;	{ 
   ;	  unsigned short w[2],i;
   ;	  for (i=0;i<2;i++) w[i]=fgetc(f); 
   ;	
	?debug	L 203
	xor	si,si
	jmp	short @9@114
@9@58:
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	call	far ptr _fgetc
	add	sp,4
	mov	bx,si
	shl	bx,1
	lea	dx,word ptr [bp-4]
	add	bx,dx
	mov	word ptr ss:[bx],ax
	inc	si
@9@114:
	cmp	si,2
	jb	short @9@58
   ;	
   ;	  return (unsigned)w[0]*256+w[1];
   ;	
	?debug	L 204
	mov	ax,word ptr [bp-4]
	shl	ax,8
	add	ax,word ptr [bp-2]
	movzx	eax,ax
	shld	edx,eax,16
	jmp	short @9@170
@9@170:
   ;	
   ;	}
   ;	
	?debug	L 205
	pop	ds
	pop	si
	leave	
	ret	
	?debug	C E31C0004001A0A
	?debug	C E601690A04060001771C02FCFF000166190A0600+
	?debug	C 00
	?debug	E
	?debug	E
mfgetw	endp
   ;	
   ;	static long  mfgetl(FILE *f)
   ;	
	?debug	L 210
	assume	cs:TMIDI_TEXT
mfgetl	proc	far
	?debug	B
	enter	8,0
	push	si
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E60166190A060000
	?debug	B
   ;	
   ;	{ 
   ;	  unsigned w[4],i; 
   ;	  for (i=0;i<4;i++) w[i]=fgetc(f); 
   ;	
	?debug	L 213
	xor	si,si
	jmp	short @10@114
@10@58:
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	call	far ptr _fgetc
	add	sp,4
	mov	bx,si
	shl	bx,1
	lea	dx,word ptr [bp-8]
	add	bx,dx
	mov	word ptr ss:[bx],ax
	inc	si
@10@114:
	cmp	si,4
	jb	short @10@58
   ;	
   ;	  return (w[0]*256+w[1])*65536L+w[2]*256+w[3];
   ;	
	?debug	L 214
	mov	ax,word ptr [bp-8]
	shl	ax,8
	add	ax,word ptr [bp-6]
	movzx	eax,ax
	shl	eax,16
	mov	dx,word ptr [bp-4]
	shl	dx,8
	movzx	edx,dx
	add	eax,edx
	movzx	edx,word ptr [bp-2]
	add	eax,edx
	shld	edx,eax,16
	jmp	short @10@170
@10@170:
   ;	
   ;	}
   ;	
	?debug	L 215
	pop	ds
	pop	si
	leave	
	ret	
	?debug	C E31D0008001A0A
	?debug	C E601690A04060001771D02F8FF000166190A0600+
	?debug	C 00
	?debug	E
	?debug	E
mfgetl	endp
   ;	
   ;	void iw_midi_stop(void) { iw_midi_play(NULL, FALSE); }
   ;	
	?debug	L 220
	assume	cs:TMIDI_TEXT
_iw_midi_stop	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
	push	0
	push	0
	push	0
	call	far ptr _iw_midi_play
	add	sp,6
	pop	ds
	pop	bp
	ret	
	?debug	E
	?debug	E
_iw_midi_stop	endp
   ;	
   ;	MIDI *iw_midi_load(char *filename,long file_offset)
   ;	
	?debug	L 225
	assume	cs:TMIDI_TEXT
_iw_midi_load	proc	far
	?debug	B
	enter	280,0
	push	si
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E60B66696C655F6F6666736574060A0A00000866+
	?debug	C 696C656E616D65180A060000
	?debug	B
   ;	
   ;	{
   ;	   long c;
   ;	   char buf[256];
   ;	   long data,retsiz;
   ;	   FILE *fp;
   ;	   MIDI *midi;
   ;	   long num_tracks;
   ;	
   ;	   fp = fopen(filename, "rb");        /* open the file */
   ;	
	?debug	L 234
	push	ds
	push	offset s@+24
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	call	far ptr _fopen
	add	sp,8
	mov	word ptr [bp-14],dx
	mov	word ptr [bp-16],ax
   ;	
   ;	   if (!fp) return NULL; 
   ;	
	?debug	L 235
	cmp	dword ptr [bp-16],large 0
	jne	short @12@114
@12@58:
	xor	dx,dx
	xor	ax,ax
@12@86:
	jmp	@12@842
@12@114:
   ;	
   ;	   midi = (MIDI*)malloc(sizeof(MIDI));              /* get some memory */
   ;	
	?debug	L 236
	push	194
	call	far ptr _malloc
	pop	cx
	mov	word ptr [bp-18],dx
	mov	word ptr [bp-20],ax
   ;	
   ;	
   ;	   if (!midi) {
   ;	
	?debug	L 238
	cmp	dword ptr [bp-20],large 0
	jne	short @12@198
   ;	
   ;	      fclose(fp); return NULL;
   ;	
	?debug	L 239
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	call	far ptr _fclose
@12@170:
	add	sp,4
	jmp	short @12@58
@12@198:
   ;	
   ;	   }
   ;	
   ;	   for (c=0; c<MIDI_TRACKS; c++) {
   ;	
	?debug	L 242
	mov	dword ptr [bp-4],large 0
	jmp	short @12@282
@12@226:
   ;	
   ;	      midi->track[c].data = NULL;
   ;	
	?debug	L 243
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp-20]
	add	bx,ax
	mov	word ptr es:[bx+4],0
	mov	word ptr es:[bx+2],0
   ;	
   ;	      midi->track[c].len = 0;
   ;	
	?debug	L 244
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp-20]
	add	bx,ax
	mov	word ptr es:[bx+6],0
	?debug	L 242
	inc	dword ptr [bp-4]
@12@282:
	cmp	dword ptr [bp-4],large 32
	jl	short @12@226
   ;	
   ;	   }
   ;	  
   ;	   fseek(fp, file_offset, SEEK_SET);
   ;	
	?debug	L 247
	push	0
	push	dword ptr [bp+10]
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	call	far ptr _fseek
	add	sp,10
   ;	
   ;	   fread(buf, 4, 1, fp);                   /* read midi header */
   ;	
	?debug	L 248
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	push	1
	push	4
	push	ss
	lea	ax,word ptr [bp-280]
	push	ax
	call	far ptr _fread
	add	sp,12
   ;	
   ;	   if (memcmp(buf, "MThd", 4)) goto err; 
   ;	
	?debug	L 249
	push	4
	push	ds
	push	offset s@+27
	push	ss
	lea	ax,word ptr [bp-280]
	push	ax
	call	far ptr _memcmp
	add	sp,10
	or	ax,ax
	je	short @12@366
	jmp	@12@814
@12@366:
   ;	
   ;	   mfgetl(fp);                            /* skip header chunk length */
   ;	
	?debug	L 250
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	push	cs
	call	near ptr mfgetl
	add	sp,4
   ;	
   ;	
   ;	   data = mfgetw(fp);                    /* MIDI file type */
   ;	
	?debug	L 252
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	push	cs
	call	near ptr mfgetw
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	dword ptr [bp-8],eax
   ;	
   ;	   if ((data != 0) && (data != 1)) goto err; 
   ;	
	?debug	L 253
	cmp	dword ptr [bp-8],large 0
	je	short @12@450
	cmp	dword ptr [bp-8],large 1
	je	short @12@450
	jmp	@12@814
@12@450:
   ;	
   ;	   num_tracks = mfgetw(fp);              /* number of tracks */
   ;	
	?debug	L 254
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	push	cs
	call	near ptr mfgetw
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	dword ptr [bp-24],eax
   ;	
   ;	   if ((num_tracks < 1) || (num_tracks > MIDI_TRACKS)) goto err; 
   ;	
	?debug	L 255
	cmp	dword ptr [bp-24],large 1
	jl	short @12@506
	cmp	dword ptr [bp-24],large 32
	jle	short @12@534
@12@506:
	jmp	@12@814
@12@534:
   ;	
   ;	
   ;	   data = mfgetw(fp);                    /* beat divisions */
   ;	
	?debug	L 257
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	push	cs
	call	near ptr mfgetw
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	dword ptr [bp-8],eax
   ;	
   ;	   midi->divisions = abs(data);
   ;	
	?debug	L 258
	mov	ax,word ptr [bp-8]
	cwd	
	xor	ax,dx
	sub	ax,dx
	les	bx,dword ptr [bp-20]
	mov	word ptr es:[bx],ax
   ;	
   ;	
   ;	   for (c=0; c<num_tracks; c++) {            /* read each track */
   ;	
	?debug	L 260
	mov	dword ptr [bp-4],large 0
	jmp	@12@758
@12@562:
   ;	
   ;	      fread(buf, 4, 1, fp);                  /* read track header */
   ;	
	?debug	L 261
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	push	1
	push	4
	push	ss
	lea	ax,word ptr [bp-280]
	push	ax
	call	far ptr _fread
	add	sp,12
   ;	
   ;	      if (memcmp(buf, "MTrk", 4)) goto err; 
   ;	
	?debug	L 262
	push	4
	push	ds
	push	offset s@+32
	push	ss
	lea	ax,word ptr [bp-280]
	push	ax
	call	far ptr _memcmp
	add	sp,10
	or	ax,ax
	je	short @12@618
	jmp	@12@814
@12@618:
   ;	
   ;	      data = mfgetl(fp);                      /* length of track chunk */
   ;	
	?debug	L 263
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	push	cs
	call	near ptr mfgetl
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	dword ptr [bp-8],eax
   ;	
   ;	      midi->track[c].len = data;
   ;	
	?debug	L 264
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp-20]
	add	bx,ax
	mov	ax,word ptr [bp-8]
	mov	word ptr es:[bx+6],ax
   ;	
   ;	      midi->track[c].data = (unsigned char*)malloc(data);    /* allocate memory */
   ;	
	?debug	L 265
	push	word ptr [bp-8]
	call	far ptr _malloc
	pop	cx
	mov	bx,word ptr [bp-4]
	imul	bx,bx,6
	les	si,dword ptr [bp-20]
	add	si,bx
	mov	word ptr es:[si+4],dx
	mov	word ptr es:[si+2],ax
   ;	
   ;	      if (!midi->track[c].data) goto err; 
   ;	
	?debug	L 266
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp-20]
	add	bx,ax
	mov	ax,word ptr es:[bx+2]
	or	ax,word ptr es:[bx+4]
	jne	short @12@674
	jmp	short @12@814
@12@674:
   ;	
   ;						     /* finally, read track data */
   ;	      retsiz=fread(midi->track[c].data, 1, data, fp);
   ;	
	?debug	L 268
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	push	word ptr [bp-8]
	push	1
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp-20]
	add	bx,ax
	push	word ptr es:[bx+4]
	push	word ptr es:[bx+2]
	call	far ptr _fread
	add	sp,12
	movzx	eax,ax
	mov	dword ptr [bp-12],eax
   ;	
   ;	      if ( retsiz != data) goto err; 
   ;	
	?debug	L 269
	mov	eax,dword ptr [bp-12]
	cmp	eax,dword ptr [bp-8]
	je	short @12@730
	jmp	short @12@814
@12@730:
	?debug	L 260
	inc	dword ptr [bp-4]
@12@758:
	mov	eax,dword ptr [bp-4]
	cmp	eax,dword ptr [bp-24]
	jge short	@@1302
	jmp	@12@562
@@1302:
   ;	
   ;	   }
   ;	
   ;	   fclose(fp);
   ;	
	?debug	L 272
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	call	far ptr _fclose
	add	sp,4
   ;	
   ;	   return midi;
   ;	
	?debug	L 273
	mov	dx,word ptr [bp-18]
	mov	ax,word ptr [bp-20]
	jmp	@12@86
@12@814:
   ;	
   ;	
   ;	   /* oh dear... */
   ;	   err:
   ;	   fclose(fp);
   ;	
	?debug	L 277
	push	word ptr [bp-14]
	push	word ptr [bp-16]
	call	far ptr _fclose
	add	sp,4
   ;	
   ;	   iw_midi_destroy(midi);
   ;	
	?debug	L 278
	push	word ptr [bp-18]
	push	word ptr [bp-20]
	call	far ptr _iw_midi_destroy
	jmp	@12@170
@12@842:
   ;	
   ;	   return NULL;
   ;	}
   ;	
	?debug	L 280
	pop	ds
	pop	si
	leave	
	ret	
	?debug	C E31F044D494449C2001E0B
	?debug	C E3210006001E0E
	?debug	C E32000C0001A21
	?debug	C E31E000400161F00
	?debug	C E3220000011A02
	?debug	C E60A6E756D5F747261636B730602E8FF00046D69+
	?debug	C 64691E02ECFF000266701902F0FF000672657473+
	?debug	C 697A0602F4FF0004646174610602F8FF00036275+
	?debug	C 662202E8FE0001630602FCFF000866696C656E61+
	?debug	C 6D65180A0600000B66696C655F6F666673657406+
	?debug	C 0A0A0000
	?debug	E
	?debug	E
_iw_midi_load	endp
   ;	
   ;	void iw_midi_destroy(MIDI *midi)
   ;	
	?debug	L 285
	assume	cs:TMIDI_TEXT
_iw_midi_destroy	proc	far
	?debug	B
	enter	4,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6046D6964691E0A060000
	?debug	B
   ;	
   ;	{
   ;	   long c;
   ;	
   ;	   if (midi == midifile)
   ;	
	?debug	L 289
	mov	eax,dword ptr [bp+6]
	cmp	eax,dword ptr midifile
	jne	short @13@86
   ;	
   ;	      iw_midi_stop();
   ;	
	?debug	L 290
	push	cs
	call	near ptr _iw_midi_stop
@13@86:
   ;	
   ;	
   ;	   if (midi) {
   ;	
	?debug	L 292
	cmp	dword ptr [bp+6],large 0
	je	short @13@282
   ;	
   ;	      for (c=0; c<MIDI_TRACKS; c++) {
   ;	
	?debug	L 293
	mov	dword ptr [bp-4],large 0
	jmp	short @13@226
@13@142:
   ;	
   ;		 if (midi->track[c].data) {
   ;	
	?debug	L 294
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp+6]
	add	bx,ax
	mov	ax,word ptr es:[bx+2]
	or	ax,word ptr es:[bx+4]
	je	short @13@198
   ;	
   ;		    free(midi->track[c].data);
   ;	
	?debug	L 295
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp+6]
	add	bx,ax
	push	word ptr es:[bx+4]
	push	word ptr es:[bx+2]
	call	far ptr _free
	add	sp,4
@13@198:
	?debug	L 293
	inc	dword ptr [bp-4]
@13@226:
	cmp	dword ptr [bp-4],large 32
	jl	short @13@142
   ;	
   ;		 }
   ;	      }
   ;	      free(midi);
   ;	
	?debug	L 298
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	call	far ptr _free
	add	sp,4
@13@282:
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 300
	pop	ds
	leave	
	ret	
	?debug	C E601630602FCFF00046D6964691E0A060000
	?debug	E
	?debug	E
_iw_midi_destroy	endp
   ;	
   ;	static unsigned long parse_var_len(unsigned char **data)
   ;	
	?debug	L 305
	assume	cs:TMIDI_TEXT
parse_var_len	proc	far
	?debug	B
	enter	4,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E323000400161B00
	?debug	C E60464617461230A060000
	?debug	B
   ;	
   ;	{
   ;	   unsigned long val = **data & 0x7F;
   ;	
	?debug	L 307
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	al,byte ptr es:[bx]
	mov	ah,0
	and	ax,127
	movsx	eax,ax
	mov	dword ptr [bp-4],eax
	jmp	short @14@86
@14@58:
   ;	
   ;	   while (**data & 0x80) {
   ;	      (*data)++;
   ;	
	?debug	L 309
	les	bx,dword ptr [bp+6]
	inc	word ptr es:[bx]
   ;	
   ;	      val <<= 7;
   ;	
	?debug	L 310
	mov	eax,dword ptr [bp-4]
	shl	eax,7
	mov	dword ptr [bp-4],eax
   ;	
   ;	      val += (**data & 0x7F);
   ;	
	?debug	L 311
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	al,byte ptr es:[bx]
	mov	ah,0
	and	ax,127
	movsx	eax,ax
	add	dword ptr [bp-4],eax
@14@86:
	?debug	L 308
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	al,byte ptr es:[bx]
	mov	ah,0
	test	ax,128
	jne	short @14@58
   ;	
   ;	   }
   ;	   (*data)++;
   ;	
	?debug	L 313
	les	bx,dword ptr [bp+6]
	inc	word ptr es:[bx]
   ;	
   ;	   return val;
   ;	
	?debug	L 314
	mov	eax,dword ptr [bp-4]
	shld	edx,eax,16
	jmp	short @14@142
@14@142:
   ;	
   ;	}
   ;	
	?debug	L 315
	pop	ds
	leave	
	ret	
	?debug	C E60376616C0C02FCFF000464617461230A060000
	?debug	E
	?debug	E
parse_var_len	endp
   ;	
   ;	static  long global_volume_fix(long vol)
   ;	
	?debug	L 322
	assume	cs:TMIDI_TEXT
global_volume_fix	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E603766F6C060A060000
	?debug	B
   ;	
   ;	{
   ;	   if (id_midi_volume >= 0)
   ;	
	?debug	L 324
	cmp	word ptr _id_midi_volume,0
	jl	short @15@114
   ;	
   ;	      return (vol * id_midi_volume) / 256;
   ;	
	?debug	L 325
	movsx	eax,word ptr _id_midi_volume
	push	eax
	mov	eax,dword ptr [bp+6]
	pop	edx
	imul	eax,edx
	mov	ebx,large 256
	cdq	
	idiv	ebx
@15@86:
	shld	edx,eax,16
	jmp	short @15@142
@15@114:
   ;	
   ;	
   ;	   return vol;
   ;	
	?debug	L 327
	mov	eax,dword ptr [bp+6]
	jmp	short @15@86
@15@142:
   ;	
   ;	}
   ;	
	?debug	L 328
	pop	ds
	pop	bp
	ret	
	?debug	C E603766F6C060A060000
	?debug	E
	?debug	E
global_volume_fix	endp
   ;	
   ;	static  long sort_out_volume(long c, long vol)
   ;	
	?debug	L 335
	assume	cs:TMIDI_TEXT
sort_out_volume	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E603766F6C060A0A00000163060A060000
	?debug	B
   ;	
   ;	{
   ;	   return global_volume_fix((vol * midi_channel[c].volume) / 128);
   ;	
	?debug	L 337
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	eax,dword ptr [bp+10]
	imul	eax,dword ptr midi_channel[bx+4]
	mov	ebx,large 128
	cdq	
	idiv	ebx
	push	eax
	push	cs
	call	near ptr global_volume_fix
	add	sp,4
	jmp	short @16@58
@16@58:
   ;	
   ;	}
   ;	
	?debug	L 338
	pop	ds
	pop	bp
	ret	
	?debug	C E60163060A06000003766F6C060A0A0000
	?debug	E
	?debug	E
sort_out_volume	endp
   ;	
   ;	static void raw_program_change(long channel, long patch)
   ;	
	?debug	L 346
	assume	cs:TMIDI_TEXT
raw_program_change	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6057061746368060A0A0000076368616E6E656C+
	?debug	C 060A060000
	?debug	B
   ;	
   ;	{
   ;	   if (channel != 9) {
   ;	
	?debug	L 348
	cmp	dword ptr [bp+6],large 9
	jne short	@@1303
	jmp	@17@198
@@1303:
   ;	
   ;	      /* bank change #1 */
   ;	      if (patch_table[patch].bank1 >= 0) {
   ;	
	?debug	L 350
	mov	bx,word ptr [bp+10]
	shl	bx,4
	cmp	dword ptr patch_table[bx],large 0
	jl	short @17@114
   ;	
   ;		 midi_driver->raw_midi(0xB0+channel);
   ;	
	?debug	L 351
	mov	al,byte ptr [bp+6]
	add	al,176
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		 midi_driver->raw_midi(0);
   ;	
	?debug	L 352
	push	0
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		 midi_driver->raw_midi(patch_table[patch].bank1);
   ;	
	?debug	L 353
	mov	bx,word ptr [bp+10]
	shl	bx,4
	mov	al,byte ptr patch_table[bx]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
@17@114:
   ;	
   ;	      }
   ;	
   ;	      /* bank change #2 */
   ;	      if (patch_table[patch].bank2 >= 0) {
   ;	
	?debug	L 357
	mov	bx,word ptr [bp+10]
	shl	bx,4
	cmp	dword ptr patch_table[bx+4],large 0
	jl	short @17@170
   ;	
   ;		 midi_driver->raw_midi(0xB0+channel);
   ;	
	?debug	L 358
	mov	al,byte ptr [bp+6]
	add	al,176
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		 midi_driver->raw_midi(32);
   ;	
	?debug	L 359
	push	32
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		 midi_driver->raw_midi(patch_table[patch].bank2);
   ;	
	?debug	L 360
	mov	bx,word ptr [bp+10]
	shl	bx,4
	mov	al,byte ptr patch_table[bx+4]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
@17@170:
   ;	
   ;	      }
   ;	
   ;	      /* program change */
   ;	      midi_driver->raw_midi(0xC0+channel);
   ;	
	?debug	L 364
	mov	al,byte ptr [bp+6]
	add	al,192
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(patch_table[patch].prog);
   ;	
	?debug	L 365
	mov	bx,word ptr [bp+10]
	shl	bx,4
	mov	al,byte ptr patch_table[bx+8]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	
   ;	      /* update volume */
   ;	      midi_driver->raw_midi(0xB0+channel);
   ;	
	?debug	L 368
	mov	al,byte ptr [bp+6]
	add	al,176
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(7);
   ;	
	?debug	L 369
	push	7
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(global_volume_fix(midi_channel[channel].volume-1));
   ;	
	?debug	L 370
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+4]
	dec	eax
	push	eax
	push	cs
	call	near ptr global_volume_fix
	add	sp,4
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
@17@198:
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 372
	pop	ds
	pop	bp
	ret	
	?debug	C E6076368616E6E656C060A060000057061746368+
	?debug	C 060A0A0000
	?debug	E
	?debug	E
raw_program_change	endp
   ;	
   ;	static void midi_note_off(long channel, long note)
   ;	
	?debug	L 378
	assume	cs:TMIDI_TEXT
midi_note_off	proc	far
	?debug	B
	enter	16,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6046E6F7465060A0A0000076368616E6E656C06+
	?debug	C 0A060000
	?debug	B
   ;	
   ;	{
   ;	   long done = FALSE;
   ;	
	?debug	L 380
	mov	dword ptr [bp-4],large 0
   ;	
   ;	   long voice, layer;
   ;	   long c;
   ;	
   ;	   /* can we send raw MIDI data? */
   ;	   if (midi_driver->raw_midi) {
   ;	
	?debug	L 385
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @18@142
   ;	
   ;	      if (channel != 9) note += patch_table[midi_channel[channel].patch].pitch;
   ;	
	?debug	L 386
	cmp	dword ptr [bp+6],large 9
	je	short @18@114
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	bx,word ptr midi_channel[bx]
	shl	bx,4
	mov	eax,dword ptr patch_table[bx+12]
	add	dword ptr [bp+10],eax
@18@114:
   ;	
   ;	      midi_driver->raw_midi(0x80+channel);
   ;	
	?debug	L 387
	mov	al,byte ptr [bp+6]
	add	al,128
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(note);
   ;	
	?debug	L 388
	mov	al,byte ptr [bp+10]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(0);
   ;	
	?debug	L 389
	push	0
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      return;
   ;	
	?debug	L 390
	jmp	@18@478
@18@142:
   ;	
   ;	   }
   ;	   /* oh well, have to do it the long way... */
   ;	   for (layer=0; layer<MIDI_LAYERS; layer++) {
   ;	
	?debug	L 393
	mov	dword ptr [bp-12],large 0
	jmp	@18@254
@18@170:
   ;	
   ;	      voice = midi_channel[channel].note[note][layer];
   ;	
	?debug	L 394
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	ax,word ptr [bp+10]
	shl	ax,4
	add	bx,ax
	mov	ax,word ptr [bp-12]
	shl	ax,2
	add	bx,ax
	mov	eax,dword ptr midi_channel[bx+24]
	mov	dword ptr [bp-8],eax
   ;	
   ;	      if (voice >= 0) {
   ;	
	?debug	L 395
	cmp	dword ptr [bp-8],large 0
	jl	short @18@226
   ;	
   ;		 midi_driver->key_off(voice + midi_driver->basevoice);
   ;	
	?debug	L 396
	les	bx,dword ptr _midi_driver
	mov	ax,word ptr [bp-8]
	add	ax,word ptr es:[bx+10]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+52]
	pop	cx
   ;	
   ;		 midi_voice[voice].note = -1;
   ;	
	?debug	L 397
	mov	bx,word ptr [bp-8]
	shl	bx,4
	mov	dword ptr midi_voice[bx+4],large -1
   ;	
   ;		 midi_voice[voice].time = _midi_tick;
   ;	
	?debug	L 398
	mov	bx,word ptr [bp-8]
	shl	bx,4
	mov	eax,dword ptr __midi_tick
	mov	dword ptr midi_voice[bx+12],eax
   ;	
   ;		 midi_channel[channel].note[note][layer] = -1; 
   ;	
	?debug	L 399
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	ax,word ptr [bp+10]
	shl	ax,4
	add	bx,ax
	mov	ax,word ptr [bp-12]
	shl	ax,2
	add	bx,ax
	mov	dword ptr midi_channel[bx+24],large -1
   ;	
   ;		 done = TRUE;
   ;	
	?debug	L 400
	mov	dword ptr [bp-4],large 1
@18@226:
	?debug	L 393
	inc	dword ptr [bp-12]
@18@254:
	cmp	dword ptr [bp-12],large 4
	jge short	@@1304
	jmp	@18@170
@@1304:
   ;	
   ;	      }
   ;	   }
   ;	   /* if the note isn't playing, it must still be in the waiting room */
   ;	   if (!done) {
   ;	
	?debug	L 404
	cmp	dword ptr [bp-4],large 0
	jne	short @18@478
   ;	
   ;	      for (c=0; c<MIDI_VOICES; c++) {
   ;	
	?debug	L 405
	mov	dword ptr [bp-16],large 0
	jmp	short @18@450
@18@338:
   ;	
   ;		    if ((midi_waiting[c].channel == channel) && 
   ;	
	?debug	L 406
   ;	
   ;		     (midi_waiting[c].note == note)) {
   ;	
	?debug	L 407
	mov	bx,word ptr [bp-16]
	imul	bx,bx,12
	mov	eax,dword ptr midi_waiting[bx]
	cmp	eax,dword ptr [bp+6]
	jne	short @18@422
	mov	bx,word ptr [bp-16]
	imul	bx,bx,12
	mov	eax,dword ptr midi_waiting[bx+4]
	cmp	eax,dword ptr [bp+10]
	jne	short @18@422
   ;	
   ;		    midi_waiting[c].note = -1;
   ;	
	?debug	L 408
	mov	bx,word ptr [bp-16]
	imul	bx,bx,12
	mov	dword ptr midi_waiting[bx+4],large -1
   ;	
   ;		    break;
   ;	
	?debug	L 409
	jmp	short @18@478
@18@422:
	?debug	L 405
	inc	dword ptr [bp-16]
@18@450:
	cmp	dword ptr [bp-16],large 32
	jl	short @18@338
@18@478:
   ;	
   ;		   }
   ;	      }
   ;	   }
   ;	}
   ;	
	?debug	L 413
	pop	ds
	leave	
	ret	
	?debug	C E601630602F0FF00056C617965720602F4FF0005+
	?debug	C 766F6963650602F8FF0004646F6E650602FCFF00+
	?debug	C 076368616E6E656C060A060000046E6F7465060A+
	?debug	C 0A0000
	?debug	E
	?debug	E
midi_note_off	endp
   ;	
   ;	static  void sort_out_pitch_bend(long *bend, long *note)
   ;	
	?debug	L 421
	assume	cs:TMIDI_TEXT
sort_out_pitch_bend	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E324000400160600
	?debug	C E6046E6F7465240A0A00000462656E64240A0600+
	?debug	C 00
	?debug	B
   ;	
   ;	{
   ;	   if (*bend == 0x2000) {
   ;	
	?debug	L 423
	les	bx,dword ptr [bp+6]
	cmp	dword ptr es:[bx],large 8192
	jne	short @19@86
   ;	
   ;	      *bend = 0;
   ;	
	?debug	L 424
	les	bx,dword ptr [bp+6]
	mov	dword ptr es:[bx],large 0
   ;	
   ;	      return;
   ;	
	?debug	L 425
	jmp	short @19@254
@19@86:
   ;	
   ;	   }
   ;	   (*bend) -= 0x2000;
   ;	
	?debug	L 427
	les	bx,dword ptr [bp+6]
	sub	dword ptr es:[bx],large 8192
	jmp	short @19@142
@19@114:
   ;	
   ;	   while (*bend < 0) {
   ;	      (*note)--;
   ;	
	?debug	L 429
	les	bx,dword ptr [bp+10]
	dec	dword ptr es:[bx]
   ;	
   ;	      (*bend) += 0x1000;
   ;	
	?debug	L 430
	les	bx,dword ptr [bp+6]
	add	dword ptr es:[bx],large 4096
@19@142:
	?debug	L 428
	les	bx,dword ptr [bp+6]
	cmp	dword ptr es:[bx],large 0
	jl	short @19@114
	jmp	short @19@226
@19@198:
   ;	
   ;	   }
   ;	   while (*bend >= 0x1000) {
   ;	      (*note)++;
   ;	
	?debug	L 433
	les	bx,dword ptr [bp+10]
	inc	dword ptr es:[bx]
   ;	
   ;	      (*bend) -= 0x1000;
   ;	
	?debug	L 434
	les	bx,dword ptr [bp+6]
	sub	dword ptr es:[bx],large 4096
@19@226:
	?debug	L 432
	les	bx,dword ptr [bp+6]
	cmp	dword ptr es:[bx],large 4096
	jge	short @19@198
@19@254:
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 436
	pop	ds
	pop	bp
	ret	
	?debug	C E60462656E64240A060000046E6F7465240A0A00+
	?debug	C 00
	?debug	E
	?debug	E
sort_out_pitch_bend	endp
   ;	
   ;	int id_midi_allocate_voice(int min, int max)
   ;	
	?debug	L 445
	assume	cs:TMIDI_TEXT
_id_midi_allocate_voice	proc	far
	?debug	B
	enter	16,0
	push	si
	push	di
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6036D6178040A080000036D696E040A060000
	mov	si,word ptr [bp+6]
	mov	di,word ptr [bp+8]
	?debug	B
   ;	
   ;	{
   ;	   long c;
   ;	   long layer;
   ;	   long voice = -1;
   ;	
	?debug	L 449
	mov	dword ptr [bp-12],large -1
   ;	
   ;	   long best_time = LONG_MAX;
   ;	
	?debug	L 450
	mov	dword ptr [bp-16],large 07FFFFFFFh
   ;	
   ;	
   ;	   if (min < 0)
   ;	
	?debug	L 452
	or	si,si
	jge	short @20@86
   ;	
   ;	      min = 0;
   ;	
	?debug	L 453
	xor	si,si
@20@86:
   ;	
   ;	
   ;	   if (max < 0)
   ;	
	?debug	L 455
	or	di,di
	jge	short @20@142
   ;	
   ;	      max = midi_driver->voices-1;
   ;	
	?debug	L 456
	les	bx,dword ptr _midi_driver
	mov	ax,word ptr es:[bx+8]
	dec	ax
	mov	di,ax
@20@142:
   ;	
   ;	
   ;	   /* which layer can we use? */
   ;	   for (layer=0; layer<MIDI_LAYERS; layer++)
   ;	
	?debug	L 459
	mov	dword ptr [bp-8],large 0
	jmp	short @20@254
@20@170:
   ;	
   ;	      if (midi_channel[midi_alloc_channel].note[midi_alloc_note][layer] < 0)
   ;	
	?debug	L 460
	mov	bx,word ptr midi_alloc_channel
	imul	bx,bx,2072
	mov	ax,word ptr midi_alloc_note
	shl	ax,4
	add	bx,ax
	mov	ax,word ptr [bp-8]
	shl	ax,2
	add	bx,ax
	cmp	dword ptr midi_channel[bx+24],large 0
	jge	short @20@226
   ;	
   ;		 break; 
   ;	
	?debug	L 461
	jmp	short @20@282
@20@226:
	?debug	L 459
	inc	dword ptr [bp-8]
@20@254:
	cmp	dword ptr [bp-8],large 4
	jl	short @20@170
@20@282:
   ;	
   ;	
   ;	   if (layer >= MIDI_LAYERS)
   ;	
	?debug	L 463
	cmp	dword ptr [bp-8],large 4
	jl	short @20@366
@20@310:
   ;	
   ;	      return -1;
   ;	
	?debug	L 464
	mov	ax,-1
@20@338:
	jmp	@20@926
@20@366:
   ;	
   ;	
   ;	   /* find a free voice */
   ;	   for (c=min; c<=max; c++) {
   ;	
	?debug	L 467
	movsx	eax,si
	mov	dword ptr [bp-4],eax
	jmp	short @20@562
@20@394:
   ;	
   ;	      if ((midi_voice[c].note < 0) && 
   ;	
	?debug	L 468
   ;	
   ;		  (midi_voice[c].time < best_time) && 
   ;		  ((c < midi_driver->xmin) || (c > midi_driver->xmax))) {
   ;	
	?debug	L 470
	mov	bx,word ptr [bp-4]
	shl	bx,4
	cmp	dword ptr midi_voice[bx+4],large 0
	jge	short @20@534
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	eax,dword ptr midi_voice[bx+12]
	cmp	eax,dword ptr [bp-16]
	jge	short @20@534
	les	bx,dword ptr _midi_driver
	movsx	eax,word ptr es:[bx+16]
	cmp	eax,dword ptr [bp-4]
	jg	short @20@506
	les	bx,dword ptr _midi_driver
	movsx	eax,word ptr es:[bx+18]
	cmp	eax,dword ptr [bp-4]
	jge	short @20@534
@20@506:
   ;	
   ;		 voice = c;
   ;	
	?debug	L 471
	mov	eax,dword ptr [bp-4]
	mov	dword ptr [bp-12],eax
   ;	
   ;		 best_time = midi_voice[c].time;
   ;	
	?debug	L 472
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	eax,dword ptr midi_voice[bx+12]
	mov	dword ptr [bp-16],eax
@20@534:
	?debug	L 467
	inc	dword ptr [bp-4]
@20@562:
	movsx	eax,di
	cmp	eax,dword ptr [bp-4]
	jge	short @20@394
   ;	
   ;	      }
   ;	   }
   ;	
   ;	   /* if there are no free voices, kill a note to make room */
   ;	   if (voice < 0) {
   ;	
	?debug	L 477
	cmp	dword ptr [bp-12],large 0
	jl short	@@1305
	jmp	@20@898
@@1305:
   ;	
   ;	      voice = -1;
   ;	
	?debug	L 478
	mov	dword ptr [bp-12],large -1
   ;	
   ;	      best_time = LONG_MAX;
   ;	
	?debug	L 479
	mov	dword ptr [bp-16],large 07FFFFFFFh
   ;	
   ;	      for (c=min; c<=max; c++) {
   ;	
	?debug	L 480
	movsx	eax,si
	mov	dword ptr [bp-4],eax
	jmp	short @20@786
@20@646:
   ;	
   ;		 if ((midi_voice[c].time < best_time) && 
   ;	
	?debug	L 481
   ;	
   ;		     ((c < midi_driver->xmin) || (c > midi_driver->xmax))) {
   ;	
	?debug	L 482
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	eax,dword ptr midi_voice[bx+12]
	cmp	eax,dword ptr [bp-16]
	jge	short @20@758
	les	bx,dword ptr _midi_driver
	movsx	eax,word ptr es:[bx+16]
	cmp	eax,dword ptr [bp-4]
	jg	short @20@730
	les	bx,dword ptr _midi_driver
	movsx	eax,word ptr es:[bx+18]
	cmp	eax,dword ptr [bp-4]
	jge	short @20@758
@20@730:
   ;	
   ;		    voice = c;
   ;	
	?debug	L 483
	mov	eax,dword ptr [bp-4]
	mov	dword ptr [bp-12],eax
   ;	
   ;		    best_time = midi_voice[c].time;
   ;	
	?debug	L 484
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	eax,dword ptr midi_voice[bx+12]
	mov	dword ptr [bp-16],eax
@20@758:
	?debug	L 480
	inc	dword ptr [bp-4]
@20@786:
	movsx	eax,di
	cmp	eax,dword ptr [bp-4]
	jge	short @20@646
   ;	
   ;		 }
   ;	      }
   ;	      if (voice >= 0)
   ;	
	?debug	L 487
	cmp	dword ptr [bp-12],large 0
	jl	short @20@870
   ;	
   ;		 midi_note_off(midi_voice[voice].channel, midi_voice[voice].note);
   ;	
	?debug	L 488
	mov	bx,word ptr [bp-12]
	shl	bx,4
	push	dword ptr midi_voice[bx+4]
	mov	bx,word ptr [bp-12]
	shl	bx,4
	push	dword ptr midi_voice[bx]
	push	cs
	call	near ptr midi_note_off
	add	sp,8
	jmp	short @20@898
@20@870:
	jmp	@20@310
@20@898:
   ;	
   ;	      else
   ;		 return -1;
   ;	   }
   ;	
   ;	   /* ok, we got it... */
   ;	   midi_voice[voice].channel = midi_alloc_channel;
   ;	
	?debug	L 494
	mov	bx,word ptr [bp-12]
	shl	bx,4
	mov	eax,dword ptr midi_alloc_channel
	mov	dword ptr midi_voice[bx],eax
   ;	
   ;	   midi_voice[voice].note = midi_alloc_note;
   ;	
	?debug	L 495
	mov	bx,word ptr [bp-12]
	shl	bx,4
	mov	eax,dword ptr midi_alloc_note
	mov	dword ptr midi_voice[bx+4],eax
   ;	
   ;	   midi_voice[voice].volume = midi_alloc_vol;
   ;	
	?debug	L 496
	mov	bx,word ptr [bp-12]
	shl	bx,4
	mov	eax,dword ptr midi_alloc_vol
	mov	dword ptr midi_voice[bx+8],eax
   ;	
   ;	   midi_voice[voice].time = _midi_tick;
   ;	
	?debug	L 497
	mov	bx,word ptr [bp-12]
	shl	bx,4
	mov	eax,dword ptr __midi_tick
	mov	dword ptr midi_voice[bx+12],eax
   ;	
   ;	   midi_channel[midi_alloc_channel].note[midi_alloc_note][layer] = voice; 
   ;	
	?debug	L 498
	mov	bx,word ptr midi_alloc_channel
	imul	bx,bx,2072
	mov	ax,word ptr midi_alloc_note
	shl	ax,4
	add	bx,ax
	mov	ax,word ptr [bp-8]
	shl	ax,2
	add	bx,ax
	mov	eax,dword ptr [bp-12]
	mov	dword ptr midi_channel[bx+24],eax
   ;	
   ;	
   ;	   return voice + midi_driver->basevoice;
   ;	
	?debug	L 500
	les	bx,dword ptr _midi_driver
	mov	ax,word ptr [bp-12]
	add	ax,word ptr es:[bx+10]
	jmp	@20@338
@20@926:
   ;	
   ;	}
   ;	
	?debug	L 501
	pop	ds
	pop	di
	pop	si
	leave	
	ret	
	?debug	C E609626573745F74696D650602F0FF0005766F69+
	?debug	C 63650602F4FF00056C617965720602F8FF000163+
	?debug	C 0602FCFF00036D696E040C0600036D6178040C07+
	?debug	C 00
	?debug	E
	?debug	E
_id_midi_allocate_voice	endp
   ;	
   ;	static void midi_note_on(long channel, long note, long vol, long polite)
   ;	
	?debug	L 509
	assume	cs:TMIDI_TEXT
midi_note_on	proc	far
	?debug	B
	enter	20,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E606706F6C697465060A12000003766F6C060A0E+
	?debug	C 0000046E6F7465060A0A0000076368616E6E656C+
	?debug	C 060A060000
	?debug	B
   ;	
   ;	{
   ;	   long c, layer, inst, bend, corrected_note;
   ;	
   ;	   /* it's easy if the driver can handle raw MIDI data */
   ;	   if (midi_driver->raw_midi) {
   ;	
	?debug	L 514
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @21@142
   ;	
   ;	      if (channel != 9)
   ;	
	?debug	L 515
	cmp	dword ptr [bp+6],large 9
	je	short @21@114
   ;	
   ;		 note += patch_table[midi_channel[channel].patch].pitch;
   ;	
	?debug	L 516
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	bx,word ptr midi_channel[bx]
	shl	bx,4
	mov	eax,dword ptr patch_table[bx+12]
	add	dword ptr [bp+10],eax
@21@114:
   ;	
   ;	
   ;	      midi_driver->raw_midi(0x90+channel);
   ;	
	?debug	L 518
	mov	al,byte ptr [bp+6]
	add	al,144
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(note);
   ;	
	?debug	L 519
	mov	al,byte ptr [bp+10]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(vol);
   ;	
	?debug	L 520
	mov	al,byte ptr [bp+14]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      return;
   ;	
	?debug	L 521
	jmp	@21@898
@21@142:
   ;	
   ;	   }
   ;	
   ;	   /* if the note is already on, turn it off */
   ;	   for (layer=0; layer<MIDI_LAYERS; layer++) {
   ;	
	?debug	L 525
	mov	dword ptr [bp-8],large 0
	jmp	short @21@254
@21@170:
   ;	
   ;	      if (midi_channel[channel].note[note][layer] >= 0) {
   ;	
	?debug	L 526
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	ax,word ptr [bp+10]
	shl	ax,4
	add	bx,ax
	mov	ax,word ptr [bp-8]
	shl	ax,2
	add	bx,ax
	cmp	dword ptr midi_channel[bx+24],large 0
	jl	short @21@226
   ;	
   ;		 midi_note_off(channel, note);
   ;	
	?debug	L 527
	push	dword ptr [bp+10]
	push	dword ptr [bp+6]
	push	cs
	call	near ptr midi_note_off
	add	sp,8
   ;	
   ;		 return;
   ;	
	?debug	L 528
	jmp	@21@898
@21@226:
	?debug	L 525
	inc	dword ptr [bp-8]
@21@254:
	cmp	dword ptr [bp-8],large 4
	jl	short @21@170
   ;	
   ;	      }
   ;	   }
   ;	
   ;	   /* if zero volume and the note isn't playing, we can just ignore it */
   ;	   if (vol == 0)
   ;	
	?debug	L 533
	cmp	dword ptr [bp+14],large 0
	jne	short @21@338
   ;	
   ;	      return;
   ;	
	?debug	L 534
	jmp	@21@898
@21@338:
   ;	
   ;	
   ;	   if (channel != 9) {
   ;	
	?debug	L 536
	cmp	dword ptr [bp+6],large 9
	jne short	@@1306
	jmp	@21@786
@@1306:
   ;	
   ;	      /* are there any free voices? */
   ;	      for (c=0; c<midi_driver->voices; c++)
   ;	
	?debug	L 538
	mov	dword ptr [bp-4],large 0
	jmp	short @21@534
@21@394:
   ;	
   ;		 if ((midi_voice[c].note < 0) && 
   ;	
	?debug	L 539
   ;	
   ;		     ((c < midi_driver->xmin) || (c > midi_driver->xmax)))
   ;	
	?debug	L 540
	mov	bx,word ptr [bp-4]
	shl	bx,4
	cmp	dword ptr midi_voice[bx+4],large 0
	jge	short @21@506
	les	bx,dword ptr _midi_driver
	movsx	eax,word ptr es:[bx+16]
	cmp	eax,dword ptr [bp-4]
	jg	short @21@478
	les	bx,dword ptr _midi_driver
	movsx	eax,word ptr es:[bx+18]
	cmp	eax,dword ptr [bp-4]
	jge	short @21@506
@21@478:
   ;	
   ;		    break;
   ;	
	?debug	L 541
	jmp	short @21@562
@21@506:
	?debug	L 538
	inc	dword ptr [bp-4]
@21@534:
	les	bx,dword ptr _midi_driver
	movsx	eax,word ptr es:[bx+8]
	cmp	eax,dword ptr [bp-4]
	jg	short @21@394
@21@562:
   ;	
   ;	
   ;	      /* if there are no free voices, remember the note for later */
   ;	      if ((c >= midi_driver->voices) && (polite)) {
   ;	
	?debug	L 544
	les	bx,dword ptr _midi_driver
	movsx	eax,word ptr es:[bx+8]
	cmp	eax,dword ptr [bp-4]
	jg	short @21@786
	cmp	dword ptr [bp+18],large 0
	je	short @21@786
   ;	
   ;		 for (c=0; c<MIDI_VOICES; c++) {
   ;	
	?debug	L 545
	mov	dword ptr [bp-4],large 0
	jmp	short @21@730
@21@646:
   ;	
   ;		    if (midi_waiting[c].note < 0) {
   ;	
	?debug	L 546
	mov	bx,word ptr [bp-4]
	imul	bx,bx,12
	cmp	dword ptr midi_waiting[bx+4],large 0
	jge	short @21@702
   ;	
   ;		       midi_waiting[c].channel = channel;
   ;	
	?debug	L 547
	mov	bx,word ptr [bp-4]
	imul	bx,bx,12
	mov	eax,dword ptr [bp+6]
	mov	dword ptr midi_waiting[bx],eax
   ;	
   ;		       midi_waiting[c].note = note;
   ;	
	?debug	L 548
	mov	bx,word ptr [bp-4]
	imul	bx,bx,12
	mov	eax,dword ptr [bp+10]
	mov	dword ptr midi_waiting[bx+4],eax
   ;	
   ;		       midi_waiting[c].volume = vol;
   ;	
	?debug	L 549
	mov	bx,word ptr [bp-4]
	imul	bx,bx,12
	mov	eax,dword ptr [bp+14]
	mov	dword ptr midi_waiting[bx+8],eax
   ;	
   ;		       break;
   ;	
	?debug	L 550
	jmp	short @21@758
@21@702:
	?debug	L 545
	inc	dword ptr [bp-4]
@21@730:
	cmp	dword ptr [bp-4],large 32
	jl	short @21@646
@21@758:
   ;	
   ;		    }
   ;		 }
   ;		 return;
   ;	
	?debug	L 553
	jmp	@21@898
@21@786:
   ;	
   ;	      }
   ;	   }
   ;	
   ;	   /* drum sound? */
   ;	   if (channel == 9) {
   ;	
	?debug	L 558
	cmp	dword ptr [bp+6],large 9
	jne	short @21@842
   ;	
   ;	      inst = 128+note;
   ;	
	?debug	L 559
	mov	eax,dword ptr [bp+10]
	add	eax,large 128
	mov	dword ptr [bp-12],eax
   ;	
   ;	      corrected_note = 60;
   ;	
	?debug	L 560
	mov	dword ptr [bp-20],large 60
   ;	
   ;	      bend = 0;
   ;	
	?debug	L 561
	mov	dword ptr [bp-16],large 0
   ;	
   ;	   }
   ;	
	?debug	L 562
	jmp	short @21@870
@21@842:
   ;	
   ;	   else {
   ;	      inst = midi_channel[channel].patch;
   ;	
	?debug	L 564
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx]
	mov	dword ptr [bp-12],eax
   ;	
   ;	      corrected_note = note;
   ;	
	?debug	L 565
	mov	eax,dword ptr [bp+10]
	mov	dword ptr [bp-20],eax
   ;	
   ;	      bend = midi_channel[channel].pitch_bend;
   ;	
	?debug	L 566
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+12]
	mov	dword ptr [bp-16],eax
   ;	
   ;	      sort_out_pitch_bend(&bend, &corrected_note);
   ;	
	?debug	L 567
	push	ss
	lea	ax,word ptr [bp-20]
	push	ax
	push	ss
	lea	ax,word ptr [bp-16]
	push	ax
	push	cs
	call	near ptr sort_out_pitch_bend
	add	sp,8
@21@870:
   ;	
   ;	   }
   ;	
   ;	   /* play the note */
   ;	   midi_alloc_channel = channel;
   ;	
	?debug	L 571
	mov	eax,dword ptr [bp+6]
	mov	dword ptr midi_alloc_channel,eax
   ;	
   ;	   midi_alloc_note = note;
   ;	
	?debug	L 572
	mov	eax,dword ptr [bp+10]
	mov	dword ptr midi_alloc_note,eax
   ;	
   ;	   midi_alloc_vol = vol;
   ;	
	?debug	L 573
	mov	eax,dword ptr [bp+14]
	mov	dword ptr midi_alloc_vol,eax
   ;	
   ;	
   ;	   midi_driver->key_on(inst, corrected_note, bend, 
   ;	
	?debug	L 575
   ;	
   ;			       sort_out_volume(channel, vol), 
   ;			       midi_channel[channel].pan);
   ;	
	?debug	L 577
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	push	word ptr midi_channel[bx+8]
	push	dword ptr [bp+14]
	push	dword ptr [bp+6]
	push	cs
	call	near ptr sort_out_volume
	add	sp,8
	push	ax
	push	word ptr [bp-16]
	push	word ptr [bp-20]
	push	word ptr [bp-12]
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+48]
	add	sp,10
@21@898:
   ;	
   ;	}
   ;	
	?debug	L 578
	pop	ds
	leave	
	ret	
	?debug	C E60E636F727265637465645F6E6F74650602ECFF+
	?debug	C 000462656E640602F0FF0004696E73740602F4FF+
	?debug	C 00056C617965720602F8FF0001630602FCFF0007+
	?debug	C 6368616E6E656C060A060000046E6F7465060A0A+
	?debug	C 000003766F6C060A0E000006706F6C697465060A+
	?debug	C 120000
	?debug	E
	?debug	E
midi_note_on	endp
   ;	
   ;	static void all_notes_off(long channel)
   ;	
	?debug	L 584
	assume	cs:TMIDI_TEXT
all_notes_off	proc	far
	?debug	B
	enter	8,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6076368616E6E656C060A060000
	?debug	B
   ;	
   ;	{
   ;	   if (midi_driver->raw_midi) {
   ;	
	?debug	L 586
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @22@114
   ;	
   ;	      midi_driver->raw_midi(0xB0+channel);
   ;	
	?debug	L 587
	mov	al,byte ptr [bp+6]
	add	al,176
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(123);
   ;	
	?debug	L 588
	push	123
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(0);
   ;	
	?debug	L 589
	push	0
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      return;
   ;	
	?debug	L 590
	jmp	short @22@338
   ;	
   ;	   }
   ;	
	?debug	L 591
	jmp	short @22@338
@22@114:
	?debug	B
   ;	
   ;	   else {
   ;	      long note, layer;
   ;	
   ;	      for (note=0; note<128; note++)
   ;	
	?debug	L 595
	mov	dword ptr [bp-4],large 0
	jmp	short @22@310
@22@142:
   ;	
   ;		 for (layer=0; layer<MIDI_LAYERS; layer++)
   ;	
	?debug	L 596
	mov	dword ptr [bp-8],large 0
	jmp	short @22@254
@22@170:
   ;	
   ;		    if (midi_channel[channel].note[note][layer] >= 0)
   ;	
	?debug	L 597
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	ax,word ptr [bp-4]
	shl	ax,4
	add	bx,ax
	mov	ax,word ptr [bp-8]
	shl	ax,2
	add	bx,ax
	cmp	dword ptr midi_channel[bx+24],large 0
	jl	short @22@226
   ;	
   ;		       midi_note_off(channel, note);
   ;	
	?debug	L 598
	push	dword ptr [bp-4]
	push	dword ptr [bp+6]
	push	cs
	call	near ptr midi_note_off
	add	sp,8
@22@226:
	?debug	L 596
	inc	dword ptr [bp-8]
@22@254:
	cmp	dword ptr [bp-8],large 4
	jl	short @22@170
	?debug	L 595
	inc	dword ptr [bp-4]
@22@310:
	cmp	dword ptr [bp-4],large 128
	jl	short @22@142
@22@338:
	?debug	C E6056C617965720602F8FF00046E6F74650602FC+
	?debug	C FF00
	?debug	E
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 600
	pop	ds
	leave	
	ret	
	?debug	C E6076368616E6E656C060A060000
	?debug	E
	?debug	E
all_notes_off	endp
   ;	
   ;	static void reset_controllers(long channel)
   ;	
	?debug	L 606
	assume	cs:TMIDI_TEXT
reset_controllers	proc	far
	?debug	B
	enter	4,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6076368616E6E656C060A060000
	?debug	B
   ;	
   ;	{
   ;	   midi_channel[channel].new_volume = 128;
   ;	
	?debug	L 608
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+16],large 128
   ;	
   ;	   midi_channel[channel].new_pitch_bend = 0x2000;
   ;	
	?debug	L 609
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+20],large 8192
   ;	
   ;	
   ;	   switch (channel % 3) {
   ;	
	?debug	L 611
	mov	eax,dword ptr [bp+6]
	mov	ebx,large 3
	cdq	
	idiv	ebx
	mov	dword ptr [bp-4],edx
	mov	cx,3
	mov	bx,offset @23@C338
@23@114:
	mov	eax,dword ptr cs:[bx]
	cmp	eax,dword ptr [bp-4]
	je	short @23@198
	add	bx,4
	loop	short @23@114
	jmp	short @23@394
@23@198:
	add	cx,cx
	add	bx,cx
	jmp	word ptr cs:[bx+6]
@23@226:
   ;	
   ;	      case 0:  midi_channel[channel].pan = ((channel/3) & 1) ? 60 : 68; break;
   ;	
	?debug	L 612
	mov	eax,dword ptr [bp+6]
	mov	ebx,large 3
	cdq	
	idiv	ebx
	test	eax,large 1
	je	short @23@282
	mov	ax,60
	jmp	short @23@310
@23@282:
	mov	ax,68
@23@310:
	movsx	eax,ax
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+8],eax
	jmp	short @23@394
@23@338:
   ;	
   ;	      case 1:  midi_channel[channel].pan = 104; break;
   ;	
	?debug	L 613
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+8],large 104
	jmp	short @23@394
@23@366:
   ;	
   ;	      case 2:  midi_channel[channel].pan = 24; break;
   ;	
	?debug	L 614
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+8],large 24
	jmp	short @23@394
@23@394:
   ;	
   ;	   }
   ;	
   ;	   if (midi_driver->raw_midi) {
   ;	
	?debug	L 617
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @23@450
   ;	
   ;	      midi_driver->raw_midi(0xB0+channel);
   ;	
	?debug	L 618
	mov	al,byte ptr [bp+6]
	add	al,176
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(10);
   ;	
	?debug	L 619
	push	10
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	      midi_driver->raw_midi(midi_channel[channel].pan);
   ;	
	?debug	L 620
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	al,byte ptr midi_channel[bx+8]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
@23@450:
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 622
	pop	ds
	leave	
	ret	
	?debug	C E6076368616E6E656C060A060000
	?debug	E
	?debug	E
reset_controllers	endp
@23@C338	label	word
	db	0
	db	0
	db	0
	db	0
	db	1
	db	0
	db	0
	db	0
	db	2
	db	0
	db	0
	db	0
	dw	@23@226
	dw	@23@338
	dw	@23@366
   ;	
   ;	static void update_controllers()
   ;	
	?debug	L 628
	assume	cs:TMIDI_TEXT
update_controllers	proc	far
	?debug	B
	enter	16,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
   ;	
   ;	{
   ;	   long c, c2;
   ;	
   ;	   for (c=0; c<16; c++) {
   ;	
	?debug	L 632
	mov	dword ptr [bp-4],large 0
	jmp	@24@618
@24@58:
   ;	
   ;	      /* check for volume controller change */
   ;	      if ((midi_channel[c].volume != midi_channel[c].new_volume) ||
   ;	
	?debug	L 634
   ;	
   ;		  (old_midi_volume != id_midi_volume)) {
   ;	
	?debug	L 635
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+4]
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	cmp	eax,dword ptr midi_channel[bx+16]
	jne	short @24@114
	movsx	eax,word ptr _id_midi_volume
	cmp	eax,dword ptr old_midi_volume
	jne short	@@1307
	jmp	@24@338
@@1307:
@24@114:
   ;	
   ;		 midi_channel[c].volume = midi_channel[c].new_volume;
   ;	
	?debug	L 636
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+16]
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+4],eax
   ;	
   ;		 if (midi_driver->raw_midi) {
   ;	
	?debug	L 637
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @24@170
   ;	
   ;		    midi_driver->raw_midi(0xB0+c);
   ;	
	?debug	L 638
	mov	al,byte ptr [bp-4]
	add	al,176
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		    midi_driver->raw_midi(7);
   ;	
	?debug	L 639
	push	7
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		    midi_driver->raw_midi(global_volume_fix(midi_channel[c].volume-1));
   ;	
	?debug	L 640
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+4]
	dec	eax
	push	eax
	push	cs
	call	near ptr global_volume_fix
	add	sp,4
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		 }
   ;	
	?debug	L 641
	jmp	short @24@338
@24@170:
   ;	
   ;		 else {
   ;		    for (c2=0; c2<MIDI_VOICES; c2++) {
   ;	
	?debug	L 643
	mov	dword ptr [bp-8],large 0
	jmp	short @24@310
@24@198:
   ;	
   ;		       if ((midi_voice[c2].channel == c) &&
   ;	
	?debug	L 644
   ;	
   ;			  (midi_voice[c2].note >= 0)) {
   ;	
	?debug	L 645
	mov	bx,word ptr [bp-8]
	shl	bx,4
	mov	eax,dword ptr midi_voice[bx]
	cmp	eax,dword ptr [bp-4]
	jne	short @24@282
	mov	bx,word ptr [bp-8]
	shl	bx,4
	cmp	dword ptr midi_voice[bx+4],large 0
	jl	short @24@282
	?debug	B
   ;	
   ;			  long vol = sort_out_volume(c, midi_voice[c2].volume);
   ;	
	?debug	L 646
	mov	bx,word ptr [bp-8]
	shl	bx,4
	push	dword ptr midi_voice[bx+8]
	push	dword ptr [bp-4]
	push	cs
	call	near ptr sort_out_volume
	push	dx
	push	ax
	pop	eax
	add	sp,8
	mov	dword ptr [bp-12],eax
   ;	
   ;			  midi_driver->set_volume(c2 + midi_driver->basevoice, vol);
   ;	
	?debug	L 647
	push	word ptr [bp-12]
	les	bx,dword ptr _midi_driver
	mov	ax,word ptr [bp-8]
	add	ax,word ptr es:[bx+10]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+56]
	add	sp,4
@24@282:
	?debug	C E603766F6C0602F4FF00
	?debug	E
	?debug	L 643
	inc	dword ptr [bp-8]
@24@310:
	cmp	dword ptr [bp-8],large 32
	jl	short @24@198
@24@338:
   ;	
   ;		       }
   ;		    }
   ;		 }
   ;	      }
   ;	
   ;	      /* check for pitch bend change */
   ;	      if (midi_channel[c].pitch_bend != midi_channel[c].new_pitch_bend) {
   ;	
	?debug	L 654
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+12]
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	cmp	eax,dword ptr midi_channel[bx+20]
	jne short	@@1308
	jmp	@24@590
@@1308:
   ;	
   ;		 midi_channel[c].pitch_bend = midi_channel[c].new_pitch_bend;
   ;	
	?debug	L 655
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+20]
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+12],eax
   ;	
   ;		 if (midi_driver->raw_midi) {
   ;	
	?debug	L 656
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @24@422
   ;	
   ;		    midi_driver->raw_midi(0xE0+c);
   ;	
	?debug	L 657
	mov	al,byte ptr [bp-4]
	add	al,224
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		    midi_driver->raw_midi(midi_channel[c].pitch_bend & 0x7F);
   ;	
	?debug	L 658
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	al,byte ptr midi_channel[bx+12]
	and	al,127
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		    midi_driver->raw_midi(midi_channel[c].pitch_bend >> 7);
   ;	
	?debug	L 659
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+12]
	sar	eax,7
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		 }
   ;	
	?debug	L 660
	jmp	@24@590
@24@422:
   ;	
   ;		 else {
   ;		    for (c2=0; c2<MIDI_VOICES; c2++) {
   ;	
	?debug	L 662
	mov	dword ptr [bp-8],large 0
	jmp	short @24@562
@24@450:
   ;	
   ;		       if ((midi_voice[c2].channel == c) &&
   ;	
	?debug	L 663
   ;	
   ;			  (midi_voice[c2].note >= 0)) {
   ;	
	?debug	L 664
	mov	bx,word ptr [bp-8]
	shl	bx,4
	mov	eax,dword ptr midi_voice[bx]
	cmp	eax,dword ptr [bp-4]
	jne	short @24@534
	mov	bx,word ptr [bp-8]
	shl	bx,4
	cmp	dword ptr midi_voice[bx+4],large 0
	jl	short @24@534
	?debug	B
   ;	
   ;			  long bend = midi_channel[c].pitch_bend;
   ;	
	?debug	L 665
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+12]
	mov	dword ptr [bp-12],eax
   ;	
   ;			  long note = midi_voice[c2].note;
   ;	
	?debug	L 666
	mov	bx,word ptr [bp-8]
	shl	bx,4
	mov	eax,dword ptr midi_voice[bx+4]
	mov	dword ptr [bp-16],eax
   ;	
   ;			  sort_out_pitch_bend(&bend, &note);
   ;	
	?debug	L 667
	push	ss
	lea	ax,word ptr [bp-16]
	push	ax
	push	ss
	lea	ax,word ptr [bp-12]
	push	ax
	push	cs
	call	near ptr sort_out_pitch_bend
	add	sp,8
   ;	
   ;			  midi_driver->set_pitch(c2 + midi_driver->basevoice, note, bend);
   ;	
	?debug	L 668
	push	word ptr [bp-12]
	push	word ptr [bp-16]
	les	bx,dword ptr _midi_driver
	mov	ax,word ptr [bp-8]
	add	ax,word ptr es:[bx+10]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+60]
	add	sp,6
@24@534:
	?debug	C E6046E6F74650602F0FF000462656E640602F4FF+
	?debug	C 00
	?debug	E
	?debug	L 662
	inc	dword ptr [bp-8]
@24@562:
	cmp	dword ptr [bp-8],large 32
	jge short	@@1309
	jmp	@24@450
@@1309:
@24@590:
	?debug	L 632
	inc	dword ptr [bp-4]
@24@618:
	cmp	dword ptr [bp-4],large 16
	jge short	@@1310
	jmp	@24@58
@@1310:
   ;	
   ;		       }
   ;		    }
   ;		 }
   ;	      }
   ;	   }
   ;	
   ;	   old_midi_volume = id_midi_volume;
   ;	
	?debug	L 675
	movsx	eax,word ptr _id_midi_volume
	mov	dword ptr old_midi_volume,eax
   ;	
   ;	}
   ;	
	?debug	L 676
	pop	ds
	leave	
	ret	
	?debug	C E60263320602F8FF0001630602FCFF00
	?debug	E
	?debug	E
update_controllers	endp
   ;	
   ;	static void process_controller(long channel, long ctrl, long data)
   ;	
	?debug	L 682
	assume	cs:TMIDI_TEXT
process_controller	proc	far
	?debug	B
	enter	4,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E60464617461060A0E0000046374726C060A0A00+
	?debug	C 00076368616E6E656C060A060000
	?debug	B
   ;	
   ;	{
   ;	   switch (ctrl) {
   ;	
	?debug	L 684
	mov	eax,dword ptr [bp+10]
	mov	dword ptr [bp-4],eax
	mov	cx,8
	mov	bx,offset @25@C338
@25@86:
	mov	eax,dword ptr cs:[bx]
	cmp	eax,dword ptr [bp-4]
	je	short @25@170
	add	bx,4
	loop	short @25@86
	jmp	@25@394
@25@170:
	add	cx,cx
	add	bx,cx
	jmp	word ptr cs:[bx+16]
@25@198:
   ;	
   ;	
   ;	      case 7:                                   /* main volume */
   ;		 midi_channel[channel].new_volume = data+1;
   ;	
	?debug	L 687
	mov	eax,dword ptr [bp+14]
	inc	eax
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+16],eax
   ;	
   ;		 break;
   ;	
	?debug	L 688
	jmp	short @25@394
@25@226:
   ;	
   ;	
   ;	      case 10:                                  /* pan */
   ;		 midi_channel[channel].pan = data;
   ;	
	?debug	L 691
	mov	bx,word ptr [bp+6]
	imul	bx,bx,2072
	mov	eax,dword ptr [bp+14]
	mov	dword ptr midi_channel[bx+8],eax
   ;	
   ;		 if (midi_driver->raw_midi) {
   ;	
	?debug	L 692
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @25@282
   ;	
   ;		    midi_driver->raw_midi(0xB0+channel);
   ;	
	?debug	L 693
	mov	al,byte ptr [bp+6]
	add	al,176
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		    midi_driver->raw_midi(10);
   ;	
	?debug	L 694
	push	10
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		    midi_driver->raw_midi(data);
   ;	
	?debug	L 695
	mov	al,byte ptr [bp+14]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
@25@282:
   ;	
   ;		 }
   ;		 break;
   ;	
	?debug	L 697
	jmp	short @25@394
@25@310:
   ;	
   ;	
   ;	      case 121:                                 /* reset all controllers */
   ;		 reset_controllers(channel);
   ;	
	?debug	L 700
	push	dword ptr [bp+6]
	push	cs
	call	near ptr reset_controllers
	jmp	short @25@366
@25@338:
   ;	
   ;		 break;
   ;	
   ;	      case 123:                                 /* all notes off */
   ;	      case 124:                                 /* omni mode off */
   ;	      case 125:                                 /* omni mode on */
   ;	      case 126:                                 /* poly mode off */
   ;	      case 127:                                 /* poly mode on */
   ;		 all_notes_off(channel);
   ;	
	?debug	L 708
	push	dword ptr [bp+6]
	push	cs
	call	near ptr all_notes_off
@25@366:
	add	sp,4
   ;	
   ;		 break;
   ;	
	?debug	L 709
	jmp	short @25@394
@25@394:
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 711
	pop	ds
	leave	
	ret	
	?debug	C E6076368616E6E656C060A060000046374726C06+
	?debug	C 0A0A00000464617461060A0E0000
	?debug	E
	?debug	E
process_controller	endp
@25@C338	label	word
	db	7
	db	0
	db	0
	db	0
	db	10
	db	0
	db	0
	db	0
	db	121
	db	0
	db	0
	db	0
	db	123
	db	0
	db	0
	db	0
	db	124
	db	0
	db	0
	db	0
	db	125
	db	0
	db	0
	db	0
	db	126
	db	0
	db	0
	db	0
	db	127
	db	0
	db	0
	db	0
	dw	@25@198
	dw	@25@226
	dw	@25@310
	dw	@25@338
	dw	@25@338
	dw	@25@338
	dw	@25@338
	dw	@25@338
   ;	
   ;	static void process_meta_event(unsigned char **pos, long *timer)
   ;	
	?debug	L 717
	assume	cs:TMIDI_TEXT
process_meta_event	proc	far
	?debug	B
	enter	10,0
	push	si
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E60574696D6572240A0A000003706F73230A0600+
	?debug	C 00
	?debug	B
   ;	
   ;	{
   ;	   unsigned char metatype = *((*pos)++);
   ;	
	?debug	L 719
	les	bx,dword ptr [bp+6]
	mov	ax,word ptr es:[bx+2]
	mov	si,word ptr es:[bx]
	inc	word ptr es:[bx]
	mov	es,ax
	mov	al,byte ptr es:[si]
	mov	byte ptr [bp-1],al
   ;	
   ;	   long length = parse_var_len(pos);
   ;	
	?debug	L 720
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	push	cs
	call	near ptr parse_var_len
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	dword ptr [bp-6],eax
   ;	
   ;	   long tempo;
   ;	
   ;	   if (midi_meta_callback)
   ;	
	?debug	L 723
	cmp	dword ptr _midi_meta_callback,large 0
	je	short @26@86
   ;	
   ;	      midi_meta_callback(metatype, *pos, length);
   ;	
	?debug	L 724
	push	dword ptr [bp-6]
	les	bx,dword ptr [bp+6]
	push	word ptr es:[bx+2]
	push	word ptr es:[bx]
	mov	al,byte ptr [bp-1]
	mov	ah,0
	movsx	eax,ax
	push	eax
	call	dword ptr _midi_meta_callback
	add	sp,12
@26@86:
   ;	
   ;	
   ;	   if (metatype == 0x2F) {                      /* end of track */
   ;	
	?debug	L 726
	cmp	byte ptr [bp-1],47
	jne	short @26@142
   ;	
   ;	      *pos = NULL;
   ;	
	?debug	L 727
	les	bx,dword ptr [bp+6]
	mov	dword ptr es:[bx],large 0
   ;	
   ;	      *timer = LONG_MAX;
   ;	
	?debug	L 728
	les	bx,dword ptr [bp+10]
	mov	dword ptr es:[bx],large 07FFFFFFFh
   ;	
   ;	      return;
   ;	
	?debug	L 729
	jmp	@26@226
@26@142:
   ;	
   ;	   }
   ;	
   ;	   if (metatype == 0x51) {                      /* tempo change */
   ;	
	?debug	L 732
	cmp	byte ptr [bp-1],81
	jne	short @26@198
   ;	
   ;	      tempo = (*pos)[0] * 0x10000L + (*pos)[1] * 0x100 + (*pos)[2];
   ;	
	?debug	L 733
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	al,byte ptr es:[bx]
	mov	ah,0
	movsx	eax,ax
	shl	eax,16
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	dl,byte ptr es:[bx+1]
	mov	dh,0
	shl	dx,8
	movsx	edx,dx
	add	eax,edx
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	dl,byte ptr es:[bx+2]
	mov	dh,0
	movsx	edx,dx
	add	eax,edx
	mov	dword ptr [bp-10],eax
   ;	
   ;	      midi_new_speed = (tempo/1000) * (TIMERS_PER_SECOND/1000);
   ;	
	?debug	L 734
	mov	eax,dword ptr [bp-10]
	mov	ebx,large 1000
	cdq	
	idiv	ebx
	imul	eax,large 1193
	mov	dword ptr midi_new_speed,eax
   ;	
   ;	      midi_new_speed /= midifile->divisions;
   ;	
	?debug	L 735
	les	bx,dword ptr midifile
	movsx	ebx,word ptr es:[bx]
	mov	eax,dword ptr midi_new_speed
	cdq	
	idiv	ebx
	mov	dword ptr midi_new_speed,eax
@26@198:
   ;	
   ;	   }
   ;	
   ;	   (*pos) += length;
   ;	
	?debug	L 738
	les	bx,dword ptr [bp+6]
	mov	ax,word ptr [bp-6]
	add	word ptr es:[bx],ax
@26@226:
   ;	
   ;	}
   ;	
	?debug	L 739
	pop	ds
	pop	si
	leave	
	ret	
	?debug	C E60574656D706F0602F6FF00066C656E67746806+
	?debug	C 02FAFF00086D657461747970650802FFFF000370+
	?debug	C 6F73230A0600000574696D6572240A0A0000
	?debug	E
	?debug	E
process_meta_event	endp
   ;	
   ;	static void process_midi_event(unsigned char **pos, unsigned char *running_status, long *timer)
   ;	
	?debug	L 745
	assume	cs:TMIDI_TEXT
process_midi_event	proc	far
	?debug	B
	enter	12,0
	push	si
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E60574696D6572240A0E00000E72756E6E696E67+
	?debug	C 5F7374617475731B0A0A000003706F73230A0600+
	?debug	C 00
	?debug	B
   ;	
   ;	{
   ;	   unsigned char byte1, byte2; 
   ;	   long channel;
   ;	   unsigned char event;
   ;	   long l;
   ;	
   ;	   event = *((*pos)++); 
   ;	
	?debug	L 752
	les	bx,dword ptr [bp+6]
	mov	ax,word ptr es:[bx+2]
	mov	si,word ptr es:[bx]
	inc	word ptr es:[bx]
	mov	es,ax
	mov	al,byte ptr es:[si]
	mov	byte ptr [bp-7],al
   ;	
   ;	
   ;	   if (event & 0x80) {                          /* regular message */
   ;	
	?debug	L 754
	test	byte ptr [bp-7],128
	je	short @27@198
   ;	
   ;	      /* no running status for sysex and meta-events! */
   ;	      if ((event != 0xF0) && (event != 0xF7) && (event != 0xFF))
   ;	
	?debug	L 756
	cmp	byte ptr [bp-7],240
	je	short @27@170
	cmp	byte ptr [bp-7],247
	je	short @27@170
	cmp	byte ptr [bp-7],255
	je	short @27@170
   ;	
   ;		 *running_status = event;
   ;	
	?debug	L 757
	les	bx,dword ptr [bp+10]
	mov	al,byte ptr [bp-7]
	mov	byte ptr es:[bx],al
@27@170:
   ;	
   ;	      byte1 = (*pos)[0];
   ;	
	?debug	L 758
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	al,byte ptr es:[bx]
	mov	byte ptr [bp-1],al
   ;	
   ;	      byte2 = (*pos)[1];
   ;	
	?debug	L 759
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	al,byte ptr es:[bx+1]
	mov	byte ptr [bp-2],al
   ;	
   ;	   }
   ;	
	?debug	L 760
	jmp	short @27@226
@27@198:
   ;	
   ;	   else {                                       /* use running status */
   ;	      byte1 = event; 
   ;	
	?debug	L 762
	mov	al,byte ptr [bp-7]
	mov	byte ptr [bp-1],al
   ;	
   ;	      byte2 = (*pos)[0];
   ;	
	?debug	L 763
	les	bx,dword ptr [bp+6]
	les	bx,dword ptr es:[bx]
	mov	al,byte ptr es:[bx]
	mov	byte ptr [bp-2],al
   ;	
   ;	      event = *running_status; 
   ;	
	?debug	L 764
	les	bx,dword ptr [bp+10]
	mov	al,byte ptr es:[bx]
	mov	byte ptr [bp-7],al
   ;	
   ;	      (*pos)--;
   ;	
	?debug	L 765
	les	bx,dword ptr [bp+6]
	dec	word ptr es:[bx]
@27@226:
   ;	
   ;	   }
   ;	
   ;	   /* program callback? */
   ;	   if ((midi_msg_callback) && 
   ;	
	?debug	L 769
   ;	
   ;	       (event != 0xF0) && (event != 0xF7) && (event != 0xFF))
   ;	
	?debug	L 770
	cmp	dword ptr _midi_msg_callback,large 0
	je	short @27@366
	cmp	byte ptr [bp-7],240
	je	short @27@366
	cmp	byte ptr [bp-7],247
	je	short @27@366
	cmp	byte ptr [bp-7],255
	je	short @27@366
   ;	
   ;	      midi_msg_callback(event, byte1, byte2);
   ;	
	?debug	L 771
	mov	al,byte ptr [bp-2]
	mov	ah,0
	movsx	eax,ax
	push	eax
	mov	al,byte ptr [bp-1]
	mov	ah,0
	movsx	eax,ax
	push	eax
	mov	al,byte ptr [bp-7]
	mov	ah,0
	movsx	eax,ax
	push	eax
	call	dword ptr _midi_msg_callback
	add	sp,12
@27@366:
   ;	
   ;	   channel = event & 0x0F;
   ;	
	?debug	L 772
	mov	al,byte ptr [bp-7]
	mov	ah,0
	and	ax,15
	movsx	eax,ax
	mov	dword ptr [bp-6],eax
   ;	
   ;	   switch (event>>4) {
   ;	
	?debug	L 773
	mov	al,byte ptr [bp-7]
	mov	ah,0
	sar	ax,4
	sub	ax,8
	mov	bx,ax
	cmp	bx,7
	jbe short	@@1311
	jmp	@27@1066
@@1311:
	shl	bx,1
	jmp	word ptr cs:@27@C994[bx]
@27@478:
   ;	
   ;	      case 0x08:                                /* note off */
   ;		 midi_note_off(channel, byte1);
   ;	
	?debug	L 775
	mov	al,byte ptr [bp-1]
	mov	ah,0
	movsx	eax,ax
	push	eax
	push	dword ptr [bp-6]
	push	cs
	call	near ptr midi_note_off
	add	sp,8
@27@506:
   ;	
   ;		 (*pos) += 2;
   ;	
	?debug	L 776
	les	bx,dword ptr [bp+6]
	add	word ptr es:[bx],2
   ;	
   ;		 break;
   ;	
	?debug	L 777
	jmp	@27@1094
@27@534:
   ;	
   ;	      case 0x09:                                /* note on */
   ;		 midi_note_on(channel, byte1, byte2, 1);
   ;	
	?debug	L 779
	push	large 1
	mov	al,byte ptr [bp-2]
	mov	ah,0
	movsx	eax,ax
	push	eax
	mov	al,byte ptr [bp-1]
	mov	ah,0
	movsx	eax,ax
	push	eax
	push	dword ptr [bp-6]
	push	cs
	call	near ptr midi_note_on
	add	sp,16
   ;	
   ;		 (*pos) += 2;
   ;	
	?debug	L 780
	jmp	short @27@506
@27@562:
	jmp	short @27@506
@27@590:
   ;	
   ;		 break;
   ;	      case 0x0A:                                /* note aftertouch */
   ;		 (*pos) += 2;
   ;		 break;
   ;	      case 0x0B:                                /* control change */
   ;		 process_controller(channel, byte1, byte2);
   ;	
	?debug	L 786
	mov	al,byte ptr [bp-2]
	mov	ah,0
	movsx	eax,ax
	push	eax
	mov	al,byte ptr [bp-1]
	mov	ah,0
	movsx	eax,ax
	push	eax
	push	dword ptr [bp-6]
	push	cs
	call	near ptr process_controller
	add	sp,12
	jmp	short @27@506
@27@618:
   ;	
   ;		 (*pos) += 2;
   ;		 break;
   ;	      case 0x0C:                                /* program change */
   ;		 midi_channel[channel].patch = byte1;
   ;	
	?debug	L 790
	mov	al,byte ptr [bp-1]
	mov	ah,0
	movsx	eax,ax
	mov	bx,word ptr [bp-6]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx],eax
   ;	
   ;		 if (midi_driver->raw_midi)
   ;	
	?debug	L 791
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @27@674
   ;	
   ;		    raw_program_change(channel, byte1);
   ;	
	?debug	L 792
	mov	al,byte ptr [bp-1]
	mov	ah,0
	movsx	eax,ax
	push	eax
	push	dword ptr [bp-6]
	push	cs
	call	near ptr raw_program_change
	add	sp,8
@27@674:
	jmp	short @27@702
@27@702:
   ;	
   ;		 (*pos) += 1;
   ;		 break;
   ;	      case 0x0D:                                /* channel aftertouch */
   ;		 (*pos) += 1;
   ;	
	?debug	L 796
	les	bx,dword ptr [bp+6]
	inc	word ptr es:[bx]
   ;	
   ;		 break;
   ;	
	?debug	L 797
	jmp	@27@1094
@27@730:
   ;	
   ;	      case 0x0E:                                /* pitch bend */
   ;		 midi_channel[channel].new_pitch_bend = byte1 + (byte2<<7);
   ;	
	?debug	L 799
	mov	al,byte ptr [bp-1]
	mov	ah,0
	mov	dl,byte ptr [bp-2]
	mov	dh,0
	shl	dx,7
	add	ax,dx
	movsx	eax,ax
	mov	bx,word ptr [bp-6]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+20],eax
	jmp	@27@506
@27@758:
   ;	
   ;		 (*pos) += 2;
   ;		 break;
   ;	      case 0x0F:                                /* special event */
   ;		 switch (event) {
   ;	
	?debug	L 803
	mov	al,byte ptr [bp-7]
	mov	ah,0
	sub	ax,240
	mov	bx,ax
	cmp	bx,15
	ja	short @27@1010
	shl	bx,1
	jmp	word ptr cs:@27@C1042[bx]
@27@842:
   ;	
   ;		    case 0xF0:                          /* sysex */
   ;		    case 0xF7: 
   ;		       l = parse_var_len(pos);
   ;	
	?debug	L 806
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	push	cs
	call	near ptr parse_var_len
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	dword ptr [bp-12],eax
   ;	
   ;		       if (midi_sysex_callback)
   ;	
	?debug	L 807
	cmp	dword ptr _midi_sysex_callback,large 0
	je	short @27@898
   ;	
   ;			  midi_sysex_callback(*pos, l);
   ;	
	?debug	L 808
	push	dword ptr [bp-12]
	les	bx,dword ptr [bp+6]
	push	word ptr es:[bx+2]
	push	word ptr es:[bx]
	call	dword ptr _midi_sysex_callback
	add	sp,8
@27@898:
   ;	
   ;		       (*pos) += l;
   ;	
	?debug	L 809
	les	bx,dword ptr [bp+6]
	mov	ax,word ptr [bp-12]
	add	word ptr es:[bx],ax
   ;	
   ;		       break;
   ;	
	?debug	L 810
	jmp	short @27@1038
@27@926:
   ;	
   ;		    case 0xF2:                          /* song position */
   ;		       (*pos) += 2;
   ;	
	?debug	L 812
	les	bx,dword ptr [bp+6]
	add	word ptr es:[bx],2
   ;	
   ;		       break;
   ;	
	?debug	L 813
	jmp	short @27@1038
@27@954:
   ;	
   ;		    case 0xF3:                          /* song select */
   ;		       (*pos)++;
   ;	
	?debug	L 815
	les	bx,dword ptr [bp+6]
	inc	word ptr es:[bx]
   ;	
   ;		       break;
   ;	
	?debug	L 816
	jmp	short @27@1038
@27@982:
   ;	
   ;		    case 0xFF:                          /* meta-event */
   ;		       process_meta_event(pos, timer);
   ;	
	?debug	L 818
	push	word ptr [bp+16]
	push	word ptr [bp+14]
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	push	cs
	call	near ptr process_meta_event
	add	sp,8
   ;	
   ;		       break;
   ;	
	?debug	L 819
	jmp	short @27@1038
@27@1010:
   ;	
   ;		    default:
   ;		       /* the other special events don't have any data bytes,
   ;			  so we don't need to bother skipping past them */
   ;		       break;
   ;	
	?debug	L 823
	jmp	short @27@1038
@27@1038:
   ;	
   ;		 }
   ;		 break;
   ;	
	?debug	L 825
	jmp	short @27@1094
@27@1066:
   ;	
   ;	      default:
   ;		 /* something has gone badly wrong if we ever get to here */
   ;		 break;
   ;	
	?debug	L 828
	jmp	short @27@1094
@27@1094:
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 830
	pop	ds
	pop	si
	leave	
	ret	
	?debug	C E6016C0602F4FF00056576656E740802F9FF0007+
	?debug	C 6368616E6E656C0602FAFF000562797465320802+
	?debug	C FEFF000562797465310802FFFF0003706F73230A+
	?debug	C 0600000E72756E6E696E675F7374617475731B0A+
	?debug	C 0A00000574696D6572240A0E0000
	?debug	E
	?debug	E
process_midi_event	endp
@27@C1042	label	word
	dw	@27@842
	dw	@27@1010
	dw	@27@926
	dw	@27@954
	dw	@27@1010
	dw	@27@1010
	dw	@27@1010
	dw	@27@842
	dw	@27@1010
	dw	@27@1010
	dw	@27@1010
	dw	@27@1010
	dw	@27@1010
	dw	@27@1010
	dw	@27@1010
	dw	@27@982
@27@C994	label	word
	dw	@27@478
	dw	@27@534
	dw	@27@562
	dw	@27@590
	dw	@27@618
	dw	@27@702
	dw	@27@730
	dw	@27@758
   ;	
   ;	void iw_midi_pause()
   ;	
	?debug	L 835
	assume	cs:TMIDI_TEXT
_iw_midi_pause	proc	far
	?debug	B
	enter	4,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
   ;	
   ;	{
   ;	   long c;
   ;	
   ;	   if (!iw_midi_Flag) return;
   ;	
	?debug	L 839
	mov	al,byte ptr iw_midi_Flag
	cbw	
	or	ax,ax
	jne	short @28@86
	jmp	short @28@282
@28@86:
   ;	
   ;	
   ;	   if (midifile==NULL||iw_midi_Flag==0) return;
   ;	
	?debug	L 841
	cmp	dword ptr midifile,large 0
	je	short @28@142
	cmp	byte ptr iw_midi_Flag,0
	jne	short @28@170
@28@142:
	jmp	short @28@282
@28@170:
   ;	
   ;	   iw_remove_int(midi_player);
   ;	
	?debug	L 842
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_remove_int
	add	sp,4
   ;	
   ;	
   ;	   for (c=0; c<16; c++)
   ;	
	?debug	L 844
	mov	dword ptr [bp-4],large 0
	jmp	short @28@254
@28@198:
   ;	
   ;	      all_notes_off(c);
   ;	
	?debug	L 845
	push	dword ptr [bp-4]
	push	cs
	call	near ptr all_notes_off
	add	sp,4
	?debug	L 844
	inc	dword ptr [bp-4]
@28@254:
	cmp	dword ptr [bp-4],large 16
	jl	short @28@198
@28@282:
   ;	
   ;	}
   ;	
	?debug	L 846
	pop	ds
	leave	
	ret	
	?debug	C E601630602FCFF00
	?debug	E
	?debug	E
_iw_midi_pause	endp
   ;	
   ;	int iw_midi_seek(long target)
   ;	
	?debug	L 851
	assume	cs:TMIDI_TEXT
_iw_midi_seek	proc	far
	?debug	B
	enter	280,0
	push	si
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E606746172676574060A060000
	?debug	B
   ;	
   ;	{
   ;	   long old_midi_loop;
   ;	   MIDI *old_midifile;
   ;	   MIDI_DRIVER *old_driver;
   ;	   long old_patch[16];
   ;	   long old_volume[16];
   ;	   long old_pan[16];
   ;	   long old_pitch_bend[16];
   ;	   long c;
   ;	
   ;	   if (midifile==NULL||iw_midi_Flag==0) return -1;
   ;	
	?debug	L 862
	cmp	dword ptr midifile,large 0
	je	short @29@86
	cmp	byte ptr iw_midi_Flag,0
	jne	short @29@142
@29@86:
	mov	ax,-1
@29@114:
	jmp	@29@1094
@29@142:
   ;	
   ;	
   ;	   /* first stop the player */
   ;	   iw_midi_Pause();
   ;	
	?debug	L 865
	call	far ptr _iw_midi_Pause
   ;	
   ;	
   ;	   /* store current settings */
   ;	   for (c=0; c<16; c++) {
   ;	
	?debug	L 868
	mov	dword ptr [bp-16],large 0
	jmp	short @29@226
@29@170:
   ;	
   ;	      old_patch[c] = midi_channel[c].patch;
   ;	
	?debug	L 869
	mov	bx,word ptr [bp-16]
	shl	bx,2
	lea	ax,word ptr [bp-88]
	add	bx,ax
	mov	si,word ptr [bp-16]
	imul	si,si,2072
	mov	eax,dword ptr midi_channel[si]
	mov	dword ptr ss:[bx],eax
   ;	
   ;	      old_volume[c] = midi_channel[c].volume;
   ;	
	?debug	L 870
	mov	bx,word ptr [bp-16]
	shl	bx,2
	lea	ax,word ptr [bp-152]
	add	bx,ax
	mov	si,word ptr [bp-16]
	imul	si,si,2072
	mov	eax,dword ptr midi_channel[si+4]
	mov	dword ptr ss:[bx],eax
   ;	
   ;	      old_pan[c] = midi_channel[c].pan;
   ;	
	?debug	L 871
	mov	bx,word ptr [bp-16]
	shl	bx,2
	lea	ax,word ptr [bp-216]
	add	bx,ax
	mov	si,word ptr [bp-16]
	imul	si,si,2072
	mov	eax,dword ptr midi_channel[si+8]
	mov	dword ptr ss:[bx],eax
   ;	
   ;	      old_pitch_bend[c] = midi_channel[c].pitch_bend;
   ;	
	?debug	L 872
	mov	bx,word ptr [bp-16]
	shl	bx,2
	lea	ax,word ptr [bp-280]
	add	bx,ax
	mov	si,word ptr [bp-16]
	imul	si,si,2072
	mov	eax,dword ptr midi_channel[si+12]
	mov	dword ptr ss:[bx],eax
	?debug	L 868
	inc	dword ptr [bp-16]
@29@226:
	cmp	dword ptr [bp-16],large 16
	jge short	@@1312
	jmp	@29@170
@@1312:
   ;	
   ;	   }
   ;	
   ;	   /* save some variables and give temporary values */
   ;	   old_driver = midi_driver;
   ;	
	?debug	L 876
	mov	eax,dword ptr _midi_driver
	mov	dword ptr [bp-12],eax
   ;	
   ;	   //midi_driver = &midi_none;
   ;	   old_midi_loop = midi_loop;
   ;	
	?debug	L 878
	movsx	eax,word ptr midi_loop
	mov	dword ptr [bp-4],eax
   ;	
   ;	   midi_loop = 0;
   ;	
	?debug	L 879
	mov	word ptr midi_loop,0
   ;	
   ;	   old_midifile = midifile;
   ;	
	?debug	L 880
	mov	eax,dword ptr midifile
	mov	dword ptr [bp-8],eax
   ;	
   ;	
   ;	   /* set flag to tell midi_player not to reinstall itself */
   ;	   midi_seeking = 1;
   ;	
	?debug	L 883
	mov	word ptr midi_seeking,1
   ;	
   ;	
   ;	   /* are we seeking backwards? If so, skip back to the start of the file */
   ;	   if (target <= midi_pos)
   ;	
	?debug	L 886
	mov	eax,dword ptr [bp+6]
	cmp	eax,dword ptr _midi_pos
	jg	short @29@310
   ;	
   ;	      prepare_to_play(midifile);
   ;	
	?debug	L 887
	push	word ptr midifile+2
	push	word ptr midifile
	call	far ptr prepare_to_play
	add	sp,4
@29@310:
	jmp	short @29@506
@29@338:
	?debug	B
   ;	
   ;	
   ;	   /* now sit back and let midi_player get to the position */
   ;	   while ((midi_pos < target) && (midi_pos != -1)) {
   ;	      long mmpc = midi_pos_counter;
   ;	
	?debug	L 891
	mov	eax,dword ptr midi_pos_counter
	mov	dword ptr [bp-20],eax
   ;	
   ;	      long mmp = midi_pos;
   ;	
	?debug	L 892
	mov	eax,dword ptr _midi_pos
	mov	dword ptr [bp-24],eax
   ;	
   ;	      mmpc -= midi_timer_speed;
   ;	
	?debug	L 893
	mov	eax,dword ptr midi_timer_speed
	sub	dword ptr [bp-20],eax
	jmp	short @29@394
@29@366:
   ;	
   ;	      while (mmpc <= 0) {
   ;	             mmpc += midi_pos_speed;
   ;	
	?debug	L 895
	mov	eax,dword ptr midi_pos_speed
	add	dword ptr [bp-20],eax
   ;	
   ;	             mmp++;
   ;	
	?debug	L 896
	inc	dword ptr [bp-24]
@29@394:
	?debug	L 894
	cmp	dword ptr [bp-20],large 0
	jle	short @29@366
   ;	
   ;	      }
   ;	      if (mmp >= target) break;
   ;	
	?debug	L 898
	mov	eax,dword ptr [bp-24]
	cmp	eax,dword ptr [bp+6]
	jl	short @29@478
	jmp	short @29@562
@29@478:
   ;	
   ;	      midi_player();
   ;	
	?debug	L 899
	call	far ptr midi_player
@29@506:
	?debug	C E6036D6D700602E8FF00046D6D70630602ECFF00
	?debug	E
	?debug	L 890
	mov	eax,dword ptr _midi_pos
	cmp	eax,dword ptr [bp+6]
	jge	short @29@562
	cmp	dword ptr _midi_pos,large -1
	jne	short @29@338
@29@562:
   ;	
   ;	   }
   ;	
   ;	   /* restore previously saved variables */
   ;	   midi_loop = old_midi_loop;
   ;	
	?debug	L 903
	mov	ax,word ptr [bp-4]
	mov	word ptr midi_loop,ax
   ;	
   ;	   midi_driver = old_driver;
   ;	
	?debug	L 904
	mov	eax,dword ptr [bp-12]
	mov	dword ptr _midi_driver,eax
   ;	
   ;	   midi_seeking = 0;
   ;	
	?debug	L 905
	mov	word ptr midi_seeking,0
   ;	
   ;	
   ;	   if (midi_pos != -1) {
   ;	
	?debug	L 907
	cmp	dword ptr _midi_pos,large -1
	jne short	@@1313
	jmp	@29@982
@@1313:
   ;	
   ;	      /* refresh the driver with any changed parameters */
   ;	      if (midi_driver->raw_midi) {
   ;	
	?debug	L 909
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	jne short	@@1314
	jmp	@29@898
@@1314:
   ;	
   ;	        for (c=0; c<16; c++) {
   ;	
	?debug	L 910
	mov	dword ptr [bp-16],large 0
	jmp	@29@870
@29@646:
   ;	
   ;	          /* program change (this sets the volume as well) */
   ;	          if ((midi_channel[c].patch != old_patch[c]) ||
   ;	
	?debug	L 912
   ;	
   ;			      (midi_channel[c].volume != old_volume[c]))
   ;	
	?debug	L 913
	mov	bx,word ptr [bp-16]
	shl	bx,2
	lea	ax,word ptr [bp-88]
	add	bx,ax
	mov	eax,dword ptr ss:[bx]
	mov	bx,word ptr [bp-16]
	imul	bx,bx,2072
	cmp	eax,dword ptr midi_channel[bx]
	jne	short @29@702
	mov	bx,word ptr [bp-16]
	shl	bx,2
	lea	ax,word ptr [bp-152]
	add	bx,ax
	mov	eax,dword ptr ss:[bx]
	mov	bx,word ptr [bp-16]
	imul	bx,bx,2072
	cmp	eax,dword ptr midi_channel[bx+4]
	je	short @29@730
@29@702:
   ;	
   ;		         raw_program_change(c, midi_channel[c].patch);
   ;	
	?debug	L 914
	mov	bx,word ptr [bp-16]
	imul	bx,bx,2072
	push	dword ptr midi_channel[bx]
	push	dword ptr [bp-16]
	push	cs
	call	near ptr raw_program_change
	add	sp,8
@29@730:
   ;	
   ;	          /* pan */
   ;	          if (midi_channel[c].pan != old_pan[c]) {
   ;	
	?debug	L 916
	mov	bx,word ptr [bp-16]
	shl	bx,2
	lea	ax,word ptr [bp-216]
	add	bx,ax
	mov	eax,dword ptr ss:[bx]
	mov	bx,word ptr [bp-16]
	imul	bx,bx,2072
	cmp	eax,dword ptr midi_channel[bx+8]
	je	short @29@786
   ;	
   ;		         midi_driver->raw_midi(0xB0+c);
   ;	
	?debug	L 917
	mov	al,byte ptr [bp-16]
	add	al,176
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;		         midi_driver->raw_midi(10);
   ;	
	?debug	L 918
	push	10
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	             midi_driver->raw_midi(midi_channel[c].pan);
   ;	
	?debug	L 919
	mov	bx,word ptr [bp-16]
	imul	bx,bx,2072
	mov	al,byte ptr midi_channel[bx+8]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
@29@786:
   ;	
   ;	          }
   ;	
   ;	          /* pitch bend */
   ;	          if (midi_channel[c].pitch_bend != old_pitch_bend[c]) {
   ;	
	?debug	L 923
	mov	bx,word ptr [bp-16]
	shl	bx,2
	lea	ax,word ptr [bp-280]
	add	bx,ax
	mov	eax,dword ptr ss:[bx]
	mov	bx,word ptr [bp-16]
	imul	bx,bx,2072
	cmp	eax,dword ptr midi_channel[bx+12]
	je	short @29@842
   ;	
   ;	            midi_driver->raw_midi(0xE0+c);
   ;	
	?debug	L 924
	mov	al,byte ptr [bp-16]
	add	al,224
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	            midi_driver->raw_midi(midi_channel[c].pitch_bend & 0x7F);
   ;	
	?debug	L 925
	mov	bx,word ptr [bp-16]
	imul	bx,bx,2072
	mov	al,byte ptr midi_channel[bx+12]
	and	al,127
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
   ;	
   ;	            midi_driver->raw_midi(midi_channel[c].pitch_bend >> 7);
   ;	
	?debug	L 926
	mov	bx,word ptr [bp-16]
	imul	bx,bx,2072
	mov	eax,dword ptr midi_channel[bx+12]
	sar	eax,7
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+36]
	pop	cx
@29@842:
	?debug	L 910
	inc	dword ptr [bp-16]
@29@870:
	cmp	dword ptr [bp-16],large 16
	jge short	@@1315
	jmp	@29@646
@@1315:
@29@898:
   ;	
   ;		      }
   ;		   }
   ;	     }
   ;	     /* if we didn't hit the end of the file, continue playing */
   ;	     if (!midi_looping) iw_install_int(midi_player, 20);
   ;	
	?debug	L 931
	cmp	word ptr midi_looping,0
	jne	short @29@954
	push	large 20
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_install_int
	add	sp,8
@29@954:
   ;	
   ;	     return 0;
   ;	
	?debug	L 932
	xor	ax,ax
	jmp	@29@114
@29@982:
   ;	
   ;	   }
   ;	
   ;	   if ((midi_loop) && (!midi_looping)) {  /* was file was looped? */
   ;	
	?debug	L 935
	cmp	word ptr midi_loop,0
	je	short @29@1066
	cmp	word ptr midi_looping,0
	jne	short @29@1066
   ;	
   ;	      prepare_to_play(old_midifile);
   ;	
	?debug	L 936
	push	word ptr [bp-6]
	push	word ptr [bp-8]
	call	far ptr prepare_to_play
	add	sp,4
   ;	
   ;	      iw_install_int(midi_player, 20);
   ;	
	?debug	L 937
	push	large 20
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_install_int
	add	sp,8
   ;	
   ;	      return 2;                           /* seek past EOF => file restarted */
   ;	
	?debug	L 938
	mov	ax,2
	jmp	@29@114
@29@1066:
   ;	
   ;	   }
   ;	
   ;	   return 1;                              /* seek past EOF => file stopped */
   ;	
	?debug	L 941
	mov	ax,1
	jmp	@29@114
@29@1094:
   ;	
   ;	}
   ;	
	?debug	L 942
	pop	ds
	pop	si
	leave	
	ret	
	?debug	C E3250040001A06
	?debug	C E3260040001A06
	?debug	C E3270040001A06
	?debug	C E3280040001A06
	?debug	C E32A0B4D4944495F44524956455248001E11
	?debug	C E32C00000023040400
	?debug	C E32B000400162C00
	?debug	C E32E00000023040400
	?debug	C E32D000400162E00
	?debug	C E33000000023010400
	?debug	C E32F000400163000
	?debug	C E33200000023040400
	?debug	C E331000400163200
	?debug	C E33400000023010400
	?debug	C E333000400163400
	?debug	C E33600000023040400
	?debug	C E335000400163600
	?debug	C E33800000023010400
	?debug	C E337000400163800
	?debug	C E33A00000023010400
	?debug	C E339000400163A00
	?debug	C E33C00000023010400
	?debug	C E33B000400163C00
	?debug	C E33E00000023010400
	?debug	C E33D000400163E00
	?debug	C E34000000023010400
	?debug	C E33F000400164000
	?debug	C E34200000023010400
	?debug	C E341000400164200
	?debug	C E34400000023010400
	?debug	C E343000400164400
	?debug	C E329000400162A00
	?debug	C E601630602F0FF000E6F6C645F70697463685F62+
	?debug	C 656E642502E8FE00076F6C645F70616E260228FF+
	?debug	C 000A6F6C645F766F6C756D65270268FF00096F6C+
	?debug	C 645F70617463682802A8FF000A6F6C645F647269+
	?debug	C 7665722902F4FF000C6F6C645F6D69646966696C+
	?debug	C 651E02F8FF000D6F6C645F6D6964695F6C6F6F70+
	?debug	C 0602FCFF0006746172676574060A060000
	?debug	E
	?debug	E
_iw_midi_seek	endp
TMIDI_TEXT	ends
TMIDI_DATA	segment word public use16 'FAR_DATA'
	db	4 dup (0)
	db	4 dup (0)
	db	4 dup (0)
TMIDI_DATA	ends
TMIDI_TEXT	segment byte public use16 'CODE'
   ;	
   ;	static void midi_player()
   ;	
	?debug	L 948
	assume	cs:TMIDI_TEXT
midi_player	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
   ;	
   ;	{  static long c,active;
   ;	   static long l;
   ;	
   ;	   if (!midifile) return;
   ;	
	?debug	L 952
	cmp	dword ptr midifile,large 0
	jne	short @30@86
	jmp	@30@1710
@30@86:
   ;	
   ;	   if (midi_semaphore) {
   ;	
	?debug	L 953
	cmp	dword ptr midi_semaphore,large 0
	je	short @30@142
   ;	
   ;	      midi_timer_speed += BPS_TO_TIMER(40);
   ;	
	?debug	L 954
	add	dword ptr midi_timer_speed,large 29829
   ;	
   ;	      iw_install_int_ex(midi_player, BPS_TO_TIMER(40));
   ;	
	?debug	L 955
	push	large 29829
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_install_int_ex
	add	sp,8
   ;	
   ;	      return;
   ;	
	?debug	L 956
	jmp	@30@1710
@30@142:
   ;	
   ;	   }
   ;	   midi_semaphore = TRUE;
   ;	
	?debug	L 958
	mov	dword ptr midi_semaphore,large 1
   ;	
   ;	   _midi_tick++;
   ;	
	?debug	L 959
	inc	dword ptr __midi_tick
@30@170:
   ;	
   ;	
   ;	   do_it_all_again:
   ;	
   ;	   for (c=0; c<MIDI_VOICES; c++)
   ;	
	?debug	L 963
	mov	dword ptr d@w+49,large 0
	jmp	short @30@254
@30@198:
   ;	
   ;	      midi_waiting[c].note = -1;
   ;	
	?debug	L 964
	mov	bx,word ptr d@w+49
	imul	bx,bx,12
	mov	dword ptr midi_waiting[bx+4],large -1
	?debug	L 963
	inc	dword ptr d@w+49
@30@254:
	cmp	dword ptr d@w+49,large 32
	jl	short @30@198
   ;	
   ;	
   ;	   /* deal with each track in turn... */
   ;	   for (c=0; c<MIDI_TRACKS; c++) { 
   ;	
	?debug	L 967
	mov	dword ptr d@w+49,large 0
	jmp	@30@478
@30@310:
   ;	
   ;	      if (midi_track[c].pos) {
   ;	
	?debug	L 968
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	ax,word ptr midi_track[bx]
	or	ax,word ptr midi_track[bx+2]
	jne short	@@1316
	jmp	@30@450
@@1316:
   ;	
   ;		 midi_track[c].timer -= midi_timer_speed;
   ;	
	?debug	L 969
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	eax,dword ptr midi_timer_speed
	sub	dword ptr midi_track[bx+4],eax
	jmp	@30@422
@30@366:
   ;	
   ;	
   ;		 /* while events are waiting, process them */
   ;		 while (midi_track[c].timer <= 0) { 
   ;		    process_midi_event(&midi_track[c].pos, 
   ;	
	?debug	L 973
   ;	
   ;				       &midi_track[c].running_status,
   ;				       &midi_track[c].timer); 
   ;	
	?debug	L 975
	mov	ax,word ptr d@w+49
	imul	ax,ax,9
	add	ax,offset midi_track+4
	push	ds
	push	ax
	mov	ax,word ptr d@w+49
	imul	ax,ax,9
	add	ax,offset midi_track+8
	push	ds
	push	ax
	mov	ax,word ptr d@w+49
	imul	ax,ax,9
	add	ax,offset midi_track
	push	ds
	push	ax
	push	cs
	call	near ptr process_midi_event
	add	sp,12
   ;	
   ;	
   ;		    /* read next time offset */
   ;		    if (midi_track[c].pos) { 
   ;	
	?debug	L 978
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	ax,word ptr midi_track[bx]
	or	ax,word ptr midi_track[bx+2]
	je	short @30@422
   ;	
   ;		       l = parse_var_len(&midi_track[c].pos);
   ;	
	?debug	L 979
	mov	ax,word ptr d@w+49
	imul	ax,ax,9
	add	ax,offset midi_track
	push	ds
	push	ax
	push	cs
	call	near ptr parse_var_len
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	dword ptr d@w+57,eax
   ;	
   ;		       l *= midi_speed;
   ;	
	?debug	L 980
	mov	eax,dword ptr d@w+57
	imul	eax,dword ptr midi_speed
	mov	dword ptr d@w+57,eax
   ;	
   ;		       midi_track[c].timer += l;
   ;	
	?debug	L 981
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	eax,dword ptr d@w+57
	add	dword ptr midi_track[bx+4],eax
@30@422:
	?debug	L 972
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	cmp	dword ptr midi_track[bx+4],large 0
	jg short	@@1317
	jmp	@30@366
@@1317:
@30@450:
	?debug	L 967
	inc	dword ptr d@w+49
@30@478:
	cmp	dword ptr d@w+49,large 32
	jge short	@@1318
	jmp	@30@310
@@1318:
   ;	
   ;		    }
   ;		 }
   ;	      }
   ;	   }
   ;	
   ;	   /* update global position value */
   ;	   midi_pos_counter -= midi_timer_speed;
   ;	
	?debug	L 988
	mov	eax,dword ptr midi_timer_speed
	sub	dword ptr midi_pos_counter,eax
	jmp	short @30@562
@30@534:
   ;	
   ;	   while (midi_pos_counter <= 0) {
   ;	      midi_pos_counter += midi_pos_speed;
   ;	
	?debug	L 990
	mov	eax,dword ptr midi_pos_speed
	add	dword ptr midi_pos_counter,eax
   ;	
   ;	      midi_pos++;
   ;	
	?debug	L 991
	inc	dword ptr _midi_pos
@30@562:
	?debug	L 989
	cmp	dword ptr midi_pos_counter,large 0
	jle	short @30@534
   ;	
   ;	   }
   ;	
   ;	   /* tempo change? */
   ;	   if (midi_new_speed > 0) {
   ;	
	?debug	L 995
	cmp	dword ptr midi_new_speed,large 0
	jg short	@@1319
	jmp	@30@786
@@1319:
   ;	
   ;	      for (c=0; c<MIDI_TRACKS; c++) {
   ;	
	?debug	L 996
	mov	dword ptr d@w+49,large 0
	jmp	short @30@730
@30@646:
   ;	
   ;		 if (midi_track[c].pos) {
   ;	
	?debug	L 997
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	ax,word ptr midi_track[bx]
	or	ax,word ptr midi_track[bx+2]
	je	short @30@702
   ;	
   ;		    midi_track[c].timer /= midi_speed;
   ;	
	?debug	L 998
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	eax,dword ptr midi_track[bx+4]
	cdq	
	idiv	dword ptr midi_speed
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	dword ptr midi_track[bx+4],eax
   ;	
   ;		    midi_track[c].timer *= midi_new_speed;
   ;	
	?debug	L 999
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	eax,dword ptr midi_track[bx+4]
	imul	eax,dword ptr midi_new_speed
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	dword ptr midi_track[bx+4],eax
@30@702:
	?debug	L 996
	inc	dword ptr d@w+49
@30@730:
	cmp	dword ptr d@w+49,large 32
	jl	short @30@646
   ;	
   ;		 }
   ;	      }
   ;	      midi_pos_counter /= midi_speed;
   ;	
	?debug	L 1002
	mov	eax,dword ptr midi_pos_counter
	cdq	
	idiv	dword ptr midi_speed
	mov	dword ptr midi_pos_counter,eax
   ;	
   ;	      midi_pos_counter *= midi_new_speed;
   ;	
	?debug	L 1003
	mov	eax,dword ptr midi_pos_counter
	imul	eax,dword ptr midi_new_speed
	mov	dword ptr midi_pos_counter,eax
   ;	
   ;	
   ;	      midi_speed = midi_new_speed;
   ;	
	?debug	L 1005
	mov	eax,dword ptr midi_new_speed
	mov	dword ptr midi_speed,eax
   ;	
   ;	      midi_pos_speed = midi_new_speed * midifile->divisions;
   ;	
	?debug	L 1006
	les	bx,dword ptr midifile
	movsx	eax,word ptr es:[bx]
	mov	edx,dword ptr midi_new_speed
	imul	edx,eax
	mov	dword ptr midi_pos_speed,edx
   ;	
   ;	      midi_new_speed = -1;
   ;	
	?debug	L 1007
	mov	dword ptr midi_new_speed,large -1
@30@786:
   ;	
   ;	   }
   ;	
   ;	   /* figure out how long until we need to be called again */
   ;	   active = 0;
   ;	
	?debug	L 1011
	mov	dword ptr d@w+53,large 0
   ;	
   ;	   midi_timer_speed = LONG_MAX;
   ;	
	?debug	L 1012
	mov	dword ptr midi_timer_speed,large 07FFFFFFFh
   ;	
   ;	   for (c=0; c<MIDI_TRACKS; c++) {
   ;	
	?debug	L 1013
	mov	dword ptr d@w+49,large 0
	jmp	short @30@926
@30@814:
   ;	
   ;	      if (midi_track[c].pos) {
   ;	
	?debug	L 1014
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	ax,word ptr midi_track[bx]
	or	ax,word ptr midi_track[bx+2]
	je	short @30@898
   ;	
   ;		 active = 1;
   ;	
	?debug	L 1015
	mov	dword ptr d@w+53,large 1
   ;	
   ;		 if (midi_track[c].timer < midi_timer_speed)
   ;	
	?debug	L 1016
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	eax,dword ptr midi_track[bx+4]
	cmp	eax,dword ptr midi_timer_speed
	jge	short @30@898
   ;	
   ;		    midi_timer_speed = midi_track[c].timer;
   ;	
	?debug	L 1017
	mov	bx,word ptr d@w+49
	imul	bx,bx,9
	mov	eax,dword ptr midi_track[bx+4]
	mov	dword ptr midi_timer_speed,eax
@30@898:
	?debug	L 1013
	inc	dword ptr d@w+49
@30@926:
	cmp	dword ptr d@w+49,large 32
	jl	short @30@814
   ;	
   ;	      }
   ;	   }
   ;	
   ;	   /* end of the music? */
   ;	   if ((!active) || ((midi_loop_end > 0) && (midi_pos >= midi_loop_end))) {
   ;	
	?debug	L 1022
	cmp	dword ptr d@w+53,large 0
	je	short @30@1038
	cmp	dword ptr _midi_loop_end,large 0
	jg short	@@1320
	jmp	@30@1430
@@1320:
	mov	eax,dword ptr _midi_pos
	cmp	eax,dword ptr _midi_loop_end
	jge short	@@1321
	jmp	@30@1430
@@1321:
@30@1038:
   ;	
   ;	      if ((midi_loop) && (!midi_looping)) {
   ;	
	?debug	L 1023
	cmp	word ptr midi_loop,0
	jne short	@@1322
	jmp	@30@1402
@@1322:
	cmp	word ptr midi_looping,0
	je short	@@1323
	jmp	@30@1402
@@1323:
   ;	
   ;		 if (midi_loop_start > 0) {
   ;	
	?debug	L 1024
	cmp	dword ptr _midi_loop_start,large 0
	jle	short @30@1234
   ;	
   ;		    iw_remove_int(midi_player);
   ;	
	?debug	L 1025
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_remove_int
	add	sp,4
   ;	
   ;		    midi_semaphore = FALSE;
   ;	
	?debug	L 1026
	mov	dword ptr midi_semaphore,large 0
   ;	
   ;		    midi_looping = TRUE;
   ;	
	?debug	L 1027
	mov	word ptr midi_looping,1
   ;	
   ;		    if (iw_midi_Seek(midi_loop_start) != 0) {
   ;	
	?debug	L 1028
	push	dword ptr _midi_loop_start
	call	far ptr _iw_midi_Seek
	add	sp,4
	or	ax,ax
	je	short @30@1178
   ;	
   ;		       midi_looping = FALSE;
   ;	
	?debug	L 1029
	mov	word ptr midi_looping,0
   ;	
   ;	               iw_midi_stop();
   ;	
	?debug	L 1030
	push	cs
	call	near ptr _iw_midi_stop
   ;	
   ;		       return;
   ;	
	?debug	L 1031
	jmp	@30@1710
@30@1178:
   ;	
   ;		    }
   ;		    midi_looping = FALSE;
   ;	
	?debug	L 1033
	mov	word ptr midi_looping,0
   ;	
   ;		    midi_semaphore = TRUE;
   ;	
	?debug	L 1034
	mov	dword ptr midi_semaphore,large 1
   ;	
   ;		    goto do_it_all_again;
   ;	
	?debug	L 1035
	jmp	@30@170
   ;	
   ;		 }
   ;	
	?debug	L 1036
	jmp	short @30@1374
@30@1234:
   ;	
   ;		 else {
   ;		    for (c=0; c<16; c++)
   ;	
	?debug	L 1038
	mov	dword ptr d@w+49,large 0
	jmp	short @30@1318
@30@1262:
   ;	
   ;		       all_notes_off(c);
   ;	
	?debug	L 1039
	push	dword ptr d@w+49
	push	cs
	call	near ptr all_notes_off
	add	sp,4
	?debug	L 1038
	inc	dword ptr d@w+49
@30@1318:
	cmp	dword ptr d@w+49,large 16
	jl	short @30@1262
   ;	
   ;		    prepare_to_play(midifile);
   ;	
	?debug	L 1040
	push	word ptr midifile+2
	push	word ptr midifile
	call	far ptr prepare_to_play
	add	sp,4
   ;	
   ;		    goto do_it_all_again;
   ;	
	?debug	L 1041
	jmp	@30@170
@30@1374:
   ;	
   ;		 }
   ;	      }
   ;	
	?debug	L 1043
	jmp	short @30@1430
@30@1402:
   ;	
   ;	      else {
   ;	         iw_midi_stop();
   ;	
	?debug	L 1045
	push	cs
	call	near ptr _iw_midi_stop
	jmp	@30@1682
@30@1430:
   ;	
   ;	         midi_semaphore = FALSE;
   ;	         return; 
   ;	      }
   ;	   }
   ;	
   ;	   /* reprogram the timer */
   ;	   if (midi_timer_speed < BPS_TO_TIMER(40))
   ;	
	?debug	L 1052
	cmp	dword ptr midi_timer_speed,large 29829
	jge	short @30@1486
   ;	
   ;	      midi_timer_speed = BPS_TO_TIMER(40);
   ;	
	?debug	L 1053
	mov	dword ptr midi_timer_speed,large 29829
@30@1486:
   ;	
   ;	
   ;	   if (!midi_seeking) iw_install_int_ex(midi_player, midi_timer_speed);
   ;	
	?debug	L 1055
	cmp	word ptr midi_seeking,0
	jne	short @30@1542
	push	dword ptr midi_timer_speed
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_install_int_ex
	add	sp,8
@30@1542:
   ;	
   ;	   /* controller changes are cached and only processed here, so we can 
   ;	      condense streams of controller data into just a few voice updates */ 
   ;	   update_controllers();
   ;	
	?debug	L 1058
	push	cs
	call	near ptr update_controllers
   ;	
   ;	
   ;	   /* and deal with any notes that are still waiting to be played */
   ;	   for (c=0; c<MIDI_VOICES; c++)
   ;	
	?debug	L 1061
	mov	dword ptr d@w+49,large 0
	jmp	short @30@1654
@30@1570:
   ;	
   ;	      if (midi_waiting[c].note >= 0)
   ;	
	?debug	L 1062
	mov	bx,word ptr d@w+49
	imul	bx,bx,12
	cmp	dword ptr midi_waiting[bx+4],large 0
	jl	short @30@1626
   ;	
   ;		 midi_note_on(midi_waiting[c].channel, midi_waiting[c].note,
   ;	
	?debug	L 1063
   ;	
   ;			      midi_waiting[c].volume, 0);
   ;	
	?debug	L 1064
	push	large 0
	mov	bx,word ptr d@w+49
	imul	bx,bx,12
	push	dword ptr midi_waiting[bx+8]
	mov	bx,word ptr d@w+49
	imul	bx,bx,12
	push	dword ptr midi_waiting[bx+4]
	mov	bx,word ptr d@w+49
	imul	bx,bx,12
	push	dword ptr midi_waiting[bx]
	push	cs
	call	near ptr midi_note_on
	add	sp,16
@30@1626:
	?debug	L 1061
	inc	dword ptr d@w+49
@30@1654:
	cmp	dword ptr d@w+49,large 32
	jl	short @30@1570
@30@1682:
   ;	
   ;	   midi_semaphore = FALSE;
   ;	
	?debug	L 1065
	mov	dword ptr midi_semaphore,large 0
@30@1710:
   ;	
   ;	}
   ;	
	?debug	L 1066
	pop	ds
	pop	bp
	ret	
	?debug	C E6016C0600000239000006616374697665060000+
	?debug	C 02350000016306000002310000
	?debug	E
	?debug	E
midi_player	endp
   ;	
   ;	char iw_midi_status()
   ;	
	?debug	L 1071
	assume	cs:TMIDI_TEXT
_iw_midi_status	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
   ;	
   ;	{ 
   ;	  if (midifile) return 1;
   ;	
	?debug	L 1073
	cmp	dword ptr midifile,large 0
	je	short @31@114
	mov	al,1
@31@86:
	jmp	short @31@142
@31@114:
   ;	
   ;	  return 0;
   ;	
	?debug	L 1074
	mov	al,0
	jmp	short @31@86
@31@142:
   ;	
   ;	}
   ;	
	?debug	L 1075
	pop	ds
	pop	bp
	ret	
	?debug	E
	?debug	E
_iw_midi_status	endp
   ;	
   ;	void iw_midi_resume() 
   ;	
	?debug	L 1080
	assume	cs:TMIDI_TEXT
_iw_midi_resume	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
   ;	
   ;	{  
   ;	   if (midifile==NULL||iw_midi_Flag==0) return;
   ;	
	?debug	L 1082
	cmp	dword ptr midifile,large 0
	je	short @32@86
	cmp	byte ptr iw_midi_Flag,0
	jne	short @32@114
@32@86:
	jmp	short @32@142
@32@114:
   ;	
   ;	   iw_install_int_ex(midi_player, midi_timer_speed);
   ;	
	?debug	L 1083
	push	dword ptr midi_timer_speed
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_install_int_ex
	add	sp,8
@32@142:
   ;	
   ;	}
   ;	
	?debug	L 1084
	pop	ds
	pop	bp
	ret	
	?debug	E
	?debug	E
_iw_midi_resume	endp
   ;	
   ;	static long load_patches(MIDI *midi)
   ;	
	?debug	L 1089
	assume	cs:TMIDI_TEXT
load_patches	proc	far
	?debug	B
	enter	274,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6046D6964691E0A060000
	?debug	B
   ;	
   ;	{
   ;	   char patches[128], drums[128];
   ;	   unsigned char *p, *end;
   ;	   unsigned char running_status, event;
   ;	   long l;
   ;	   long c;
   ;	
   ;	   for (c=0; c<128; c++)                        /* initialise to unused */
   ;	
	?debug	L 1097
	mov	dword ptr [bp-18],large 0
	jmp	short @33@114
@33@58:
   ;	
   ;	      patches[c] = drums[c] = FALSE;
   ;	
	?debug	L 1098
	lea	ax,word ptr [bp-274]
	mov	bx,word ptr [bp-18]
	add	bx,ax
	mov	al,0
	mov	byte ptr ss:[bx],al
	lea	dx,word ptr [bp-146]
	mov	bx,word ptr [bp-18]
	add	bx,dx
	mov	byte ptr ss:[bx],al
	?debug	L 1097
	inc	dword ptr [bp-18]
@33@114:
	cmp	dword ptr [bp-18],large 128
	jl	short @33@58
   ;	
   ;	
   ;	   patches[0] = TRUE;                           /* always load the piano */
   ;	
	?debug	L 1100
	mov	byte ptr [bp-146],1
   ;	
   ;	
   ;	   for (c=0; c<MIDI_TRACKS; c++) {              /* for each track... */
   ;	
	?debug	L 1102
	mov	dword ptr [bp-18],large 0
	jmp	@33@1066
@33@170:
   ;	
   ;	      p = midi->track[c].data;
   ;	
	?debug	L 1103
	mov	ax,word ptr [bp-18]
	imul	ax,ax,6
	les	bx,dword ptr [bp+6]
	add	bx,ax
	mov	ax,word ptr es:[bx+4]
	mov	dx,word ptr es:[bx+2]
	mov	word ptr [bp-2],ax
	mov	word ptr [bp-4],dx
   ;	
   ;	      end = p + midi->track[c].len;
   ;	
	?debug	L 1104
	mov	ax,word ptr [bp-18]
	imul	ax,ax,6
	les	bx,dword ptr [bp+6]
	add	bx,ax
	mov	ax,word ptr [bp-2]
	mov	dx,word ptr [bp-4]
	add	dx,word ptr es:[bx+6]
	mov	word ptr [bp-6],ax
	mov	word ptr [bp-8],dx
   ;	
   ;	      running_status = 0;
   ;	
	?debug	L 1105
	mov	byte ptr [bp-9],0
	jmp	@33@1010
@33@198:
   ;	
   ;	
   ;	      while (p < end) {                         /* work through data stream */
   ;		 event = *p; 
   ;	
	?debug	L 1108
	les	bx,dword ptr [bp-4]
	mov	al,byte ptr es:[bx]
	mov	byte ptr [bp-10],al
   ;	
   ;		 if (event & 0x80) {                    /* regular message */
   ;	
	?debug	L 1109
	test	byte ptr [bp-10],128
	je	short @33@366
   ;	
   ;		    p++;
   ;	
	?debug	L 1110
	inc	word ptr [bp-4]
   ;	
   ;		    if ((event != 0xF0) && (event != 0xF7) && (event != 0xFF))
   ;	
	?debug	L 1111
	cmp	byte ptr [bp-10],240
	je	short @33@338
	cmp	byte ptr [bp-10],247
	je	short @33@338
	cmp	byte ptr [bp-10],255
	je	short @33@338
   ;	
   ;		       running_status = event;
   ;	
	?debug	L 1112
	mov	al,byte ptr [bp-10]
	mov	byte ptr [bp-9],al
@33@338:
   ;	
   ;		 }
   ;	
	?debug	L 1113
	jmp	short @33@394
@33@366:
   ;	
   ;		 else                                   /* use running status */
   ;		    event = running_status; 
   ;	
	?debug	L 1115
	mov	al,byte ptr [bp-9]
	mov	byte ptr [bp-10],al
@33@394:
   ;	
   ;	
   ;		 switch (event>>4) {
   ;	
	?debug	L 1117
	mov	al,byte ptr [bp-10]
	mov	ah,0
	sar	ax,4
	sub	ax,8
	mov	bx,ax
	cmp	bx,7
	jbe short	@@1324
	jmp	@33@926
@@1324:
	shl	bx,1
	jmp	word ptr cs:@33@C1170[bx]
@33@478:
   ;	
   ;	
   ;		    case 0x0C:                          /* program change! */
   ;		       patches[*p] = TRUE;
   ;	
	?debug	L 1120
	les	bx,dword ptr [bp-4]
	mov	al,byte ptr es:[bx]
	mov	ah,0
	lea	dx,word ptr [bp-146]
	add	ax,dx
	mov	bx,ax
	mov	byte ptr ss:[bx],1
   ;	
   ;		       p++;
   ;	
	?debug	L 1121
@33@506:
	inc	word ptr [bp-4]
   ;	
   ;		       break;
   ;	
	?debug	L 1122
	jmp	short @33@954
@33@534:
   ;	
   ;	
   ;		    case 0x09:                          /* note on, is it a drum? */
   ;		       if ((event & 0x0F) == 9)
   ;	
	?debug	L 1125
	mov	al,byte ptr [bp-10]
	mov	ah,0
	and	ax,15
	cmp	ax,9
	jne	short @33@590
   ;	
   ;			  drums[*p] = TRUE;
   ;	
	?debug	L 1126
	les	bx,dword ptr [bp-4]
	mov	al,byte ptr es:[bx]
	mov	ah,0
	lea	dx,word ptr [bp-274]
	add	ax,dx
	mov	bx,ax
	mov	byte ptr ss:[bx],1
@33@590:
	jmp	short @33@618
@33@618:
   ;	
   ;		       p += 2;
   ;		       break;
   ;	
   ;		    case 0x08:                          /* note off */
   ;		    case 0x0A:                          /* note aftertouch */
   ;		    case 0x0B:                          /* control change */
   ;		    case 0x0E:                          /* pitch bend */
   ;		       p += 2;
   ;	
	?debug	L 1134
	add	word ptr [bp-4],2
   ;	
   ;		       break;
   ;	
	?debug	L 1135
	jmp	short @33@954
@33@646:
	jmp	short @33@506
@33@674:
   ;	
   ;	
   ;		    case 0x0D:                          /* channel aftertouch */
   ;		       p += 1;
   ;		       break;
   ;	
   ;		    case 0x0F:                          /* special event */
   ;		       switch (event) {
   ;	
	?debug	L 1142
	mov	al,byte ptr [bp-10]
	mov	ah,0
	sub	ax,240
	mov	bx,ax
	cmp	bx,15
	ja	short @33@870
	shl	bx,1
	jmp	word ptr cs:@33@C1218[bx]
@33@758:
   ;	
   ;			  case 0xF0:                    /* sysex */
   ;			  case 0xF7: 
   ;			     l = parse_var_len(&p);
   ;	
	?debug	L 1145
	push	ss
	lea	ax,word ptr [bp-4]
	push	ax
	push	cs
	call	near ptr parse_var_len
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	dword ptr [bp-14],eax
   ;	
   ;			     p += l;
   ;	
	?debug	L 1146
	mov	ax,word ptr [bp-14]
	add	word ptr [bp-4],ax
   ;	
   ;			     break;
   ;	
	?debug	L 1147
	jmp	short @33@898
@33@786:
   ;	
   ;	
   ;			  case 0xF2:                    /* song position */
   ;			     p += 2;
   ;	
	?debug	L 1150
	add	word ptr [bp-4],2
   ;	
   ;			     break;
   ;	
	?debug	L 1151
	jmp	short @33@898
@33@814:
   ;	
   ;	
   ;			  case 0xF3:                    /* song select */
   ;			     p++;
   ;	
	?debug	L 1154
	inc	word ptr [bp-4]
   ;	
   ;			     break;
   ;	
	?debug	L 1155
	jmp	short @33@898
@33@842:
   ;	
   ;	
   ;			  case 0xFF:                    /* meta-event */
   ;			     p++;
   ;	
	?debug	L 1158
	inc	word ptr [bp-4]
	jmp	short @33@758
@33@870:
   ;	
   ;			     l = parse_var_len(&p);
   ;			     p += l;
   ;			     break;
   ;	
   ;			  default:
   ;			     /* the other special events don't have any data bytes,
   ;				so we don't need to bother skipping past them */
   ;			     break;
   ;	
	?debug	L 1166
	jmp	short @33@898
@33@898:
   ;	
   ;		       }
   ;		       break;
   ;	
	?debug	L 1168
	jmp	short @33@954
@33@926:
   ;	
   ;	
   ;		    default:
   ;		       /* something has gone badly wrong if we ever get to here */
   ;		       break;
   ;	
	?debug	L 1172
	jmp	short @33@954
@33@954:
   ;	
   ;		 }
   ;	
   ;		 if (p < end)                           /* skip time offset */
   ;	
	?debug	L 1175
	mov	ax,word ptr [bp-4]
	cmp	ax,word ptr [bp-8]
	jae	short @33@1010
   ;	
   ;		    parse_var_len(&p);
   ;	
	?debug	L 1176
	push	ss
	lea	ax,word ptr [bp-4]
	push	ax
	push	cs
	call	near ptr parse_var_len
	add	sp,4
@33@1010:
	?debug	L 1107
	mov	ax,word ptr [bp-4]
	cmp	ax,word ptr [bp-8]
	jae short	@@1325
	jmp	@33@198
@@1325:
	?debug	L 1102
	inc	dword ptr [bp-18]
@33@1066:
	cmp	dword ptr [bp-18],large 32
	jge short	@@1326
	jmp	@33@170
@@1326:
   ;	
   ;	      }
   ;	   }
   ;	
   ;	   /* tell the driver to do its stuff */ 
   ;	   return midi_driver->load_patches(patches, drums);
   ;	
	?debug	L 1181
	push	ss
	lea	ax,word ptr [bp-274]
	push	ax
	push	ss
	lea	ax,word ptr [bp-146]
	push	ax
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+40]
	add	sp,8
	movsx	eax,ax
	cwd	
	jmp	short @33@1122
@33@1122:
   ;	
   ;	}
   ;	
	?debug	L 1182
	pop	ds
	leave	
	ret	
	?debug	C E3450080001A02
	?debug	C E3460080001A02
	?debug	C E601630602EEFF00016C0602F2FF00056576656E+
	?debug	C 740802F6FF000E72756E6E696E675F7374617475+
	?debug	C 730802F7FF0003656E641B02F8FF0001701B02FC+
	?debug	C FF00056472756D734502EEFE0007706174636865+
	?debug	C 7346026EFF00046D6964691E0A060000
	?debug	E
	?debug	E
load_patches	endp
@33@C1218	label	word
	dw	@33@758
	dw	@33@870
	dw	@33@786
	dw	@33@814
	dw	@33@870
	dw	@33@870
	dw	@33@870
	dw	@33@758
	dw	@33@870
	dw	@33@870
	dw	@33@870
	dw	@33@870
	dw	@33@870
	dw	@33@870
	dw	@33@870
	dw	@33@842
@33@C1170	label	word
	dw	@33@618
	dw	@33@534
	dw	@33@618
	dw	@33@618
	dw	@33@478
	dw	@33@646
	dw	@33@618
	dw	@33@674
   ;	
   ;	int iw_midi_play(MIDI *midi, int loop)
   ;	
	?debug	L 1187
	assume	cs:TMIDI_TEXT
_iw_midi_play	proc	far
	?debug	B
	enter	4,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6046C6F6F70040A0A0000046D6964691E0A0600+
	?debug	C 00
	?debug	B
   ;	
   ;	{
   ;	   long c;
   ;	
   ;	   if (!iw_midi_Flag) return -1;
   ;	
	?debug	L 1191
	mov	al,byte ptr iw_midi_Flag
	cbw	
	or	ax,ax
	jne	short @34@114
@34@58:
	mov	ax,-1
@34@86:
	jmp	@34@422
@34@114:
   ;	
   ;	   iw_remove_int(midi_player);
   ;	
	?debug	L 1192
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_remove_int
	add	sp,4
   ;	
   ;	
   ;	   for (c=0; c<16; c++)
   ;	
	?debug	L 1194
	mov	dword ptr [bp-4],large 0
	jmp	short @34@198
@34@142:
   ;	
   ;	      all_notes_off(c);
   ;	
	?debug	L 1195
	push	dword ptr [bp-4]
	push	cs
	call	near ptr all_notes_off
	add	sp,4
	?debug	L 1194
	inc	dword ptr [bp-4]
@34@198:
	cmp	dword ptr [bp-4],large 16
	jl	short @34@142
   ;	
   ;	
   ;	   if (midi) {
   ;	
	?debug	L 1197
	cmp	dword ptr [bp+6],large 0
	je	short @34@366
   ;	
   ;	      if (!midi_loaded_patches)
   ;	
	?debug	L 1198
	cmp	dword ptr midi_loaded_patches,large 0
	jne	short @34@338
   ;	
   ;		 if (load_patches(midi) != 0)
   ;	
	?debug	L 1199
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	push	cs
	call	near ptr load_patches
	add	sp,4
	or	ax,dx
	je	short @34@338
	jmp	short @34@58
@34@338:
   ;	
   ;		    return -1;
   ;	
   ;	      midi_loop = loop;
   ;	
	?debug	L 1202
	mov	ax,word ptr [bp+10]
	mov	word ptr midi_loop,ax
   ;	
   ;	      midi_loop_start = -1;
   ;	
	?debug	L 1203
	mov	dword ptr _midi_loop_start,large -1
   ;	
   ;	      midi_loop_end = -1;
   ;	
	?debug	L 1204
	mov	dword ptr _midi_loop_end,large -1
   ;	
   ;	
   ;	      prepare_to_play(midi);
   ;	
	?debug	L 1206
	push	word ptr [bp+8]
	push	word ptr [bp+6]
	call	far ptr prepare_to_play
	add	sp,4
   ;	
   ;	
   ;	      /* arbitrary speed, midi_player() will adjust it */
   ;	      iw_install_int(midi_player, 20);
   ;	
	?debug	L 1209
	push	large 20
	push	seg midi_player
	push	offset midi_player
	call	far ptr _iw_install_int
	add	sp,8
   ;	
   ;	   }
   ;	
	?debug	L 1210
	jmp	short @34@394
@34@366:
   ;	
   ;	   else {
   ;	      midifile = NULL;
   ;	
	?debug	L 1212
	mov	dword ptr midifile,large 0
   ;	
   ;	      midi_pos = -1;
   ;	
	?debug	L 1213
	mov	dword ptr _midi_pos,large -1
@34@394:
   ;	
   ;	   }
   ;	
   ;	   return 0;
   ;	
	?debug	L 1216
	xor	ax,ax
	jmp	@34@86
@34@422:
   ;	
   ;	}
   ;	
	?debug	L 1217
	pop	ds
	leave	
	ret	
	?debug	C E601630602FCFF00046D6964691E0A060000046C+
	?debug	C 6F6F70040A0A0000
	?debug	E
	?debug	E
_iw_midi_play	endp
   ;	
   ;	static long midi_init(char driver)
   ;	
	?debug	L 1224
	assume	cs:TMIDI_TEXT
midi_init	proc	far
	?debug	B
	enter	40,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E606647269766572020A060000
	?debug	B
   ;	
   ;	{
   ;	   long c, c2, c3;
   ;	   long argc, back = 0;
   ;	
	?debug	L 1227
	mov	dword ptr [bp-20],large 0
   ;	
   ;	   char **argv;
   ;	   char buf[16];
   ;	
   ;	   midi_loaded_patches = FALSE;
   ;	
	?debug	L 1231
	mov	dword ptr midi_loaded_patches,large 0
   ;	
   ;	
   ;	   switch (driver)
   ;	
	?debug	L 1233
	mov	al,byte ptr [bp+6]
	cbw	
	mov	bx,ax
	cmp	bx,3
	ja	short @35@254
	shl	bx,1
	jmp	word ptr cs:@35@C1154[bx]
@35@142:
   ;	
   ;	    { case MIDI_AUTO:  midi_driver = &iw_midi_adlib; break;
   ;	
	?debug	L 1234
	mov	word ptr _midi_driver+2,seg _iw_midi_adlib
	mov	word ptr _midi_driver,offset _iw_midi_adlib
	jmp	short @35@282
@35@170:
	jmp	short @35@142
@35@198:
   ;	
   ;	      case MIDI_ADLIB: midi_driver = &iw_midi_adlib; break;
   ;		  case MIDI_MPU401:midi_driver = &iw_midi_mpu401;break;
   ;	
	?debug	L 1236
	mov	word ptr _midi_driver+2,seg _iw_midi_mpu401
	mov	word ptr _midi_driver,offset _iw_midi_mpu401
	jmp	short @35@282
@35@226:
   ;	
   ;	      case MIDI_DIGI:  sprintf(iw_message,"Haven't supported digi midi\n");
   ;	
	?debug	L 1237
	push	ds
	push	offset s@+37
	push	seg _iw_message
	push	offset _iw_message
	call	far ptr _sprintf
	add	sp,8
	jmp	short @35@254
@35@254:
   ;	
   ;	                       back = 1; break;
   ;	      default: back = 1;
   ;	
	?debug	L 1239
	mov	dword ptr [bp-20],large 1
@35@282:
   ;	
   ;	    }
   ;	
   ;	   if (back) return FALSE;
   ;	
	?debug	L 1242
	cmp	dword ptr [bp-20],large 0
	je	short @35@366
@35@310:
	xor	eax,eax
@35@338:
	shld	edx,eax,16
	jmp	@35@1122
@35@366:
   ;	
   ;	
   ;	   if (!midi_driver->detect()) {
   ;	
	?debug	L 1244
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+20]
	or	ax,ax
	jne	short @35@450
   ;	
   ;	      sprintf(iw_message,"MIDI detect failed\n");
   ;	
	?debug	L 1245
	push	ds
	push	offset s@+66
@35@422:
	push	seg _iw_message
	push	offset _iw_message
	call	far ptr _sprintf
	add	sp,8
	jmp	short @35@310
@35@450:
   ;	
   ;	      return FALSE;
   ;	   }
   ;	
   ;	   if (!midi_driver->init(64)) {
   ;	
	?debug	L 1249
	push	64
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+24]
	pop	cx
	or	ax,ax
	jne	short @35@506
   ;	
   ;	      sprintf(iw_message,"MIDI init failed\n");
   ;	
	?debug	L 1250
	push	ds
	push	offset s@+86
	jmp	short @35@422
@35@506:
   ;	
   ;	      return FALSE;
   ;	   }
   ;	
   ;	   iw_install_timer();
   ;	
	?debug	L 1254
	call	far ptr _iw_install_timer
   ;	
   ;	
   ;	   for (c=0; c<16; c++) {
   ;	
	?debug	L 1256
	mov	dword ptr [bp-4],large 0
	jmp	short @35@758
@35@534:
   ;	
   ;	      midi_channel[c].volume = 128;
   ;	
	?debug	L 1257
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+4],large 128
   ;	
   ;	      midi_channel[c].pitch_bend = 0x2000;
   ;	
	?debug	L 1258
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx+12],large 8192
   ;	
   ;	
   ;	      for (c2=0; c2<128; c2++)
   ;	
	?debug	L 1260
	mov	dword ptr [bp-8],large 0
	jmp	short @35@702
@35@562:
   ;	
   ;		 for (c3=0; c3<MIDI_LAYERS; c3++)
   ;	
	?debug	L 1261
	mov	dword ptr [bp-12],large 0
	jmp	short @35@646
@35@590:
   ;	
   ;		    midi_channel[c].note[c2][c3] = -1;
   ;	
	?debug	L 1262
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	ax,word ptr [bp-8]
	shl	ax,4
	add	bx,ax
	mov	ax,word ptr [bp-12]
	shl	ax,2
	add	bx,ax
	mov	dword ptr midi_channel[bx+24],large -1
	?debug	L 1261
	inc	dword ptr [bp-12]
@35@646:
	cmp	dword ptr [bp-12],large 4
	jl	short @35@590
	?debug	L 1260
	inc	dword ptr [bp-8]
@35@702:
	cmp	dword ptr [bp-8],large 128
	jl	short @35@562
	?debug	L 1256
	inc	dword ptr [bp-4]
@35@758:
	cmp	dword ptr [bp-4],large 16
	jl	short @35@534
   ;	
   ;	   }
   ;	
   ;	   for (c=0; c<MIDI_VOICES; c++) {
   ;	
	?debug	L 1265
	mov	dword ptr [bp-4],large 0
	jmp	short @35@870
@35@814:
   ;	
   ;	      midi_voice[c].note = -1;
   ;	
	?debug	L 1266
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr midi_voice[bx+4],large -1
   ;	
   ;	      midi_voice[c].time = 0;
   ;	
	?debug	L 1267
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr midi_voice[bx+12],large 0
	?debug	L 1265
	inc	dword ptr [bp-4]
@35@870:
	cmp	dword ptr [bp-4],large 32
	jl	short @35@814
   ;	
   ;	   }
   ;	
   ;	   for (c=0; c<128; c++) {
   ;	
	?debug	L 1270
	mov	dword ptr [bp-4],large 0
	jmp	@35@1066
@35@926:
   ;	
   ;	      sprintf(buf, "p%d", c+1);
   ;	
	?debug	L 1271
	mov	eax,dword ptr [bp-4]
	inc	eax
	push	eax
	push	ds
	push	offset s@+104
	push	ss
	lea	ax,word ptr [bp-40]
	push	ax
	call	far ptr _sprintf
	add	sp,12
   ;	
   ;	        argv=NULL;
   ;	
	?debug	L 1272
	mov	dword ptr [bp-24],large 0
   ;	
   ;	      if ((argv) && (argc == 4)) {
   ;	
	?debug	L 1273
	cmp	dword ptr [bp-24],large 0
	jne short	@@1327
	jmp	@35@1010
@@1327:
	cmp	dword ptr [bp-16],large 4
	je short	@@1328
	jmp	@35@1010
@@1328:
   ;	
   ;		 patch_table[c].bank1 = atoi(argv[0]);
   ;	
	?debug	L 1274
	les	bx,dword ptr [bp-24]
	push	word ptr es:[bx+2]
	push	word ptr es:[bx]
	call	far ptr _atol
	add	sp,4
	movsx	eax,ax
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr patch_table[bx],eax
   ;	
   ;		 patch_table[c].bank2 = atoi(argv[1]);
   ;	
	?debug	L 1275
	les	bx,dword ptr [bp-24]
	push	word ptr es:[bx+6]
	push	word ptr es:[bx+4]
	call	far ptr _atol
	add	sp,4
	movsx	eax,ax
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr patch_table[bx+4],eax
   ;	
   ;		 patch_table[c].prog  = atoi(argv[2]);
   ;	
	?debug	L 1276
	les	bx,dword ptr [bp-24]
	push	word ptr es:[bx+10]
	push	word ptr es:[bx+8]
	call	far ptr _atol
	add	sp,4
	movsx	eax,ax
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr patch_table[bx+8],eax
   ;	
   ;		 patch_table[c].pitch = atoi(argv[3]);
   ;	
	?debug	L 1277
	les	bx,dword ptr [bp-24]
	push	word ptr es:[bx+14]
	push	word ptr es:[bx+12]
	call	far ptr _atol
	add	sp,4
	movsx	eax,ax
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr patch_table[bx+12],eax
   ;	
   ;	      }
   ;	
	?debug	L 1278
	jmp	short @35@1038
@35@1010:
   ;	
   ;	      else {
   ;		 patch_table[c].bank1 = -1;
   ;	
	?debug	L 1280
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr patch_table[bx],large -1
   ;	
   ;		 patch_table[c].bank2 = -1;
   ;	
	?debug	L 1281
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr patch_table[bx+4],large -1
   ;	
   ;		 patch_table[c].prog = c;
   ;	
	?debug	L 1282
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	eax,dword ptr [bp-4]
	mov	dword ptr patch_table[bx+8],eax
   ;	
   ;		 patch_table[c].pitch = 0;
   ;	
	?debug	L 1283
	mov	bx,word ptr [bp-4]
	shl	bx,4
	mov	dword ptr patch_table[bx+12],large 0
@35@1038:
	?debug	L 1270
	inc	dword ptr [bp-4]
@35@1066:
	cmp	dword ptr [bp-4],large 128
	jge short	@@1329
	jmp	@35@926
@@1329:
   ;	
   ;	      }
   ;	   }
   ;	
   ;	   return TRUE;
   ;	
	?debug	L 1287
	mov	eax,large 1
	jmp	@35@338
@35@1122:
   ;	
   ;	}
   ;	
	?debug	L 1288
	pop	ds
	leave	
	ret	
	?debug	C E3470010001A02
	?debug	C E348000400161800
	?debug	C E6036275664702D8FF0004617267764802E8FF00+
	?debug	C 046261636B0602ECFF0004617267630602F0FF00+
	?debug	C 0263330602F4FF000263320602F8FF0001630602+
	?debug	C FCFF0006647269766572020A060000
	?debug	E
	?debug	E
midi_init	endp
@35@C1154	label	word
	dw	@35@142
	dw	@35@170
	dw	@35@226
	dw	@35@198
   ;	
   ;	static void midi_exit()
   ;	
	?debug	L 1293
	assume	cs:TMIDI_TEXT
midi_exit	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
   ;	
   ;	{
   ;	   iw_midi_stop();
   ;	
	?debug	L 1295
	push	cs
	call	near ptr _iw_midi_stop
   ;	
   ;	   midi_driver->exit();
   ;	
	?debug	L 1296
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+28]
   ;	
   ;	}
   ;	
	?debug	L 1297
	pop	ds
	pop	bp
	ret	
	?debug	E
	?debug	E
midi_exit	endp
   ;	
   ;	static void prepare_to_play(MIDI *midi)
   ;	
	?debug	L 1302
	assume	cs:TMIDI_TEXT
prepare_to_play	proc	far
	?debug	B
	enter	4,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E6046D6964691E0A060000
	?debug	B
   ;	
   ;	{
   ;	   long c;
   ;	
   ;	   for (c=0; c<16; c++)
   ;	
	?debug	L 1306
	mov	dword ptr [bp-4],large 0
	jmp	short @37@114
@37@58:
   ;	
   ;	      reset_controllers(c);
   ;	
	?debug	L 1307
	push	dword ptr [bp-4]
	push	cs
	call	near ptr reset_controllers
	add	sp,4
	?debug	L 1306
	inc	dword ptr [bp-4]
@37@114:
	cmp	dword ptr [bp-4],large 16
	jl	short @37@58
   ;	
   ;	
   ;	   update_controllers();
   ;	
	?debug	L 1309
	push	cs
	call	near ptr update_controllers
   ;	
   ;	
   ;	   midifile = midi;
   ;	
	?debug	L 1311
	mov	eax,dword ptr [bp+6]
	mov	dword ptr midifile,eax
   ;	
   ;	   midi_pos = 0;
   ;	
	?debug	L 1312
	mov	dword ptr _midi_pos,large 0
   ;	
   ;	   midi_pos_counter = 0;
   ;	
	?debug	L 1313
	mov	dword ptr midi_pos_counter,large 0
   ;	
   ;	   midi_speed = TIMERS_PER_SECOND / 2 / midifile->divisions;   /* 120 bpm */
   ;	
	?debug	L 1314
	les	bx,dword ptr midifile
	movsx	ebx,word ptr es:[bx]
	mov	eax,large 000091A6Eh
	cdq	
	idiv	ebx
	mov	dword ptr midi_speed,eax
   ;	
   ;	   midi_new_speed = -1;
   ;	
	?debug	L 1315
	mov	dword ptr midi_new_speed,large -1
   ;	
   ;	   midi_pos_speed = midi_speed * midifile->divisions;
   ;	
	?debug	L 1316
	les	bx,dword ptr midifile
	movsx	eax,word ptr es:[bx]
	mov	edx,dword ptr midi_speed
	imul	edx,eax
	mov	dword ptr midi_pos_speed,edx
   ;	
   ;	   midi_timer_speed = 0;
   ;	
	?debug	L 1317
	mov	dword ptr midi_timer_speed,large 0
   ;	
   ;	   midi_seeking = 0;
   ;	
	?debug	L 1318
	mov	word ptr midi_seeking,0
   ;	
   ;	   midi_looping = 0;
   ;	
	?debug	L 1319
	mov	word ptr midi_looping,0
   ;	
   ;	
   ;	   for (c=0; c<16; c++) {
   ;	
	?debug	L 1321
	mov	dword ptr [bp-4],large 0
	jmp	short @37@254
@37@170:
   ;	
   ;	      midi_channel[c].patch = 0;
   ;	
	?debug	L 1322
	mov	bx,word ptr [bp-4]
	imul	bx,bx,2072
	mov	dword ptr midi_channel[bx],large 0
   ;	
   ;	      if (midi_driver->raw_midi)
   ;	
	?debug	L 1323
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+36],large 0
	je	short @37@226
   ;	
   ;		 raw_program_change(c, 0);
   ;	
	?debug	L 1324
	push	large 0
	push	dword ptr [bp-4]
	push	cs
	call	near ptr raw_program_change
	add	sp,8
@37@226:
	?debug	L 1321
	inc	dword ptr [bp-4]
@37@254:
	cmp	dword ptr [bp-4],large 16
	jl	short @37@170
   ;	
   ;	   }
   ;	
   ;	   for (c=0; c<MIDI_TRACKS; c++) {
   ;	
	?debug	L 1327
	mov	dword ptr [bp-4],large 0
	jmp	@37@450
@37@310:
   ;	
   ;	      if (midi->track[c].data) {
   ;	
	?debug	L 1328
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp+6]
	add	bx,ax
	mov	ax,word ptr es:[bx+2]
	or	ax,word ptr es:[bx+4]
	je	short @37@366
   ;	
   ;		 midi_track[c].pos = midi->track[c].data;
   ;	
	?debug	L 1329
	mov	ax,word ptr [bp-4]
	imul	ax,ax,6
	les	bx,dword ptr [bp+6]
	add	bx,ax
	mov	ax,word ptr es:[bx+4]
	mov	dx,word ptr es:[bx+2]
	mov	bx,word ptr [bp-4]
	imul	bx,bx,9
	mov	word ptr midi_track[bx+2],ax
	mov	word ptr midi_track[bx],dx
   ;	
   ;		 midi_track[c].timer = parse_var_len(&midi_track[c].pos);
   ;	
	?debug	L 1330
	mov	ax,word ptr [bp-4]
	imul	ax,ax,9
	add	ax,offset midi_track
	push	ds
	push	ax
	push	cs
	call	near ptr parse_var_len
	push	dx
	push	ax
	pop	eax
	add	sp,4
	mov	bx,word ptr [bp-4]
	imul	bx,bx,9
	mov	dword ptr midi_track[bx+4],eax
   ;	
   ;		 midi_track[c].timer *= midi_speed;
   ;	
	?debug	L 1331
	mov	bx,word ptr [bp-4]
	imul	bx,bx,9
	mov	eax,dword ptr midi_track[bx+4]
	imul	eax,dword ptr midi_speed
	mov	bx,word ptr [bp-4]
	imul	bx,bx,9
	mov	dword ptr midi_track[bx+4],eax
   ;	
   ;	      }
   ;	
	?debug	L 1332
	jmp	short @37@394
@37@366:
   ;	
   ;	      else {
   ;		 midi_track[c].pos = NULL;
   ;	
	?debug	L 1334
	mov	bx,word ptr [bp-4]
	imul	bx,bx,9
	mov	word ptr midi_track[bx+2],0
	mov	word ptr midi_track[bx],0
   ;	
   ;		 midi_track[c].timer = LONG_MAX;
   ;	
	?debug	L 1335
	mov	bx,word ptr [bp-4]
	imul	bx,bx,9
	mov	dword ptr midi_track[bx+4],large 07FFFFFFFh
@37@394:
   ;	
   ;	      }
   ;	      midi_track[c].running_status = 0;
   ;	
	?debug	L 1337
	mov	bx,word ptr [bp-4]
	imul	bx,bx,9
	mov	byte ptr midi_track[bx+8],0
	?debug	L 1327
	inc	dword ptr [bp-4]
@37@450:
	cmp	dword ptr [bp-4],large 32
	jge short	@@1330
	jmp	@37@310
@@1330:
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 1339
	pop	ds
	leave	
	ret	
	?debug	C E601630602FCFF00046D6964691E0A060000
	?debug	E
	?debug	E
prepare_to_play	endp
   ;	
   ;	void  iw_set_volume(int digi_volume,int midi_volume)
   ;	
	?debug	L 1344
	assume	cs:TMIDI_TEXT
_iw_set_volume	proc	far
	?debug	B
	push	bp
	mov	bp,sp
	push	si
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	C E60B6D6964695F766F6C756D65040A0800000B64+
	?debug	C 6967695F766F6C756D65040A060000
	mov	si,word ptr [bp+8]
	?debug	B
   ;	
   ;	{  
   ;	    if (midi_volume >= 0) {
   ;	
	?debug	L 1346
	or	si,si
	jl	short @38@282
   ;	
   ;	      if (midi_volume<0) midi_volume=0;
   ;	
	?debug	L 1347
	or	si,si
	jge	short @38@114
	xor	si,si
@38@114:
   ;	
   ;	      if (midi_volume>255) midi_volume=255;
   ;	
	?debug	L 1348
	cmp	si,255
	jle	short @38@170
	mov	si,255
@38@170:
   ;	
   ;	
   ;	      if ((midi_driver->mixer_volume) && 
   ;	
	?debug	L 1350
   ;	
   ;		  (midi_driver->mixer_volume(midi_volume) == 0))
   ;	
	?debug	L 1351
	les	bx,dword ptr _midi_driver
	cmp	dword ptr es:[bx+32],large 0
	je	short @38@254
	push	si
	les	bx,dword ptr _midi_driver
	call	dword ptr es:[bx+32]
	pop	cx
	or	ax,ax
	jne	short @38@254
   ;	
   ;		 id_midi_volume = -1;
   ;	
	?debug	L 1352
	mov	word ptr _id_midi_volume,-1
	jmp	short @38@282
@38@254:
   ;	
   ;	      else
   ;		 id_midi_volume = midi_volume;
   ;	
	?debug	L 1354
	mov	word ptr _id_midi_volume,si
@38@282:
   ;	
   ;	   }
   ;	   if (digi_volume >= 0) {
   ;	
	?debug	L 1356
	cmp	word ptr [bp+6],0
	jl	short @38@310
@38@310:
   ;	
   ;	   }
   ;	}
   ;	
	?debug	L 1358
	pop	ds
	pop	si
	pop	bp
	ret	
	?debug	C E60B646967695F766F6C756D65040A0600000B6D+
	?debug	C 6964695F766F6C756D65040C0600
	?debug	E
	?debug	E
_iw_set_volume	endp
	?debug	C E80107544D4944492E4361749632
   ;	
   ;	int main(void)
   ;	
	?debug	L 10
	assume	cs:TMIDI_TEXT
_main	proc	far
	?debug	B
	enter	2,0
	push	ds
	mov	ax,TMIDI_DATA
	mov	ds,ax
	?debug	B
   ;	
   ;	{
   ;		int i;
   ;		printf("Hello, midi world !!\n");
   ;	
	?debug	L 13
	push	ds
	push	offset s@+108
	call	far ptr _printf
	add	sp,4
   ;	
   ;	//	iw_midi_card= MIDI_OPL2;
   ;		iw_midi_init(MIDI_MPU401);
   ;	
	?debug	L 15
	push	3
	push	cs
	call	near ptr _iw_midi_init
	pop	cx
   ;	
   ;		printf("init message: %s %s\n", iw_message, midi_driver->desc);
   ;	
	?debug	L 16
	les	bx,dword ptr _midi_driver
	push	word ptr es:[bx+6]
	push	word ptr es:[bx+4]
	push	seg _iw_message
	push	offset _iw_message
	push	ds
	push	offset s@+130
	call	far ptr _printf
	add	sp,12
   ;	
   ;		printf("voices=%d\n", midi_driver->voices);
   ;	
	?debug	L 17
	les	bx,dword ptr _midi_driver
	push	word ptr es:[bx+8]
	push	ds
	push	offset s@+151
	call	far ptr _printf
	add	sp,6
   ;	
   ;		music = iw_midi_load("music.mid", 0);
   ;	
	?debug	L 18
	push	large 0
	push	ds
	push	offset s@+162
	push	cs
	call	near ptr _iw_midi_load
	add	sp,8
	mov	word ptr _music+2,dx
	mov	word ptr _music,ax
   ;	
   ;		iw_midi_play(music, 1);
   ;	
	?debug	L 19
	push	1
	push	word ptr _music+2
	push	word ptr _music
	push	cs
	call	near ptr _iw_midi_play
	add	sp,6
   ;	
   ;		scanf("%d", &i);
   ;	
	?debug	L 20
	push	ss
	lea	ax,word ptr [bp-2]
	push	ax
	push	ds
	push	offset s@+172
	call	far ptr _scanf
	add	sp,8
   ;	
   ;		iw_midi_rest();
   ;	
	?debug	L 21
	push	cs
	call	near ptr _iw_midi_rest
   ;	
   ;	//	printf("count=%d\n", iw_mpu_intcount);
   ;		scanf("%d", &i);
   ;	
	?debug	L 23
	push	ss
	lea	ax,word ptr [bp-2]
	push	ax
	push	ds
	push	offset s@+175
	call	far ptr _scanf
	add	sp,8
   ;	
   ;		/*iw_remove_timer();*/
   ;		return 0;
   ;	
	?debug	L 25
	xor	ax,ax
	jmp	short @39@58
@39@58:
   ;	
   ;	}
   ;	
	?debug	L 26
	pop	ds
	leave	
	ret	
	?debug	C E601690402FEFF00
	?debug	E
	?debug	E
_main	endp
TMIDI_TEXT	ends
TMIDI_DATA	segment word public use16 'FAR_DATA'
_music	label	dword
	db	4 dup (0)
_id_error_msg	label	byte
	db	150 dup (0)
midi_looping	label	word
	db	2 dup (0)
midi_seeking	label	word
	db	2 dup (0)
patch_table	label	word
	db	2048 dup (0)
midi_waiting	label	word
	db	384 dup (0)
midi_channel	label	word
	db	33152 dup (0)
midi_voice	label	word
	db	512 dup (0)
midi_track	label	word
	db	288 dup (0)
midi_alloc_vol	label	word
	db	4 dup (0)
midi_alloc_note	label	word
	db	4 dup (0)
midi_alloc_channel	label	word
	db	4 dup (0)
midi_new_speed	label	word
	db	4 dup (0)
midi_speed	label	word
	db	4 dup (0)
midi_pos_speed	label	word
	db	4 dup (0)
midi_timer_speed	label	word
	db	4 dup (0)
midi_pos_counter	label	word
	db	4 dup (0)
_midi_driver	label	dword
	db	4 dup (0)
	?debug	C E9
	?debug	C FA00000000
s@	label	byte
	db	'Sound card init failed'
	db	10
	db	0
	db	'rb'
	db	0
	db	'MThd'
	db	0
	db	'MTrk'
	db	0
	db	'Haven'
	db	39
	db	't supported digi midi'
	db	10
	db	0
	db	'MIDI detect failed'
	db	10
	db	0
	db	'MIDI init failed'
	db	10
	db	0
	db	'p%d'
	db	0
	db	'Hello, midi world !!'
	db	10
	db	0
	db	'init message: %s %s'
	db	10
	db	0
	db	'voices=%d'
	db	10
	db	0
	db	'music.mid'
	db	0
	db	'%d'
	db	0
	db	'%d'
	db	0
TMIDI_DATA	ends
TMIDI_TEXT	segment byte public use16 'CODE'
TMIDI_TEXT	ends
	public	_main
	public	_music
_load_patches	equ	load_patches
	extrn	_iw_midi_Seek:far
	extrn	_iw_midi_Pause:far
_process_midi_event	equ	process_midi_event
_process_meta_event	equ	process_meta_event
_process_controller	equ	process_controller
_update_controllers	equ	update_controllers
_reset_controllers	equ	reset_controllers
_all_notes_off	equ	all_notes_off
_midi_note_on	equ	midi_note_on
	public	_id_midi_allocate_voice
_sort_out_pitch_bend	equ	sort_out_pitch_bend
_midi_note_off	equ	midi_note_off
_raw_program_change	equ	raw_program_change
_sort_out_volume	equ	sort_out_volume
_global_volume_fix	equ	global_volume_fix
_parse_var_len	equ	parse_var_len
_mfgetl	equ	mfgetl
_mfgetw	equ	mfgetw
_midi_exit	equ	midi_exit
_midi_init	equ	midi_init
	public	_id_error_msg
_iw_midi_Flag	equ	iw_midi_Flag
	public	_midi_sysex_callback
	public	_midi_meta_callback
	public	_midi_msg_callback
_midi_looping	equ	midi_looping
_midi_seeking	equ	midi_seeking
_patch_table	equ	patch_table
_midi_waiting	equ	midi_waiting
_midi_channel	equ	midi_channel
_midi_voice	equ	midi_voice
_midi_track	equ	midi_track
_midi_alloc_vol	equ	midi_alloc_vol
_midi_alloc_note	equ	midi_alloc_note
_midi_alloc_channel	equ	midi_alloc_channel
	public	_id_midi_volume
_old_midi_volume	equ	old_midi_volume
_midi_new_speed	equ	midi_new_speed
_midi_speed	equ	midi_speed
_midi_pos_speed	equ	midi_pos_speed
_midi_timer_speed	equ	midi_timer_speed
_midi_loaded_patches	equ	midi_loaded_patches
_midi_semaphore	equ	midi_semaphore
	public	_midi_loop_end
	public	_midi_loop_start
_midi_loop	equ	midi_loop
_midifile	equ	midifile
_midi_lock_mem	equ	midi_lock_mem
_prepare_to_play	equ	prepare_to_play
_midi_player	equ	midi_player
_midi_pos_counter	equ	midi_pos_counter
	public	_midi_pos
	public	_iw_midi_status
	public	_iw_midi_resume
	public	_iw_midi_seek
	public	_iw_midi_pause
	public	_iw_midi_stop
	public	_iw_midi_play
	public	_iw_midi_destroy
	public	_iw_midi_load
	public	_iw_midi_rest
	public	_iw_midi_init
	public	_iw_set_volume
__dummy_noop3	equ	_dummy_noop3
__dummy_noop2	equ	_dummy_noop2
__dummy_noop1	equ	_dummy_noop1
__dummy_key_on	equ	_dummy_key_on
__dummy_adjust_patches	equ	_dummy_adjust_patches
__dummy_load_patches	equ	_dummy_load_patches
	extrn	_iw_midi_mpu401:word
	extrn	_iw_midi_adlib:word
	public	_midi_driver
	public	__midi_tick
	extrn	_memcmp:far
	extrn	_malloc:far
	extrn	_free:far
	extrn	_atol:far
	extrn	_sprintf:far
	extrn	_scanf:far
	extrn	_printf:far
	extrn	_fseek:far
	extrn	_fread:far
	extrn	_fopen:far
	extrn	_fgetc:far
	extrn	_fclose:far
	extrn	_iw_message:byte
	extrn	_iw_sb_port:word
	extrn	_iw_remove_int:far
	extrn	_iw_install_int:far
	extrn	_iw_install_int_ex:far
	extrn	_iw_install_timer:far
_s@	equ	s@
	?debug	C EA010D
	?debug	C E34900000023040400
	?debug	C EC055F6D61696E491800
	?debug	C EC065F6D757369631E0000
	?debug	C E34A00000023060400
	?debug	C E34B00000023040400
	?debug	C EB0D5F69775F6D6964695F5365656B4B00
	?debug	C EB0E5F69775F6D6964695F50617573654B00
	?debug	C E34C00000023010400
	?debug	C E34D00000023010400
	?debug	C E34E00000023010400
	?debug	C E34F00000023010400
	?debug	C E35000000023010400
	?debug	C E35100000023010400
	?debug	C E35200000023010400
	?debug	C E35300000023040400
	?debug	C EC175F69645F6D6964695F616C6C6F636174655F+
	?debug	C 766F696365531800
	?debug	C E35400000023010400
	?debug	C E35500000023010400
	?debug	C E35600000023010400
	?debug	C E35700000023060400
	?debug	C E35800000023060400
	?debug	C E359000000230C0400
	?debug	C E35A00000023060400
	?debug	C E35B00000023060400
	?debug	C E35C00000023010400
	?debug	C E35D00000023060400
	?debug	C E35E0096001A02
	?debug	C EC0D5F69645F6572726F725F6D73675E0000
	?debug	C E36000000023010400
	?debug	C E35F000400166000
	?debug	C EC145F6D6964695F73797365785F63616C6C6261+
	?debug	C 636B5F0000
	?debug	C E36200000023010400
	?debug	C E361000400166200
	?debug	C EC135F6D6964695F6D6574615F63616C6C626163+
	?debug	C 6B610000
	?debug	C E36400000023010400
	?debug	C E363000400166400
	?debug	C EC125F6D6964695F6D73675F63616C6C6261636B+
	?debug	C 630000
	?debug	C E3660B50415443485F5441424C4510001E27
	?debug	C E3650000081A66
	?debug	C E3680C57414954494E475F4E4F54450C001E2C
	?debug	C E3670080011A68
	?debug	C E36A0C4D4944495F4348414E4E454C18081E30
	?debug	C E36C0010001A06
	?debug	C E36B0000081A6C
	?debug	C E3690080811A6A
	?debug	C E36E0A4D4944495F564F49434510001E38
	?debug	C E36D0000021A6E
	?debug	C E3700A4D4944495F545241434B09001E3D
	?debug	C E36F0020011A70
	?debug	C EC0F5F69645F6D6964695F766F6C756D65040000
	?debug	C EC0E5F6D6964695F6C6F6F705F656E64060000
	?debug	C EC105F6D6964695F6C6F6F705F73746172740600+
	?debug	C 00
	?debug	C E37100000023010400
	?debug	C E37200000023010400
	?debug	C E37300000023010400
	?debug	C EC095F6D6964695F706F73060000
	?debug	C E37400000023020400
	?debug	C EC0F5F69775F6D6964695F737461747573741800
	?debug	C E37500000023010400
	?debug	C EC0F5F69775F6D6964695F726573756D65751800
	?debug	C E37600000023040400
	?debug	C EC0D5F69775F6D6964695F7365656B761800
	?debug	C E37700000023010400
	?debug	C EC0E5F69775F6D6964695F7061757365771800
	?debug	C E37800000023010400
	?debug	C EC0D5F69775F6D6964695F73746F70781800
	?debug	C E37900000023040400
	?debug	C EC0D5F69775F6D6964695F706C6179791800
	?debug	C E37A00000023010400
	?debug	C EC105F69775F6D6964695F64657374726F797A18+
	?debug	C 00
	?debug	C E37B000000231E0400
	?debug	C EC0D5F69775F6D6964695F6C6F61647B1800
	?debug	C E37C00000023020400
	?debug	C EC0D5F69775F6D6964695F726573747C1800
	?debug	C E37D00000023020400
	?debug	C EC0D5F69775F6D6964695F696E69747D1800
	?debug	C E37E00000023010400
	?debug	C EC0E5F69775F7365745F766F6C756D657E1800
	?debug	C E37F00000023010400
	?debug	C E3808000000023010400
	?debug	C E3808100000023010400
	?debug	C E3808200000023010400
	?debug	C E3808300000023010400
	?debug	C E3808400000023040400
	?debug	C EB0F5F69775F6D6964695F6D70753430312A00
	?debug	C EB0E5F69775F6D6964695F61646C69622A00
	?debug	C EC0C5F6D6964695F647269766572290000
	?debug	C EC0B5F5F6D6964695F7469636B060000
	?debug	C E3808500000023040400
	?debug	C EB075F6D656D636D70808500
	?debug	C E38087000400160100
	?debug	C E380860000002380870400
	?debug	C EB075F6D616C6C6F63808600
	?debug	C E3808800000023010400
	?debug	C EB055F66726565808800
	?debug	C E3808900000023060400
	?debug	C EB055F61746F6C808900
	?debug	C E3808A00000023040401
	?debug	C EB085F737072696E7466808A00
	?debug	C E3808B00000023040401
	?debug	C EB065F7363616E66808B00
	?debug	C E3808C00000023040401
	?debug	C EB075F7072696E7466808C00
	?debug	C E3808D00000023040400
	?debug	C EB065F667365656B808D00
	?debug	C E3808E000000230A0400
	?debug	C EB065F6672656164808E00
	?debug	C E3808F00000023190400
	?debug	C EB065F666F70656E808F00
	?debug	C E3809000000023040400
	?debug	C EB065F6667657463809000
	?debug	C E3809100000023040400
	?debug	C EB075F66636C6F7365809100
	?debug	C E380920000001A02
	?debug	C EB0B5F69775F6D657373616765809200
	?debug	C EB0B5F69775F73625F706F72740400
	?debug	C E3809300000023010400
	?debug	C EB0E5F69775F72656D6F76655F696E74809300
	?debug	C E3809400000023020400
	?debug	C EB0F5F69775F696E7374616C6C5F696E74809400
	?debug	C E3809500000023020400
	?debug	C EB125F69775F696E7374616C6C5F696E745F6578+
	?debug	C 809500
	?debug	C E3809600000023010400
	?debug	C EB115F69775F696E7374616C6C5F74696D657280+
	?debug	C 9600
	?debug	C E60C69775F6D6964695F466C6167020000023000+
	?debug	C 000C6D6964695F6C6F6F70696E6704000002D700+
	?debug	C 000C6D6964695F7365656B696E6704000002D900+
	?debug	C 000B70617463685F7461626C6565000002DB0000+
	?debug	C 0C6D6964695F77616974696E6767000002DB0800+
	?debug	C 0C6D6964695F6368616E6E656C690000025B0A00+
	?debug	C 0A6D6964695F766F6963656D000002DB8B000A6D+
	?debug	C 6964695F747261636B6F000002DB8D000E6D6964+
	?debug	C 695F616C6C6F635F766F6C06000002FB8E000F6D+
	?debug	C 6964695F616C6C6F635F6E6F746506000002FF8E+
	?debug	C 00126D6964695F616C6C6F635F6368616E6E656C+
	?debug	C 06000002038F000F6F6C645F6D6964695F766F6C+
	?debug	C 756D65060000021E00000E6D6964695F6E65775F+
	?debug	C 737065656406000002078F000A6D6964695F7370+
	?debug	C 656564060000020B8F000E6D6964695F706F735F+
	?debug	C 7370656564060000020F8F00106D6964695F7469+
	?debug	C 6D65725F737065656406000002138F00136D6964+
	?debug	C 695F6C6F616465645F7061746368657306000002+
	?debug	C 1A00000E6D6964695F73656D6170686F72650600+
	?debug	C 0002160000096D6964695F6C6F6F70040000020C+
	?debug	C 0000086D69646966696C651E000002080000106D+
	?debug	C 6964695F706F735F636F756E7465720600000217+
	?debug	C 8F000B50415443485F5441424C456606000C5741+
	?debug	C 4954494E475F4E4F54456806000A4D4944495F56+
	?debug	C 4F4943456E06000C4D4944495F4348414E4E454C+
	?debug	C 6A06000A4D4944495F545241434B7006000B4D49+
	?debug	C 44495F4452495645522A0600044D4944491F0600+
	?debug	C 0777636861725F740206000446494C451A060006+
	?debug	C 66706F735F740606000673697A655F740A06000B+
	?debug	C 50415443485F5441424C456607000C5741495449+
	?debug	C 4E475F4E4F54456807000A4D4944495F564F4943+
	?debug	C 456E07000C4D4944495F4348414E4E454C6A0700+
	?debug	C 0A4D4944495F545241434B7007000B4D4944495F+
	?debug	C 4452495645522A0700044D4944491F0700
	?debug	F load_patches 74 24 0
	?debug	F process_midi_event 76 24 0
	?debug	F process_meta_event 77 24 0
	?debug	F process_controller 78 24 0
	?debug	F update_controllers 79 24 0
	?debug	F reset_controllers 80 24 0
	?debug	F all_notes_off 81 24 0
	?debug	F midi_note_on 82 24 0
	?debug	F sort_out_pitch_bend 84 24 0
	?debug	F midi_note_off 85 24 0
	?debug	F raw_program_change 86 24 0
	?debug	F sort_out_volume 87 24 0
	?debug	F global_volume_fix 88 24 0
	?debug	F parse_var_len 89 24 0
	?debug	F mfgetl 90 24 0
	?debug	F mfgetw 91 24 0
	?debug	F midi_exit 92 24 0
	?debug	F midi_init 93 24 0
	?debug	F midi_lock_mem 113 0 0
	?debug	F prepare_to_play 114 24 0
	?debug	F midi_player 115 24 0
	?debug	F _dummy_noop3 127 24 0
	?debug	F _dummy_noop2 128 24 0
	?debug	F _dummy_noop1 129 24 0
	?debug	F _dummy_key_on 130 24 0
	?debug	F _dummy_adjust_patches 131 24 0
	?debug	F _dummy_load_patches 132 24 0
	?debug	C E200056C6576656C040005666C6167730A000266+
	?debug	C 64020004686F6C640800056273697A6504000662+
	?debug	C 75666665721B0004637572701B0006697374656D+
	?debug	C 700A0005746F6B656E04C014000000
	?debug	C E200096469766973696F6E73040005747261636B+
	?debug	C 20C0C2000000
	?debug	C E20004646174611B00036C656E04C006000000
	?debug	C E200046E616D6518000464657363180006766F69+
	?debug	C 63657304000962617365766F69636504000A6D61+
	?debug	C 785F766F6963657304000A6465665F766F696365+
	?debug	C 73040004786D696E040004786D61780400066465+
	?debug	C 746563742B0004696E69742D0004657869742F00+
	?debug	C 0C6D697865725F766F6C756D653100087261775F+
	?debug	C 6D69646933000C6C6F61645F7061746368657335+
	?debug	C 000E61646A7573745F706174636865733700066B+
	?debug	C 65795F6F6E3900076B65795F6F66663B000A7365+
	?debug	C 745F766F6C756D653D00097365745F7069746368+
	?debug	C 3F00077365745F70616E41000B7365745F766962+
	?debug	C 7261746F43C048000000
	?debug	C E2000562616E6B3106000562616E6B3206000470+
	?debug	C 726F67060005706974636806C010000000
	?debug	C E200076368616E6E656C0600046E6F7465060006+
	?debug	C 766F6C756D6506C00C000000
	?debug	C E200057061746368060006766F6C756D65060003+
	?debug	C 70616E06000A70697463685F62656E6406000A6E+
	?debug	C 65775F766F6C756D6506000E6E65775F70697463+
	?debug	C 685F62656E640600046E6F74656BC018080000
	?debug	C E200076368616E6E656C0600046E6F7465060006+
	?debug	C 766F6C756D6506000474696D6506C010000000
	?debug	C E20003706F731B000574696D657206000E72756E+
	?debug	C 6E696E675F73746174757308C009000000
	end
