Help with PSG programming

Страница 1/2
| 2

By AxelStone

Prophet (2703)

Аватар пользователя AxelStone

17-05-2016, 22:43

Hi people, I'm trying to make PSG sounds using normal BIOS functions. As far as I know, to make PSG sounds you simply needs to load in register correct values. To make tests, I've used a ayfx file that has this format:

Quote:

Every frame is encoded with the flag byte and a number of bytes that vary depending from value changes.
bit0..3 Volume
bit4 Disable T
bit5 Change Tone
bit6 Change Noise
bit7 Disable N

When bit5 is set, two bytes with tone period are follow; when bit6 is set, a single byte with noise period follow; when both bits are set, first two bytes of tone period, then single byte with noise period follow. When none of the bits are set, next flags byte follow.

Considering channel A, for example:
bit0..3 Volume -> R10 of PSG (Amplitude Register)
bit4 Disable T -> Bit 0 of R7 (Mixer Register)
bit5 Change Tone -> Loads the 2 bytes to R0 and R1. (Tone generators registers)
bit6 Change Noise -> Load byte to R6 (Noise register)
bit7 Disable N -> Bit3 of R7 (Mixer Register)

I've made a loop that reads the content of ayfx file and in every frame sets PSG registers with the loaded values. However no sound is generated, only sounds the GICINI routine that sounds like a key click.

Is needed something more to play the sound? Thanks.

Для того, чтобы оставить комментарий, необходимо регистрация или !login

By dioniso

Champion (475)

Аватар пользователя dioniso

17-05-2016, 23:05

Hi, AxelStone. I'm glad you're trying some assembler.

You should try to use some routine of your own. I'm not familiar with the code of ayfx. Remember, bit 0 at R7 is enabled and bit 1 is disabled.

Although you'll probably have some documents already, maybe this information could be helpful.

By kanima

Master (192)

Аватар пользователя kanima

18-05-2016, 00:24

AxelStone wrote:

Considering channel A, for example:
bit0..3 Volume -> R10 of PSG (Amplitude Register)
...

Amplitude for channel A is on R8, not R10. You've probably read some official documentation that lists the register numbers in octal (somebody else had the same problem a couple of months ago). Of course, 8 decimal is written as 10 in octal ;0

By flyguille

Prophet (3029)

Аватар пользователя flyguille

18-05-2016, 01:44

the PSG manual is numbering in OCTAL, not in HEXADECIMAL or DECIMAL.

so R10 = register #8 in decimal number.

Don't worry I fail in the same trap.

By DarkSchneider

Paladin (882)

Аватар пользователя DarkSchneider

18-05-2016, 08:26

And who had that brilliant idea? oO

By nitrofurano

Champion (287)

Аватар пользователя nitrofurano

18-05-2016, 11:41

btw, i think that a very good exercise is trying to play .vgm files (first those that only uses ay-3-8910), then i guess you will clearly and easily find out what everything does! Smile

By AxelStone

Prophet (2703)

Аватар пользователя AxelStone

18-05-2016, 12:15

You are right, it's R#8, who decided to use octal notation??? Question

After changing R10 to R8 I obtains sound, but it's not the SFX this is supossely to be, something must be wrong. I'm going to revise my code.

@nitrofurano Thanks for the suggestion, where I can find info about .vgm files? ayFx format is clearly documented, it's simply a sequence of bytes containing values of PSG registers. I don't mind to experiment with .vgm format Wink

By Grauw

Ascended (8516)

Аватар пользователя Grauw

18-05-2016, 13:12

Nice suggestion of nitrofurano Smile. VGM spec is here.

By AxelStone

Prophet (2703)

Аватар пользователя AxelStone

18-05-2016, 15:58

It sound now, thanks for your advices Wink . I'll take a look at that @Grauw.

@dioniso I didn't said it's assembler Tongue

By flyguille

Prophet (3029)

Аватар пользователя flyguille

18-05-2016, 17:30

AxelStone wrote:

You are right, it's R#8, who decided to use octal notation??? Question

After changing R10 to R8 I obtains sound, but it's not the SFX this is supossely to be, something must be wrong. I'm going to revise my code.

@nitrofurano Thanks for the suggestion, where I can find info about .vgm files? ayFx format is clearly documented, it's simply a sequence of bytes containing values of PSG registers. I don't mind to experiment with .vgm format Wink

You are using AyFX that is the problem.

I hear huge differences between how the AyFX app sounds, and then how sounds the same sample in OpenMSX.

in OpenMSX the sound is like more muffled than AyFX, and it is not about just volume, but in AyFX you can hear that it is rich in details, overall when you poke the registers, sometime you hears some "clicks", that in openMSX not, maybe it is wrong the AyFX, I don't know.

By AxelStone

Prophet (2703)

Аватар пользователя AxelStone

18-05-2016, 17:55

flyguille wrote:

in OpenMSX the sound is like more muffled than AyFX, and it is not about just volume, but in AyFX you can hear that it is rich in details, overall when you poke the registers, sometime you hears some "clicks", that in openMSX not, maybe it is wrong the AyFX, I don't know.

I suposse that it's due to PSG implementation of ayFX editor and OpenMSX. You are right, ayFX sounds more clear and loud, but probably OpenMSX has a closer implementation of real MSX PSG and that not was ayFX editor purpose.

Страница 1/2
| 2