-
Notifications
You must be signed in to change notification settings - Fork 20
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
args not passed to elf_main #29
Comments
Yes. The mechanism is in place but the values aren't being set correctly. What you should be seeing at the moment is System Type = 0 Question about the System Type field: What are you intending to do with this information in the ELF code? I'm asking because I'm not entirely convinced you need the PAL60 option. I'm sure we agree that PAL60 is the same as PAL except that the display is 60Hz rather than 50Hz. However, the frequency of the display is something that would be 'decided' by the ELF code. ie. it's not information the hardware or emulation can reliably provide before the ELF code is run. There is something called PAL-M which is very nearly the PAL standard in that it produces PAL colour but at the intended frequency of 60Hz. Is that what you meant? Maybe I'm just being overly fussy with the naming but I've been down this rabbit hole a lot :-) For references, Gopher2600 supports the following clock speeds:
Gopher2600 will assume the NTSC clock unless (a) explicitely instructed or (b) the TV display indicates that the ROM is outputting a PAL-50 signal. As far as I know, it's impossible to reliably discern the other specifications just from the ROM program. |
I think for Gopher it can be limited to NTSC and PAL60. PAL50 would only be relevant on the UCA carts where there could be systems that require 50Hz. The elf game can adjust its color palette based on which TV standard the loader indicates. The Flags can be kept at 0 until you add support for exiting from elf games back to the ROM selection screen. If that's supported, Flags can be set to 1 to indicate exit is available. |
I've pushed a change that set the ARM clock speed correctly and sets the System Type d7c71fd I don't think we agree on the PAL60 issue. As far as I'm concerned, there's no such thing as PAL60. There's PAL running at 60Hz but the only information that can be provided in that situation is that the machine is PAL. Whether the display is running at 60Hz is something the ROM decides, not the hardware. As such, in this change the System Type is set to either NTSC or PAL. If the emulated VCS is either a SECAM or PAL-M machine, the System Type will be set to NTSC. |
Thinking this over some more, I think the only way the system type argument can work in hardware is if the multicart has a way for the user to of specify the system. So the user will be able to say that "this is a PAL system with a TV that can display 60Hz". Or "This is a SECAM system". Etc. I can emulate that capability in the preferences window. Maybe have a section in the PlusCart tab: "System Type for ELF ROMs". System in this context being the combination of the console and the TV. I don't see how the information can be supplied to the ELF ROM otherwise. Unless you have other thoughts on this. |
Indeed, the UCA family of carts have a setting in the menu system that lets you choose the TV type. That is what is passed in those carts. Generally, it's much easier to support both NTSC and PAL if they both run at 60HZ because 50HZ would change the timing of audio and physics without some extra code to compensate. So, given the option between 50HZ and 60HZ the cart would do 60HZ. That was my reasoning behind PAL60 being the default for PAL TV mode. As you pointed out though, it's ultimately up to the cart. So far, my games will only output 60HZ regardless. Only the palette will change depending on TV mode.
|
This concept of passing the preferred TV type to a game was actually part of the AtariVox/Savekey specs, altough it is rarely used AFAIK: The unfinished homebrew "Man goes down" read this byte and uses its value as the default TV mode. By pressing the SELECT switch when starting the game, it is possible to change the TV mode between NTSC, PAL and PAL60, and the result is written back to the eeprom, so it is remembered the next time you play the cart (as long as you have the AtariVox/Savekey plugged in, of course). I'm not aware of any other game that uses that feature. |
I didn't know that! But I now realise that the cartridges must have such a system already. I understand what you need and I'll make the changes. |
That's really interesting! I'll add that information to the savekey code |
I've pushed the changes to allow PAL60 to be selected and forwarded to the ELF binary. I've not added the "System Type for ELF ROMs" tab like I suggested. However, changing the TV spec on the command line works as expected. Example:
You can also use the filename to specify the TV system:
In both cases the ELF args are set appropriately but that'll be revealed in testing. I've also improved the TV selection combobox in the debugger. This won't affect the ELF arg memory currently (the arg memory is set on cartridge "insertion" and not afterwards) but I suppose it could be made to be kept up to date as options are changed. The real change behind this combo box is the TV image updating immediately, even if the emulation is paused. |
When loading an elf rom the elf_main() function should be passed an array of uint32_t that specifies the system type, clock rate, and feature flags.
See UCA firmware for an example here: https://github.com/Al-Nafuur/United-Carts-of-Atari/blob/main/source/STM32firmware/PlusCart/Src/cartridge_emulation_ELF.c
// For MP_SYSTEM_TYPE
#define ST_NTSC_2600 0
#define ST_PAL_2600 1
#define ST_PAL60_2600 2
// For MP_FEATURE_FLAGS
#define FF_MULTI_CART 1 // Indicates elf is loaded by multicart and should allow exiting (return from main() function)
The text was updated successfully, but these errors were encountered: