etxmato / emma_02

Emma 02 - RCA CDP 1802 Multi-system Emulator
Other
39 stars 9 forks source link

Comx-35 clock setting #43

Closed wel97459 closed 1 year ago

wel97459 commented 1 year ago

I found a bit confusing that instead of the clock setting being the clock speed of the processor. It's the clock speed before it's dived by 2. Most of the other systems in the emulator are the clock speed of the processor. Which really makes more sense as no one is thinking about a pixel clock in an emulator.

etxmato commented 1 year ago

Sorry Winston I do not agree. The clock specified is the clock going into the 1802 chip, what the 1802 does with that is another thing. What you are describing is some kind of instruction clock, then I should probably divide by 16. Note these systems, like the COMX were advertised with clock speed as I use.

wel97459 commented 1 year ago

The clock speed of the system is 5.67Mhz, but the CDP1870 divides that by two and feeds it to the CDP1802. The reason I'm bring it up is when you try taking a tape audio file to a real system, using the default speed of 2.835Mhz for NTSC. It ends up generating a header with a 1Khz tone. However the real system generates a header tone of 2khz. And if you change the emulation clock speed to that of 5.67Mhz, you also get a audio file with a 2Khz header tone.

etxmato commented 1 year ago

Ok understood Winston. But the 2.835 is not the video clock; it is the CPU input clock. So the fact that the header tone has a wrong frequency must be another issue. Currently don’t know the cause of it and/or if there is indeed a clock problem. Will investigate …

etxmato commented 1 year ago

Hi Winston, sorry have been busy with the Cybervision emulator so I kinda forgot about this problem. I have now compared an original COMX wav file that I had with one created on Emma 02. I do agree the wav output could be improved, the Cybervision output is probably more accurate than the COMX at the moment. But the frequency of the header tone is 2KHz in the file I get generated (as far as I can see). Maybe you can send me a file you created?

On what OS are you running Emma 02?

wel97459 commented 1 year ago

I'm on Ubuntu Linux. I can post a wave file later for you to look at.

wel97459 commented 1 year ago

Here's A psave out of the Comx-35, clock set at 2.835Mhz. Emma v1.47 on Ubuntu Linux. blank.wav

etxmato commented 1 year ago

Thanks! I’ll have a look and see if I can reproduce the problem on Linux tonight.

etxmato commented 1 year ago

This is strange indeed. I can see your blank.wav (as you said) has a 1K frequency leader tone and when I create one on Linux it is the same as yours. Doing the same on macOS results in a 2K frequency. Speed of the CPU looks correct, so not sure what is going on... I also just compiled the latest beta release which does exactly the same. The latest beta has the new Cybervision 2001 emulator with a more accurate save routine. Now the whole CV emulator has some problems on Linux, so maybe I will try to fix those first and when done I can see how that save compares to macOS and expected frequencies.... this might take a few days.

etxmato commented 1 year ago

Just to let you know; the new Cybervision emulator works fine on double clock speed (on Linux). So it looks like the same problem as the COMX tape load/save. However for now I have now idea where it goes wrong. Will continue tomorrow...

etxmato commented 1 year ago

I think I found it :). For some reason I have a clock factor of 2 implemented for Linux, this is needed for emulator speed otherwise it runs on half the speed. I copied the same factor for cassette handling which is wrong. I don't really understand why it is needed for sound / emulator speed but not for cassette sound. Anyway when I remove that factor for the cassette handling it works fine.

Here is a ubuntu package for arm: https://github.com/etxmato/emma_02_installation/raw/main/v1.47.14/emma_02_arm.deb. Note this is a beta release, mainly introducing XML handling under the XML tab but none of that is properly documented in the help pages.

I'm starting a x86 build now but that is always a bit cumbersome, not sure when it will be done as I need to run it on emulation on my arm macOS. Code is also committed in the dev branch in case you build it yourself.

wel97459 commented 1 year ago

Awesome, I'll check it out.

etxmato commented 1 year ago

Not sure if this one works will try to test it tonight: https://github.com/etxmato/emma_02_installation/raw/main/v1.47.14/emma_02_x64.deb

etxmato commented 1 year ago

Managed to mess it up just before I committed the code yesterday. New code committed which I think works, I will restart different linux builds now....

etxmato commented 1 year ago

Updated linux packages: https://github.com/etxmato/emma_02_installation/raw/main/v1.47.14/emma_02_arm.deb https://github.com/etxmato/emma_02_installation/raw/main/v1.47.14/emma_02_x64.deb https://github.com/etxmato/emma_02_installation/raw/main/v1.47.14/emma_02_x64_fedora.rpm https://github.com/etxmato/emma_02_installation/raw/main/v1.47.14/emma_02_x64_suse.rpm

Sorry, didn't get time to test the packages...

etxmato commented 1 year ago

I tested the SUSE package which works ok. The x64.deb package installs on my ubuntu but Emma 02 itself doesn't start for some reason. Possibly something to do with my installation or possibly a problem in the build. Not sure...

wel97459 commented 1 year ago

Well I can't even get V1.47.14 to output a wave file to test with under Ubuntu.

etxmato commented 1 year ago

Did you compile it from GitHub or install my package? I'm assuming you tried it on Ubuntu x64/amd64? I just checked if I used the correct files in the build and it all looks correct...

I also ran it on my arm64 Ubuntu which works fine; just tested again and I get wav files.

Not sure where it went wrong... what is it doing if anything? is it starting up and 'just' not creating the wav file? If so it sounds a bit like the problem I discovered after I committed the first package on Saturday morning....the later packages should have fixed that but maybe not...

wel97459 commented 1 year ago

I had to default all the configurations, and that got it working. Thanks for working on this issue.

Also tested it on my FPGA comx-35 core I made and it loaded fine: FPGA comx-35 running a game loaded off of tape interface.

etxmato commented 1 year ago

Great and that is looking very cool :)