Subversion Repositories Shiroi

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
9 nishi 1
/* $Id: sound.c 12 2024-08-29 04:19:08Z nishi $ */
2
 
3
#include "sound.h"
4
 
5
#include "io.h"
6
 
7
short psg_addr;
8
short psg_data;
9
 
10
void beep(void){
12 nishi 11
	_beep(1L * 1024 / 2);
9 nishi 12
}
13
 
14
void _beep(unsigned long howlong){
15
	if(psg_addr == -1) return;
16
	unsigned long i;
17
 
18
	outp(psg_addr, 8);
19
	outp(psg_data, 0x0f);
20
 
21
	outp(psg_addr, 0);
10 nishi 22
	outp(psg_data, 0xb0);
9 nishi 23
 
24
	outp(psg_addr, 1);
25
	outp(psg_data, 0x0);
26
 
27
	outp(psg_addr, 7);
28
	outp(psg_data, 0x3e);
29
 
30
	for(i = 0; i < howlong; i++);
31
 
32
	outp(psg_addr, 7);
33
	outp(psg_data, 0x3f);
34
}
35
 
36
void sound_card(int t, int port){
37
	if(t == 0x11){
38
		psg_addr = port - 2;
39
		psg_data = port - 1;
40
	}
41
}