stella/gopher binary

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie

Well, I had a lot of trouble getting this to run under stella.
Not stella's fault - at least initially. I had the developer ARM speed set to 60 MHz -- instead of 70.  So I was running way way out of time. Planet texture mapping is incredibly time-consuming.  But that wasn't all of it, unfortunately. Even when I set to 70 MHz, the planet draw was running out of time when the planet got big.

Which is odd, because it points to a difference in timing between Gopher and Stella -- that is, they are different enough that my code ran overtime on Stella but not Gopher. At 70 MHz.

Anyway, my draw loop took 192,000 cycles/frame (!!!) and I needed to decrease this significantly if Stella was gonna run.  After lots of optimisations, I got the draw loop down to a respectable 168,000 cycles/frame - but still too slow for Stella; despite the 14% speedup give or take.

So, was a bit stuck for a while - but realised I could just shift the planet itself down by a single trixel line (3 scanlines) and that would mean that there would be one less planet line to draw when it was really big (close). And that was enough to allow Stella to run.

So, the attached binary should run OK on stella and gopher.
No idea on hardware.

There are lots of 'PlanetTripAdvisor" reviews to read; some funny.



SpiceWare

I truncated it to 120K to try:

dd bs=1024 count=120 if=WenHopPlanetPluto_20260625@02_24_33.bin of=test_120K.bin
Picture is initial stable but starts rolling as the planet gets larger. It eventually crashed. I initially thought the 6507's PC might have advanced beyond 4K cartridge space, but in reviewing the footage the crash occurred when the planet was small and the screen was not rolling.

I initially tried exporting the video at 480p using Photos as I did with my prior video attachments, but the file ended up too large to attach.  I ran it thru Handbrake instead and was able to make it 1080p while being half the file size of 480p export from Photos.


Andrew Davie

Quote from: SpiceWare on 28 Jun 2026, 02:49 AMPicture is initial stable but starts rolling as the planet gets larger. It eventually crashed. I initially thought the 6507's PC might have advanced beyond 4K cartridge space, but in reviewing the footage the crash occurred when the planet was small and the screen was not rolling.

Thanks.

