Path: utzoo!attcan!uunet!samsung!umich!bushido!jamesb
From: jamesb@bushido.uucp (Jim Harvey)
Newsgroups: comp.sys.cbm
Subject: Re: Convertion from text-BASIC to run-BASIC?
Message-ID: <1990Oct13.232456.269@bushido.uucp>
Date: 13 Oct 90 23:24:56 GMT
References: <14423.27130fa4@max.u.washington.edu> <1990Oct11.213035.20178@infonode.ingr.com> <1990Oct12.123326.1956@bushido.uucp>
Organization: Bushido Systems of Ann Arbor, Michigan.
Lines: 192
In article <1990Oct12.123326.1956@bushido.uucp> jamesb@bushido.uucp (Jim Harvey) writes:
>In article <1990Oct11.213035.20178@infonode.ingr.com> palmerc@infonode.UUCP (Chris Palmer) writes:
>>In article <14423.27130fa4@max.u.washington.edu> scott@max.u.washington.edu writes:
>>>Does anyone know or have written a routine that converts
>>>from a BASIC program in text-format to a runnable-format?
>>>If so, could you explain to me how to go about in achieving
>>>this and/or send me the routine that already does this.
>>>Scott K. Stephen
>>
>>If this is what you're looking for, I am currently writing a set of programs
>>that convert a text file BASIC listing to a runnable form or a runnable
>>BASIC program to ASCII text. It's not completely finished (I don't have it
>>working for screen control characters yet), but its getting there.
>>
>>| Christopher M. Palmer #|Quote section| | | | | | ||
>>/ Intergraph Corporation #| | Closed For| |o| | | | |\
>>\ Internet: b14!abulafia!palmerc@ingr.com #| | | |Repairs| | | | | | |/
>>| UUCP : ...uunet!ingr!b14!abulafia!palmerc #| | | | | | | | | | | | | ||
>
>There is a very simple magic incantation to perform this. Basically, it
>redirects a disk file into the console on the 64, requires a few pokes
>nothing more. It was posted to the net years ago. I'll see if I can find
>it at home.
>
>Jim Harvey |
>Michigan Bell Telephone Co. | "Ask not for whom the Bell Tolls and you
>29777 Telegraph Rm 3352 | will only pay station to station rates."
>Southfield, Mich. 48034 |
>-------
>
Here is what I have so far. I have tested this using an Amiga running the
A64 emulator....
I have lost the original post from USENET that told how to do this. If
anyone still has this, please post the name of the person who figured it
out.. It's a great hack. I seem to recall that the poster was in
Stone Mountain Georgia.
The MAGIC INCANTATION is:
OPEN 2,8,2,"file,S,R" : POKE812,73: POKE781,2: SYS65478
^^^^
Where file is the prepared basic text to import on unit 8 as defined
in the A64 preferences. You can even use this to make command files
for the C64.
the screen will scroll up and when it looks like it's done, hit
RUN/STOP-RESTORE (Esc-Help on A64) and get your READY back. Now enter
CLOSE 2: POKE 812,47: SYS 65484
There are two GOTCHA's however. One is simple; the text must be in all
upper case and I don't know how to include the C64 graphics characters
unless your text editor will let you enter a Hex code for a character.
Best to use the equivalent CHR$(n) for things like cursor movement, this
will import OK.
The other problem is fatal. Amiga ends it's lines with a LineFeed. C64
ends it's lines with a Carriage Return. Unless you translate all the
0x0a's to 0x0d's before you do the MAGIC INCANTATION, you will end up
with a single long line of basic text, which is less than useful.
I have written a small C program to let the Amiga to do the conversion.
Before you do the importation, simply do:
LFTOCR textfile importfile
where textfile is the code you have prepared with the Amiga editor, and
importfile is a different name for the converted text. Then use the
name importfile in the MAGIC INCANTATION. Here is the C program, compile
under an ANSI compiler like Manx 5 or Lattice 5, 16 bit ints are ok:
----- CUT HERE ------ CUT HERE --------------------------------------
#include
main (int argc, char *argv[])
{ FILE *input, *output;
int c;
if( (input = fopen(argv[1], "r")) == (FILE *)NULL) exit(20);
if( (output = fopen(argv[2], "w")) == (FILE *)NULL) exit(20);
while ( (c = fgetc(input)) != EOF)
{if (c == 0x0a) c = 0x0d;
fputc(c, output); }
fclose (input); fclose (output);
}
----- CUT HERE ------ CUT HERE --------------------------------------
UUENCODED ZOOed EXECUTABLE FOLLOWS
section 1 of uuencode 3.07 of file lftocr.zoo by R.E.M.
begin 644 lftocr.zoo
M6D]/(#(N,#`@07)C:&EV92X:``#J2+8P0=``X]=I?[P:@\L%RY/P"C+R^\E`QYC\^(S*
M+&,LDV\"G71Q4D<.@#L`0`(`0>+-4A`*SAA0HJ:J&01P_CTF`(`R""FQU+4DJ
MH^"U%$EP`$"```;="P5@D8P%XPTD"!`T7E3M#,`!:-&D3:-6_8V`RSJO8\]FW
M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JX'`#4)F"/1%K\Y`K!RR;=)CP
M#)11H[UY'*P):8L9:O#IF)!9FY2)FP.!F65)&99X`"UA!JA27]G):&QV<[CQ3
M8MJ`$.S@D`+Q.@,0$0HQ`/*`$+(A$'&@$"ZKAB[[.B^K$*PALZPULP?!&@PA'
MLCC;LS[[LT`;M$([M$1;M$9[M$B;M$J[M$S;M$[[M`I!`3^+L@BQ#B*+L@$!Z
MW*?$_0(`````````````````````````````````````````````````````[
+````````````_(,`3
``
end
sum -r/size 33257/5339 section (from "begin" to "end")
sum -r/size 5952/3791 entire input file
--
-------
Jim Harvey |
Michigan Bell Telephone Co. | "Ask not for whom the Bell Tolls and you
29777 Telegraph Rm 3352 | will only pay station to station rates."
Southfield, Mich. 48034 |
-------