From aac2ecae4a1e4f57510f5bbc7f7b5234f6925d35 Mon Sep 17 00:00:00 2001 From: Robin Krens Date: Sun, 12 Jun 2022 15:39:19 +0200 Subject: [PATCH] snd: init and test of noise sound --- src/main.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) 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; -- 2.7.4