lgblgblgb / xemu

Emulations (running on Linux/Unix/Windows/macOS, utilizing SDL2) of some - mainly - 8 bit machines, including the Commodore LCD, Commodore 65, and the MEGA65 as well.
https://github.com/lgblgblgb/xemu/wiki
GNU General Public License v2.0
201 stars 31 forks source link

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

Closed MightyAxle closed 1 year ago

MightyAxle commented 1 year ago

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.

lgblgblgb commented 1 year ago

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 commented 1 year ago

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

MightyAxle commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

MightyAxle commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

We 100% success rate! All ROMs work on 20230402002720 next branch! ๐Ÿ‘Thank you! ๐Ÿ†