The following warnings occurred:
Warning [2] Undefined property: MyLanguage::$archive_pages - Line: 2 - File: printthread.php(287) : eval()'d code PHP 8.1.34 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/printthread.php(287) : eval()'d code 2 errorHandler->error_callback
/printthread.php 287 eval
/printthread.php 117 printthread_multipage



Freeplaytech Forum
How do I integrate the link cable into my projects? - Printable Version

+- Freeplaytech Forum (https://forum.freeplaytech.com)
+-- Forum: Neo Geo Pocket (https://forum.freeplaytech.com/forumdisplay.php?fid=1)
+--- Forum: Software Development (https://forum.freeplaytech.com/forumdisplay.php?fid=4)
+--- Thread: How do I integrate the link cable into my projects? (/showthread.php?tid=5490)

Pages: 1 2 3


RE: How do I integrate the link cable into my projects? - Ahchay - 06-08-2026

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...

Code:
u8 Link_CreateTestByte()
{
    // VECT_COMCREATEDATA=0x13
    __asm("ldb  rw3, 0x13");
    __asm("ldb  rb3, 123");
    SystemCall();

    // 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;
}



RE: How do I integrate the link cable into my projects? - Ahchay - 06-10-2026

Got it working!

Still getting my head round doing buffer transfers, but blatting individual bytes between two NGPCs seems to be working as expected

Need to put a bit more handshaking in to make sure that everything stays in sync/deal with disconnects etc but the core functionality seems solid


RE: How do I integrate the link cable into my projects? - sodthor - 06-11-2026

already great!
I did try years ago but only got crashes...
Can't find my code anymore (too old).
Can't retry as one on my ngpc is ko Sad


RE: How do I integrate the link cable into my projects? - Ahchay - 06-13-2026

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


RE: How do I integrate the link cable into my projects? - winteriscoming - 06-14-2026

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?


RE: How do I integrate the link cable into my projects? - Ahchay - 06-15-2026

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


RE: How do I integrate the link cable into my projects? - Ahchay - 06-15-2026

I should try it with the old neotracker code i suppose?


RE: How do I integrate the link cable into my projects? - Ahchay - 06-15-2026

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


RE: How do I integrate the link cable into my projects? - sodthor - 06-15-2026

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?


RE: How do I integrate the link cable into my projects? - Ahchay - 06-15-2026

Ah, that's interesting - I'll have a look into that