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

  1. #301
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    The user edits the line and [...] the line number over and over.
    O_o

    That's what the edit feature is for...

    Neither the console nor [...] minibasic and minibasic::interpreter.
    *shrug*

    The `interpreter' spawns a `compiler'...

    I think a better candidate for history navigation might [...] keys, personally.
    *shrug*

    But then you wouldn't be modeling today's text editors...

    As far as modern editors go, do any modern C++ editors wrap lines by default?

    As I pointed out earlier, the compiler knows nothing about minibasic.
    Correction... the interpreter...

    In fact, the only reason [...] to do it's work.
    No. It doesn't. The design or the implementation as it stands may need to spawn a new instance to deal with the "INPUT" function, but the function itself can be implemented without needing another `compiler' or `interpreter'.

    I disagree. Being part of the [...] of the input history feature.
    Having the queue feature be a part of the interface exported from the `console' class doesn't break encapsulation nor does it change its usefulness to outside classes. In fact, even as the source stands, it would probably take changing a grand total of six lines, only two in "console.cpp", to support what I'm suggesting and use it.

    Only minibasic and minibasic::interpreter [...] as they *use* these objects.
    Actually, the callback mechanism that handles ESCAPE uses a singleton. It just doesn't directly access a singleton.

    We are using global state everywhere.

    The point is, there is no unnecessary intermingling here, whatsoever.
    There is nothing but unnecessary intermingling. We've only decorated bad C in the guise of C++. As far as usability, reliability, and expandability goes the current implementation is almost as bad as the single source C++ file you guys had long ago and not much further from the original assembler.

    *shrug*

    We obviously disagree on this. I've helped you guys track down a few bugs. I've added a few bits and cleaned up a few things. I assumed we were trying to get a working version so we knew what we needed. I can only imagine that you'll want to continue the design in a similar vein or let it stagnate and rot with other poorly punned hacks. I admit, I am the who wrote the worst ones, but still I think I'll return to working on other projects in the time allotted for this project.

    Of course, if you guys find a bug you just can't nail I'll be happy to take a look.

    Soma

  2. #302
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I'm all for a bit of cleaning up of the code - in fact, I've been doing a fair bit of that so far.

    I don't quite know why the input needs a compiler/interpreter or whatever - surely it's just reading textual input and converting it into a number and storing it in the location given?

    --
    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. #303
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> I don't quite know why the input needs a compiler/interpreter or whatever - surely it's just reading textual input and converting it into a number and storing it in the location given?

    INPUT accepts an expression, such as ABS(A*RND(@(17))). Naturally, the code has to be compiled and executed so that the result can be push onto the stack.
    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;
    }

  4. #304
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    INPUT accepts an expression, such as ABS(A*RND(@(17))).
    The original doesn't support anything even approximating that. It accepts an `int32_t' limited to base ten and, if I remember correctly, ten characters. (I only bring up the ten character limit because "ABS(A*RND(@(17)))" is more than ten characters.)

    Naturally, the code has to be compiled and executed so that the result can be push onto the stack.
    *shrug*

    At least this explain why the classes are so strongly tied together.

    Soma

  5. #305
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    Yeah, I missed that one.
    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;
    }

  6. #306
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    I've posted my most recent update - merge as necessary. We probably need to think about documentation at this point. Just a simple text file would suffice, or maybe an html file? We should also probably post some zip files on the site (one for the executable and readme, and another for the source and license) so that Paul and others can test it out and give us some input (and maybe even help settle some of the disagreements we've been having).

    [edit]
    Well, I've had some trouble uploading this to the site, so I'll just post it here for now, just in case Paul wants to try it out.
    [/edit]
    Last edited by Sebastiani; 04-25-2009 at 10:12 PM. Reason: additions
    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. #307
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    "Just a simple text file would suffice, or maybe an html file?"

    "BitBucket" gives you a "wiki" resource for that sort of thing. (So far I've resisted "wiki" so I'm not sure if it is all that useful.)

    "Well, I've had some trouble uploading this to the site, so I'll just post it here for now, just in case Paul wants to try it out."

    Are you behind a weird firewall or something?

    Anyway, I've uploaded it for you. (The same image you posted here.) Until you have version stable enough to have a distinction between "beta" and "stable" versions you probably should just upload any binary with the same "minibasic.exe" name. "BitBucket" replaces the old upload saving some space on Mats's account. (I realize it isn't a lot, but at half a buck an image it could add up pretty quick.)

    Also, there is a pretty major bug in the newline handling I forgot to mention the other day. Load up "PITMAN.MBI" or any other program that requests input that doesn't explicitly handle newline and hold "enter"/"return" down. Yea, that isn't supposed to happen. Beyond the display problems, it will eventually crash either the loaded program or "minibasic" itself.

    Soma
    Last edited by phantomotap; 04-26-2009 at 04:17 AM.

  8. #308
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> Also, there is a pretty major bug in the newline handling I forgot to mention the other day.

    Did you confirm that with the most recent update (I had located and fixed a bug in the initial window resize that may have had something to do with it)? Anyway, after about 5 minutes of holding down the return key I didn't any errors (which isn't to say it wouldn't crash on another system, of course).

    >> Are you behind a weird firewall or something? Anyway, I've uploaded it for you.

    Yes, I am. And thank you.

    >> "BitBucket" gives you a "wiki" resource for that sort of thing. (So far I've resisted "wiki" so I'm not sure if it is all that useful.)

    I'll check into that. But it may not even be necessary. We'll see.
    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. #309
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    I've now repeated the test. I've included an image. It has obviously not crashed yet, but within about two seconds of this snap it crashed back to "minibasic".

    Did you confirm that [...] key I didn't any errors.
    Yea, I tried the latest build. (Using the image you posted.) That's what reminded me to bring it up.

    With "PITMAN.MBI" the display scrolls off the screen but doesn't crash. (The display is static in the original.)

    With "REIGN.MBI" the display will scroll of the screen for a few lines before crashing back to "minibasic" or crash "minibasic" itself.

    With "DFOREST1.MBI" everything seems to work and looks fine.

    Soma
    Last edited by phantomotap; 04-26-2009 at 09:19 AM.

  10. #310
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    OK, I see what you mean now. Well, originally, I was ignoring the return key unless the program was in line input mode, but then Paul mentioned something to the effect that it should advance to the next line any time the return key was pressed, so I modified the get function. But now that I try it with the old MiniBasic, it doesn't appear to scroll in response to the return key, so either I misunderstood Paul, or else his assumptions were incorrect. I'll comment that line out and run his programs again to see if I can duplicate the problem he was having.
    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;
    }

  11. #311
    Registered User
    Join Date
    Jun 2004
    Posts
    76
    Couldn't get the new update of MINI-BASIC to work. Can someone zip it up and list it on this message board? Thanks!

    Paul

  12. #312
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    Sure, here you go.

    That's the one that Soma uploaded to the Bitbucket. If that doesn't work, let us know what messages etc you get.

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

  13. #313
    Kernel hacker
    Join Date
    Jul 2007
    Location
    Farncombe, Surrey, England
    Posts
    15,677
    I've just worked over the token_scanner code to make it "has-a" instead of "is-a". It makes the code much easier to read, I think.

    Expect more work in the tokenizer area, see the repo for more details.

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

  14. #314
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    >> I've just worked over the token_scanner code to make it "has-a" instead of "is-a". It makes the code much easier to read, I think.

    The more I think of, the more that makes sense. After all, half of the code was sprinkled with token_scanner:: qualifiers, to avoid potential confusion. So, yeah, good call.
    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;
    }

  15. #315
    Registered User
    Join Date
    Jun 2004
    Posts
    76
    Quote Originally Posted by matsp View Post
    Sure, here you go.

    That's the one that Soma uploaded to the Bitbucket. If that doesn't work, let us know what messages etc you get.

    --
    Mats
    Says "Program too big to fit into memory".

    Paul

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