Originally Posted By robbbert
You can already paste as if you were typing it in. However it only works properly on some computers. Others produce gibberish.

I know the pasting functionality that MESS has. It wasn't working well for MC-1000, then I recoded the keyboard input code and fixed it. Now it works almost properly, but the frequency of the pseudo-keystrokes is a bit too fast for pasting a long BASIC program, or one that has long lines, for instance. The time needed to process the input after every ENTER (tokenize the line and add it to the end of the program in RAM) causes the loss of the next keystroke (the first digit of the line number of the next line). I don't know if the frequency of these pseudo-keystrokes is adjustable in MESS.

Anyway, a long program still takes a lot of seconds to be inserted by this "pseudo-typed" pasting. The "injection" of data is immediate, and much more convenient. You can prepare a program in a text editor and paste it to the emulator every now and then for quick tests.

Originally Posted By etabeta78
concerning the original post, I think that he talks about something different.

Yes. smile

Originally Posted By etabeta78
1. copying and pasting RAM content requires some sort of snapshot format to be created,

For BASIC programs, the format would be the program in text form. (Some escaping method could be considered to represent non-ASCII characters that many machines have.)

For generic RAM data, the format would be the same as in the Debugger's Memory Window: each line starts with an address, followed by a series of bytes to be inserted from that point on. (All hexadecimal, of course.) Example:
3000 00 00 00 00 00 00 00 00 10 10 10 10 10 00 10 00
3010 28 28 28 00 00 00 00 00 28 28 7c 28 7c 28 28 00
3020 10 3c 50 38 14 78 10 00 60 64 08 10 20 4c 0c 00
3030 20 50 50 20 54 48 34 00

Some tagging convention could identify specific pieces/banks of RAM:
[bank 1]
0000 00 00 00 00 00 00 00 00 10 10 10 10 10 00 10 00

[bank 2]
0000 00 40 40 48 43 20 30 33 34 4f 3b 20 20 20 20 20

Originally Posted By etabeta78
and however I think you can already use the debugger for that

Eh? I looked and found no copying or pasting feature in the debugger. Only direct typing.

Originally Posted By etabeta78
2. BASIC tokens manipulation can be added to imgtool (I think coco supports this already if you need an example)

Ugh, that stills involves creating a file (disk image?) in your system and loading it into the computer. And the machine emulated must have its disk capabilities implemented in MESS, which not all do.

Originally Posted By etabeta78
3. copying the screen content is something that I have no idea how could be implemented across the various different systems: one should probably intercept all the accesses to the RAM/VRAM and select the specific ones (it also reminds me too much the old hack used for c64 floppies, so that thinking to it already gives me nightmares... wink )

As it is the case with (de)tokenizing BASIC programs to/from the clipboard, that feature would need to be programmed independenty for each machine, with direct access to the (V)RAM.

Different machines have different BASIC dialects, with different tokens, stored in different formats at different points of memory. Internal pointers must be properly so that the machine knows the size of the program area.

As for the text screen, different machines have different screen sizes, different character sets, and so on... Some don't even have a "text" screen at all. In ZX Spectrum, for instance, characters shapes are stamped on a graphical screen, and the machine doesn't differentiate them from any line or dot plotted. It would be needed to compare every 8-byte-high screen square with the shapes in ROM to recognize the "text" content of the screen. For other machines, as those based on MC6847 like MC-1000 and the CoCo, it would be very trivial.