Okay, think I've got the first bit working now - not sure whether this is the neatest way to do it, but it appears to work as expected - or at least, it doesn't not work...
// The "return value" of the system call will be
// in register ra3
// Move into the XHL register
__asm("ldb l,ra3"); // Loads ra3 into the hl lower byte
__asm("ldb h,0"); // Clears the upper byte
return;
}
06-13-2026, 04:03 AM (This post was last modified: 06-13-2026, 04:09 AM by Ahchay.)
Thanks, for a couple of days off just throwing the kitchen sink at it, I'm pretty happy. One problem I've found is that the sound driver (winteriscoming's vgm lib) interferes with the serial link. I'm trying to get around that by renegotiating the link if it fails but that's a bit intermittent
Had a bit of help from tixul (the ngpcraft guy) but Steve fuzzy's code is brilliant
Code is up at https://codeberg.org/Ahchay/FRUITYVINES.ngp if anyone fancies a look at it, I'll continue hacking away at it and hopefully I'll get something usable out of it. If not then classic and puzzle mode will just have to do
I'm interested in getting linking working. Is it possible my sound driver is using some kind of timer or register the serial link needs? Is it that serial disconnects when playing a sound? Or maybe when the driver is getting initialized?
06-15-2026, 12:28 AM (This post was last modified: 06-15-2026, 12:31 AM by Ahchay.)
Check out the project above. I don't know what the conflict actually is, but the link establishes and then loses it when a sound is playing - bgm causes an instant disconnect, but sfx can coexist for a while
I'm still experimenting though, so it might be something that I'm not doing fully correctly yet. My next step is to try and reestablish a connection of it does drop
The behaviour in neopop is completely different to real hardware unfortunately
06-15-2026, 04:51 AM (This post was last modified: 06-15-2026, 07:24 AM by Ahchay.)
Worth mentioning that my test code above is not very clever yet - both clients are just both constantly sending and receiving the 50 byte play field to each other, at the speed of the vblank basically, so it might be a simple cpu loading problem when the sound driver gets involved
I didn't really expect the "constant broadcasting" method I'm using to work as well as it did to be honest.
I have experimented with sending a block header/footer and using that to handshake, but no joy yet
Right now, there isn't a difference in the code between the "host" and the "client" - basically both sides are just shouting their positions at each other and hoping that the other machine is keeping up. I suspect that I'll need to do something where the host will coordinate the communication. Not massively difficult - at least conceptually
In PLink! code (StdHandler.inc - Interrupt_VSync), the serial transmissions are stopped at the vbl start and restored before "reti"
No comment to explain why... maybe it's useful.
Does the snd driver use the vbl ? or maybe the same bank of registers ra3? rw3?