C Board  

Go Back   C Board > Community Boards > Projects and Job Recruitment

Reply
 
LinkBack Thread Tools Display Modes
Old 03-09-2009, 04:26 PM   #1
Registered User
 
Join Date: Jun 2004
Posts: 76
Arrow Converting MINI-BASIC in MASM over to C++?

Is this an easy conversion? Converting MINI-BASIC, written in MASM, over to C++? The Yahoo group for MINI-BASIC is here:

http://tech.groups.yahoo.com/group/minibasic/

Paul
Paul Panks is offline   Reply With Quote
Old 03-09-2009, 05:10 PM   #2
Registered User
 
Join Date: Jun 2004
Posts: 76
I should also note that MINI-BASIC uses the Windows API for display, keyboard and file I/O. This should be easy to convert to C or C++ using the stdlib.h

Paul
Paul Panks is offline   Reply With Quote
Old 03-10-2009, 10:54 AM   #3
Registered User
 
Join Date: Jun 2004
Posts: 76
The original Palo Alto Tiny BASIC appeared in 1976 in the pages of Dr. Dobbs Journal. MINI-BASIC is a modern variant of Palo Alto Tiny BASIC using Windows API calls for screen, keyboard and file I/O. It has 26 variables, A-Z, and 1 array, @(I).

Despite these limitations, MINI-BASIC is a robust programming language written in ASM. More commands can be added with ease.

Paul
Paul Panks is offline   Reply With Quote
Old 03-10-2009, 11:03 AM   #4
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Not having looked at it, I'd say that rewriting it in C++ is an "intermediate" difficultly - far from impossible, but not a "5 minutes whilst browsing the web" either.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 03-10-2009, 12:57 PM   #5
Registered User
 
Join Date: Jun 2004
Posts: 76
What should a person focus on when converting from one language to another?

Paul
Paul Panks is offline   Reply With Quote
Old 03-10-2009, 01:54 PM   #6
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
First, you need to understand BOTH languages well. Next you need to have some way of testing the new code, to ensure that it still does the same thing as the old one.

I have looked a bit at the Mini-Basic code now, and it's using an awful lot of global variables and various naughty assembler tricks (like calls to the middle of a function), which makes the task a bit difficult.

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 03-10-2009, 02:00 PM   #7
Registered User
 
Join Date: Jun 2004
Posts: 76
Calls to the middle of a function? Could that be causing the occasional (and strange) Windows API error?

Paul
Paul Panks is offline   Reply With Quote
Old 03-10-2009, 03:25 PM   #8
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Quote:
Originally Posted by Paul Panks View Post
Calls to the middle of a function? Could that be causing the occasional (and strange) Windows API error?

Paul
Possibly, but I think that may be other problems. I have currently got it displaying the console window with a title. See attached picture.

Edit: That's with 278 lines of code.

--
Mats
Attached Images
 
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 03-10-2009, 05:41 PM   #9
Registered User
 
Join Date: Jun 2004
Posts: 76
Looks good. Is that a mock screen, or the real thing?

Paul
Paul Panks is offline   Reply With Quote
Old 03-10-2009, 06:09 PM   #10
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Quote:
Originally Posted by Paul Panks View Post
Looks good. Is that a mock screen, or the real thing?

Paul
It's real in the sense that I copied the MASM code into C++ - although it is more "assembler written in C" than C++, if you see what I mean.

I'm currently trying to get the input going - it's a bit long-winded to try to translate back from assembler, but I'm getting there. Once I have basic input working, I'll go to bed for today. Don't know when I will continue (and I don't know if I'll EVER finish it).

I've got over 600 lines, but that includes a bit of "comments of work to be done with untranslated assembler code".

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Old 03-10-2009, 07:39 PM   #11
Registered User
 
Join Date: Jun 2004
Posts: 76
Looks good. Keep up the good work.

Paul
Paul Panks is offline   Reply With Quote
Old 03-11-2009, 11:39 AM   #12
Registered User
 
Join Date: Jun 2004
Posts: 76
Quote:
Originally Posted by matsp View Post
Not having looked at it, I'd say that rewriting it in C++ is an "intermediate" difficultly - far from impossible, but not a "5 minutes whilst browsing the web" either.

--
Mats
I think the easiest way to convert it is to study the assembly code and write a C++ program to interpret it in C.

Paul
Paul Panks is offline   Reply With Quote
Old 03-11-2009, 03:54 PM   #13
Registered User
 
Join Date: Jun 2004
Posts: 76
Quote:
Originally Posted by matsp View Post
Not having looked at it, I'd say that rewriting it in C++ is an "intermediate" difficultly - far from impossible, but not a "5 minutes whilst browsing the web" either.

--
Mats
True. It does require some patience to re-write in C/C++.

Paul
Paul Panks is offline   Reply With Quote
Old 03-11-2009, 11:45 PM   #14
Registered User
 
Join Date: Jun 2004
Posts: 76
Quote:
Originally Posted by matsp View Post
First, you need to understand BOTH languages well. Next you need to have some way of testing the new code, to ensure that it still does the same thing as the old one.

I have looked a bit at the Mini-Basic code now, and it's using an awful lot of global variables and various naughty assembler tricks (like calls to the middle of a function), which makes the task a bit difficult.

--
Mats
Global variables are fine, right? Aren't they useful in such a large program?

Paul
Paul Panks is offline   Reply With Quote
Old 03-12-2009, 03:45 AM   #15
Kernel hacker
 
Join Date: Jul 2007
Location: Farncombe, Surrey, England
Posts: 15,686
Quote:
Originally Posted by Paul Panks View Post
Global variables are fine, right? Aren't they useful in such a large program?

Paul
Global variables are hard to keep track of, since it's hard to follow where such variables are being changed. I currently keep some global variables, but a lot of variables are passed around between functions.

And it's only 120KB of source code, so I wouldn't call it a "large" program.

How is your translation work going? Or are you waiting for me to do it for you?

--
Mats
__________________
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
matsp is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Converting textBox1->Text into a basic string. azjherben C++ Programming 5 06-07-2009 08:27 PM
[ANN] New script engine (Basic sintax) MKTMK C++ Programming 1 11-01-2005 10:28 AM
what are your thoughts on visual basic? orion- General Discussions 16 09-22-2005 04:28 AM
VC++ 6 & MASM (eek) ahluka C++ Programming 2 07-16-2005 10:00 AM


All times are GMT -6. The time now is 10:38 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC2

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22