[comp.sys.apple] Apple basic to ibm conversion

DRF6@PSUVM.BITNET (06/07/89)

  Does anybody know of a straighforward way to get apple basic files converted
to text files (ascii) so they can be transfered to an ibm pc?  I have a quadram
card for reading apple disks on an ibm pc, but cannot seem to get the files
translated.  I tried to simply redirect the screen output to a disk file, but
when I issue a PR# command for the disk drive, I get an message saying initiali
zing and that is it.  It must be simple, but it appears I need help from some
apple gurus.

Thanks in advance.

Dave Forsman

dlyons@Apple.COM (David Lyons) (06/07/89)

In article <89157.142053DRF6@PSUVM> DRF6@PSUVM.BITNET writes:
>
>  Does anybody know of a straighforward way to get apple basic files converted
>to text files [...] ?
>
>Dave Forsman

Okay, I'll tell you a boring way first.  Pick an unused line number, like maybe
0, and do this:

Load your Applesoft program.
0 ?CHR$(4);"OPEN THE.LISTING": ?CHR$(4);"WRITE THE.LISTING": LIST 1, :
  ?CHR$(4);"CLOSE THE.LISTING": END

Then RUN it from that line (just RUN if you used line 0; RUN 63999 if you used
63999 (the highest allowed), etc).

If you are using DOS 3.3 (don't), be sure MON O is not turned on (type NOMONICO
to turn off all monitoring), since it will make Applesoft insert carriage
returns into the file where you almost certainly don't want them (in the middle
of long lines that would wrap).

If you're using ProDOS, the above should work fine.

Now, here's how *I* would do it:

Run Davex (a Shareware command shell which happens to be written by me).
Type

   > the.listing; blist my.program

You can download Davex from a variety of places.  I also generally mail copies
to people who ask & give me a postal address (specify 5.25 or 3.5 disk).


 --Dave Lyons, Apple Computer, Inc.          |   DAL Systems
   AppleLink--Apple Edition: DAVE.LYONS      |   P.O. Box 875
   AppleLink--Personal Edition: Dave Lyons   |   Cupertino, CA 95015-0875
   GEnie: D.LYONS2 or DAVE.LYONS         CompuServe: 72177,3233
   Internet/BITNET:  dlyons@apple.com    UUCP:  ...!ames!apple!dlyons

   My opinions are my own, not Apple's.

ldcol@PacBell.COM (Larry D Colton) (06/07/89)

In article <89157.142053DRF6@PSUVM> DRF6@PSUVM.BITNET writes:
>
>  Does anybody know of a straighforward way to get apple basic files converted
>to text files (ascii) so they can be transfered to an ibm pc?  I have a quadram
>card for reading apple disks on an ibm pc, but cannot seem to get the files
>translated.  I tried to simply redirect the screen output to a disk file, but
>when I issue a PR# command for the disk drive, I get an message saying initiali
>zing and that is it.  It must be simple, but it appears I need help from some
>apple gurus.

This question comes up every couple of months on the net and is really quite
easy to do once you know the answer.  The idea is to open a text file on disk,
prepare the file for writing and then list the program.  Since the file is
open, the LIST output will be directed to the disk file.  After listing, close 
the file and you are done.  Should you later want to get the text file 
converted back to a BASIC file, simple type new at the basic prompt, EXEC the
file (- works in ProDOS) and then SAVE your program.

A simple way to implement the above is to add a line 0 at the beginning of your
program that looks like this:

0 D$ = CHR$(4): PRINT D$ "OPEN PRGM.TXT": PRINT D$ "WRITE PRGM.TXT": LIST 1-:
  PRINT D$ "CLOSE": END

After entering this line, simply type RUN.  Note that the 1- following LIST
starts the listing at line one, thus omitting the temporary line that creates
the text file.  The END stops execution after the text file has been created.

>
>Thanks in advance.

You're welcome.

>
>Dave Forsman


-- 
Larry Colton                {att,bellcore,sun,ames,pyramid}!pacbell!ldcol

SEWALL@UCONNVM.BITNET (Murph Sewall) (06/07/89)

>  Does anybody know of a straighforward way to get apple basic files converted
>to text files (ascii) so they can be transfered to an ibm pc?

