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: utility menu tools cannot be started #369

Open
lgblgblgb opened this issue Feb 12, 2023 · 1 comment
Open

MEGA65: utility menu tools cannot be started #369

lgblgblgb opened this issue Feb 12, 2023 · 1 comment

Comments

@lgblgblgb
Copy link
Owner

lgblgblgb commented Feb 12, 2023

Originally issue #368 but it's a more generic one: since the big changes of #140 utility menu items (configure, fdisk, keyboard test) do not work and produces only "white screen".

Since #140 I needed tons of modifications to allow newer HYPPO to be able to work inside Xemu/MEGA65. These changes are so interlocked, cannot be separated or reverted back step-by-step (to find the exact change which introduced the problem). However one side effect of this project is the inaccessibility of the utility menu items, that worked before, but not anymore after that project. Because of the "monolithic" nature of the big change, it's not possible to trace back (git bisect or anything like that) the exact change/commit which introduced the issue.

This problem - though known for me since a year or so - was handled as "low priority" issue (or even "cosmetic") as these are not so important in an emulator (Xemu anyway overrides settings, can format disk image as its own etc etc) as on a real machine. However, indeed, it shows there is some regression here since worked before, and the exact problem may reveal a more generic issue which can resolve other currently unknown problems as well in seemingly very different scenarios.

Note that even the first post in issue #140 the problem was already known, but would block the whole project of "new-HYPPO" if not ignored. Since then I made several attempts to track down this issue, but no luck. Anyway even those tries of mine revealed some issues Xemu did wrongly, which helped in emulation quality in general, but still, so far the root of the issue is not resolved yet.

The utility menu can be more easily triggered with two of these methods (no need for superhero reflexes ...):

  • use the -useutilmenu CLI switch to start Xemu/MEGA65
  • use the UI menu: Reset / ROM swhitch -> Reset into utility menu

So far, every tries of mine to find the actual problem (there were at least 2 occasions when I had hours of time to try to find the problem) was unsuccessful :(

@lgblgblgb
Copy link
Owner Author

lgblgblgb commented Jan 27, 2024

What I've done so far (IIRC ... but the quoted source fragment is fresh now, of course not by heart for that part).

from mega65-core repository, file src/hyppo/main.asm:

utility_end_of_list:
        ;; XXX Get input from user (accept only numbers 1 - 9)
        jsr scankeyboard
        cmp #$ff
        beq utility_end_of_list
        cmp #$31
        bcc utility_end_of_list
        cmp #$39
        bcs utility_end_of_list

        ;; XXX Based on input, find that utility
        and #$f
        tax
        dex ;; input is 1-9, so subtract one for list beginning at 0
        jsr utillist_rewind
ueol2:  jsr utillist_validity_check
        ;; Select again if first choice invalid
        bcc utility_end_of_list
        dex
        bmi ueol1
        jsr utillist_next
        bra ueol2
ueol1:

        inc $d021

After selecting (let's say 1, ie CONFIGURE) utility, inc $d021 is executed, and this causes the screen goes white. Something here then goes horribly wrong. It seems, even hypervisor RAM is overwritten (?) what I can see in matrix mode, after the selection, compared to before the utility selection.

My gut feeling says that it's something of these, or mix of:

  • bad emulation of DMA in Xemu somehow, which is triggered here (there is some DMA work)
  • in hypervisor mode, memory mapping etc does not work the same way as I emulate ...

Though so far this does not helped exactly to pinpoint the issue that I can fix ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant