File tree 3 files changed +95
-0
lines changed
3 files changed +95
-0
lines changed Original file line number Diff line number Diff line change
1
+ #include <genesis.h>
2
+ #include <ym2612.h>
3
+
4
+ void write_freq ( int freq ) {
5
+ char aux = freq >>8 ;
6
+ YM2612_writeReg ( 0 , 0xa4 , aux );
7
+ aux = freq & 0xff ;
8
+ YM2612_writeReg ( 0 , 0xa4 , aux );
9
+ }
10
+
11
+ int main () {
12
+ char ymregs [] = {
13
+ 0xb0 , 0x07 , // FB - connect
14
+ 0xb4 , 0xc0 , // LR
15
+ 0x30 , 0x01 , // DT - MULT
16
+ 0x40 , 0x00 , // TL
17
+ 0x50 , 0x1f , // AR
18
+ 0x60 , 0x00 , // DR
19
+ 0x70 , 0x00 , // SR
20
+
21
+ 0x80 , 0x00 , // SL+RR
22
+ 0x90 , 0x00 , // SSG
23
+ 0xa4 , 0x00 , // Block
24
+ 0xa0 , 0x00 // Fnum
25
+ };
26
+ int k ;
27
+ int ssg = 7 ;
28
+ int inc = 1 ;
29
+ Z80_requestBus (1000 );
30
+ // YM2612_reset();
31
+ for ( k = 0 ; k < sizeof (ymregs ); k += 2 ) {
32
+ YM2612_writeReg ( 0 , ymregs [k ], ymregs [k + 1 ]);
33
+ }
34
+ VDP_drawText ("Freq sweep" , 10 , 13 );
35
+ YM2612_writeReg ( 0 , 0x28 , 0x10 ); // key-on channel 0 op 0
36
+ while (1 ) {
37
+ unsigned k1 ;
38
+ int freq = 0 ;
39
+ for (k1 = 160 ;k1 > 0 ;k1 -- ) {
40
+ unsigned k2 = 0xffff ;
41
+ while (k2 -- );
42
+ }
43
+ if (freq == 0 ) inc = 1 ;
44
+ freq += inc ;
45
+ if (freq > 0xc000 ) inc = -1 ;
46
+ YM2612_writeReg ( freq );
47
+ }
48
+ return 0 ;
49
+ }
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" standalone =" yes" ?>
2
+ <CodeBlocks_project_file >
3
+ <FileVersion major =" 1" minor =" 6" />
4
+ <Project >
5
+ <Option title =" test" />
6
+ <Option makefile =" c:/sgdk/makefile.gen" />
7
+ <Option makefile_is_custom =" 1" />
8
+ <Option pch_mode =" 2" />
9
+ <Option compiler =" sega_genesis_compiler" />
10
+ <Build >
11
+ <Target title =" default" >
12
+ <Option output =" out/test" prefix_auto =" 1" extension_auto =" 1" />
13
+ <Option object_output =" out/" />
14
+ <Option type =" 1" />
15
+ <Option compiler =" sega_genesis_compiler" />
16
+ <Compiler >
17
+ <Add option =" -O2" />
18
+ </Compiler >
19
+ <Linker >
20
+ <Add option =" -s" />
21
+ </Linker >
22
+ </Target >
23
+ </Build >
24
+ <Compiler >
25
+ <Add option =" -Wall" />
26
+ </Compiler >
27
+ <Unit filename =" test.c" >
28
+ <Option compilerVar =" CC" />
29
+ </Unit >
30
+ <Extensions >
31
+ <code_completion />
32
+ <envvars />
33
+ <debugger />
34
+ </Extensions >
35
+ </Project >
36
+ </CodeBlocks_project_file >
Original file line number Diff line number Diff line change
1
+ <?xml version =" 1.0" encoding =" UTF-8" standalone =" yes" ?>
2
+ <CodeBlocks_layout_file >
3
+ <FileVersion major =" 1" minor =" 0" />
4
+ <ActiveTarget name =" default" />
5
+ <File name =" test.c" open =" 1" top =" 1" tabpos =" 1" split =" 0" active =" 1" splitpos =" 0" zoom_1 =" 0" zoom_2 =" 0" >
6
+ <Cursor >
7
+ <Cursor1 position =" 632" topLine =" 0" />
8
+ </Cursor >
9
+ </File >
10
+ </CodeBlocks_layout_file >
You can’t perform that action at this time.
0 commit comments