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
BlackBox9 cartridge emulation. [More information needed.] #334
Comments
It is probably a bug in the emulation. But I don't know the BB9 well enough
to understand where these glitches are coming from. I saw them also in the
menu.
I quickly drafted the BB9 emulation within 15 minutes, so it may need some
verification / debugging.
|
I understand. |
I fixed the freeze button issue. The same issue causes problems in the U64 when switching cartridges. |
It's a commit from Vice mirror repo. |
I found Vice 3.6.1 and crt bb9 runs there without glitches. |
Comparing a hardware implementation and a software implementation might put
us on the wrong track. It might help to check if the basic logic is
correct; but that actually already seems to be the case, as the software
inside of the cart runs just fine.
You see, the glitches are very short in nature. One byte of graphics crap,
sometimes a bit more. It seems to fail when the CPU writes and the VIC
reads. The real question is: why does this happen with BB9 and not with
other carts, e.g. Jupiterlander? This behavior was observed with
Jupiterlander, but this was timing related. Which cartridge runs is
independent of the timing; or in other words: the timing is set for the
ultimate as a whole, not for a specific cart. It would help to understand
what BB9 is doing with the VIC. Does it use Ultimax mode a lot?
…On Thu, Apr 27, 2023 at 5:16 AM radius75 ***@***.***> wrote:
It's a commit from Vice's mirror repo.
BB9 support seems to have appeared somewhere between 3.6.0 and 3.6.1
I don't know if it can help in this case.
***@***.***
<VICE-Team/svn-mirror@a1c88de>
—
Reply to this email directly, view it on GitHub
<#334 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACUFDSMXDOBGC4V6WIRIVCTXDHQKXANCNFSM6AAAAAAXMH5HJM>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
BB9 is different from the rest of BB3,4,8. |
The author of the video confirmed to me on FB, that this video was made with BB9.crt on modded Vice3.1 |
Ok.. without further info, and only links to Vice, a software emulator, I
think it's best to remove it and drop the support for BB9.
Message ID: ***@***.***>
… |
It must be so. More information may be available from people who added BB9 to Vice, or those who somehow managed to dump to a BIN file. Maybe someday.. If I manage to find out more, I will definitely post it here. Anyway, thank you very much for your effort. |
The hardware equivalent of doing what VICE does would be gating game/exrom with phi2, so the cartridge is only active in CPU cycles. To check whether that is true, you could change line 131 in blackbox9.c https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/c64/cart/blackbox9.c#l131 to
if you now get the same glitches in VICE; then this is the problem. That said, the whole implementation is based on guesswork and i don't know how the actual hardware works exactly - i wouldnt be surprised to see those glitches also with a real cartridge. You might want to contact someone who owns the physical cartridge first. |
The hardware equivalent of doing what VICE does would be gating game/exrom
with phi2, so the cartridge is only active in CPU cycles.
Interesting... I am not sure if I have PHI2 available in that module, but I
could route it there. I am trying to get my head around how this could
cause the glitches. It seems to be related to the write from the CPU.
To check whether that is true, you could change line 131 in blackbox9.c
https://sourceforge.net/p/vice-emu/code/HEAD/tree/trunk/vice/src/c64/cart/blackbox9.c#l131
to
cart_config_changed_slotmain((currbank << CMODE_BANK_SHIFT) | currmode, (currbank << CMODE_BANK_SHIFT) | currmode, CMODE_WRITE);
if you now get the same glitches in VICE; then this is the problem.
Thanks.. I have never looked into the VICE source code, nor tried to build
VICE myself... so I might choose another route to find out what goes wrong.
Best regards,
Gideon
Message ID: ***@***.***>
… |
Just gave it a quick try - i dont see any glitches even with that change
When Ultimax is active in VICII cycles, then VICII sees cartridge ROM and will display garbage most likely (eg you can also see this with Action Replay V5, eg for a short time before it starts loading). Why it would cause such "sparkles" as the OP describes is a good question though - it would have to switch between ultimax and non ultimax a lot. The ROM i have here doesnt do this though :) |
I agree with you completely. IMHO, the sparkles are too short for switching
back and forth.
Message ID: ***@***.***>
… |
I think i know what happens... first of all, the cartridge does not use a register, but it switches the mode depending on the address in the IO1 range (and apparently both on read and write). That actually explains how it can produce "sparkles" that are one cycle (aka 8 pixels) wide: The cartridge has trampoline code in the IO1 area. When the code jumps to such trampoline, it will run the code in IO1, and at the same time switch the cartridge mode every cycle. I have put breaks on the entire IO1 range in VICE, so you can see this:
etc (every "Sync reset" marks when a breakpoint hits, ie when it jumped into IO1). The second value is game/exrom - so that changes rapidly all the time. and to confirm the theory, this patch produces the glitches in VICE too:
I didnt see them before, because i only patched "write". it is the reads that are the problem! So, the solution is still the same: game/exrom must be inactive at all times in VICII cycles :) (This btw is the case for other cartridges too - eg Retro Replay) |
Unfortunately, I don't have access to the real BB9. I found a video from YT where real hardware is presented.The graphic glitches are not visible. |
So, the solution is still the same: game/exrom must be inactive at all
times in VICII cycles :) (This btw is the case for other cartridges too -
eg Retro Replay)
That kind of sucks. :) This is totally incompatible with how the U64 does
it. Since the introduction of the 48 MHz turbo mode, the decode needs to be
known at every clock cycle. This is necessary to know when (if) to make an
external cycle on the cartridge port or not. To get some external carts to
work, there is a dynamic mode which slows down the bridge whenever a mode
change is expected, but this won't work for internal carts. Anyway, that's
something I need to think a bit more about later, we are now discussing the
U2 cartridge.
So, the solution is still the same: game/exrom must be inactive at all
times in VICII cycles :) (This btw is the case for other cartridges too -
eg Retro Replay)
It doesn't apply to all carts. Ultimax carts certainly do need to do a read
during a VIC cycle, and all carts that are supposed to work at 2 MHz in a
C128 also do.
Thank you for your contribution.. I will certainly try to gate the
EXROM/GAME outputs with PHI2.
… Message ID: ***@***.***>
|
Did some grepping in the VICE source, its at least these carts that use a different config in VIC and CPU cycle (not necessarily "inactive" in the VICII cycle!): Gmod2, stardos, blackbox9, magic formel, mmc replay, freeze machine, partner64, atomic power, isepic, freeze frame 2, freeze frame, rrnet-mk3, capture, formel64, LTKernal, IEEE FLash 64, Final Cartridge 3, Final Cartridge Plus, IDE64, MMC64, EXOS, Comal80, Expert Cartridge, Retro Replay Mind you, that even very simple ROM cartridges (which do not "need" this) sometimes gate game/exrom with phi2, so the above list is probably not complete. I'd expect that at least all that somehow use the address on the bus (instead of the data) have to do it.
As said above, this should not be generally the case - some cartridges need it. Some cartridges will even use different modes in both cycles, so this should be a per cartridge thing. |
I checked fw3.10i on U2+. The BB9 CRT works very well. |
A working "replica" of BB9 has been created I will quote and try to translate the explanation of the author of this new bb9 regarding the screen glitches in music keyboard mode. https://www.c64scene.pl/viewtopic.php?p=49620#p49620
|
ah much better idea would be to gate game/exrom with phi2 and not let the vicii see ultimax mode :) |
The author of replica pointed out one more serious error in bb9 emulation on Vice and Ultimate. on a real bb9, after executing <-q, peek(56880) returns a numeric value. This is important when running programs. The standard F3 key runs <-Q:RUN: A Reset with the Spacebar pressed should unlink the eprom and go to Basic2.0 If I get more details on this, I'll make a Reopen Issue |
that makes no sense |
it will supposedly take an extra Input in the GAL Perhaps he means the lines needed to address the memory. Ambitious, maybe soon it will be bb10 ;D |
I'm reopening this Issue. The original bb9 disconnected the eprom completely after executing the <-q command.
|
I think what is missing is a simple "disable cartridge" feature, very similar to how it works in AR. The condition is apparently "when IO1 is written, bit 7 of addr is 0, bit 6 and bit 0 of addr are 1" (ie 0xde41). In that case just "disconnect" the register from IO1 (but still update the bank/game/exrom) until reset. |
For me, it worked as I imagined. (Vice latest fixed build) |
Related to #314
I checked running bb9 on U2+ 3.10f
Function "2 - MUSICAL INSTRUMENT" (music keyboard), Selected on the start screen.
It is displayed with moving noises on the screen.
Is there any way to fix this by changing the settings in Ultimate options?
The same CRT in Vice3.7.1 works without such glitches.
The text was updated successfully, but these errors were encountered: