[Coco] pasting text into emulated coco session on xroar?

Salvador Garcia salvadorgarciav at yahoo.com
Fri Jan 26 15:17:53 EST 2018


 Pasting code directly into the code window is not a trivial endeavor. I have a BASIC simulator for the DTSS (Dartmouth BASIC) and I added this function.

I had two choices: 

1. Have a specific paste option that internally copied the contents of the clipboard to an internal buffer and then processed the code to get it into the simulator.
2. Have an option that opens a text screen and have the user manually paste the code there. The simulator then processes the code to get it into the simulator.

I chose option 2 to make it more generic. However, in both cases, it was necessary to run the code through a syntax checker to ensure that the pasted code wasn't dirty.

Regards.

    On Friday, January 26, 2018, 9:33:04 AM CST, Ciaran Anscomb <cocomalt at 6809.org.uk> wrote:  
 
 "Richard Cavell" wrote:
>    No. But you can:
> 
>    xroar -type 'PRINT "HELLO"'

FWIW the reason XRoar doesn't do this yet is that SDL2 doesn't abstract
"paste", so I'd have to look into the windows- and macosx- specific
ways to do this (not that macosx builds work since I stopped having a
mac of course...).

Assuming paste event can be trapped and accessing cut buffer/clipboard
is straightforward on those archs, there are two ways that come to mind
for passing it to the emulated machine:

1. Intercept BASIC keyboard scanning ROM call.  That's what "-type" does.
Fast (can feed text as quickly as the ROM reads it), but not compatible
with applications that bypass this (or OS-9, of course).

2. Simulate timed keypress/release.  Always going to be slower if it's
going to be reliable.  Entering a whole program may take a while!

(Either way, probably a good idea to have a physical keypress interrupt
this, as you might lose control for a long time...)

>    Note that in MAME, you can use the "UI Paste" action.

Any idea which of the above approaches this takes?  Also, where is
this function?  Middle button paste doesn't work, and I can't find it
in the menus (reasonably recent build from git).

..ciaran

-- 
Coco mailing list
Coco at maltedmedia.com
https://pairlist5.pair.net/mailman/listinfo/coco
  


More information about the Coco mailing list