07-15-2003, 11:38 PM
A program written in C++ that would read and execute QBasic code just like a scripting program. Different versions or packets you could download to emulate libraries (but each would use the allegro, just translate from DQBput() to drawsprite(), etc...). Here would be a really crappy example:
QB code:
DIM i AS INTEGER
SCREEN 13
LINE (0, 0)-(319, 199), 15
SLEEP
END
C++ interpreter (haven't made a parser or anything) the basic idea would be:
DIM i AS INTEGER would make any references to i in the basic code refer to an integer in a huge array for integers. This would also apply to floats, strings, etc..
SCREEN 13 would tell allegro you want to make a 320x200 resolution with 8bit color depth.
LINE would be converted to allegro's line()
SLEEP would be converted to readkey() (when it has no value)
END would signify the end of the file and quit the program.
This is probably impossible, or at least so that you couldn't emulate all the commands of QBasic in C++. Someone like me who just started C++ doesn't need to be making this, but someone with lots of experience does.
Some of the problems that would have to be addressed would be: how do you handle EMS and XMS calls (maybe just allocate them in system memory and emulate them accordingly), DOS calls like interrupt probably wouldn't work, File inputting/writing because QB uses commas to tell the compiler that there is a newline in the text file while C++ uses a space, types, multidimensional arrays, etc, etc, etc...
Somebody tell me this is impossible OR push me in the right direction and hook me up with a parsing function or tutorial.
QB code:
DIM i AS INTEGER
SCREEN 13
LINE (0, 0)-(319, 199), 15
SLEEP
END
C++ interpreter (haven't made a parser or anything) the basic idea would be:
DIM i AS INTEGER would make any references to i in the basic code refer to an integer in a huge array for integers. This would also apply to floats, strings, etc..
SCREEN 13 would tell allegro you want to make a 320x200 resolution with 8bit color depth.
LINE would be converted to allegro's line()
SLEEP would be converted to readkey() (when it has no value)
END would signify the end of the file and quit the program.
This is probably impossible, or at least so that you couldn't emulate all the commands of QBasic in C++. Someone like me who just started C++ doesn't need to be making this, but someone with lots of experience does.
Some of the problems that would have to be addressed would be: how do you handle EMS and XMS calls (maybe just allocate them in system memory and emulate them accordingly), DOS calls like interrupt probably wouldn't work, File inputting/writing because QB uses commas to tell the compiler that there is a newline in the text file while C++ uses a space, types, multidimensional arrays, etc, etc, etc...
Somebody tell me this is impossible OR push me in the right direction and hook me up with a parsing function or tutorial.