Jump to content
  • 0

PSG Emulator Code



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?


  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.

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.


  • Create New...

Important Information

Please review our Terms of Use