scott@max.u.washington.edu (10/11/90)
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. Thanks in advance. Sincerely, Scott K. Stephen
consp24@bingsuns.cc.binghamton.edu (consp24) (10/11/90)
Scott: The key to this conversion process is to read the file into the input buffer. I have a simple program somewhere for the 64 that will do this (I'll look for it for ya...) but for those interested souls with 128's, this'll do the trick: OPEN 1,8,8,"filename" SYS 65478,0,1 (changes the input from keyboard to disk... dunno how) It's a great feature for doing program merges: Type the code to merge (ex. a subroutne). Type OPEN 5,8,4,"0:filename,s,w" CMD5: LIST CLOSE5 This copies the program to text format (will work on the 64) Then just load the program to merge with (with non-overlapping line numbers) and type OPEN 1,8,8,"filename" SYS 65478,0,1 You'll get an out of data error as it types in the READY (= READ Y) This is a favorite trick of mine :) Gregg Riedel consp24@bingsuns.pod.binghamton.edu
c0037544@cc.nu.oz.au (10/11/90)
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. > Thanks in advance. > > Sincerely, > Scott K. Stephen I have a routine that will do this. However at the moment I am unable to find the exact listing. Hopefully the following information will give you an idea if you wish to write it yourself : The routine was a small program, with line numbers beginning at 63000 or something, ie: numbers way out of the way of most programs. This program then opened the file that contained the text file, and read in a line at a time. This line was printed to the screen, and then a GOTO was printed, to the line that read in a line of text. The program then ended, with a cursor home and two carriage returns stuffed into the keyboard buffer. The effect of this was to make the computer think that someone was pressing return over the line in direct mode and so tokenising it, and sticking it into the program. The next carriage return made the GOTO execute, and so another line was read in, and so on. When the routine finished with an end-of-file error, all that needed to be done was close the file and delete the routine at the end of the now tokenised and runnable BASIC program. ------------------------------------------------------------------------------- | David Williams | University of Newcastle | | c0037544@cc.nu.oz.au | Department of Computer Science (Undergrad) | |-----------------------------------------------------------------------------| | "The decision of Random Numbers is too important to be left to chance !" | -------------------------------------------------------------------------------
palmerc@infonode.ingr.com (Chris Palmer) (10/12/90)
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. >Thanks in advance. > >Sincerely, >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. The good (or bad) news about it is that am writing it in C for Unix and Amiga machines. I just acquired a C64 emulator for my Amiga and wanted to be able to write programs for my SX-64 on my Amiga (because I can no longer stand to use the C64 screen editor). I'll post or mail you a copy of the source code (probably post if enough people are interested, besides, my mailer is flakey) when I get it complete. If you can't wait (and if you are looking for code that doesn't run on the C64 itself, if you are this wont help you), all I did was write lex routines that read in each token and convert it to ASCII. In the reverse, it just reads in the keywords and outputs the tokens. I put all text in lower case letters so that it will be distinguished from BASIC keywords. For screen control characters, I created tokens like <GRN> and <CRSR_DOWN> to encode them in ASCII. The only really hard part was writing a routine that encodes the line numbers because they are in binary and have pointers to the next line number in memory. This was easy on the BASIC-ASCII but quite hard on the ASCII-BASIC. -- | Christopher M. Palmer #|Quote section| | | | | | || / Intergraph Corporation #| | Closed For| |o| | | | |\ \ Internet: b14!abulafia!palmerc@ingr.com #| | | |Repairs| | | | | | |/ | UUCP : ...uunet!ingr!b14!abulafia!palmerc #| | | | | | | | | | | | | ||
jamesb@bushido.uucp (Jim Harvey) (10/12/90)
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 | -------
jamesb@bushido.uucp (Jim Harvey) (10/14/90)
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 <stdio.h> 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:``#<I\3]*@```-;___\"``$````````!W*?$+ M_0(!EPX``'$```!-%0E:J$4\%0``)@X```$```````````!L9G1O8W(`````. M````"@!_%%,`````````````0"DC*````0`8,$^@08$##AH4()``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GY:-WV7K2%7Z09;=.V8M%Y.+M)&9.G#ZO):6#!";`)!*/V9 MF+,9F3IBFY5YF;NY&K16E+<V`+M6%[TVG>9@B0E!`(5690&`G>CE:$!`9;XIZ M;")0G,<69<K9)LPIGO^%G-5&3^89)XRP;6"`",;QCFK8.@`)`+DA9,Z0<'VE\ M'Q*@!+BC#:?!1H_1$I0!%@8P>?)0902P9"[@9"\P`"\@`.A%#"+@/Q]@`A]`? MH8_6?0$`%@HP%)3A!4.@``"@!#GG#Y\T/OY`;RX!"5R:`E`0"/Y`'E@:@:(QB M/O+@!)`P6S9:D`8@I;X%`[#3DL-YIM*0@LJE``+3%'(P%-4EF6T`#ZL3.[-3P M.R)0/5;98F>J#VF*._K`IF<*#)_T7K(##/*E7ZP@"`)`(-_#J2"PJ:.QJ:'Q* M8_7%!H*09L0T9)HJ"`!CJB6*J@Y0<ZTJ`95ZJH*0G:MJ<QR"I8)@`;<:J[]*@ MJS(7$K83-@2@-FSC-G`C-TR!1WBC-WSC-RKP!6?*#68`0#F'#F>``X7Z2\&4S MJ-FTJ!Q2J&$U5HYUE+@##N3Z8FKTG,-$GL4: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 | -------