OSDN Git Service

p16 is being worked on a bunch by me wwww [16_ca needs huge amounts of work and I...
[proj16/16.git] / src / lib / 16_sd.h
1 /* Project 16 Source Code~\r
2  * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
3  *\r
4  * This file is part of Project 16.\r
5  *\r
6  * Project 16 is free software; you can redistribute it and/or modify\r
7  * it under the terms of the GNU General Public License as published by\r
8  * the Free Software Foundation; either version 3 of the License, or\r
9  * (at your option) any later version.\r
10  *\r
11  * Project 16 is distributed in the hope that it will be useful,\r
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
14  * GNU General Public License for more details.\r
15  *\r
16  * You should have received a copy of the GNU General Public License\r
17  * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
18  * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
19  * Fifth Floor, Boston, MA 02110-1301 USA.\r
20  *\r
21  */\r
22 \r
23 #ifndef __16_SD_H_\r
24 #define __16_SD_H_\r
25 \r
26 #include "src/lib/16_head.h"\r
27 #include <hw/8254/8254.h>               /* 8254 timer */\r
28 #include <hw/adlib/adlib.h>\r
29 #include <hw/vga/vga.h>\r
30 #include <hw/dos/dos.h>\r
31 #include <hw/8259/8259.h>\r
32 \r
33 #define MIN_REGISTER                    0x01\r
34 #define MAX_REGISTER                    0xF5\r
35 #define ADLIB_FM_ADDRESS        0x388   /* adlib address/status register */\r
36 #define ADLIB_FM_DATA           0x389   /* adlib data register           */\r
37 \r
38 /*\r
39 * FM Instrument definition for .SBI files - SoundBlaster instrument\r
40 * - these are the important parts - we will skip the header, but since\r
41 *   I am not sure where it starts and ends so I have had to guess.\r
42 *   However it SEEMS! to work. Each array has two values, one for\r
43 *   each operator.\r
44 */\r
45 typedef struct{\r
46         byte SoundCharacteristic[2];    /* modulator frequency multiple...  */\r
47         byte Level[2];                  /* modulator frequency level...     */\r
48         byte AttackDecay[2];            /* modulator attack/decay...        */\r
49         byte SustainRelease[2];         /* modulator sustain/release...     */\r
50         byte WaveSelect[2];             /* output waveform distortion       */\r
51         byte Feedback;                  /* feedback algorithm and strength  */\r
52 } FMInstrument;\r
53 \r
54 \r
55 void opl2out(word reg, word data);\r
56 void opl3out(word reg, word data);\r
57 void opl3exp(word data);\r
58 \r
59 void FMReset(void/*int percusiveMode*/);\r
60 void FMKeyOff(int voice);\r
61 void FMKeyOn(int voice, int freq, int octave);\r
62 void FMSetVoice(int voiceNum, FMInstrument *ins);\r
63 \r
64 void SD_Initimf(global_game_variables_t *gvar);\r
65 void SD_imf_free_music(global_game_variables_t *gvar);\r
66 int SD_imf_load_music(const char *path, global_game_variables_t *gvar);\r
67 //void interrupt irq0(global_game_variables_t *gvar);\r
68 void SD_imf_tick(global_game_variables_t *gvar);\r
69 void SD_adlib_shut_up();\r
70 \r
71 #endif /*__16_SND_H_*/\r