Someone's bound to send you the line of Applesoft to tack on at line 0
or at the very end of a program that'll do the job, but the problem with
that code is that there are programs that already use those line numbers
and you may overwrite something unless you check each one.

If you have a bunch of Applesoft to translate, download the EXECUTIONER
from LISTSERV@BROWNVM -- I don't recall the file number email the command

INDEX APPLE2-L

to LISTSERV@BROWNVM

The EXECUTIONER has an option of writing Applesoft as ASCII (it'll change
PRINT to ? in every print statement -- Applesooft recognizes that 'shorthand'
but PC Basic might not; however it's an easy enough thing to undo with an
editor).

Murph Sewall                       Vaporware? ---> [Gary Larson returns 1/1/90]
Prof. of Marketing     Sewall@UConnVM.BITNET
Business School        sewall%uconnvm.bitnet@mitvma.mit.edu          [INTERNET]
U of Connecticut       {psuvax1 or mcvax }!UCONNVM.BITNET!SEWALL     [UUCP]
           (203) 486-5246 [FAX] (203) 486-2489 [PHONE] 41 49N 72 15W [ICBM]

-+- I don't speak for my employer, though I frequently wish that I could
            (subject to change without notice; void where prohibited)

jla@hogbbs.Fidonet.Org (Slartibartfast) (06/08/89)

->   Does anybody know of a straighforward way to get apple
-> basic files converted
-> to text files (ascii) so they can be transfered to an ibm
-> pc?

Well yes.  On an Apple you can change fileytypes.  I am not sure on how to
do it....but I know that you can.
--  
Fidonet : 1:263/42    Jim Anderson    |
UUCP    : ..psuvax1!psuhcx!hogbbs!jla |       This Space
Internet: jla@hogbbs.fidonet.org      |        For Rent
or jla%hogbbs.fidonet.org@hcx.psu.edu |

SEWALL@UCONNVM.BITNET (Murph Sewall) (06/08/89)

>->   Does anybody know of a straighforward way to get apple
>-> basic files converted
>-> to text files (ascii) so they can be transfered to an ibm
>-> pc?
>
>Well yes.  On an Apple you can change fileytypes.  I am not sure on how to
>do it....but I know that you can.

There are programs on APPLE2-L for both ProDOS and DOS 3.3 which change
filetypes.  HOWEVER, changing an Applesoft file to 'T' or 'TXT' won't help
a whole lot because Applesoft files are "tokenized" (many common operators
such as 'PRINT' are stored as single binary characters -- tokens).  While
an Applesoft file isn't entirely a binary file, it's not a text file either
-- sort of a hybrid for lack of better jargon.

Murph Sewall                       Vaporware? ---> [Gary Larson returns 1/1/90]
Prof. of Marketing     Sewall@UConnVM.BITNET
Business School        sewall%uconnvm.bitnet@mitvma.mit.edu          [INTERNET]
U of Connecticut       {psuvax1 or mcvax }!UCONNVM.BITNET!SEWALL     [UUCP]
           (203) 486-5246 [FAX] (203) 486-2489 [PHONE] 41 49N 72 15W [ICBM]

-+- I don't speak for my employer, though I frequently wish that I could
            (subject to change without notice; void where prohibited)

sb@pro-generic.cts.com (Stephen Brown) (06/10/89)

Network Comment: to #2254 by pnet01!crash!jade.berkeley.edu!drf6%psuvm.BITNET

To convert a BASIC file to a text file do the following:
 
Determine the highest line of the program. Let's say its 5000.  Then at some
higher line (say 6000) enter the following program:
 
6000 PRINT CHR$(4);"OPEN NEWFILE"
6001 PRINT CHR$(4);"WRITE NEWFILE"
6002 LIST 0,5000
6003 PRINT CHR$(4);"CLOSE"
 
Once this is done, type:
 
RUN 6000
 
The disk drive will turn on, and a while later, you will have a text file on
the disk which will contain the contents of your AppleSoft program.  The text
file will be somewhat larger than the AppleSoft file, so make sure there's
enough room on the disk. Also, make sure the filename you use is legal.
NEWFILE is legal under DOS and ProDOS; 4ME is illegal under both, NEW FILE is
legal only under DOS.
 
Hope this helps.
 
Stephen Brown
 
ProLINE: sb@pro-generic.cts.com

------------>sometimes you feel like a nut
                       sometimes you don't<----------