[comp.sys.cbm] Pet to C64 BASIC conversion

Brendan@cup.portal.com (02/18/88)

 A friend of mine is trying to convert a program in PET basic to c-64 bsic..
it's a prog for a volleyball team...first I'll slow you the lines:

 3700 IF Q$="Y" THEN END
 3710 IF C$="CONFERENCE" THEN 3790
 3780 GOTO 3830
 3790 GOSUB"CONPAST"
 3800 RESTORE"CON"TO"CONPAST"
 3810 V$="CON,SEQ,WRITE"
 3820 GOTO3840
 3830 V$="GAME"+STR$(N)+",SEQ,WRITE"
 3840 OPEN 1,8,2,V$

 Lines 3790 and 3800 are the big problem..it doesn't use any machine
language, so I don't seee how it could alter the basic interpreter...(I
can't remember if the PET had computed gosub's & goto's or not). He's asked
around  a bit, & no one's been able to tell him how to get around those
two lines for the 64 conversion..any help would be *much* appreciated..

                        BK
UUCP:...sun!portal!cup.portal.com!Brendan_Patrick_Kehoe
Portal: Brendan

Geoffrey_Welsh@watmath.waterloo.edu (02/20/88)

 > From: Brendan@cup.portal.com
 > Date: 18 Feb 88 02:06:37 GMT
 >
 >  3790 GOSUB"CONPAST"
 >  3800 RESTORE"CON"TO"CONPAST"
 >
 >  Lines 3790 and 3800 are the big problem..
 
   That is NOT PET BASIC. Although PET BASIC does support computed 
GOTOs in the form
 
ON X GOTO 100,150,200,500
 
  it does NOT support labels. Whoever wrote the program was using a 
modified BASIC interpreter, no two ways about it. If he can't go back and re-
write the code to work without the extra features, he'll have to port the
modified interpreter to the 64.
 
   If he can't do the former, I venture to say he won't be able to do
the latter, either.
 
   Geoff ( watmath!fido!221.171!izot )

--- ConfMail V3.31
 * Origin: The Waterloo Window: WOC's out there? (1:221/171)

john13@garfield.UUCP (John Russell) (02/21/88)

In article <3295@cup.portal.com> Brendan@cup.portal.com writes:
>
> A friend of mine is trying to convert a program in PET basic to c-64 bsic..
>it's a prog for a volleyball team...first I'll slow you the lines:
>
> 3700 IF Q$="Y" THEN END
> 3710 IF C$="CONFERENCE" THEN 3790
> 3780 GOTO 3830
--> 3790 GOSUB"CONPAST"
--> 3800 RESTORE"CON"TO"CONPAST"
> 3810 V$="CON,SEQ,WRITE"
> 3820 GOTO3840
> 3830 V$="GAME"+STR$(N)+",SEQ,WRITE"
> 3840 OPEN 1,8,2,V$

It looks to me as if at least line 3800 was meant to be a comment, and should
be REM'ed out. 3790 could be an "unimplemented feature", ie the programmer
simply forgot to replace "conpast" with the line number, and never took that
branch to have the syntax error hit him.

The first thing I would try is make 3800 a REM, and replace the label in 3790
with the line number -- if you can locate the intended gosub. Probably the
original author was using some programming utility which would automatically
replace such labels with the proper line numbers.

John
-- 
"Fanaticism is all right... as long as you're ALONE! HAHAHAHA!"
		-- Pat Robertson shares a gem of wisdom told to him by Richard 
		   Nixon, and thus becomes the first politician to whom I can
		   honestly apply the term "scares the willies out of me"

adam@gpu.utcs.toronto.edu (Adam R. Iles) (02/21/88)

