Jump to content
  • 0

PSG Emulator Code


Yazwho
 Share

Question

I was looking through the emulators code to see how the PSG works.

Even with my pretty terrible C knowledge, I understand most of it. Apart from the section below. I think I understand the syntax (xor the volume with $20, if the 6th bit ($20) is set, or the volume with $C0), I dont get why it's doing it. It kinda feels like it's meant to cap the value at 63, but it doesn't do that and there are surly better ways to achieve it anyway. So I was wondering if anyone else knew?

https://github.com/commanderx16/x16-emulator/blob/master/src/vera_psg.c

 
  int8_t sv = (v ^ 0x20);
  if (sv & 0x20) {
  sv |= 0xC0;
  }
Link to comment
Share on other sites

2 answers to this question

Recommended Posts

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

Please review our Terms of Use