Page 1 of 1

Poking around the Commander X16 EMU

Posted: Wed Mar 08, 2023 5:13 pm
by Pantheris
So I was trying out the CX16 EMU and man is this system a little fun emulator. It runs decently well, and it's kinda fun to play with. Now I have been having some trouble with getting the sound capabilities working directly through BASIC, because I kind of wanted to possibly make a tracker and nothing I have tried, excepting games, have been able to get the VERA's sound generation to work. I was wondering why that was, because this beats the hell out of me. Also, I did improve the readability of that one line drawing demo I found on one of the videos that 8-bit guy did.
10 SCREEN 128
20 A = INT(RND(1)*320)
30 B = INT(RND(1)*240)
40 C = INT(RND(1)*320)
50 D = INT(RND(1)*240)
60 E = INT(RND(1)*16)
70 LINE A, B, C, D, E
80 GOTO 20

Re: Poking around the Commander X16 EMU

Posted: Wed Mar 08, 2023 8:57 pm
by TomXP411
Have you tried the new BASIC sound commands?

FMINIT sets everything up, then you can use FMNOTE to play a note.

Check out the latest emulator and manuals at https://github.com/X16Community/x16-emu ... es/tag/r42

Re: Poking around the Commander X16 EMU

Posted: Wed Mar 08, 2023 11:55 pm
by DragWx
Hah, that's one of the first things I wanted to do too, when I downloaded the emulator for the first time just a few days ago. :D

The registers for controlling the VERA's PSG are actually in VRAM, so you needed to access them with VPOKE. In addition to setting a channel's frequency, you needed to also set the waveform, set the left/right output bits, and set the volume to something audible, so you needed four VPOKEs in total before you'd hear anything.

The new PSGxxx BASIC commands simplify this greatly, so that's the better way to go now.

Re: Poking around the Commander X16 EMU

Posted: Mon Mar 20, 2023 7:26 pm
by Jestin
I know I'm late to this thread, but yes, you've discovered exactly the reason why we build out the new BASIC statements for audio. You can read through the rationale and development process here: viewtopic.php?t=4985