-
Notifications
You must be signed in to change notification settings - Fork 1
/
MIDI.INC
99 lines (77 loc) · 1.19 KB
/
MIDI.INC
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
is_input:
push edx
mov dx,word [midisp]
in al,dx
and al,0x80
pop edx
ret
is_output:
push edx
mov dx,word [midisp]
in al,dx
and al,0x40
pop edx
ret
get_mpu_in:
push edx
mov dx,word [mididp]
in al,dx
pop edx
ret
put_mpu_out:
push edx
mov dx,word [mididp]
out dx,al
pop edx
ret
setuart:
su1:
call is_output
cmp al,0
jnz su1
mov dx,word [midisp]
mov al,0xff
out dx,al
su2:
mov dx,word [midisp]
mov al,0xff
out dx,al
call is_input
cmp al,0
jnz su2
call get_mpu_in
cmp al,0xfe
jnz su2
su3:
call is_output
cmp al,0
jnz su3
mov dx,word [midisp]
mov al,0x3f
out dx,al
ret
align 4
sys_midi:
cmp [mididp],0
jnz sm0
mov [esp+36],dword 1
ret
sm0:
cmp eax,1
mov [esp+36],dword 0
jnz smn1
call setuart
ret
smn1:
cmp eax,2
jnz smn2
sm10:
call get_mpu_in
call is_output
test al,al
jnz sm10
mov al,bl
call put_mpu_out
ret
smn2:
ret