Jump to content

Open Club  ·  76 members

StellaRT
IGNORED

Community-Built Unnamed 1970's Video Game Console-Compatible System (WIP)


Al_Nafuur

Recommended Posts

2 minutes ago, DirtyHairy said:

But that means yielding to the scheduler, and then we're talking microseconds again. I think polling is the only way here.

Hmm, that's a shame. The scheduler is evil kneivel. I suppose polling is OK if Stella was able to do some useful work before making it to the Timer polling. The Timer chip would just enforce waiting "enough" time rather than the exact time. 

Link to comment
Share on other sites

32 minutes ago, splendidnut said:

What about doing the evil 'dump the ROM' for the checksum and then 'reset/reboot' the cartridge either via hardware or software (making sure to randomize the starting bank)?

Dumping the PlusCart means dumping half the internet 🤣

 

But currently the debugger is doing a scan of what he thinks is the "first bank" anyway. So maybe the md5sum of this scan is enough to distinguish the cartridges?

The 7800 is doing a "checksum" read of the cartridge at startup to determine if it is a legit 7800 cartridge. Most 2600 cartridges should be OK with this startup, so maybe we could do the same and use the generated checksum?

 

 

Link to comment
Share on other sites

Just now, MarcoJ said:

Hmm, that's a shame. The scheduler is evil kneivel. I suppose polling is OK if Stella was able to do some useful work before making it to the Timer polling. The Timer chip would just enforce waiting "enough" time rather than the exact time. 

That was the idea anyways.

Link to comment
Share on other sites

3 minutes ago, Al_Nafuur said:

But currently the debugger is doing a scan of what he thinks is the "first bank" anyway

Does it use the GPIO peek/poke driver to do this? If so, I imagine that would be fine for heuristics like a normal rom.

Link to comment
Share on other sites

12 minutes ago, MarcoJ said:

Does it use theG PIO peek/poke driver to do this? If so, I imagine that would be fine for heuristics like a normal rom.

It has to use peek from the driver, otherwise he would have only the data from the bin file.

 

you can check it by starting the emulation directly to the debug window by adding the "-debug" switch to the command line. Even though Stella hasn't even emulated anything you can see the whole data in the debugger.

 

  • Like 1
Link to comment
Share on other sites

8 minutes ago, Thomas Jentzsch said:

Distinguish yes, identify no.

Yes banked cartridges would have multiple md5sums depending which bank was active during start up, but it would be a finite amount of md5sums per cartridge.

Link to comment
Share on other sites

7 minutes ago, Al_Nafuur said:

Yes banked cartridges would have multiple md5sums depending which bank was active during start up, but it would be a finite amount of md5sums per cartridge.

You still have the problem of random values returned by hotspots. These have to be eliminated. So we need two steps:

  • detect bankswitching from first bank
  • create checksum of first bank, ignoring hotspots

 

Also, the first bank may not provide the pattern Stella is looking for.

Edited by Thomas Jentzsch
  • Like 1
Link to comment
Share on other sites

The bootloader went on fine using the AVRDude utility and zadig windows driver utility. With the micronucleus inserted, linux on the pi detects it as a USB device. It is now primed to have Timer program changes through Linux. The routing of timer I/O lines are marked up in the photo below.

 

digispark.png.47794976bb47e610d8374660bdb88fab.png

digi.thumb.png.2e9cdfeb64c66d133c6e39a75d1016fd.png

  • Like 1
Link to comment
Share on other sites

13 minutes ago, MarcoJ said:

The bootloader went on fine using the AVRDude utility and zadig windows driver utility. With the micronucleus inserted, linux on the pi detects it as a USB device. It is now primed to have Timer program changes through Linux. The routing of timer I/O lines are marked up in the photo below.

 

digispark.png.47794976bb47e610d8374660bdb88fab.png

digi.thumb.png.2e9cdfeb64c66d133c6e39a75d1016fd.png

Cool!

Does it have a external (20Mhz) clock? AFAIK the internal one is only 8Mhz. The internal timers can be up-scaled to 8x clock (64Mhz). Which would be fine, but the internal clock seems to have a precision of +/-10% so the up-scaled timers will be not very precise!

 

Link to comment
Share on other sites

1 hour ago, Al_Nafuur said:

Dumping the PlusCart means dumping half the internet 🤣

I get that you're probably joking, BUT, I would think that the PlusCart either starts to it's own menu OR starts with a preloaded game.  i.e.  a somewhat STATIC ROM.

And then when a game is loaded from the PlusCart, Stella would have to re-identify the Cart, probably when the reset vector is hit.

 

