From: Robin Krens Date: Sun, 12 Jun 2022 13:39:19 +0000 (+0200) Subject: snd: init and test of noise sound X-Git-Url: https://robinkrens.nl/gitweb/?a=commitdiff_plain;h=aac2ecae4a1e4f57510f5bbc7f7b5234f6925d35;p=swan-dev snd: init and test of noise sound --- diff --git a/src/main.c b/src/main.c index 7690c66..5a18283 100644 --- a/src/main.c +++ b/src/main.c @@ -7,6 +7,7 @@ */ #include #include +#include #include #include @@ -61,29 +62,13 @@ unsigned char inport(unsigned char portnr) return val; } -static void __attribute__((used)) dummy() +void setup_audio(void) { - __asm__("iret"); -} + outport(IO_AUDIO_CTRL, AUDIO_4_NOISE | AUDIO_4_ON); + outport(IO_AUDIO_NOISE_CTRL, NOISE_RESET | NOISE_ENABLE | 0x2); + outport(IO_AUDIO4_VOL, 0x22); -//__attribute__((naked)) void dummy_isr(void) -//{ -// __asm__("push %ax\n\t" -// "push %bx\n\t" -// "popw %bp\n\t" /* HACK: directly pop bp again */ -// ); -// -// //unsigned char val = inport(IO_BG_X); -// //val++; -// -// //outport(IO_BG_X, val); -// //outport(IO_INT_ACK, INT_VBLANK_START); -// __asm__("pop %ax\n\t" -// "pop %bx\n\t" -// ); -// -// __asm__("iret"); -//} +} void setup_ivec(void) { @@ -143,6 +128,7 @@ int main(void) setup_ivec(); init_video(); + setup_audio(); outport(IO_VIDEO_MODE, VMODE_16C_CHK | VMODE_CLEANINIT); unsigned short base = 0x3000; /* screens pos */ unsigned short sprite_pos = base - (MAP_SIZE*2) - SPR_TABLE_SIZE;