4 #include "newgame-sound.c"
6 unsigned char *next_sample
;
7 unsigned char *stop_sound
;
9 extern void interruptvector(void);
11 long time_at_last_run
= 0;
16 interrupthandler(long unsigned interrupt_source
)
18 setInterval(FREQUENCY
/ 11250 - 100);
22 if (next_sample
!= stop_sound
) {
23 DAC_both
= *next_sample
++ << 6;
26 delta
= time
- time_at_last_run
;
27 time_at_last_run
= time
;
35 mmix_fprintf(1, "Hello?", 0);
37 next_sample
= stop_sound
= blob
+ sizeof blob
;
40 * XXX 8 and even 7 distorts the sound. Why? AAhh, it's only
41 * when on head phones. Amplified it sounds great
48 long unsigned my_sample
, time_for_next
;
50 mmix_printf("Starting sound. Scale is %d\n", scale
);
52 time_for_next
= now() + (FREQUENCY
/ RATE
);
53 for (p
= blob
; p
!= blob
+ sizeof blob
; ++p
) {
54 MMIX_IOSPACE
[11] = (long) p
>> 8;
56 my_sample
= my_sample
<< scale
;
57 time_for_next
+= (FREQUENCY
/ RATE
);
58 while (now() < time_for_next
)
63 while ((sw
= get_switches()) == 0);
65 scale
+= (sw
& SW3
) ? 1 : -1;
72 mmix_printf("Trying interrupts!\n", 0);
74 setInterruptVector(interruptvector
);
75 setIntrMask(1 << 7); // Enable interval
78 mmix_printf("Starting sound\n", 0);
81 setInterval(FREQUENCY
/ RATE
);
83 while ((get_switches() & SW3
) == 0)
84 mmix_printf("delta %d\n", delta
);
85 while ((get_switches() & SW3
) != 0);