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

MEGA65: PRG run option (UI/CLI) should work on all (closed) ROM versions #364

Closed
MightyAxle opened this issue Nov 24, 2022 · 9 comments
Closed

Comments

@MightyAxle
Copy link

When using Windows with XMEGA65.EXE on ROM build 990003 it is not possible to run PRG files. Only attaching Disk Images is possible.

If a PRG is selected to run nothing happens. If you try and load the PRG as a Disk image a read error occurs.

Reverting back to ROM build 920376 allows for the running of PRG files.

This issue only became apparent when trying to use the CBM prg Studio by Arthur Jordison when the created PRG files. Since reverting back to an older ROM build everything seems to be working correctly.

@MightyAxle MightyAxle changed the title Running PRG files Running PRG files not working Nov 24, 2022
@lgblgblgb
Copy link
Owner

Thanks for the report! The problem is most likely because that's an experimental/development series of ROM (99xxxx), which totally changed how keyboard scanning works and Xemu has to "cheat" to "fake" keypresses to load PRGs which is not detected then by new ROMs because of the totally reworked keyboard scanner routine in the ROM. Meanwhile, to avoid auto-boot DISK images to cause problems, Xemu temporary deactivates the disk image access till the keyboard buffer is "consumed" by the ROM. Since it's never happened because of the changed kbd scanner routine in newer ROMs, it's even left in that state, thus the read error.

So though it's a very annoying thing, I am aware of this and it'sthe nature of the experimental ROM: not supported in emulation, with this functionality at least. Unfortunately it's quite impossible to support both methods with current code flow, and would cause major problems.

@lgblgblgb lgblgblgb changed the title Running PRG files not working MEGA65: Running PRG files not working with experimental/development closed-ROM versions Nov 24, 2022
@lgblgblgb
Copy link
Owner

Though, I still "reverse the rights ;)" to figure out a better way to support all possible ROMs somehow ...

@lgblgblgb lgblgblgb changed the title MEGA65: Running PRG files not working with experimental/development closed-ROM versions MEGA65: Figure out a way to produce "fake keypresses" (for PRG run etc) in a "ROM/software keyboard scanning method"-independent way Nov 26, 2022
@lgblgblgb lgblgblgb self-assigned this Nov 26, 2022
@MightyAxle
Copy link
Author

We all appreciate your hard work creating the best possible experience for the MEGA65 through Xemu. It sure has made me feel good about programming in BASIC again! 😊👍

@lgblgblgb
Copy link
Owner

lgblgblgb commented Apr 1, 2023

https://discord.com/channels/719326990221574164/781481205639020554/1091513603061977130

It seems even "non-developer" new ROM version(s?) can have problem here.

So in general, I should fix things here to allow all (closed) ROM version to work flawlessly.

@lgblgblgb lgblgblgb changed the title MEGA65: Figure out a way to produce "fake keypresses" (for PRG run etc) in a "ROM/software keyboard scanning method"-independent way MEGA65: PRG run option (UI/CLI) should work on all ROMs Apr 1, 2023
@lgblgblgb lgblgblgb changed the title MEGA65: PRG run option (UI/CLI) should work on all ROMs MEGA65: PRG run option (UI/CLI) should work on all (closed) ROM versions Apr 1, 2023
@lgblgblgb
Copy link
Owner

I found the issue, I think. It's not the keyboard handling changes as I thought before. The issue, that Xemu wants to be ROM version independent (also it works ... worked ... with C64(GO64)/C65/MEGA65 KERNAL as well) thus not using address trapping or anything. It looks for the READY. on the actual screen memory, and checks for byte $A0 on the next line (cursor in 'on' state). Here is the problem: it seems, newer ROMs handles cursor differently. Instead of using $A0 (which is also compatible with GO64 mode C64 KERNAL) now the screen memory remains, and - I assume - the colour RAM is used instead with probably the inverse hardware attribute for cursor 'inversion'.

@lgblgblgb lgblgblgb moved this from TODO to In Progress in MEGA65 emulator project Apr 1, 2023
@lgblgblgb lgblgblgb added the WIP label Apr 1, 2023
lgblgblgb added a commit that referenced this issue Apr 1, 2023
Xemu tries to be ROM independent, as there is no "single ROM" version,
so ROM traps method is virtually impossible (especially since it must
work with old C65 ROMs, GO64 C64-ROMs, and dozens of MEGA65 ROM
versions). Thus, Xemu looks for the READY. text on the current screen,
and searches for the blinking cursor "can be seen", this way it knows
it's the right moment to inject PRG into memory directly, _and_ writing
a RUN command onto the screen. After that, a single RETURN key emulation
is enough.

However. Newer MEGA65 ROM versions seems to use the VIC3 style hardware
inverse attribute for cursor, not the C64-way+C65+older MEGA65 way. Thus
Xemu could not ever see, the system is ready for injection ... I tried
to come with a solution here, which works in each cases, also checking
the colour RAM and inverse hardware VIC attribute from now.
@lgblgblgb
Copy link
Owner

Tested with MEGA65 closed ROMs versions 920377, 920383, 990004 also in C64 mode, it seems the fix works in all the cases.

@MightyAxle
Copy link
Author

Thanks for your sterling work. ROM version 920377 works 100%. 👍ROMs 920383 and 990004 still won't run .PRG files and when you try and load a D81 disk image a read error is returned. I downloaded the newest stable version of Xemu 20230201214849 to test this.

@lgblgblgb
Copy link
Owner

lgblgblgb commented Apr 2, 2023

@MightyAxle You need version 20230402002720 available on the "next" branch. On https://github.lgb.hu/xemu/ this is the second "section" of downloadables (aka "future next stable"). The master (aka "stable") branch is something I only seldom update from the then-current next, when next seems to be stable enough in terms of the accumulated changes here since the previous "down-merge" from next to master. This is always the method, ie no direct change to master ever only through the "staging" next from time to time.

@MightyAxle
Copy link
Author

We 100% success rate! All ROMs work on 20230402002720 next branch! 👍Thank you! 🏆

@lgblgblgb lgblgblgb moved this from In Progress to DONE in MEGA65 emulator project Apr 2, 2023
lgblgblgb added a commit that referenced this issue May 15, 2023
Drop using the two-phase ?"@" trick to release RETURN, and use a
timeout instead. For C64 LOAD, let's use two normal phase though,
we can save the ugly keyboard buffer trick (just introduced in the
previous commit btw ...), and we can use "turbo mode" for loading
too, to speed of LOADing (no need in MEGA65 mode, as it's usually
40.5MHz mode already). Also several clean-ups here and there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants