Search found 92 matches
- Wed Jul 26, 2017 8:21 am
- Forum: Blabla
- Topic: Faster x mod 384 (x%384)?
- Replies: 10
- Views: 14287
Re: Faster x mod 384 (x%384)?
To simplify the explanation I imply the operation is with (16bit) integers. But instead is with 16:16 fixed points. So really the operation is something like: x mod 384<<16 where x can range from 0 to 4096<<16. (Meaning it uses signed 32 bit integers) As I understand, integer part of your 16.16 num...
- Tue Jul 25, 2017 9:21 am
- Forum: Blabla
- Topic: Faster x mod 384 (x%384)?
- Replies: 10
- Views: 14287
Re: Faster x mod 384 (x%384)?
Great formula.
a = 56959
d1 = 21
d2 = 17
# d1 and d2 are random divisors
a % (d1*d2) == a // d1 % d2 * d1 + a % d1
a % 320 == a // 64 % 5 * 64 + a % 64
a % 320 == (((a >> 6) % 5) << 6) + (a & 0x3F)
r57shell, there's no need in "|" in next line, just use "+".
a = 56959
d1 = 21
d2 = 17
# d1 and d2 are random divisors
a % (d1*d2) == a // d1 % d2 * d1 + a % d1
a % 320 == a // 64 % 5 * 64 + a % 64
a % 320 == (((a >> 6) % 5) << 6) + (a & 0x3F)
r57shell, there's no need in "|" in next line, just use "+".
Code: Select all
| (a & 0x3F);
- Mon Jul 24, 2017 9:02 pm
- Forum: Blabla
- Topic: Faster x mod 384 (x%384)?
- Replies: 10
- Views: 14287
Re: Faster x mod 384 (x%384)?
All code below is in Python A key formula is the "general rule" in the article you linked earlier Example: a = 123 m = 5 b = 16 # equal results print( a % m ) print( ( (b % m) * (a // b) + (a % b) ) % m ) To find residue of dividing by 320 you can find residues of 5 and 64 and then convert them to u...
- Mon Jul 24, 2017 7:21 pm
- Forum: Blabla
- Topic: Faster x mod 384 (x%384)?
- Replies: 10
- Views: 14287
Re: Faster x mod 384 (x%384)?
Miquel, this C-written mod3 function has about 20 arithmetic operations. I'm afraid, in terms of M68k they will consume more cycles in total than one DIVU :D Fast version will require pre-computed array. Straightforward method is (don't be confused with different meaning of 'x'): x mod 320 = x - x d...
- Wed Apr 19, 2017 8:22 pm
- Forum: Megadrive/Genesis
- Topic: 68000 programming optimization tips? (for speed)
- Replies: 28
- Views: 38241
Re: 68000 programming optimization tips? (for speed)
By the way, a lot of people ignore Scc commands (ST, SF, Sxx), but they are pretty useful to calculate complex boolean expressions (with addition of NOT, AND, OR, EOR) rather than doing a massive branching.
- Tue Apr 18, 2017 7:27 pm
- Forum: Megadrive/Genesis
- Topic: 68000 programming optimization tips? (for speed)
- Replies: 28
- Views: 38241
Re: 68000 programming optimization tips? (for speed)
You say you know basic optimization techniques. In most cases "advanced" optimization tricks will be a compromise between performance and code size or, which is worse, between performance and code complexity and readability. I think it will be better to give us some samples you want to optimize. Not...
- Sat Aug 13, 2016 10:48 am
- Forum: Sound
- Topic: New Documentation: An authoritative reference on the YM2612
- Replies: 865
- Views: 2325261
Re: New Documentation: An authoritative reference on the YM2612
Hi all! I haven't read this topic for many years. Maybe, this info was discussed earlier, maybe I'm repeating myself, if so, pardon me. The subject is "ladder effect". Eke gave link to my old post about DAC output, where I say operators are shifted arithmetically (not logically) by 5 bits Ladder eff...
- Wed Mar 05, 2014 12:55 pm
- Forum: Sound
- Topic: Extreme High Quality Sound Emulation
- Replies: 24
- Views: 22576
Блин, два грамотея ведут диалог на ломаном английском на импортном форуме. Ты уверен, что знаешь, что вызывает зеркалирование? Я тебе говорю, это выходит при расчёте матрицы ДПФ над вещественными числами. Эту хрень ты и видишь на картинках и слышишь в ушах. Возьми посчитай ДПФ руками, чтобы понять, ...
- Tue Mar 04, 2014 8:38 pm
- Forum: Sound
- Topic: Extreme High Quality Sound Emulation
- Replies: 24
- Views: 22576
Sorry, didn't notice your new message. This is new part for my first message: Points 1 and 2 make very notable difference on quiet sound making it sound louder. It's all because operators use ariphmetic shift, not logical. Let me show it on example. Copy-paste this text to Excel, delimiter = whitesp...
- Tue Mar 04, 2014 7:40 pm
- Forum: Sound
- Topic: Extreme High Quality Sound Emulation
- Replies: 24
- Views: 22576
The most important difference between "digitally ideal" emulated sound and real sound is in analogue output: 1) 9-bit DAC 2) ladder effect from DAC level -1 to level 0 3) other analogue and mixing effects. Changing multiplexion method won't give you too much, AFAIR I've said this some years ago on t...
- Thu Jul 11, 2013 10:19 am
- Forum: Blabla
- Topic: 64206 riddle...
- Replies: 5
- Views: 5467
- Wed Jul 10, 2013 1:22 pm
- Forum: Blabla
- Topic: 64206 riddle...
- Replies: 5
- Views: 5467
- Fri Jun 28, 2013 10:28 am
- Forum: Sound
- Topic: PCM maximum Hz
- Replies: 15
- Views: 12766
It would be nice to have a test program which actually loop in waiting for busy flag and feeding the dac then we can read number of sent sample per second and somehow estimate the accepted PCM rate on each system :) I'd already done this program, it's somewhere on my hard disk :) Comparing original...
- Wed Jun 26, 2013 8:25 pm
- Forum: Sound
- Topic: PCM maximum Hz
- Replies: 15
- Views: 12766
- Wed Jun 19, 2013 5:59 pm
- Forum: Megadrive/Genesis
- Topic: Help figuring out some logic in Flicky - new challenge #3!
- Replies: 19
- Views: 19919