linappleii / linapple

Apple 2e emulator
GNU General Public License v2.0
138 stars 61 forks source link

Support for 50HZ Video option #117

Open cesarmiquel opened 4 years ago

cesarmiquel commented 4 years ago

Hi! Great work on the emulator! I was trying to run this demo: http://fr3nch.t0uch.free.fr/MAD3/MAD3.html which runs fine in AppleWin but fails displaying 'KO' on LinApple. Testing in AppleWin I noticed that if I turn off the '50hz video' setting in WinApple it also fails with the same error. Looking at the source code of the demo I noticed it does a check for what appears to be the refresh rate. I went over the Video.cpp and Video.h source code in AppleWin and the Linux version but see no reference to 50HZ video in Linux. Is this unsupported? Is it complicated to do?

cesarmiquel commented 4 years ago

Messing around with the Video.cpp and comparing with the AppleWin version I noticed that if I make this modification to Video.cpp:

static bool bVideoScannerNTSC = false;  // NTSC video scanning (or PAL)

And re-compile linapple the demo runs! So, seems to be that the the 50HZ functionality is in place but not configurable. I can probably try to create a PR for this.

Unfortunately, the demo doesn't work as expected. If you test it in AppleWin you'll notice the colors are different. The demo does something which I haven't been able to invstigate to be able to have so many colors and I believe that "trick" is not working in LinApple.

maxolasersquad commented 4 years ago

I wonder if bVideoScannerNTSC is something should be added to the configuration file. You said that AppleWin has '50hz video' as a configurable option, is this the effective option being changed with that variable?

ThorstenBr commented 4 years ago

The variable switches the number of emulated scan lines. This affects timing (emulated CPU speed vs emulated video refresh rate). Yes, it should be exposed as a configuration option. This will have a (minor) effect on the timing of various applications (games).

The demo is probably changing the displayed colors with each refresh cycle. The human eye won't see the flickering of alternating colors, but perceive the mixed color instead. That's how the demo displayed more colors than supported by the actual hardware. It's tricky to emulate such details in an emulation though.

Just curious: what happens when you set

Singlethreaded = 1

in the linapple.conf config file. Does it change the emulated color effect?

cesarmiquel commented 4 years ago

I didn't touch SingleThreaded. I'll test and get back to you. The demo works fine on AppleWin though and since this is a port of that not sure why it fails. I also tested the "1982 issue of Softtalk 'Have an Apple Split'" (http://rich12345.tripod.com/aiivideo/softalk.html) and (http://cmosher01.github.io/Epple-II/screenshots.html) in LinApple and that didn't seem to work as well so I thought maybe there's some limitation in how the Video.cpp was ported. Think thats possible?

cesarmiquel commented 4 years ago

@ThorstenBr I don't see that parameter in linapple/linapple.conf.sample. Is that option valid? Maybe it's on some branch?

cesarmiquel commented 4 years ago

This is how it looks in LinApple: linapple18

And this in AppleWin: mad3-00

You can watch the demo running here: https://www.youtube.com/watch?v=jkn9m9lV1ig

and Download DSK image and source here: http://fr3nch.t0uch.free.fr/MAD3/MAD3.html

ThorstenBr commented 4 years ago

@ThorstenBr I don't see that parameter in linapple/linapple.conf.sample. Is that option valid? Maybe it's on some branch?

No, it's there - just missing in the sample file. It's visible here though: https://github.com/linappleii/linapple/blob/master/res/linapple.conf

cesarmiquel commented 4 years ago

Yes, I found the flag and modified it but it didn't seem to work. Looking a little more into the source code I noticed that indeed the only thing that the configuration does is setup that boolean. But the SetVideoRefreshRate() function does one other thing: it calls NTSC_SetRefreshRate(rate);. I looked up that function and realized the whole of NTSC.cpp is gone! It seems that class was added in the end of 2014 and from what I understand the repo this projects is based off was forked before? It seems to me AppleWin tries to simulate NTSCV video with many details but I don't know this project much so I may be completely wrong :-). Who do you think would know how this works @ThorstenBr ?