Qbasic>Blitz

Blitz3D Forums/Blitz3D Programming/Qbasic>Blitz

Damien Sturdy(Posted 2004) [#1]
History:
back in 1999/2000 i created a 2d platformer in Qbasic, which, to those of you who dont know, is DOS only, or windows 95. In windows 98+, it had problems.

Anyway, my project (den bros 3), died with the introduction of windows 2000+ XP because they didnt allow for alot of the things in a dos window that 95/98 did.
========

The question is:

Does anyone else here like the idea of a program to wrap Qbasic code to Blitz code, effectively reviving the older projects?

I have successfully managed it with Den bros 3, and Total Sonic, and in doing so noted alot of the differences in command sets. I have also found it to be an easier task than first thought, though Den bros and total sonic only used simple qbasic commands.

the way it will work:

1) Read .bas file, and change any commands that are directly compatible with any blitz commands, and change variable types.
This section would take notes of any incompatible commands.

2) Read through all SUB routines, if it is a sub, rename it to function and leave at that. if it is a function, find a command that is similar to <nameoffunction>= and change it to "return".

3) Any incompatible commands are "Included" into the output code from a seperate BB file. (for instance, directQBs sprite commands could be written in blitz seperately and then it would get included into the output BB)

The result COULD then be:
>Compile output .bb file
>Run output .exe file

This could then mean the birth of a compatible version of "Qbasic for windows" (which was wanted years back and is too late now, but Qbasic is still quite active amongst win95/98 users surprisingly!)


I find this sort of thing very interesting, and just wondered if anyone would find it useful? and/or if anyone would be willing to help write any "wrapper" libraries (like directqb). Obviously not everything would be re-written but the main used commands will be.


Rob Farley(Posted 2004) [#2]
With most basics you can copy and paste from on to another will very little modification to make it run. There's no reason why something like this should be difficult to write.

Personally I've no use for it, anything I've written in previous languages if they were a good idea I'll re-write them, generally speaking the re-written code is 1000x better than the original code.


Damien Sturdy(Posted 2004) [#3]
yes indeed, i agree entirely. i will be doing it, as il be learning too.

There are alot of "lazy" people out there (like me) who dont realy want to rewrite their stuff.Maybe they have newer projects to work on etc.... it would be cool to see some of those old games running again without spanding weeks rewriting/moding code. An excelent example:

An online mate of mine wrote a game... hes still working on it, which is excelent, but with new versions of windows spewing dos out the window, he may soon have no people able to use it.

the amount of work gone into said project is imense and rewriting it is not realy feasible.


he Runs this program, points it to the Qbasic source...
and walla, his game runs in windows 2000/xp and much much smoother :D


jfk EO-11110(Posted 2004) [#4]
It may be a good idea, but wasn't there already a QB to BB converter somewhere? I guess I remember I saw one, once upon a time.

Anyway, I translated a few of QB progs to BB manually, and usually it goes pretty straight forward. I even translated Programs that used linenumbers :), so I had to make all the linenumbers that where actualy used as goto- and gosub-targets to be legal blitz labels, simply by renaming eg. "110" to ".label110".


Damien Sturdy(Posted 2004) [#5]
see if that already exists, i will go find it, and theres no need for me to do it!
however, what you heard about might have been my last attempt at QB to BB, which i never finished.


WolRon(Posted 2004) [#6]
Note that converting some things will be difficult, like the commands that output different frequency sounds. There is no equivalent Blitz capability. But you could probably pull it off by loading in a preset sound at a preset frequency and then adjust that frequency on the fly by using the SoundPitch command.


Damien Sturdy(Posted 2004) [#7]
Wolron, the PC speaker is simply a square wave, that can be done easily, as i have vast knowledge of WAV and have written a simple 3 osc ADSR synthesizer with pure blitz.

As for any of the old qbasic sound blaster routines, they can be cheated and replaced with a blitz file include.



Oh, and id like to appologise for posting this in blitz3d, which is quite obviously the wrong forum for this post! ^.^ >.<


BTW, first project to come of this:-

http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=danjeruz08252004021758&comments=no


MrCredo(Posted 2004) [#8]
I can't recommend this. Write just a new game in BB...

I remember how it was to code a game in QB. Hera a many differences. Palette's, another Pageflipping, "hardcoded" images in DIM-arrays, machine-codes, interrupts and some other "jokes"...


Damien Sturdy(Posted 2004) [#9]
I have most of it sorted.

http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=danjeruz08252004021758&comments=no

Things like interrupts are not going to be done, but most of the routines can be rewritten quite fast.

Well, since i now have den bros 3 working, i doubt im going to be writing this thing. it would have been interesting though!


by the way, Qbasic is from the days where you had to use your brain to get anything decent. :P (no offence to anyone here, but blitz does make it real easy to get platformers with full graphics and stereo sound up and running!)