From the cartridge side, it's identical to just doing mouse support (a special poke() to turn the mouse on, then stat() calls to get mouse coordinates). The only thing done on the Javascript side is letting the cart know it's a phone/tablet (via pico8_gpio) so it can hide the mouse cursor.