Jump to content
IGNORED

Propoasal for alternate implementation of "emulation exit"


Andrew Davie

Recommended Posts

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
Link to comment
Share on other sites

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
Link to comment
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:
 

 

Link to comment
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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
Share on other sites

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
Link to comment
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.

Link to comment
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
Link to comment
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.

Link to comment
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.

 

Link to comment
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?

Link to comment
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 )

 

Link to comment
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.

Link to comment
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).

 

 

Link to comment
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
Link to comment
Share on other sites

  • 4 months later...
  • 1 month later...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...