Jump to content
Andrew Davie

Propoasal for alternate implementation of "emulation exit"

Recommended Posts

which ROMs have you tested so far?

 

Share this post


Link to post
Share on other sites
Posted (edited)

After rebooting the problem was gone. But whenever I play Combat, it returns. Weird.

 

I tested the NTSC version of Combat and also an Air Sea Battle (Alien Battle) hack. And both seem to trigger the bug. Both have PAL color loss (odd scanline count), maybe that plays a role? Or maybe some special coding of the old games?

Combat - Tank-Plus (Tank) (1977) (Atari, Joe Decuir, Larry Kaplan, Steve Mayer, Larry Wagner - Sears) (CX2601 - 99801, 6-99801, 49-75101, 49-75124) ~.bin

Edited by Thomas Jentzsch

Share this post


Link to post
Share on other sites
Posted (edited)
6 hours ago, Thomas Jentzsch said:

I tested the NTSC version of Combat and also an Air Sea Battle (Alien Battle) hack. And both seem to trigger the bug

I think the problem might be that both games, in addition to reading the switches,  perform several writes to SWCHB (because they have some unused bits set as output and use them as extra ram), and the value written has bit d0=0, according to the Stella debugger.

 

To the Pluscart, this appears identical to a read from SWCHB with the RESET switch pressed, as it cannot differentiate a read operation from a write one.
 
In both cases it sees SWCHB on the address bus followed by a value with bit d0=0 on the data bus, and there's no way to know if the latter comes from the RIOT (read) or the CPU (write).

 

Edited by alex_79
  • Like 1

Share this post


Link to post
Share on other sites

Very good analysis. :thumbsup: I suppose that kills the current exiting logic.

 

Any idea for a better solution?

Share this post


Link to post
Share on other sites
15 hours ago, Thomas Jentzsch said:

Very good analysis. :thumbsup: I suppose that kills the current exiting logic.

 

Any idea for a better solution?

 

15 hours ago, alex_79 said:

Nope, I can't think of any.

 

 

me too, but maybe we just wait what @batari comes up with for the Harmony Cart:
 

 

Share this post


Link to post
Share on other sites

Is it possible to make „the method of emulation exit“ selectable in the PlusCard configuration menue?

 

I mean the actual method works (for some/most of the programs) but is not easy to execute. If we had an option to select the method everyone can test it by themselves. 
 

… just an idea 🤷‍♂️

  • Like 1

Share this post


Link to post
Share on other sites

Maybe we should build a database which contains ROMs which do not well with the exit code.

Share this post


Link to post
Share on other sites
Posted (edited)

What about this:


As soon as there's an access to SWACNT or SWBCNT (and mirrors), then disable the emulation exit for the current game.
This takes care of games that use the ports as outputs: you wouldn't be able to use the exit functions for those, but that's still better than unexpected exit.

 

There's still the problem of controllers (e.g. trackballs) that can leave one input constantly low, but  that could be solved by using a combination that only involves the console switches, like the previously proposed "long RESET press while SELECT is NOT pressed". In this case you don't even need to check SWACNT anymore.

 

Edited by alex_79
  • Like 1

Share this post


Link to post
Share on other sites
Posted (edited)

The PlusCart cannot track the state of SWBCNT because it is a write operation, right?

 

BTW: The SaveKey and AtariVox write to SWCHA too. But usually they only use the right port.

Edited by Thomas Jentzsch

Share this post


Link to post
Share on other sites

It can see an access, while it cannot know if it's a write or read operation. Anyway there shouldn't be any reason for a game to access SWACNT / SWBCNT unless it's using the ports as output.

Share this post


Link to post
Share on other sites
Posted (edited)

That's not correct. Quite a lot of games simply write 0 to SWBCNT (e.g. Beat 'Em & Eat 'Em, Buck Rogers, Bump 'n Jump...). Could we get the bits set by assuming that the load operation happened directly before the write?

lda/x/y #??
sta/x/y SWBCNT

 

Edited by Thomas Jentzsch

Share this post


Link to post
Share on other sites
Posted (edited)
1 hour ago, Thomas Jentzsch said:

That's not correct. Quite a lot of games simply write 0 to SWBCNT (e.g. Beat 'Em & Eat 'Em, Buck Rogers, Bump 'n Jump...).

Good point, I assumed that only games that need to set it as output did that.

Quote

Could we get the bits set by assuming that the load operation happened directly before the write?

Actually, I think there's no need for that: you can read back SWACNT/SWBCNT, so it doesn't really matter to know if it's a write or read operation: the data bus will in any case have the SWBCNT value.
So, on any access to SWBCNT, just check the data bus, and if it's not 0 then disable the emulation exit function.

 

Edited by alex_79
  • Like 1

Share this post


Link to post
Share on other sites

For what it's worth, Tim Worthington's 2600RGB allows for an extra button on the joystick that allows for remote SELECT/RESET.

 

The extra button is implemented as a simultaneous left+right at the same time, in combination with the joystick being pressed up or down:

Quote

How to use

The extra button mounted on the joystick can activate three functions.

  • Extra + Up = Select
  • Extra + Down = Reset
  • Extra + Fire = Palette switch.

 

When using PlusCart games, usually trying to use the extra button results in exiting the ROM and back to the PlusCart menu.

Share this post


Link to post
Share on other sites

The extra button functionality is known to cause incompatibilities with some controllers (for example with trackballs), and/or some specific games.

 

https://atariage.com/forums/topic/243453-atari-2600-trak-ball-games/?do=findComment&comment=4268750

 

https://atariage.com/forums/topic/317432-2600-jr-strange-joystick-behaviour-help-needed/

 

The Extra + Down combination would almost always exit emulation on the PlusCart, as it triggers Right + Reset.

 

  • Like 1

Share this post


Link to post
Share on other sites

While testing the new HSC roms for Solar Fox I triggered early exit often. What I think is happening is that when I lost my last life I was traveling to the right, and a second or two later I hit reset.

 

I also had this problem with early exit while playing Berzerk a long time ago.

Share this post


Link to post
Share on other sites
1 hour ago, Omegamatrix said:

While testing the new HSC roms for Solar Fox I triggered early exit often. What I think is happening is that when I lost my last life I was traveling to the right, and a second or two later I hit reset.

 

I also had this problem with early exit while playing Berzerk a long time ago.

Yes I had this effect too. If SWCHA is not read by the kernel (Game Over or Titlescreen) after the game, the last value read for SWCHA is the "active" value for the exit function. A fix is to add a "LDA SWCHA" in the Titlescreen/Game Over loop.

 

Share this post


Link to post
Share on other sites

I had 3 bytes free before doing VSYNC, so I inserted a LDA SWCHA. Hopefully everything is good now.

 

 

Share this post


Link to post
Share on other sites
On 5/18/2021 at 8:26 PM, alex_79 said:

Actually, I think there's no need for that: you can read back SWACNT/SWBCNT, so it doesn't really matter to know if it's a write or read operation: the data bus will in any case have the SWBCNT value.
So, on any access to SWBCNT, just check the data bus, and if it's not 0 then disable the emulation exit function.

@Al_Nafuur Are you going to fix the bug based on this information?

Share this post


Link to post
Share on other sites
1 hour ago, Thomas Jentzsch said:

@Al_Nafuur Are you going to fix the bug based on this information?

 

I think this will not "fix" the bug this will only deactivate the exit function for unintentional and intentional exits. Furthermore this will only "fix" it for the few games that are using the free SWCHB bits for extra storage.

 

Most of the unintended exits happen when the games don't query both SWCHx in their different loops (Game, title screen or game-over loop). Then the status stored for the not queried SWCHx in our flags is no longer updated.

 

Therefore I tend more to a solution like this one:

On 5/18/2021 at 4:47 PM, Bomberman94 said:

Is it possible to make „the method of emulation exit“ selectable in the PlusCard configuration menue?

 

I mean the actual method works (for some/most of the programs) but is not easy to execute. If we had an option to select the method everyone can test it by themselves. 
 

… just an idea 🤷‍♂️

 

Or maybe I can implement a simple 6502 cycle counter that resets our SWCHx states when the counter overflows (e.g. a 16 bit counter would reset the flags after ~ 55 ms )

 

Share this post


Link to post
Share on other sites
21 minutes ago, Al_Nafuur said:

I think this will not "fix" the bug this will only deactivate the exit function for unintentional and intentional exits. Furthermore this will only "fix" it for the few games that are using the free SWCHB bits for extra storage.

IMO that's a valid bug fix for the games in question. It is not meant to fix all problems.

 

21 minutes ago, Al_Nafuur said:

Most of the unintended exits happen when the games don't query both SWCHx in their different loops (Game, title screen or game-over loop). Then the status stored for the not queried SWCHx in our flags is no longer updated.

That's a different problem which seems independent from the problem of games writing to SWCHx.

Share this post


Link to post
Share on other sites
On 5/26/2021 at 11:15 AM, Thomas Jentzsch said:

IMO that's a valid bug fix for the games in question. It is not meant to fix all problems.

No matter how we would call it, these kind of exceptions will cost a lot of precious MCU cycles during the emulation of every ROM and it will only solve the issue with a handful of games. That's why I would prefer a more generic solution (like a user setting to disable the exit function).

 

 

Share this post


Link to post
Share on other sites

A user setting to disable exit function would be great. When I was playing Alfred Challenge for the 2600 game by game Podcast last week, the game would exit to the PlusCart menu when I pressed reset(not holding the joystick to right). Also someone I gave a UnoCart(PlusCart hardware) to has complained about various games that exit on him.

  • Like 1

Share this post


Link to post
Share on other sites

Where are we here? I would like to be at least able to disable the exit functionality if it breaks a game.

Share this post


Link to post
Share on other sites

Why not list 2 or 3 possible exit functionalities in the settings? First one could be the well known we use today and the others ones can be tested by the users - feedback what or how many games could be listed here 🤔

Share this post


Link to post
Share on other sites

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...