1 /*
2 Atari MIDI emulation
3
4 ARAnyM (C) 2005-2006 Patrice Mandin
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 2 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 */
20
21 #include "sysdeps.h"
22 #include "hardware.h"
23 #include "cpu_emulation.h"
24 #include "memory-uae.h"
25 #include "midi.h"
26 #include "parameters.h"
27
28 #define DEBUG 0
29 #include "debug.h"
30
31 #include <cstdio>
32 #include <cstdlib>
33 #include <cstring>
34
MIDI(memptr addr,uint32 size)35 MIDI::MIDI(memptr addr, uint32 size) : ACIA(addr, size)
36 {
37 D(bug("midi: interface created at 0x%06x", getHWoffset()));
38
39 reset();
40 }
41
~MIDI(void)42 MIDI::~MIDI(void)
43 {
44 D(bug("midi: interface destroyed at 0x%06x", getHWoffset()));
45 }
46
reset(void)47 void MIDI::reset(void)
48 {
49 D(bug("midi: reset"));
50
51 ACIA::reset();
52 }
53
54
close(void)55 void MIDI::close(void)
56 {
57 if (fd >= 0)
58 {
59 int i, j;
60
61 for (j=0;j<128;j++) {
62 for (i=0;i<16;i++) {
63 WriteData(0x80 + i);
64 WriteData(j);
65 WriteData(0);
66 }
67 }
68
69 ::close(fd);
70 fd = -1;
71 }
72 }
73