+Al_Nafuur Posted September 13 Share Posted September 13 I am currently working on a new project which is in an early WIP/PoC phase (I even haven't come up with a name for the project). Proposals for a project name can be found here The story behind this project is that I never liked the approach of the retron77. I always thought that it can be done better. When Atari announced the 2600+ with the same "wrong" approach I decided to test if my idea of doing a better device is feasible. For my testing I use a Raspberry Pi 3B+ connected to a breadboard, but something similar should be possible with the CPUs used in the Retron77 or the 2600+. I have developed a special driver for Stella to connect the cartridge to the CPUs I/O and emulate a 2600 directly using the cartridge without dumping it. If the driver handles the communication and the timings with the cartridge exactly like a real 2600 would do, a 100% of all bankings (even future bankings) and cartridges will work on this setup. @Thomas Jentzsch, @MarcoJ and @DirtyHairy have supported me with ideas to improve the driver. Currently we are at about 85% of the emulation speed. Current status is: Every std. banking cartridge seems to work (2K, 4K, F8, F6 tested) It seems I don't have a cartridge with SC-RAM to test. Decathlon cartridge (FE banking) still doesn't work (Stella debugger shows that the bank doesn't switch on a JSR) PlusCart seems to be fully working (including exit and PlusROM functions. See compatibility list below) GameLine cartridge shows briefly the intro message and then crashes or starts to puls dial. I think it might be an voltage issue here, because the Raspberry Pi shows a "Low Voltage" warning SuperCharger doesn't work I don't have a DPC+ or CDFJ cart to test. Here is a compatibility list for all bankings tested mostly on the PlusCart, because I don't have the real cartridges: https://forums.atariage.com/topic/354860-compatibility-list-for-all-bankings/ Software/hardware list for the breadboard setup: Raspberry Pi 3B+ Pi OS with VS-Code and the SDL2 development libs The latest code from the Stella GIT repository. One 8-bit Logic Level Shifter (SN74LVC245AN) (~ $1.50) 2600 cartridge port connector A breadboard Wires How to connect the components: https://forums.atariage.com/topic/354887-setting-up-the-unnamed-1970s-console/ Setting up the Raspberry Pi development environment: https://forums.atariage.com/topic/354887-setting-up-the-unnamed-1970s-console/?do=findComment&comment=5317255 @ZeroPage Homebrew's reveal video on Youtube: 36 Link to comment Share on other sites More sharing options...
+splendidnut Posted September 13 Share Posted September 13 7 minutes ago, Al_Nafuur said: I have developed a special driver for Stella to connect the cartridge to the CPUs I/O and emulate the cartridge directly without dumping it. If you're interfacing with the actual cartridge, then you're not emulating it. Anyways, Awesome job! 2 Link to comment Share on other sites More sharing options...
+johnnywc Posted September 13 Share Posted September 13 13 minutes ago, Al_Nafuur said: I don't have a DPC+ or CDFJ cart to test. (I ordered Load Runner last year at AA but it still hasn't arrived yet!) Great Job, this is very cool! If you're interested in trying any Champ Games for (DPC+, CDFJ, and CDFJ+), send me a PM and I'm sure we can work something out. 7 1 Link to comment Share on other sites More sharing options...
+Karl G Posted September 13 Share Posted September 13 This is absolutely brilliant! I hope it ends up being feasible performance-wise. 1 Link to comment Share on other sites More sharing options...
r_type2600 Posted September 13 Share Posted September 13 3 hours ago, Al_Nafuur said: ( I even haven't come up with a name for the project) How about "Stellactic" or "Stellaxy" or "Stellaga" - sure would be fitting this project's impact 🙂 Link to comment Share on other sites More sharing options...
DirtyHairy Posted September 13 Share Posted September 13 (edited) Very cool, good job . If you are talking directly to the cartridge, I would assume you have hard real time requirements. If you miss too much time due to scheduling, you won't be able to catch up within the bounds imposed by the cartridge bus. Emulators usually deal with this by emulating a large timeslice as fast as possible and sleeping after that, but this approach requires you to emulate continuously. Stella's threaded model that we introduced for stable audio doesn't necessarily help with that either. Refactoring Stella (specifically the main loop), manually pinning threads to different cores and playing with preemption and scheduling might help a lot (if you haven't already done that). Ping me if you'd like some assistance. Edited September 13 by DirtyHairy 5 Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted September 13 Author Share Posted September 13 2 minutes ago, DirtyHairy said: Very cool, good job. If you are talking directly to the cartridge, I would assume you have hard real time requirements. If you miss too much time due to scheduling, you won't be able to catch up within the bounds imposed by the cartridge bus. Emulators usually deal with this by emulating a large timeslice as fast as possible and sleeping after that, but this approach requires you to emulate continuously. Stella's threaded model that we introduced for stable audio doesn't necessarily help with that either. Refactoring Stella, manually pinning threads to different cores and switching to a RT kernel might help a lot (if you haven't already done that). Ping me if you'd like some assistance. A RT OS or kernel might help here, but I think it is not necessary. The 2600 is only using the address and data bus to communicate with the cartridge. Basically it was designed just for 4K of ROM. So we only have to assure that the changes on this I/O bus are "instantaneously" and not interrupted by the OS scheduler. And that we are waiting at least the amount of time (~770ns) with fetching the answer from the databus. If this waiting is interrupted for a few ms by the scheduler it shouldn't matter, because the cart should still "hold" the response on the bus. 1 Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted September 13 Author Share Posted September 13 4 hours ago, splendidnut said: If you're interfacing with the actual cartridge, then you're not emulating it. Yes Stella is only emulating the 2600 with its cartridge port and not the cartridge itself. I am not quite sure we have informed Stella's internal debugger about that. 4 hours ago, splendidnut said: Anyways, Awesome job! thanks 1 Link to comment Share on other sites More sharing options...
DirtyHairy Posted September 13 Share Posted September 13 (edited) 32 minutes ago, Al_Nafuur said: And that we are waiting at least the amount of time (~770ns) with fetching the answer from the databus. You are the one doing the work, and you know better where your bottlenecks are, but I think this wait is an intrinsic problem. On linux, a scheduler quantum is about 100msec. If the scheduler preempts you and services another thread that's roughly the time you loose, which amounts to ~120000 6502 cycles (since each cycle is a bus access). In the best case, Stella can try to catch up by executing the missed cycles the next time it is scheduled, but that will not work reliably because of the limited speed the cartridge ROM can tolerate (the 770ns wait). It will only be able to execute some 1300000 cycles per second, which is just about 100000 cycles surplus per second on top of the 1200000 cycles that it has to do per second in order to achieve full speed. Catching up a single quantum may already take about one second, which is too much to maintain the illusion of steady full speed. If you miss more quanta during that time, then the "backlog" of cycles will keep growing, and you won't even achieve full speed on average. This is just an order-of-magnitude argument, the details depend on the scheduler, the other processes fighting for the same core, etc., but I think this issue must be addressed in order to get this approach working stable at full speed. In addition, Stella's current scheduling is not designed for this and likely will do a bad job. Edited September 13 by DirtyHairy 2 Link to comment Share on other sites More sharing options...
Dionoid Posted September 13 Share Posted September 13 (edited) Wow, this is so cool! I had a similar idea a few years ago (see link below) using an arduino, but the Stella devs convinced me the hardware wasn't going to be fast enough (which is true for an arduino). I'm really happy that @Al_Nafuur is working on this PoC/WIP, and 85% speed is really impressive. What if you switch to the fastest Raspberry Pi? Would that help get that last 15% speed? Edited September 13 by Dionoid 2 Link to comment Share on other sites More sharing options...
+batari Posted September 13 Share Posted September 13 This is a great idea. I also wished that Atari had used such a model instead of the fundamentally-flawed "dump once at boot" model of the R77. I am not sure if the R77 can be fixed, but hopefully the 2600+ can. 2 Link to comment Share on other sites More sharing options...
JetSetIlly Posted September 13 Share Posted September 13 5 hours ago, Al_Nafuur said: I am currently working on a new project which is in an early WIP/PoC phase ( I even haven't come up with a name for the project) Excellent work. I was thinking about something like this last week during all the talk of the limitations of cartridge dumpers. It'll be interesting to get Gopher2600 working in a similar manner. Well done! I'm looking forward to seeing it in action. Meanwhile, if you need any help with anything I'm happy to help 1 1 Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted September 13 Author Share Posted September 13 Here is some information how to connect the components (might change in the future): 5 Link to comment Share on other sites More sharing options...
+GoldLeader Posted September 13 Share Posted September 13 Holy Shitdog! This is Awesome! Keep up the good work! 1 Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted September 13 Share Posted September 13 2 hours ago, r_type2600 said: How about "Stellactic" or "Stellaxy" or "Stellaga" - sure would be fitting this project's impact 🙂 "StellaR" comes to mind. 6 Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted September 13 Author Share Posted September 13 2 hours ago, Dionoid said: Wow, this is so cool! I had a similar idea a few years ago (see link below) using an arduino, but the Stella devs convinced me the hardware wasn't going to be fast enough (which is true for an arduino). I'm really happy that @Al_Nafuur is working on this PoC/WIP, and 85% speed is really impressive. What if you switch to the fastest Raspberry Pi? Would that help get that last 15% speed? I am not sure if a RPi 4 would be faster with the current driver. I don't have one to test, so maybe someone can test it when I am ready with the source code and the installation guide. I would prefer to get it working with the RPi 3, because it is cheaper than the 4. As @DirtyHairy pointed out the (~770ns) wait on the bus is whats affecting the emulation speed the most. Most EPROMS and masked ROMs are responding (much) faster (down to 70ns). So we might reduce the time we wait before reading the data bus to "gain" emulation speed. But we would be out of spec with what the 2600 does and some cartridges (Multicarts?) that need the time to response wouldn't work anymore. The current driver is even worse than the 770ns, because the hardware timer we use (seems to) have a resolution of 1000ns. So our waits are currently at an average of ~1500ns (if they are not interrupted by the OS scheduler) 1 Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted September 13 Share Posted September 13 41 minutes ago, Al_Nafuur said: As @DirtyHairy pointed out the (~770ns) wait on the bus is whats affecting the emulation speed the most. Most EPROMS and masked ROMs are responding (much) faster (down to 70ns). So we might reduce the time we wait before reading the data bus to "gain" emulation speed. But we would be out of spec with what the 2600 does and some cartridges (Multicarts?) that need the time to response wouldn't work anymore. Can't you start a timer before you access the bus? And before the next bus access wait for the timer to elapse? That would get you rid of the Stella code overhead. And maybe with some initial tests, this timer could be automatically adjusted to ROM speed? 1 Link to comment Share on other sites More sharing options...
+MarcoJ Posted September 13 Share Posted September 13 Do the results change if you use a traditional cart VS the PlusCart? The data load would be almost instantaneous on PlusCart, compared to a traditional EEPROM. Also, wait states could be sidestepped or lessened from getting data from the PlusCart instead of a traditional cart. Link to comment Share on other sites More sharing options...
Dionoid Posted September 13 Share Posted September 13 2 hours ago, Al_Nafuur said: I am not sure if a RPi 4 would be faster with the current driver. I don't have one to test, so maybe someone can test it when I am ready with the source code and the installation guide. I would prefer to get it working with the RPi 3, because it is cheaper than the 4. Actually in the Netherlands it's the other way around: the RPi 4 (1GB model) costs € 44.95, while the RPi 3B+ costs € 49.95: RPi 4 (1 GB model) https://www.kiwi-electronics.com/nl/raspberry-pi-boards-behuizingen-uitbreidingen-en-accessoires-59/raspberry-pi-boards-363/raspberry-pi-4-model-b-1gb-11017 RPi 3B+ https://www.kiwi-electronics.com/nl/raspberry-pi-boards-behuizingen-uitbreidingen-en-accessoires-59/raspberry-pi-boards-363/raspberry-pi-3-model-bplus-3392 ... assuming of course that the 1GB model is sufficient for your project. Link to comment Share on other sites More sharing options...
+Al_Nafuur Posted September 13 Author Share Posted September 13 Proposals for a project name: Stellactic Stellaxy Stellaga StellaR NostagliaBox StellaDream StellaRetro StellaSphear StellaNova Stellander Stellacaster StellaNeo Fun Box NotA2600Dumper Stella+ Stellabox StellaRT Stellacharger StellaRcharger Very Cool System VeryCoolSystem Link to comment Share on other sites More sharing options...
JetSetIlly Posted September 13 Share Posted September 13 (edited) 6 minutes ago, Al_Nafuur said: Proposals for a project name: Stella+ Edited September 13 by JetSetIlly 3 3 Link to comment Share on other sites More sharing options...
r_chase Posted September 13 Share Posted September 13 (edited) When I first saw something about this on the Discord, I said that it would be something for the Raspberry Pi...and I was partially right. Admittedly, I said that it would be an OS, but this goes beyond what I had in mind. So...will this add-on be compatible with Atari 7800 carts as well? Also, I think just "Stellabox" would work. Edited September 13 by r_chase Addendum for project name. Link to comment Share on other sites More sharing options...
Dionoid Posted September 13 Share Posted September 13 (edited) 12 minutes ago, Al_Nafuur said: Proposals for a project name: StellaRT (RT for RealTime access to cartridges) Edited September 13 by Dionoid 5 Link to comment Share on other sites More sharing options...
+MarcoJ Posted September 13 Share Posted September 13 1 minute ago, Al_Nafuur said: StellaNova I like this one, because it has a double meaning. Nova can be a star, and also mean "new" in latin languages. The Stella chip and program being new/reborn fits perfectly. Link to comment Share on other sites More sharing options...
Thomas Jentzsch Posted September 13 Share Posted September 13 9 minutes ago, Al_Nafuur said: Proposals for a project name Stellacharger or StellaRcharger Link to comment Share on other sites More sharing options...
Recommended Posts