Thread: Converting MINI-BASIC in MASM over to C++?

  1. #316
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    It runs fine for me. What system are you running? I wonder if running strip.exe (a program to remove unnecessary information from the executable) had anything to do with it? I've included a the pre-stripped version here, just in case you want to try it out. Another option (though I'm not sure you're familiar with) is to build the program from the source with a C++ compiler.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  2. #317
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    When you load minibasic, or when you load a basic program into minibasic?

    If the latter, what program are you loading?

    --
    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.

  3. #318
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I downloaded the zip-file onto my work-machine, and although I haven't got any basic file to load into it, it certainly works as far as getting a "Ready" prompt, and a 10 Print "Hello, World" works fine too.

    --
    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.

  4. #319
    Registered User
    Join Date
    Jun 2004
    Posts
    76
    Quote Originally Posted by Sebastiani View Post
    It runs fine for me. What system are you running? I wonder if running strip.exe (a program to remove unnecessary information from the executable) had anything to do with it? I've included a the pre-stripped version here, just in case you want to try it out. Another option (though I'm not sure you're familiar with) is to build the program from the source with a C++ compiler.
    I'm running Windows XP SP2.

    Paul

  5. #320
    Registered User
    Join Date
    Jun 2004
    Posts
    76
    Now it works.

    Paul

  6. #321
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    OK, good. Let us know if you find any bugs or have any problems with it.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  7. #322
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I've just updated the code quite dramatically. I'm not sure at this point if I've broken something - running pitman in game-mode seems to work correctly.

    --
    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.

  8. #323
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Alright. I'm tied up in a project at the moment, but as soon as I have a chance I'll check it out.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  9. #324
    Registered User
    Join Date
    Jun 2004
    Posts
    76
    Looks good.

    Paul

  10. #325
    Registered User
    Join Date
    Jun 2004
    Posts
    76

    Question

    Quote Originally Posted by Sebastiani View Post
    >> To make it "binary compatible" with the existing assembly code, I think reading documentation may not be sufficient.

    Good point.
    How's the port coming along?

    Paul

  11. #326
    Registered User
    Join Date
    Jun 2004
    Posts
    76

    Arrow

    Quote Originally Posted by Sebastiani View Post
    >> ...but I think porting it to C/C++ would benefit the C/C++ community.

    How exactly does a C/C++ programmer benefit?

    >> It is a useful language modeled after Palo Alto Tiny BASIC from 1976.

    Debatable. I once had the task of translating a legacy program written in BASIC to C. The problem was that over the years, with each modification, the program had developed more and more bugs, and ran ever slower. The program consisted of at least 10,000 - 15,000 lines of code, and the maintainers openly admitted that they had problems understanding the code themselves (which they had written!), and were not at all sure what was causing all of the errors. After reading the code for a few hours it became clear to me that a complete rewrite would be necessary. Tracing the flow of the code was nearly impossible, and global variables were strewn all over the place. A real mess. Incidentally, the C version took only a few days to complete, was orders of magnitude smaller, and ran much faster. The bottom line is that BASIC just isn't very scaleable. It may be 'useful' for certain toy projects, but falls way short of being a 'real' programming language.
    True, but C++ is a good starting point.

    Paul

  12. #327
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> How's the port coming along?

    I was actually waiting to see if you had found any bugs or missing features. If not, I suppose we can make a final release out of it, but I just wanted to make sure that everything was working properly before doing that.
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

  13. #328
    Registered User
    Join Date
    Jun 2004
    Posts
    76
    Yes, it is working fine.

    Paul

  14. #329
    Registered User
    Join Date
    Jun 2004
    Posts
    76

    Question

    Quote Originally Posted by Sebastiani View Post
    It runs fine for me. What system are you running? I wonder if running strip.exe (a program to remove unnecessary information from the executable) had anything to do with it? I've included a the pre-stripped version here, just in case you want to try it out. Another option (though I'm not sure you're familiar with) is to build the program from the source with a C++ compiler.
    Is this the latest release?

    Paul

  15. #330
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    No, there have been some changes since the last release, so I'll try to post the newest one sometime near the end of the week (assigned with a 2.0 version number).
    Code:
    #include <cmath>
    #include <complex>
    bool euler_flip(bool value)
    {
        return std::pow
        (
            std::complex<float>(std::exp(1.0)), 
            std::complex<float>(0, 1) 
            * std::complex<float>(std::atan(1.0)
            *(1 << (value + 2)))
        ).real() < 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Converting textBox1->Text into a basic string.
    By azjherben in forum C++ Programming
    Replies: 5
    Last Post: 06-07-2009, 08:27 PM
  2. [ANN] New script engine (Basic sintax)
    By MKTMK in forum C++ Programming
    Replies: 1
    Last Post: 11-01-2005, 10:28 AM
  3. what are your thoughts on visual basic?
    By orion- in forum A Brief History of Cprogramming.com
    Replies: 16
    Last Post: 09-22-2005, 04:28 AM
  4. VC++ 6 & MASM (eek)
    By cboard_member in forum C++ Programming
    Replies: 2
    Last Post: 07-16-2005, 10:00 AM