Dead Hackers Society
Other BBSes »
 
 

68k Inside

Sommarhack 2024

Silly Venture 2024 SE
Demoscene  Coding  CT60  Buy/sell

Atari coding BBS
 
Re: Lance's 50khz playroutine
Posted by: ljbk Feb,28.2013-22:42 

Hi !

I am glad to see that there are a few readers for this.

Here is a new bit with some statistical calculations before the hard part.

; Before we go any thurther, we know enough about Lance routine to safely
; estimate how much CPU cycles per VBL can be gained in going down to 25
; KHz replay.
; Let's divide the main part in 3:
; - reading part;
; - mixing part;
; - storing part;
; As we have seen, if we reduce to 25 KHz replay, then we can only do 500
; reads per VBL. But there are 4 out of the 36 octave notes that require
; more than 500 reads to avoid skipping data: B-3, A#3, A-3 and G#3 with
; dividers 113, 120, 127 and 135 respectively. In fact they would require
; 7093790 / (2 x divider) / 50 VBLs = 628, 591, 559 and 525 reads per VBL
; respectively. As we can only do 500 at 25 KHz, we will skip 128, 91, 59
; and 25 bytes respectively having to insert in the generated code as many
; addq #1,An. The average bytes to skip per note is then: (128+91+59+25)
; / 36 notes = 303 / 36 = 8.42. The clock cycles spent for reading vary
; from 8 (simple read (voice 0)) to 20 (read and volume the data via
; table (voice 1)) and the average is: (8+20)/2 = 14 cycles. The addq
; costs 8 cycles. SO for each read not done, we will save 14-8 = 6 cycles.
; As we do 8.42 reads less in average, we will save 6 * 8.42 = 50.52
; cycles in average.
; In the mixing part, we want to know how many adds we can save. Let's do
; an example that can be considered an average case: a C-2 on one of the
; voices and a C-3 on the other one. A C-2 means aproximately 166.666
; reads per VBL. The correct amount is 7093790 / (2 x 428) / 50 = 165.7.
; A C-3 means twice that amount. To simplify i will use the 166.666 value.
; 166.666 reads out of 1000 updates at 50 KHz means 1 read every 6
; updates. For the C-3, we will have 1 read every 3 updates. At 25 KHz,
; we are down to 1 read every 3 updates and 1 read every 1.5 updates.
; Doing the respective combinations we will get in average at 50 KHz:
; 55.55 simultaneous reads on the two voices, 388.88 reads on one of the
; two voices and 555.55 cases where we just update the buffer with the
; previous mixing result. The same at 25 KHz will result in: 111.11
; simultaneous reads, 277.78 single reads and 111.11 cases where we just
; update the buffer with the previous mixing result. In both cases we
; keep a total of 166.66 + 333.33 = 500 reads. Comparing the two cases,
; this means taht going from 50 KHz to 25 KHz increases the simultaneous
; reads by 55.55 and reduces by 111.11 the single reads. SO in average,
; we have: +55.55 - 111.11 = -55.55 which means 55.55 cases of mixing
; less than before. Each mixing costs a maximum of 8 cycles: move.b
; from the voice register (d0 or d1) to d2 and add.b new one to d2. So
; in total this saves us in average a maximum of 55.55 x 8 = 444.44
; cycles.
; Finally, in the storing part, counting is easy. We have 1000 updates
; at 50 KHz and 500 at 25 KHz so we save 500 updates like this one:
; move.b d2,(sp)+. I assume updating via (sp) with .b would cost the
; same as using any other An despite that specific behaviour that gives
; us the interleaved buffer update. If so, each update costs 8 cyles.
; We save then 500 x 8 = 4000 cycles.
; Adding the 3 parts, we can save up to 50.52 + 444.44 + 4000 = around
; 4495 cycles per mixing. As we have two mixings for Left and Right, we
; can save a maximum of 4495 + 4495 = 8990 cycles by going down to 25
; KHz replay. That represents a maximum of 5.6% of the CPU time.
;
; Still interested ?
;
; TO BE CONTINUED ... OR NOT ...
;
;------------------------------------------------------------------------








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