Dumping the Cart seems like a viable option.... not necessarily the best option, but an option none-the-less to get things working for now.

 

  • Like 1
Link to comment
Share on other sites

5 hours ago, Al_Nafuur said:

Does it have a external (20Mhz) clock? AFAIK the internal one is only 8Mhz. The internal timers can be up-scaled to 8x clock (64Mhz). Which would be fine, but the internal clock seems to have a precision of +/-10% so the up-scaled timers will be not very precise!

No, it would be currently using the internal one. Given the program on the chip is essentially doing nop delays, it's precision would only be a multiple of 1/20Mhz anyway. Perhaps 50 ns steps, or something like that. I'll look into it more tonight.

Link to comment
Share on other sites

23 hours ago, Kroko said:

no will try that tomorrow ...

this is a 2 ms plot of the bus (2000 cycles):

image.thumb.png.2f46315659b4a3a6616a06d648ab8955.png

the small black interruptions are 5us gaps (or areas where the address bus is not changing 5 cycles), the larger gap is 35 us

 

image.thumb.png.98633a33d3a94bd6fbdceddcbcfe5b7b.png


So at least that new setting changed something ...
 

echo -1 > /proc/sys/kernel/sched_rt_runtime_us
Edited by Kroko
  • Like 1
Link to comment
Share on other sites

9 minutes ago, Kroko said:

But this looks quite bad... its recording from DigDug:
image.thumb.png.5124956e7f71fe91a35069163714686f.png

image.thumb.png.8c961dbbcc03a7d628f723f278bceeb0.png

The second one is $02 (WSYNC), so this should be normal.

The first one is $0284 (INTIM) but looks to me like a WSYNC too 🤷‍♂️

 

 

 

  • Like 1
Link to comment
Share on other sites

19 hours ago, Thomas Jentzsch said:

You still have the problem of random values returned by hotspots. These have to be eliminated. So we need two steps:

  • detect bankswitching from first bank
  • create checksum of first bank, ignoring hotspots

 

Also, the first bank may not provide the pattern Stella is looking for.

Does anyone know what the 7800 is doing at startup to generate the checksum of the ROM? I would think it is omitting RAM and hotspots?

Link to comment
Share on other sites

13 hours ago, MarcoJ said:

I could be wrong, but the difference is just the flash size?

Yes RAM/flash/eeprom sizes are different. The 25 is the smallest, but should be sufficient for our purpose.

Link to comment
Share on other sites

14 minutes ago, Al_Nafuur said:

Yes RAM/flash/eeprom sizes are different. The 25 is the smallest, but should be sufficient for our purpose.

I see what you mean by the 8MHz thing. If our goal is to emulate a 6507 cycle, that gives us only a few instructions to implement this timer. 

 

Back to software solution for a second. How difficult would it be to have a separate CPU core in Stella that implements the nop delay only and then send CPU flags/semaphores when the timer is ready? 

Link to comment
Share on other sites

7 minutes ago, MarcoJ said:

Back to software solution for a second. How difficult would it be to have a separate CPU core in Stella that implements the nop delay only and then send CPU flags/semaphores when the timer is ready? 

@DirtyHairy has made a similar proposal, but using a cpu cycle counter instead of a nop loop. Both approaches are dependent on the CPU clock, but the cycle counter would be better, because we can compute the amount of cycles to wait if we have the clock speed of the current cpu. For the NOPs this is not that easy and we would have to test for different CPU/Pi versions.

 

  • Like 2
Link to comment
Share on other sites

https://s3.amazonaws.com/digistump-resources/files/97a1bb28_DigisparkSchematic.pdf

 

This is the schematic of the Digispark with it's ATTINY85. The external crystal option is possible with pins 2 and 3. However, these pins are already used for the USB interface. Thus, it looks a bit much to mod to have the external crystal for this module. It would suit the bare DIP-8 packages though like what you have.

  • Like 1
Link to comment
Share on other sites

21 minutes ago, Al_Nafuur said:

test for different CPU/Pi versions

It is possible to find the Pi in use by running:

 

cat /proc/cpuinfo | grep Model

 

It could be possible to have a database of board types to select an appropriate delay

  • Like 1
Link to comment
Share on other sites

32 minutes ago, MarcoJ said:

It is possible to find the Pi in use by running:

 

cat /proc/cpuinfo | grep Model

 

It could be possible to have a database of board types to select an appropriate delay

Yes , but we would have to keep this database updated and make tests with new devices (Pi6B+/- etc.) to know how many NOPs every model/variant needs, whereas CPU cycles will always be measured in hz:
 

cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

 

Link to comment
Share on other sites

  • Recently Browsing   0 members

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