-
Notifications
You must be signed in to change notification settings - Fork 11
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
QNICE writes to manually-loadable ROMs on hard reset. #56
Comments
I found out that when this happens, the full I can use that to disable writing. I will try that next. The drive ROM of course truncates the address to a smaller number of bits since it's of limited size. I hope that the qnice core does actually store this csr-page data somewhere else, because there is no room for it in the various ROMs... |
No, it doesn't...
I think we need an extra device type, one for ROM-like things, that don't have a CSR. Edit: from a quick look, it seems that
already would do the right thing for R10=0, at least it seems like it would skip that loop at the end. But the value has other effects, so maybe it won't work. |
@Rhialto Thank you for raising this issue. I am currently very busy with life so I do not have a ton of time to support you and/or fix a bug, if there is one. Currently I guess there is no bug - but who knows :-) To quickly check the basics:
I am sorry, that this whole mechanism is currently not very well documented (not documented at all). So we need to do a bit of forensics together. It is important that you implement the CSR protocol when working with the On-Screen-Menu to load ROMs or things like that. An example how to do it is shown in: https://github.com/MJoergen/C64MEGA65/blob/master/CORE/vhdl/prg_loader.vhd Look at lines 69++ The protocol helper is here: https://github.com/sy2002/MiSTer2MEGA65/blob/master/M2M/vhdl/qnice_csr.vhd And don't forget that QNICE operates on the falling edge. You need to support this CSR protocol and we suggest that you use qnice_csr.vhd for it. Another example which uses qnice_csr.vhd is here: https://github.com/MJoergen/C64MEGA65/blob/master/CORE/vhdl/sw_cartridge_csr.vhd But this is way more complicated. The above-mentioned prg_load much more mimics the "data pump" that you might be looking for. My guess is: You did not implement this protocol and this is why the QNICE firmware crashes. Also another question to you: Can you clarify your use case? Do you want ROMs to be automatically loaded on startup? Then you need to use the auto-load mechanism, which is different from the manual loading mechanism described here. Auto = on startup / hard-reset and Manual = user uses the file browser to pick it. An example of the automatic mechanism is the Jiffy DOS loading mechanism as shown in the C64 core:
But in this case, also the MiSTer code needs to be changed for accomodating the falling-edge nature of QNICE, example: https://github.com/MJoergen/C64_MiSTerMEGA65/blob/5afb90e02fcefb053ac27792f42e742ad61e8b9b/rtl/iec_drive/c1541_multi.sv#L111 It might also make sense to have a Skype call together, i.e. you, @MJoergen and I to get to know each other and to resolve this here quickly. Feel free to dm me on Discord. |
Thanks for all the info, @sy2002 ! I see now that this is not a bug, but merely a difference in use case and/or expectations. Let me explain how I got to the implementation that I did. It is at https://github.com/Rhialto/PET_MEGA65 and https://github.com/Rhialto/PET2001_MiSTer/ . I started with the PET2001 core from MiSTer. Into that I copied the c1541 code from the C64MEGA65 core. PETs have many different models and a big difference between those is in the ROM contents. There are many different version of the "editor" ROM E000-E7FF or -EFFF. Too many to count. Furthermore there are 2 or 3 empty sockets for 4 KB ROMs and there are many of those around. So having loadable ROMs is kind of essential. Further I like to have at least one set pre-loaded so that you don't need to do much setup to use the core. No extra files on the SDcard needed. And as I understand it, auto-load ROMs aren't automatically loadable by hand anyway. So the 1541 and also the PET came with an interface already to load the ROMs. Here is a fragment from the C64 core applying that to the 1541: https://github.com/MJoergen/C64MEGA65/blob/master/CORE/vhdl/mega65.vhd#L864
I used essentially the same for my copied drive. The PET also had a similar access to the internals, https://github.com/MiSTer-devel/PET2001_MiSTer/blob/master/rtl/pet2001hw.sv#L66
Indeed for this I had to add the qnice clock, and rearrange the internal dual ported RAMs a bit. So this is how I got to use the ROM loader. I just wired it up the same. The floppy disk buffers are also wired up the same. I think that for something as simple as a plain ROM this qnice protocol is not needed. The examples I saw don't implement it. And I suspect that if a ROM load option for the 1541 was added to the menu of the C64MEGA65 core, it would fail in the same way as it did for me. I guess nobody got around to trying it out so far. For now I worked around the issue by always returning OK (2) from a read on the CSR page, and ignoring writes to it. But it would be simpler if the qnice code treated a simple ROM load the same as a floppy disk mount. I noticed in the code that this case is tested in a few places, and there is a note somewhere that these don't have a CSR. Having that as a supported case for ROM loads sounds like a good solution to me. https://github.com/Rhialto/PET_MEGA65/blob/v0.00005/CORE/vhdl/mega65.vhd#L556
I could strip down |
Copied from discord https://discord.com/channels/719326990221574164/782759365064917065/1315000073444135034
The QNICE core, when starting up, seems to write to several of the "core specific devices" as listed in C_CRTROMS_MAN. I caught it doing that and enabling qnice_dev_we_i for several of them. The disk drive does a checksum of its ROMs and then fails. It shows that by doing 2 flashes of its drive led, repeatedly.
I though to maybe avoid it by changing the number of the drive ROM, but this made no difference. Now the changed number appears, and write is done to addrexx $3000 in its address space....
I had to disable writing to the drive ROM for now until I find out what's going on exactly.
I found out where it happens. I suppose the QNICE code doesn't change often so my addresses are probably reproducable. It is at
24A1
in a function calledCRTROM_CSR_W.
It is called from237D
just below the label_CRTRI_L9
and the comment; set all CSRs of all CRT/ROM devices to "idle"
.The text was updated successfully, but these errors were encountered: