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

Joel Rees joel.rees at gmail.com
Fri Jan 26 18:36:37 EST 2018


2018/01/27 5:18 "Salvador Garcia via Coco" <coco at maltedmedia.com>:
>
>  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.
>

If you choose to check syntax before you let the interpreter check syntax,
that's your choice.

For me, it's not necessary. I'll let the interpreter do the job once I have
the source text transferred.

> 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


More information about the Coco mailing list