Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAD EFFECT 1 and 2 do not work correctly #11

Closed
Archange427 opened this issue Nov 20, 2019 · 12 comments
Closed

MAD EFFECT 1 and 2 do not work correctly #11

Archange427 opened this issue Nov 20, 2019 · 12 comments

Comments

@Archange427
Copy link

MAD EFFECT 1 and 2 use a new way to get horizontal synchronization at each frame.
AIPC seems to have timing issues with that and the display is not synchronized.
So I built a special alternative version for AIPC (and previously for AppleWin) to compensate missing cycles (see comments in source code)

download and source code here:
http://fr3nch.t0uch.free.fr/MADEF/MADEF.html
http://fr3nch.t0uch.free.fr/MAD2/MAD2.html

Information from corrected issues that could be useful (from AppleWin's repository):
AppleWin/AppleWin#699
AppleWin/AppleWin#711
AppleWin/AppleWin#724
AppleWin/AppleWin#701

sosaria7 pushed a commit that referenced this issue Jun 6, 2020
 - fixed bugs of cpu clock of some instructions
 - improved checking clock timing for more accurate synchronization
@sosaria7
Copy link
Owner

sosaria7 commented Jun 6, 2020

Hi, I fixed this problem.
Now, AIPC access memory at the last clock of each instructions.
and fixed some bugs of clock counting of 65c02 and interrupt occurring of 6522.

But there's some problem on MAD2.
To get the exact elapsed clock after interrupt, I needed to modify sub 26 to sub 25 in main.a
I tested on my real Apple IIe, and there's same problem.

        SEC                                                             ; 2
        LDA IntL                                                        ; 3
        SBC $C404           ; get T1 lower value (counter never stop)   ; 4 
                            ; -> read at cycle 18/24
                            ; reset INT too
        ; SEC not needed - never (previous result is always >0)                       
        ;SBC #26             ; = [32-7+1] => get final value from 0-7      ; 2
                            ; value = IntL - T1 lower + 7 - 24
        SBC #25             ; "fixed" value for AIPC / APPLEWIN         ; 2

@Archange427
Copy link
Author

Hey @sosaria7
Very happy to see you back in the game!
And yes you're right, the right code is "SUB #25"!
At that time (MAD EFFECT 2), I was "groping" to get the code to work on AppleWin, AiPC and a real Apple II because none of them gave the same result... And some of my comments in my own code are probably wrong!

I've tested the other French Touch releases since then as well as unreleased tests and everything seems to work fine with this new version of AiPC (except for "Digidream" but this has nothing to do with a timing problem and I'll open a new issue for that soon).

Congratulations again for this update!

@tomcw
Copy link

tomcw commented Jun 6, 2020

@Archange427 - will you be updating the MAD2.DSK (here) with an image that works on the real IIe?

...I may have to revisit this in AppleWin now, as I admit I didn't test with a real IIe. Serves me right!

@tomcw
Copy link

tomcw commented Jun 6, 2020

Or just hex edit MAD2.DSK at offset $3318: 1A->19
It works on my non-enhanced IIe now :-)

EDIT: This fixed version also works on AppleWin! ...so AppleWin has a bug in that it runs MAD2.DSK with both values (1A and 19). Oh well, something else to fix :-/

@Archange427
Copy link
Author

Archange427 commented Jun 6, 2020

@tomcw : in fact, I plan to make available the sources of all French Touch releases on FT's Github "soon". That way, it will be much easier for updates them.
And on this occasion, I think the code of each release will be updated for the current versions of the emulators.

Btw thanks to @fenarinarsa for kicking my ass and "forcing" me to use some more modern stuff ;)

Edit: but "MAD2.DSK" available on http://fr3nch.t0uch.free.fr/MAD2/MAD2.html is working on a real IIe.
I just tested it... it's ok! So $3318: 1A is OK on my real IIe (PAL).

@tomcw
Copy link

tomcw commented Jun 6, 2020

No... MAD2.DSK does not work on a real IIe!
I only just tried it for the first time.

NB. I have a standard (non-enhanced) IIe, ie. with NMOS 6502.
What do you and @sosaria7 have?

@Archange427
Copy link
Author

@tomcw :

sorry for the confusion but on my real IIe (PAL/unenhanced):

MAD2.DSK is working with SUB #25 OR SUB #26.
($3318: 19/1A)

Both also work on AppleWin.
But only the one with $19 (SUB #25) is working with AiPC.

@tomcw
Copy link

tomcw commented Jun 6, 2020

Hmm... but for me on my real IIe (PAL/unenhanced):
MAD2.DSK (SUB #26) - crashes!
MAD2.DSK (SUB #25) - working

@Archange427
Copy link
Author

I don't know what to say.
I'm not in the habit of releasing stuff that doesn't work - at least - on my own machine.
So I tested it on mine at the time. I've done it again today and it works...

Would this have anything to do with the MegaAudio?

@tomcw
Copy link

tomcw commented Jun 6, 2020

Would this have anything to do with the MegaAudio?

Yes, maybe (probably?) as this emulates the 6522's using an FPGA - so maybe there's a subtle "out by 1" bug in their emulation?

@sosaria7
Copy link
Owner

sosaria7 commented Jun 7, 2020

I have NTSC/enhanced version of Apple //e
MAD2.DSK with SBC #26 doesn't work correctly on my Apple //e

@Archange427
Copy link
Author

@sosaria7 : I updated MAD 2 DSK with SUB #25.
I think the "problem" (SUB #26 working) is related to the MegaAudio inside my own Apple IIe.
So you can close this issue.
Thanks again!

@sosaria7 sosaria7 closed this as completed Jun 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants