Older Basic Languages TO Blitzmax

BlitzMax Forums/BlitzMax Programming/Older Basic Languages TO Blitzmax

Shortwind(Posted 2009) [#1]
Would anyone be interested in a program that can take old style basic listings for older computers and convert them to run under blitzmax?

I'm thinking at this point including:

1. C64 (Standard, and possibly Simon's Basic)
2. TI 99/4A (Standard)
3. Other "generic" line numbered basics. (PC GWBasic for example.)

Reason for this? Challenge, fun, learning.

If interested in seeing some results, please vote 1,2 or 3.

Thanks.


GfK(Posted 2009) [#2]
Locomotive BASIC. Its what I started programming in, in 1986.


Shortwind(Posted 2009) [#3]
@GfK

Never seen this Basic dialect. If you can supply the following information I can take it into consideration... The program I'm planning should be able to handle most versions of basic... in time.

1. Which Machine did you use this on.
2. Do you have links to a manual. (Since I've never used this before)
3. Are there code listings available to test.

:)


GfK(Posted 2009) [#4]
1. Amstrad CPC464

2/3. Might find some useful stuff here.

The first two links are the 'official' manual, but one is spanish, the other french. The English version contained loads of code samples and stuff.

[edit] The CPC664 (7.2MB, PDF) manual is pretty much the same. Loads of code in there but bear in mind it was written a quarter of a century ago and is aimed at absolute beginners.


CS_TBL(Posted 2009) [#5]
Problems:

Old BASICs are often structured like a plate o' spagetti. It's often more practical to just rewrite from scratch.

Old BASICs ran on old computers, old computers had videochips which often had typical tricks in order to get somewhere, whereas modern computers (and Blitz languages) are far more simple: blit till you drop. Similar for sound chips.

The word 'emulator' buzzes between my ears.. :P


markcw(Posted 2009) [#6]
It would be a novelty but pretty much useless. Better to spend your time writing a code converter for a modern basic language.

... Basically something that would be useful.


Shortwind(Posted 2009) [#7]
@CS_TBL:Of course a full system emulator is simplier, mainly because they have already been done. And of course 90% of old basics are "plate's 'o spagetti" but that's all they had for basic back then in a typical unexpanded machine. I was just interested in the logistics, discovering the drawbacks, (what's easy to fake and what's not), etc...


Shortwind(Posted 2009) [#8]
@markcw: Of course it's a waste of time! LOL! But then depending on your "point of view" isn't all this "technology" a waste of time?

And - What "modern" programming language? Visual Basic? Qbasic?

--------
I'm actually surprised (unless I've missed them) that no one has taken the time to write a C to BlitzMax conversion or qbasic to blitzmax already...

It's all in personnel choice I suppose. If your programming to make money for a living then a project like this would be basically useless.

But I don't do this for money. It's a hobby... A challenge. I program because I can. Because it tests the mind, spirit, and sometimes the bottle. :)

So, again, what "modern" language would you vote for??


GfK(Posted 2009) [#9]
It would be a novelty but pretty much useless.
I disagree. I'll tell you why.

First and foremost, writing something like that - nay - ANY working code is a personal achievement. Personal achievements motivate you to do bigger and better things, regardless of whether or not others deem it worthwhile. Its a goal you set for yourself and went out and achieved it.

When you achieve something you feel better about yourself, and inspired to do more.

The alternative is to sit in the corner, muttering to yourself because your life and everything in it has no purpose. You shouldn't always take things at face value.

I could say a lot more on the issue from a personal perspective, but I'm not going to.


markcw(Posted 2009) [#10]
Well for a start you're talking about a huge gulf between the level of technology which is going to be a big headache to take into account. Also most of these languages are already emulated, so why reinvent the wheel?

To convert C to BlitzMax hasn't been done simply because it's very complicated and hard.

Anyway, if I had to pick I would vote for ActionScript since then people could port games to the browser or vice-versa.


GfK(Posted 2009) [#11]
Also most of these languages are already emulated, so why reinvent the wheel?
Well, if its wheel analogies you want...

If I use somebody else's wheel, I'll have a wheel. It will work and I won't care or ask how.

If I make my own wheel, I'll know how its constructed, how it works and how it can be used. I'll be able to find weak spots in the design and improve on them. Plus I have the satisfaction of knowing I discovered the ability within me to build my own wheel.

Knowledge is most important to many.


Yasha(Posted 2009) [#12]
why reinvent the wheel?


Because.



No, seriously.


Shortwind(Posted 2009) [#13]
@GFK

I agree completely!


markcw(Posted 2009) [#14]
Ok, good luck with it Shortwind.


EOF(Posted 2009) [#15]
Gfk
I used to play around with Locomotive Basic for the CPC464
It was actually very capable and easy to use.
What with the SYMBOL command for re-defining characters and the ENT/ENV commands for creating custom sounds. Good fun

ShortWind
Vote -> 1 and 3
I guess I have done something vaguely similar to what you have in mind. For example I take BlitzMax code and generate Mobile Processing equivalent code (Java based)
Most of it is "find and replace" with a few checks and balances thrown into place topped with a sprinkle of code block formatting


What method do you have in mind for doing the conversion?
I found it to be quite daunting when looking into this previously
There was a point where I was going to parse the whole line bit by bit but it kind of opens up many cans of worms since the user can be fairly flexible in how they write their code

You also have to consider old methods which Max does not use . some examples being interrupts, gosubs, line numbering jumps
I guess a lot of the old basic commands would need wrapping too
10 EVERY 50,1 GOSUB 100
20 ....
30 IF blah THEN GOTO 5000
50 ...
100 MODE 0 : BORDER 3 : PEN 1 : PRINT @10,6,"xxxx"
110 RETURN



iprice(Posted 2009) [#16]
I too hail from CPC 464 Locomotive BASIC. I wrote many small games and apps with it before moving onto assembly. Forgotten all of it now though :(

Good luck with this :)


Shortwind(Posted 2009) [#17]
@Jim Brown
Well, a smart person would handle this project in the same manner as converting any programming language to another, IE: a compiler.

My program will be a "compiler", of sorts. A real compiler is capable of taking any programming language and turn it into another programming language... whether that be machine specific assembly, or p-code, or what-ever. A real compiler will use a grammar to direct it on doing the translation. I am going to "attempt" to create my own "grammar" template so I can allow this program to interperate many different basic dialects. Being that 90% of most basic langauages in the last 30 years are more or less the same, it will allow for a very diverse input of source code.

Of course I will have to decide, almost from the beginning, what graphics options I'm going to incorporate into the program, as well as sound. I will also have to figure out if I'm going to create my own font and print display, or try to use "LIBTCOD" to simplify most of the printing. (Brucey is having difficulty with libtcod, so I believe I'll have to write my own....)

Obviously any programs (C64 is a good example) that try to employ assembly routines will have to be converted with TODO: sections, or just abort the compile.

My MAIN objective (#1 priority) at this point should be obvious: To create a compiler that can take all "standard" basic commands into BlitzMax source. This would include such basic commands as the following:

ABS, AND, ASC, ATN, CLS, COLOR, COS, DATA, DEF FN, DIM, END, FOR..NEXT, GET, GOSUB, GOTO, IF..THEN..ELSE, INPUT, INT, KEY, LEFT$, LEN, LET, LOG, MID$, MOD, NOT, ON..GOSUB, ON..GOTO, OR, PRINT, RND, REM, RESTORE, RETURN, RIGHT$, SIN, SPC, SQR, TAB, TAN, TIME$, VAL, XOR

This is not a extensive list, or course.

I've never really been too interested in graphics, but more in the functions, techniques, logic, and restrictions of a particular language. It has been suggested that BlitzMax is not "capable" or "suited" for certain programming efforts. Well, I suppose I could agree with the basic concept, that certain tasks "MAY" be better in another programming language... But to say that something "can't" be done, or "shouldn't" be done, is absurd. That is the whole point behind programming in the first place. To take the fight against the limitations and make something greater than anyone thought possible.

I find that a lot of the "new" programmers in the last 10 years have very much come to depend on the programming language/IDE to do everything for them. The constraints of memory, disk space/speed, graphics limitations of scale and color... they all have more or less been forgotten. Too many new programmers that believe they are so smart don't have a clue what it means to program under limitations.

Sorry for the diatribe, guess I got a little carried away.
:)


Czar Flavius(Posted 2009) [#18]
I actually think your project is a good idea. It sounds like you will have fun doing it, and will learn a lot.

As for the whole "should I reinvent the wheel or not" debate, and about programming in limitations, I don't think there is a single fit-all answer. There are three important factors to consider: learning, result and fun. Different people have different priorities on these factors, which is why there is so much disagreement about it.

Learning - if you're programming to learn, then reinventing the wheel is a good way to learn how things work.
Result - if you're programming to make money, or produce a working product as quick as possible, reinventing the wheel is a waste of time.
Fun - Do you like reinventing the wheel? Then do it! Or don't, if you don't like it.

Before, while I was learning programming, I wanted to do everything myself, my way. It was good for learning, but it was difficult for me to actually complete a working project. Now, I've decided I want to program to create finished, distributable (perhaps sellable) products, so I'm going from learning to result, and trying to use whatever 3rd party modules I can, to get the nitty gritty out of the way and get an actual game polished and finished quickly and efficiently.

In summary, consider your own situation and needs, and what you would consider the most FUN xD