Copy and Paste?

Started by nikoniko, January 04, 2007, 05:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nikoniko

Is there any way to paste text into VICE as if it's been typed by keyboard? Although when I was a little boy I didn't mind typing long programs in the BASIC editor, I'm working on something now where I'd much rather use a Windows text editor, then paste into VICE when I'm ready to run it.

Alternately, is there a PC utility which will convert an ASCII file to a tokenized BASIC 7.0 prg?

Stephane Richard

Hmmm...I don't have a solution to that, but I want one ;-).

Hope someone can find a way, we both know why it would be a great thing hehe.
When God created light, so too was born, the first Shadow!

MystikShadows

nikoniko

Hmm... over on COMP.SYS.CBM I was reading about a modification of VICE 1.19 which allows one to communicate with VICE over a network port in order to perform PEEKs and POKEs, so I suppose that could be used to accomplish what I want. I could either POKE to the keyboard buffer and let the 128 take care of the rest or I could pre-tokenize the source and POKE it into BASIC RAM directly. The first approach sounds much easier, since if I really wanted to do all the tokenization myself, I'd go all the way and write an app to convert TXT files to PRGs. :) Though maybe it'd be worth investing the time to write such a utility! I wonder if the 128 Programmer's Guide has information on tokenization? Or I could dive into the source code for VICE and see if I could implement a Paste function. I guess that makes the most sense of all, since that's what I really want.

Although I think I could stand typing on a real C128, as I did it for years and didn't mind, it's too much of a pain under VICE on my PC. I've tried various keyboard remappings, but nothing feels quite comfortable to me.

nikoniko

UPDATE!

This will (supposedly) read in a text file on the 128 and enter it as if it had been typed at the keyboard:

open1,8,2,"filename":sys 65478,,1

When the last line has been entered, hit RUN/STOP and then type:

close1

Now I just need an ASCII to PETSCII converter. :)

nikoniko

MAJOR UPDATE!!

Okay, nevermind everything else I wrote. Here is the perfect solution:

EDIT: Oops. Bad link. Go to http://iancoog.altervista.org/ , then click on BasText 1.04 to download

Download, extract, and put the BASTEXT.EXE file somewhere in your path or in the same directory as your source code.

Now, load up the text file you want to convert to a tokenized BASIC program in your favorite editor. At the beginning of the file, type:

start tok128 outputfile

Replace outputfile with whatever you want the final filename to be.

So, for example:

start tok128 hello.prg
10 print "hello world":goto 10


Then when you're ready to convert, type the following at the Command prompt:

bastext -o -7 inputfile

Where inputfile is the name of the ASCII source code you want to convert to a tokenized PRG. If you want BASIC 2.0, use -2 instead of -7, and in your source file use tok64 instead of tok128.

It works beautifully!

Blacklord


nikoniko

I should've known better than to direct link. Besides not working in this case, it was also bad manners. It's fixed now.

istvan

BasText is probably the best solution for this problem, but if you ever need to feed keystrokes into Vice (or any other Windows program), there's a freeware program called WinKeySim that'll read characters from a disk file into the keyboard buffer.

nikoniko

Thanks, Istvan, I'll look into that too. I'm glad there are a few different ways to solve this problem. :)

xlar54

Quote from: nikonikoHmm... over on COMP.SYS.CBM I was reading about a modification of VICE 1.19 which allows one to communicate with VICE over a network port in order to perform PEEKs and POKEs, so I suppose that could be used to accomplish what I want. I could either POKE to the keyboard buffer and let the 128 take care of the rest or I could pre-tokenize the source and POKE it into BASIC RAM directly. The first approach sounds much easier, since if I really wanted to do all the tokenization myself, I'd go all the way and write an app to convert TXT files to PRGs. :) Though maybe it'd be worth investing the time to write such a utility! I wonder if the 128 Programmer's Guide has information on tokenization? Or I could dive into the source code for VICE and see if I could implement a Paste function. I guess that makes the most sense of all, since that's what I really want.

Although I think I could stand typing on a real C128, as I did it for years and didn't mind, it's too much of a pain under VICE on my PC. I've tried various keyboard remappings, but nothing feels quite comfortable to me.
This was mine.  It works really well, and was meant for exactly these kinds of tasks.  What you want to do is write something that connects to this port and pokes the values of the code into the keyboard buffer, with a carriage return.  VICE should then tokenize and move on.  The x64.exe version of this should be on the board here somewhere in  the downloads section.  Note that its only x64, not yet x128, so you cant tokenize BASIC 7 programs.  I was kinda waiting to hear back from the VICE team to see if they were interested in adding this (they showed some interest) to the next version. I sent them the code and haven't yet heard back.  My $.02

nikoniko

Thanks, I'll take a look at that, too. I hope they will add it, as I'd love to see VICE have more powerful tools for development, debugging and research. Would it be difficult to adapt your code to also work for x128?

Blacklord

Quote from: nikonikoThanks, I'll take a look at that, too. I hope they will add it, as I'd love to see VICE have more powerful tools for development, debugging and research. Would it be difficult to adapt your code to also work for x128?
Here's the direct link - http://landover.no-ip.com/files/emu/x64-119-tcpip.zip

Lance

romwack

Quote from: nikonikoEDIT: Oops. Bad link. Go to http://iancoog.altervista.org/ , then click on BasText 1.04 to download
Works great, but it gets confused if any there are extra spaces in the code, but edit those out first and it works.  I assume that quoted text is fine, but I've not tried it.

Jason

jotapm

Hi. I'm a former user of C128, and I want to use the winvice. I have some txt files with some old basic programs, and using the BASTEXT program cannot load them into winvice. I try generating a simple program like Nikoniko used as example, and winvice always tell me that cannot attach the device. I am really rookie, can someone explain me step-by-step for dummies, how to put a .txt with 10 lines of basic language, so I can avoid typing it ? I would really appreciate it. Thanks a lot.

nikoniko

After you've generated your program using BASTEXT, you don't need to put the program on a disk image. Just stick it in the same directory as WinVICE, then from within WinVICE type DLOAD"program name". When you don't attach any disk images, VICE searches the current directory to find your file.