The Sentinel (1986)

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andrew Davie


Gotta keep the crosshair on a target cube for a short while until it explodes.

JetSetIlly

Quote from: Andrew Davie on 12 Jul 2024, 01:01 AMHere's another binary. I'm curious if anyone gets it running on UNO/PlusCart with latest ELF firmware. Let me know. Otherwise, you'll need the Gopher emulator to view - it doesn't run on Stella.
The two most recent binaries (the ones dated 12th July) don't work on my PlusCart but the earlier binaries do, although they too eventually crash out. I'm guessing the 6507 PC is overflowing and hitting a KIL instruction.
https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

Andrew Davie

Quote from: JetSetIlly on 12 Jul 2024, 03:35 AMThe two most recent binaries (the ones dated 12th July) don't work on my PlusCart but the earlier binaries do, although they too eventually crash out. I'm guessing the 6507 PC is overflowing and hitting a KIL instruction.

TY for testing. Here's a "pulled back" version which I hope might fare better.


JetSetIlly

Quote from: Andrew Davie on 12 Jul 2024, 11:51 AMTY for testing. Here's a "pulled back" version which I hope might fare better.
No. That doesn't work either. I'll have to take a closer look at how the cycle counting is working with ELF because it's clearly not good enough to make predictions.
https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

Andrew Davie

Quote from: JetSetIlly on 12 Jul 2024, 05:55 PM
Quote from: Andrew Davie on 12 Jul 2024, 11:51 AMTY for testing. Here's a "pulled back" version which I hope might fare better.
No. That doesn't work either. I'll have to take a closer look at how the cycle counting is working with ELF because it's clearly not good enough to make predictions.




I am not sure what's wrong. I will have to try and dig up a PlusCart, find a CRT, and get hardware running here. Then I can figure out what's up.  Meanwhile I'm working on a throttle based on the number o of pixels drawn by the 3D engine.

DirtyHairy

Seems you got a bunch of undefined symbols in your ELF, Andrew:

unable to resolve symbol sqrtf - using default 0x00000000
unable to resolve symbol cosf - using default 0x00000000
unable to resolve symbol sinf - using default 0x00000000
unable to resolve symbol tanf - using default 0x00000000
unable to resolve symbol sqrtf - using default 0x00000000
unable to resolve symbol printf - using default 0x00000000

Seems you are not calling them as the binary runs on Gopher (and I don't think they are responsible for the fail on hardware, either), but getting rid of them might be a good idea  ;)

DirtyHairy

#81
Actually, taking a look at the cartridge driver code I think they are --- looks like the linker aborts if a symbol cannot be resolved.

EDIT:

The earlier version from here does not contain these symbols: https://woodgrain.taswegian.com/index.php?msg=807

Andrew Davie

Quote from: DirtyHairy on 12 Jul 2024, 08:57 PMActually, taking a look at the cartridge driver code I think they are --- looks like the linker aborts if a symbol cannot be resolved.

EDIT:

The earlier version from here does not contain these symbols: https://woodgrain.taswegian.com/index.php?msg=807


That's very interesting - all new to me.
Could you please review the attached version - I did in fact have <math.h> included, but not called by reachable code. This has now been removed in this version...  I've also reorganised for speed and disabled some stuff.  Fingers crossed.


DirtyHairy

Looks good 👍 I can't test on hardware, and my implementation in Stella is not yet ready for actually running ELF, but the undefined symbols are gone --- it links correctly now. Chances are good that works on hardware now, too.

Andrew Davie

Just to explain what happened here, and why I have those symbols;  I asked ChatGPT to do some 3D pipeline code for me - and it did a reasonable job, so I plonked the code in as a placeholder in a new .cpp file. To test it was basically compilable I included it in the build - but I never called any of the code. Of course it included a few standard library files and math, which of course I don't use either. But the presence of that code caused the references and linking problems. The fix was to simply remove that file from the build, since it wasn't called/used anyway.  Lesson learned!

Can't wait to see a Stella version running!  Happy to contribute versions and help test wherever I can.

JetSetIlly

Quote from: DirtyHairy on 12 Jul 2024, 08:57 PMActually, taking a look at the cartridge driver code I think they are --- looks like the linker aborts if a symbol cannot be resolved.
Well spotted! Gopher2600 logs that the function is referenced but can't link it and will likely crash (to the debugger) if called. I'll add a strict mode for the ELF loader to prevent issues like this slipping past. I'm glad it's not a cycle issue, that would have been painful.

How close are you to getting the loader working in Stella?

https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

DirtyHairy

#86
Quote from: Andrew Davie on 12 Jul 2024, 10:07 PMCan't wait to see a Stella version running!  Happy to contribute versions and help test wherever I can.

Thanks ;) There's still some way to go, but I hope to have the implementation in Stella up and running in a week or so.

Quote from: JetSetIlly on 12 Jul 2024, 10:24 PMHow close are you to getting the loader working in Stella?

The loader is working and creates a fully relocated executable image. I also have the basic cartridge driver working which it currently ends up sitting in the overblank routine, waiting for the ARM program to boot. What is still missing is adapting our ARM emulation code (which is build for DPC+/CDF), extending it to Cortex-M0+ (it's currently only Thumb16) and syncing ARM and 6502 emulation.

JetSetIlly

Quote from: DirtyHairy on 13 Jul 2024, 02:07 AMThe loader is working and creates a fully relocated executable image. I also have the basic cartridge driver working which it currently ends up sitting in the overblank routine, waiting for the ARM program to boot. What is still missing is adapting our ARM emulation code (which is build for DPC+/CDF), extending it to Cortex-M0+ (it's currently only Thumb16) and syncing ARM and 6502 emulation.
If it helps it looks like Mattress Monkeys has been compiled with Thumb16 only - there are no 32bit instructions apart from the long-branch-with-link (BL) instruction, which you'll already have. And there is no conditional execution. I'm pretty sure it was built targeting ARMv6-M which is Thumb16 only.

Looking at the disassembly for Sentinal I can see it's the same. Thumb16 only.
https://github.com/JetSetIlly/Gopher2600
@JetSetIlly@mastodon.gamedev.place
@jetsetilly.bsky.social

Andrew Davie

Quote from: JetSetIlly on 13 Jul 2024, 03:00 AMLooking at the disassembly for Sentinal I can see it's the same. Thumb16 only.

Yes, just happenstance really as I inherited the makefile/build from Zack. I don't really know at this stage what other options are sensible/possible.

DirtyHairy

Quote from: JetSetIlly on 13 Jul 2024, 03:00 AMIf it helps it looks like Mattress Monkeys has been compiled with Thumb16 only - there are no 32bit instructions apart from the long-branch-with-link (BL) instruction, which you'll already have. And there is no conditional execution. I'm pretty sure it was built targeting ARMv6-M which is Thumb16 only.

Looking at the disassembly for Sentinal I can see it's the same. Thumb16 only.

Yeah, on second look you're right, that point is hopefully only academic. According to the M0+ architecture documentation, the only 32bit instructions are coprocessor and memory barrier instructions and +-24bit BL. I was misled by the B.W relocation which is supported by the cartridge driver code, but this is not part of M0+ .