Dead Hackers Society
Other BBSes »
 
 

68k Inside

Sommarhack 2024

Silly Venture 2024 SE
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: 200Hz SNDH-replay using TimerC
Posted by: evil May,21.2015-18:40 

The 200 Hz Timer C is a system service interrupt that for example hard disk drivers can use. If it is not handled carefully, you risk ending up with a crashed hard drive.

That's why grazey suggested to call the OS TC as well to make sure everything is fine.

So why do SNDH-files refer to Timer C? Because many tracks (Sid Sound Designer ones in particular) uses all A/B/D timers for sound effects, only C left for music callback. And as it's already at 200 Hz, it can be used to call most tracks at 200 or lower speed. For speeds not even dividable with 200 the SNDH-players makes an approximation. Something like:

counter: dc.w 200
sndhfreq: equ 60

play_from_tc200:
sub.w #sndhfreq,counter
bgt.s .noplay
bsr sndh+8 ;play
add.w #sndhfreq,counter
.noplay:



Anyways back to the demo coding..

With a 200 Hz interrupt going (as well as other sound effect interrupts), you can be assured that raster interrupts will be challenged for stability. With the callback to the OS Timer C, even more likely so. Yeah it sucks. 200 Hz tracks often also make use of all A/B/D timers for sound effects (one timer per channel). And then you're left with only HBL for raster interrupts, and that will be totally annihilated by the MFP A/B/C/D which have higher priority.

So, let's do the preaching once again:

1. Make up the restrictions of the music
2. Compose the music

A few ideas for restrictions

a) A demo without raster effects or border killing:
Anything goes as long as the track leaves enough CPU free.

b) A demo with raster effects and simple (top and low) border killing:
50 Hz track, max two interrupt effects placed on A and D timers. Preferably only one interrupt effect on timer D.

c) A demo with hardsync code (Spectrum 512, plasma, side-borders killed):
50 Hz track, no interrupt effects. Maybe allow digi-drums if you are willing to implement the digi-player into your hardsync code (quite common practice).


Alternative c is always safe, and can even be recorded to a register stream (14 bytes/vbl) so your replay will be silly fast.


As for your current case, it's hard to know which route to make as I don't know what kind of effects you're doing. But let's assume it's demo model (a) as described above. Then I'd go with Grazeys way all day.

init:
moveq #1,d0
bsr sndh
move.l $114.w,save_c
move.l #tc,$114.w

tc:
movem.l d0-a6,-(sp)
bsr sndh+8
movem.l (sp)+,d0-a6

move.l save_c,-(sp) ;run the original timer c after rts, it will do the rte
rts

exit:
move.l save_c,$114.w
bsr sndh+4



I know it's a lot of dravel, but hopefully something useful in there, minus all the typos and errors!

--
Anders Eriksson
ae@dhs.nu








[All messages in this thread]    [Start new thread]

Topic Posted by  Date 
200Hz SNDH-replay using TimerC Sdw May,21.2015-15:31
  Re: 200Hz SNDH-replay using TimerC gwEm/PHF May,21.2015-16:00
    Re: 200Hz SNDH-replay using TimerC Sdw May,21.2015-16:16
      Re: 200Hz SNDH-replay using TimerC evil May,21.2015-18:40
        Re: 200Hz SNDH-replay using TimerC Sdw May,27.2015-16:39
          Re: 200Hz SNDH-replay using TimerC evil May,27.2015-17:52
            Re: 200Hz SNDH-replay using TimerC Sdw May,27.2015-23:58
              Re: 200Hz SNDH-replay using TimerC gwEm/PHF May,28.2015-16:42
                Re: 200Hz SNDH-replay using TimerC evil May,28.2015-17:16
                  Re: 200Hz SNDH-replay using TimerC Splash/S1 May,29.2015-00:58
                    Re: 200Hz SNDH-replay using TimerC evil May,29.2015-11:56
                      Re: 200Hz SNDH-replay using TimerC gwEm/PHF May,29.2015-15:13
                        Re: 200Hz SNDH-replay using TimerC Splash/S1 May,31.2015-19:21
                  Re: 200Hz SNDH-replay using TimerC Sdw May,31.2015-21:49
                    Re: 200Hz SNDH-replay using TimerC insane Jun,07.2016-10:08
                      Re: 200Hz SNDH-replay using TimerC insane Jun,07.2016-10:29
                      Re: 200Hz SNDH-replay using TimerC Splash/Sector One Jun,30.2016-18:30


Reply to this message
Name:
Topic:
Anti-troll code:

Message:

What's the anti-troll code?
That's your personal code to be able to add comments and messages on the dhs.nu site.
Don't have a code or forgot it? Fix it here.
© 1994-2024 Dead Hackers Society Contact: Anders Eriksson