It will, seemingly, ALWAYS crash on transition to a new planet (when it's small and the review text has disappeared) on hardware and (maybe) Stella.  Gopher, it doesn't crash. I'll get that fixed soonish.

The stability is an overtime in OS/VB. Interesting that BOTH Stella and Gopher are getting this timing wrong. I'm *really* pushing things to the limit with the texture mapping, which becomes more costly as the planet gets bigger.  I can't see a way to make it faster, but I can adjust several things like where the planet is on the screen, and the number of scanlines drawn. I'll eventually find a balance which works on all 3.

Nice to see it running on actual hardware, though!  And with the latest version (posted just now), the textures will look way better too.


Andrew Davie

Quote from: SpiceWare on 28 Jun 2026, 02:49 AMI initially tried exporting the video at 480p using Photos as I did with my prior video attachments, but the file ended up too large to attach.  I ran it thru Handbrake instead and was able to make it 1080p while being half the file size of 480p export from Photos.


If you have a YouTube account, then it's simple to create a video and set it to "unpublished" -- and then you can just copy the YouTube link in its entirety into the youtube tag thingy (just click on the youtube icon in the toolbar here).  It devolves it into a number instead of a URL... but should display just fine on the forum in an embedded youtube window.

Andrew Davie

Quote from: SpiceWare on 28 Jun 2026, 02:49 AMPicture is initial stable but starts rolling as the planet gets larger.

Attached version uses *significantly* less cycles (129k vs 153k) during OS+VB.
It should survive for bigger planets before glitching. Hopefully full-size.

I shifted the planet down 3 trixel lines, and also reduced the depth 1 trixel line.
Just to see if it's "good enough" with these settings.

This binary still has the crash issue on planet change.


SpiceWare

#5
Quote from: Andrew Davie on 28 Jun 2026, 03:26 AMIf you have a YouTube account

I had one a long time ago but they decided to enforce the use of real names for channel and they started to harass me because their algorithm did not recognize DarrellSpiceJr as my real name.  Eventually I was no longer allowed to post comments, not even in response to comments on my own channel, so I closed it.

SpiceWare

Success for image stability!

Andrew Davie

Quote from: SpiceWare on 28 Jun 2026, 04:18 AMSuccess for image stability!

Awesome! I will use that as a baseline, and try and get a few more scanlines.
Thanks for testing. Great to see it on a real machine.


Andrew Davie

I'm still mystified by the timing differences on the Dev Cart.
I wonder if there are extra wait-states on the memory that are effectively slowing the ARM?

JetSetIlly

Quote from: Andrew Davie on 28 Jun 2026, 04:19 PMI'm still mystified by the timing differences on the Dev Cart.
I wonder if there are extra wait-states on the memory that are effectively slowing the ARM?
Cycle counting for the ARM emulation is very difficult. In fact there are four types of cycles to account for. We are only interested in three of the four for current 2600 development, but still, it's added complication

I try to account for the different memory latency in the Harmony but when coupled with the different cycle types, but the precise effects are unclear to me.


My current position for Gopher2600 is to say that even if cycle counting is not absolutely correct when measured against real hardware, cycle counting of an emulated instruction is at least correct when measured against other emulated instructions. In other words, the relative performance of an instruction and more importantly, groups of instructions, is accurate.

The practical effect of this is being able to measure relative performance of program functions and even specific lines of source code.

My advice, which you already follow, is to identify which area of the program is consuming the most time and to optimise or elide that part of the program. If you've done all you can with regard to optimisation, and it's still not functioning perfectly on real hardware, then maybe what you're attempting is simply too much.


There are a couple of levers in both Gopher2600 and Stella that can help bring the emulation more in line with hardware. In Gopher2600 I call this the "cycle regulator" and you can find it in the Cartridge/ARM section of the preferences window. But it's a blunt instrument and I wouldn't recommend fiddling with it.


One project I would like to undertake for Gopher2600, is improved debugging of real hardware. Splendidnut, Al Nafuur and myself showed that it's possible to halt the hardware (the PlusCart in this case), to capture the memory from the hardware and to use that memory to continue execution in Gopher2600. We did this manually every time we needed it but it should be possible to automate.

As a consequence of that debugging addition, it should then be possible to get accurate cycle information from the hardware chip. Currently, the emulator has correct information about the sequence and types of cycles that make up an instruction, but the scaling of the different combinations is incorrect. With carefully written test programs, it should be possible to get an accurate picture of what is happening.
https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

Andrew Davie

Quote from: SpiceWare on 28 Jun 2026, 04:13 AM
Quote from: Andrew Davie on 28 Jun 2026, 03:26 AMIf you have a YouTube account

I had one a long time ago but they decided to enforce the use of real names for channel and they started to harass me because their algorithm did not recognize DarrellSpiceJr as my real name.  Eventually I was no longer allowed to post comments, not even in response to comments on my own channel, so I closed it.

The second go-to option is a free DropBox account.
Upload there, and post a link to it.



Andrew Davie

OK, this one is "pushing" the limits. Well, it does run fine in Stella (for me, anyway) and also in Gopher. Hardware: unknown.

I rewrote the internals of the texture mapper (20 pixels to 16 pixels) and also found a few edge-case bugs.

Having fixed those things, I now find that the planet-changeover now doesn't crash in Stella. So I didn't exactly find/fix THAT bug. But that bug appears to be gone.  So, Stella seems to be running fine (even with the MUCH bigger planet) and I hope hardware does too.

I did try the dd reduction to 120K in my make, but Stella simply would not run that file for me. So I abandoned that.



Andrew Davie

Barring any issues, this is the last binary specifically related to the planet@visor reviews.
I've polished it to death, and really need to move on to other things.