snd: init and test of noise sound
authorRobin Krens <robin@robinkrens.nl>
Sun, 12 Jun 2022 13:39:19 +0000 (15:39 +0200)
committerRobin Krens <robin@robinkrens.nl>
Sun, 12 Jun 2022 13:39:19 +0000 (15:39 +0200)
src/main.c

index 7690c66..5a18283 100644 (file)
@@ -7,6 +7,7 @@
  */
 #include <memory.h>
 #include <video.h>
+#include <dma_snd.h>
 #include <config.h>
 #include <interrupt.h>
 
@@ -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;