Subversion Repositories Shiroi

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
8 nishi 1
/* $Id: psg.c 8 2024-08-28 16:29:15Z nishi $ */
2
 
3
#include "psg.h"
4
 
5
#include "io.h"
6
 
7
short psg_addr;
8
short psg_data;
9
 
10
void beep(void){
11
	_beep(3L * 1024);
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);
22
	outp(psg_data, 0xd6);
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 psg_card(int t, int port){
37
	if(t == 0x11){
38
		psg_addr = port - 2;
39
		psg_data = port - 1;
40
	}
41
}