zpq
New Member
Posts: 18
|
Post by zpq on Dec 15, 2021 9:39:15 GMT -5
Is there a program or any documents to help convert GWbasic to LB?
Thanks
|
|
|
Post by Brandon Parker on Dec 15, 2021 10:06:45 GMT -5
Not that I am aware of, but maybe that is a good opportunity to strike one up...
{:0)
Brandon Parker
|
|
|
Post by tsh73 on Dec 15, 2021 10:48:05 GMT -5
First save it with A switch to get plain ASCII instead of tokenised file SAVE "MYPROG.BAS", A Then run it though Microsoft REMLINE Here's version that should be compatible with LB justbasiccom.proboards.com/thread/697/remline-analogueThen you just fiddle until it work, more or less... There is a commands that have to be rewritten,like using MID$() on the left side of assignment There is no "ON X GOTO 10,20,30,40" kind of operator - should be rewritten with things we have in LB (likely SELECT CASE) Running old program in old basic side-by-side with running translation in LB should help. Really it depends on what your program actually do. Does it input/print in text mode? Then you almost set. Just fix all little things LB barks at. There were even games in this format, see libertybasiccom.proboards.com/thread/1821/super-star-trek-liberty-basicDoes it draw things on-screen? That one is harder. Grahics in LB works differently, so you have to re-do that somehow. There are frameworks what tries to help to convert single-screen graphic program to LB by providing similar functions/subs for one-to-one substitution Last code I've seen is justbasiccom.proboards.com/thread/726/classic-breakout-game(I think I used it once to successfully convert old game of my programming from QBASIC but I was not able to locate it. EDIT: found, it was in 2016 on old forum. Using this framework is faster then total rewrite, but you have to comprehend this library). Here is video from Carl Gundel on adapting old basic program to LB www.youtube.com/watch?v=lJnIoHuDbicSo get your code in printable form, try to run it, ask here if there are problems.
|
|
|
Post by dan1101 on Dec 15, 2021 15:14:12 GMT -5
I do A LOT of work with vintage BASIC programs. I have collected hundreds of them and have played around with converting several dozen to Liberty BASIC. There is a large and growing community of vintage BASIC programming hobbyists, most likely due to the fact that literally millions of people learned to program in BASIC decades ago with the advent of personal computers. Millions of them are now reaching retirement age and have the time to revisit their youth when they wrote their own games or typed them in from computer magazines. I think creating a program to automate the process of translating between different versions of BASIC would be welcome and very popular. Sadly, I know of no such program. Yet. Wikipedia lists over THREE HUNDRED FIFTY distinct versions of BASIC! Each has its own quirks and challenges. I have found that some of the differences can lurk beneath the surface, reaching far beyond simple differences in syntax. Just three examples: 1) whether or not array element zero is counted in a DIM statement, or even exists at all, 2) what values of A trigger the jump in the statement: IF NOT A THEN 500, 3) and even the order of operations in a complex calculation without parentheses. The code may appear to be doing one thing, but might actually be doing something different than expected, depending upon the interpreter. For me the first step in the process is to get a good manual of BOTH versions of BASIC. A useful GW-BASIC manual can be downloaded as a free .pdf here: archive.org/details/GWBASICUsersManual/mode/2upAnother GREAT resource is the Rosetta Code site, where you can find multiple versions of the same task written in a variety of BASIC versions. It is an outstanding site to learn language differences. You can compare code from over FIFTY different versions of BASIC at Rosetta Code, including, of course, Liberty BASIC and GW-BASIC. rosettacode.org/wiki/Category:BASIC_Implementations
|
|
zpq
New Member
Posts: 18
|
Post by zpq on Dec 16, 2021 8:36:24 GMT -5
Hi Here is come code from a game in it's original format. I can change it to get it to run up to an error. It won't work at all as is. The error is "array MP() is one dimensional" How can this be converted to LB?
1150 FOR RT=0 TO 2:READ NP, MT(RT):FOR I=1 TO NP 1170 READ MP(RT,I), MP$(RT,I), MR$(RT,I), ZM(RT,I):NEXT I,RT
9030 DATA 21,2850 9040 DATA 90,Barstow,I-15 in California,7.80 9050 DATA 225,Needles,I-40 in California,1 9060 DATA 440,Flagstaff,I-40 in California,3.65
|
|
|
Post by tsh73 on Dec 16, 2021 9:27:42 GMT -5
1) LB does not allow READ into array. Solution: read into temporary variable then assign to array. 2) LB dows not allow single NEXT for several FOR Solution: just add missing NEXT 3) lt looks like DATA needs strings selinited with (") Solution: just add (") around strings.
With this it runs (and errors then runs out of data)
1150 FOR RT=0 TO 2':READ NP, MT(RT): READ NP, tmp: MT(RT)=tmp FOR I=1 TO NP 1170 'READ MP(RT,I), MP$(RT,I), MR$(RT,I), ZM(RT,I): READ t1,t2$,t3$,t4: MP(RT,I)=t1: MP$(RT,I)=t2$: MR$(RT,I)=t3$: ZM(RT,I)=t4 'NEXT I,RT NEXT I next RT
9030 DATA 21,2850 9040 DATA 90,"Barstow","I-15 in California",7.80 9050 DATA 225,"Needles","I-40 in California",1 9060 DATA 440,"Flagstaff","I-40 in California",3.65
|
|
|
Post by dan1101 on Dec 16, 2021 14:29:23 GMT -5
1) LB does not allow READ into array. Solution: read into temporary variable then assign to array In the new release of Liberty BASIC, this will no longer be an issue. LB 5 will allow DATA to be read directly into arrays. 3) lt looks like DATA needs strings delinited with (") Solution: just add (") around strings. This is another good example of significant differences between versions of BASIC. I have found several BASIC interpreters that allow string variables in DATA statements without quotes. Some versions also allow keywords without spaces, which Liberty BASIC requires. For example: DATA100 rather than DATA 100 and FORI=1TO50 rather than For I=1 to 50. I like the idea of creating a conversion guide for moving between BASICs. We could create one or more threads dedicated to that purpose under Community Projects.
|
|