In article <3295@cup.portal.com> Brendan@cup.portal.com writes:
>
> A friend of mine is trying to convert a program in PET basic to c-64 bsic..
>it's a prog for a volleyball team...first I'll slow you the lines:
>
> 3780 GOTO 3830
> 3790 GOSUB"CONPAST"
> 3800 RESTORE"CON"TO"CONPAST"
> 3810 V$="CON,SEQ,WRITE"
>
> Lines 3790 and 3800 are the big problem..it doesn't use any machine
> ...
>                        BK
>UUCP:...sun!portal!cup.portal.com!Brendan_Patrick_Kehoe
>Portal: Brendan

The problem you are facing is probably the use of BASIC 4.0 commands
being interpreted by a BASIC 2.0 interpreter.  This is almost certain
if the above was listed on the 64, since the tokens used to represent
the commands would be unrecognized by the 64, and it would substitute
its own commands.

I haven't used either a PET, or a 64 for well over a year (my boards
got fried :-(.  If you want to get around this you should list the
program on a 4.0 machine, or a 64 with an enhanced interpreter (such
as was provided by either the BI Bus Card or RTC C-Link which are both
distant history now.)

Adam R. Iles -- adam@utgpu (UUCP)

-- 
    
        Any opinions stated above may, or may not, refect those
        of any sane person living, dead, or just sleeping.

       Adam R. Iles:
                ...{decvax,ihnp4,utcsri,{allegra,linus}!utzoo}!utcs!adam

leblanc@godzilla.ele.toronto.edu (Marcel LeBlanc) (02/22/88)

In article <3295@cup.portal.com> Brendan@cup.portal.com writes:
>
> A friend of mine is trying to convert a program in PET basic to c-64 bsic..
>
...
> 3790 GOSUB"CONPAST"
> 3800 RESTORE"CON"TO"CONPAST"
> 3810 V$="CON,SEQ,WRITE"
> 3820 GOTO3840
> 3830 V$="GAME"+STR$(N)+",SEQ,WRITE"
> 3840 OPEN 1,8,2,V$
>
> Lines 3790 and 3800 are the big problem..it doesn't use any machine
...
>                        BK

The problem results from listing keywords which are available in BASIC 4.0
but not in BASIC 2.0.  If you listed the program on a PET, the two lines 
in question would make sense.  The highest value defined for a token in
BASIC 2.0 is $CB.  If values higher than this are present, LIST seems to 
take the keyword for (TOKEN-$4C).  This would mean that the two lines
would have been as follows in BASIC 4.0:

3790 SCRATCH"CONPAST"
3800 RENAME"CON"TO"CONPAST"

These can be translated directly to commands sent to the drive error
channel via a PRINT# command.

-- 

  Marcel A. LeBlanc
  University of Toronto -- Toronto, Canada
  also: LMS Technologies Ltd, Fredericton, NB, Canada

Brendan@cup.portal.com (02/23/88)

 That friend's figured it out (I'm pretty sure)..if you replace the line
with the GOSUB statement to a DELETE statement (assuming enhanced DOS
commands) and the RESTORE to RENAME, it would follow with the main idea
of the program, by deleting the old records & replacing them with the
current ones...thanks for you responses though!

                Brendan Kehoe

UUCP: ...sun!portal!cup.portal.com!Brendan_Patrick_Kehoe
      Brendan@cup.portal.com
Portal: Brendan

fred@cbmvax.UUCP (Fred Bowen) (02/23/88)

In article <3295@cup.portal.com>, Brendan@cup.portal.com writes:
> 
>  A friend of mine is trying to convert a program in PET basic to c-64 bsic..
>
>  3790 GOSUB"CONPAST"
>  3800 RESTORE"CON"TO"CONPAST"

These look not like PET tokens but like P-series tokens.  The lines should
be  SCRATCH"CONPAST"  and  RENAME"CON"TO"CONPAST".   To convert these to a
C64 you would have to open the disk command channel and send the appropriate
command strings to accomplish the same things...

--
-- 
Fred Bowen			uucp:	{ihnp4|rutgers|caip}!cbmvax!fred
				arpa:	cbmvax!fred@RUTGERS.EDU
				tele:	215 431-9100

Commodore Electronics, Ltd.,  1200 Wilson Drive,  West Chester,  PA,  19380