|
|
1.1 root 1: /* Generator is (c) James Ponder, 1997-2001 http://www.squish.net/generator/ */
2:
3: #include "generator.h"
4: #include "gensoundi.h"
5:
6: #ifdef JFM
7: # include "jfm.h"
8: #else
9: # include "support.h"
10: # include "fm.h"
11: #endif
12:
13: uint8 soundi_regs1[256];
14: uint8 soundi_regs2[256];
15: uint8 soundi_address1 = 0;
16: uint8 soundi_address2 = 0;
17: uint8 soundi_keys[8];
18:
19: /*** soundi_ym2612fetch - fetch byte from ym2612 chip ***/
20:
21: uint8 soundi_ym2612fetch(uint8 addr)
22: {
23: #ifdef JFM
24: return jfm_read(soundi_ctx, addr);
25: #else
26: return YM2612Read(0, addr);
27: #endif
28: }
29:
30: /*** soundi_ym2612store - store a byte to the ym2612 chip ***/
31:
32: void soundi_ym2612store(uint8 addr, uint8 data)
33: {
34: switch (addr) {
35: case 0:
36: soundi_address1 = data;
37: break;
38: case 1:
39: if (soundi_address1 == 0x28 && (data & 3) != 3)
40: soundi_keys[data & 7] = data >> 4;
41: if (soundi_address1 == 0x2a) {
42: soundi_keys[7] = 0;
43: }
44: if (soundi_address1 == 0x2b)
45: soundi_keys[7] = data & 0x80 ? 0xf : 0;
46: soundi_regs1[soundi_address1] = data;
47: break;
48: case 2:
49: soundi_address2 = data;
50: break;
51: case 3:
52: soundi_regs2[soundi_address2] = data;
53: break;
54: }
55: #ifdef JFM
56: jfm_write(soundi_ctx, addr, data);
57: #else
58: YM2612Write(0, addr, data);
59: #endif
60: }
61:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.