Topic Posted by  Date 
Lance's 50khz playroutine Bod/STAX Feb,18.2013-17:35
  Re: Lance's 50khz playroutine gwEm Feb,18.2013-20:42
  Re: Lance's 50khz playroutine ggn Feb,18.2013-20:53
    Re: Lance's 50khz playroutine Bod/STAX Feb,18.2013-21:28
      Re: Lance's 50khz playroutine gwEm Feb,18.2013-23:05
        Re: Lance's 50khz playroutine gwEm Feb,18.2013-23:16
          Re: Lance's 50khz playroutine gwEm Feb,19.2013-02:21
            Re: Lance's 50khz playroutine Bod/STAX Feb,22.2013-17:08
              Re: Lance's 50khz playroutine gwEm Feb,25.2013-20:36
                Re: Lance's 50khz playroutine ljbk Feb,25.2013-23:54
                  Re: Lance's 50khz playroutine Bod/STAX Feb,26.2013-11:23
                    Re: Lance's 50khz playroutine evil Feb,26.2013-12:04
                      Re: Lance's 50khz playroutine ljbk Feb,26.2013-14:45
                        Re: Lance's 50khz playroutine ljbk Feb,26.2013-21:46
                          Re: Lance's 50khz playroutine evil Feb,27.2013-17:01
                            Re: Lance's 50khz playroutine ljbk Feb,28.2013-13:24
                              Re: Lance's 50khz playroutine ljbk Feb,28.2013-13:28
                                Re: Lance's 50khz playroutine gwEm Feb,28.2013-14:07
                                  Re: Lance's 50khz playroutine Bod/STAX Feb,28.2013-21:41
                                    Re: Lance's 50khz playroutine ljbk Feb,28.2013-22:42
                                      Sem assunto ljbk Mar,01.2013-13:27
                                        Lance's 50 KHz playroutine ljbk Mar,01.2013-15:49
                                          Re: Lance's 50 KHz playroutine ljbk Mar,01.2013-17:34
                                            Re: Lance's 50 KHz playroutine ljbk Mar,01.2013-17:36
                                              Re: Lance's 50 KHz playroutine evil Mar,01.2013-19:03
                                                Re: Lance's 50 KHz playroutine ljbk Mar,02.2013-00:18
                                                  Re: Lance's 50 KHz playroutine ljbk Mar,04.2013-17:39
                                                    Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-02:21
                                                      Re: Lance's 50 KHz playroutine gwEm Mar,06.2013-13:23
                                                        Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-15:57
                                                          Re: Lance's 50 KHz playroutine evil Mar,06.2013-16:48
                                                            Re: Lance's 50 KHz playroutine ggn Mar,06.2013-17:31
                                                              Re: Lance's 50 KHz playroutine evil Mar,06.2013-17:48
                                                                Re: Lance's 50 KHz playroutine ggn Mar,06.2013-23:54
                                                            Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-18:18
                                                              Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-21:51
                                                              Re: Lance's 50 KHz playroutine ggn Mar,06.2013-23:59
                                                                Re: Lance's 50 KHz playroutine ljbk Mar,07.2013-02:31
                                                                  Re: Lance's 50 KHz playroutine ggn Mar,07.2013-12:34
                                                                    Re: Lance's 50 KHz playroutine ljbk Mar,07.2013-14:00
                                                                      Re: Lance's 50 KHz playroutine gwEm Mar,07.2013-18:00
                                                                        Re: Lance's 50 KHz playroutine ljbk Mar,07.2013-18:51
                                                                          Re: Lance's 50 KHz playroutine ljbk Mar,08.2013-02:10
                                                                            Re: Lance's 50 KHz playroutine ljbk Mar,08.2013-13:12
                                                                              Re: Lance's 50 KHz playroutine ljbk Mar,09.2013-00:17
                                                            Re: Lance's 50 KHz playroutine ljbk Mar,06.2013-19:28
                              Re: Lance's 50khz playroutine ljbk Feb,28.2013-15:47
                                Re: Lance's 50khz playroutine ljbk Feb,28.2013-15:51
                                  Re: Lance's 50khz playroutine ljbk Feb,28.2013-18:56
                                    Re: Lance's 50khz playroutine nativ Mar,24.2013-00:07
                                      Re: Lance's 50khz playroutine ljbk Apr,13.2013-01:21
                                        Re: Lance's 50khz playroutine ljbk Apr,16.2013-16:12
                                          Re: Lance's 50khz playroutine ljbk Apr,19.2013-12:14
                                            Re: Lance's 50khz playroutine ljbk Apr,22.2013-14:54
                                              Re: Lance's 50khz playroutine ljbk Apr,25.2013-19:03
                                                Re: Lance's 50khz playroutine ggn Apr,25.2013-21:03
                                                  Re: Lance's 50khz playroutine ljbk Apr,26.2013-09:18
                                                    Re: Lance's 50khz playroutine ggn Apr,26.2013-11:28
                                                      Re: Lance's 50khz playroutine ljbk Apr,26.2013-12:13
  Re: Lance's 50khz playroutine ljbk May,01.2013-22:30
    Re: Lance's 50khz playroutine evil May,02.2013-14:46
      Re: Lance's 50khz playroutine gwEm May,02.2013-20:00
        Re: Lance's 50khz playroutine Damo May,02.2013-21:00
          Re: Lance's 50khz playroutine evil May,03.2013-13:00
      Re: Lance's 50khz playroutine ljbk May,08.2013-17:50
        Re: Lance's 50khz playroutine Cyprian May,10.2013-13:01
          Re: Lance's 50khz playroutine ljbk May,11.2013-00:22
          Re: Lance's 50khz playroutine ljbk May,11.2013-08:54
            Re: Lance's 50khz playroutine Cyprian May,11.2013-15:18
              Re: Lance's 50khz playroutine ljbk May,11.2013-15:35
                Re: Lance's 50khz playroutine Lance May,23.2013-00:02
                  Re: Lance's 50khz playroutine ljbk May,23.2013-14:44
  Re: Lance's 50khz playroutine Bod/STAX Jun,06.2013-20:32
    Re: Lance's 50khz playroutine Bod/STAX Jun,06.2013-20:39
      Re: Lance's 50khz playroutine ljbk Jun,07.2013-00:09
        Re: Lance's 50khz playroutine Bod/STAX Jun,07.2013-18:38
          Re: Lance's 50khz playroutine ljbk Jun,07.2013-21:46


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