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: F011 FDC internal block buffer behaviour difference between MEGA65 and Xemu #251

Open
lgblgblgb opened this issue May 19, 2021 · 1 comment

Comments

@lgblgblgb
Copy link
Owner

lgblgblgb commented May 19, 2021

Shallan has created a nice loader for his works, which uses F011 registers directly to load needed files etc. That works on MEGA65.

With Xemu/MEGA65 it does not work.

However, interestingly, if the disk image is attached, AND the PRG file itself injected externally, it works. It seems, the initial loading (of the program itself) from disk breaks the loader then for whatever reason, which won't happen with external injection used. This suggests that there is some kind of "non-clean state" or something of the emulated F011 FDC controller, if used before (to load the PRG) which ruins the loader then.

I tested this with "LUMA" so the fix is intended to be "LUMAfix" (pun intended ...) ;)

Details

So, extract the main program file from luma.d81, let's call it luma.prg.

This works (loader is OK): -prg luma.prg -8 luma.d81

While just this (then loading the program inside the emulator) does not: -8 luma.d81

@lgblgblgb
Copy link
Owner Author

lgblgblgb commented Jun 7, 2021

Breaking news

So, it turned out (by Shallan) that the problem is $D087 which is the data access register for the internal block buffer of F011. This register is emulated by Xemu of course, otherwise even ROM would not work. However, there is some difference between Xemu and MEGA65, since this is the problem here. The difference should be somewhat tricky, as it does not affect the behaviour of the ROM at least.

Though, Shallan stated he will use a workaround, clearly, this difference should be addressed and corrected in Xemu! Thus I modify the title of this issue to reflect the situation better.

This may also explains why LUMA worked with PRG inject: probably, the problem is the incorrect block buffer pointer handling, though, it's initially correct, but "messed up" by ROM on LOAD. It's a curious thing why ROM does not care about a problem like this, that's why I think, it's maybe a kind of tricky problem to attack.

@lgblgblgb lgblgblgb changed the title MEGA65: debug possible FDC emulation problem causing Shallan's loader failing to work MEGA65: F011 internal block buffer behaviour difference between MEGA65 and Xemu Jun 7, 2021
@lgblgblgb lgblgblgb changed the title MEGA65: F011 internal block buffer behaviour difference between MEGA65 and Xemu MEGA65: F011 FDC internal block buffer behaviour difference between MEGA65 and Xemu Jun 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

1 participant