Once a TiddlyWiki fires up a BASIC program, that TiddlyWiki can’t directly feed anything to the BASIC program.
The only time a TiddlyWiki can “feed” anything to the BASIC program directly is upon dynamically building the HTML (BASIC program, javascript to interpret the program, and maybe some transcluded goodies that get wikified upon dynamically building that HTML) just before sending all of that to an iframe.
Anything that changes that HTML passed to the iframe causes the BASIC program to restart.
The way to get TiddlyWiki talking to the program while it is running: local storage !
So whatever widgets involved with, say, a game, in a TiddlyWiki tiddler set values in local storage.
The BASIC program regularly checks local storage, and processing gets triggered based on what the BASIC program finds in local storage.
The BASIC program can also provide values to the TiddlyWiki via local storage, but some kind of trigger needs to be setup in TiddlyWiki to check local storage (a manual trigger would involve a human pressing a button; an automated trigger would involve some kind of timer in TiddlyWiki to trigger check of local storage and retrieving values from local storage.)
TiddlyWiki to BASIC communication is ridiculously easy. The other direction is a bit of work.
Using BASIC for dynamic generation of good-enough graphics based on events happening in TiddlyWiki: awesome scenario.