Announcement

Collapse

Forum etiquette

Our mission ...

This forum is part of our mission to promote the preservation of vintage computers through education and outreach. (In real life we also run events and have a museum.) We encourage you to join us, participate, share your knowledge, and enjoy.

This forum has been around in this format for over 15 years. These rules and guidelines help us maintain a healthy and active community, and we moderate the forum to keep things on track. Please familiarize yourself with these rules and guidelines.


Remain civil and respectful

There are several hundred people who actively participate here. People come from all different backgrounds and will have different ways of seeing things. You will not agree with everything you read here. Back-and-forth discussions are fine but do not cross the line into rude or disrespectful behavior.

Conduct yourself as you would at any other place where people come together in person to discuss their hobby. If you wouldn't say something to somebody in person, then you probably should not be writing it here.

This should be obvious but, just in case: profanity, threats, slurs against any group (sexual, racial, gender, etc.) will not be tolerated.


Stay close to the original topic being discussed
  • If you are starting a new thread choose a reasonable sub-forum to start your thread. (If you choose incorrectly don't worry, we can fix that.)
  • If you are responding to a thread, stay on topic - the original poster was trying to achieve something. You can always start a new thread instead of potentially "hijacking" an existing thread.



Contribute something meaningful

To put things in engineering terms, we value a high signal to noise ratio. Coming here should not be a waste of time.
  • This is not a chat room. If you are taking less than 30 seconds to make a post then you are probably doing something wrong. A post should be on topic, clear, and contribute something meaningful to the discussion. If people read your posts and feel that their time as been wasted, they will stop reading your posts. Worse yet, they will stop visiting and we'll lose their experience and contributions.
  • Do not bump threads.
  • Do not "necro-post" unless you are following up to a specific person on a specific thread. And even then, that person may have moved on. Just start a new thread for your related topic.
  • Use the Private Message system for posts that are targeted at a specific person.


"PM Sent!" messages (or, how to use the Private Message system)

This forum has a private message feature that we want people to use for messages that are not of general interest to other members.

In short, if you are going to reply to a thread and that reply is targeted to a specific individual and not of interest to anybody else (either now or in the future) then send a private message instead.

Here are some obvious examples of when you should not reply to a thread and use the PM system instead:
  • "PM Sent!": Do not tell the rest of us that you sent a PM ... the forum software will tell the other person that they have a PM waiting.
  • "How much is shipping to ....": This is a very specific and directed question that is not of interest to anybody else.


Why do we have this policy? Sending a "PM Sent!" type message basically wastes everybody else's time by making them having to scroll past a post in a thread that looks to be updated, when the update is not meaningful. And the person you are sending the PM to will be notified by the forum software that they have a message waiting for them. Look up at the top near the right edge where it says 'Notifications' ... if you have a PM waiting, it will tell you there.

Copyright and other legal issues

We are here to discuss vintage computing, so discussing software, books, and other intellectual property that is on-topic is fine. We don't want people using these forums to discuss or enable copyright violations or other things that are against the law; whether you agree with the law or not is irrelevant. Do not use our resources for something that is legally or morally questionable.

Our discussions here generally fall under "fair use." Telling people how to pirate a software title is an example of something that is not allowable here.


Reporting problematic posts

If you see spam, a wildly off-topic post, or something abusive or illegal please report the thread by clicking on the "Report Post" icon. (It looks like an exclamation point in a triangle and it is available under every post.) This send a notification to all of the moderators, so somebody will see it and deal with it.

If you are unsure you may consider sending a private message to a moderator instead.


New user moderation

New users are directly moderated so that we can weed spammers out early. This means that for your first 10 posts you will have some delay before they are seen. We understand this can be disruptive to the flow of conversation and we try to keep up with our new user moderation duties to avoid undue inconvenience. Please do not make duplicate posts, extra posts to bump your post count, or ask the moderators to expedite this process; 10 moderated posts will go by quickly.

New users also have a smaller personal message inbox limit and are rate limited when sending PMs to other users.


Other suggestions
  • Use Google, books, or other definitive sources. There is a lot of information out there.
  • Don't make people guess at what you are trying to say; we are not mind readers. Be clear and concise.
  • Spelling and grammar are not rated, but they do make a post easier to read.
See more
See less

BASIC INPUT: a strange "feature"?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    BASIC INPUT: a strange "feature"?

    Pre-info: I'm busy writing my own BASIC that should be able to boot from floppy on a 8088 machine. It is written from scratch in assembly. The idea is that the code should be Commodore compatible so it be able to run PRG files copied from Commodores.

    Not having used INPUT for a very long time, I was playing with it on my C64. The used program was simple:

    1 input a,b
    2 print a,b

    Not knowing any more how you could enter multiple inputs, I started with ‘1 2’. To be sure to read it well, a space between the 1 and the 2.
    First surprise: it asked for another input and the second and biggest surprise: the output was ’12 3’. RTFM I found out that I had to use commas as separators instead of spaces. After some time I tried as input ‘1 2 3 4 , 5 6 7 8’ and the result was ‘1234 5678’. To make sure that it were numbers I saw I added 'a+b' at the end of line 2 and I got 6912.

    So it seems BASIC simply skips the spaces when reading numerical input. IMHO it shouldn’t do that. But it does. Am I missing something or did I run in a feature?


    With kind regards / met vriendelijke groet, Ruud Baltissen

    www.baltissen.org

    #2
    I tested it in IBM PC BASIC and got the same behavior. Note that inserting letters in the middle of a number like "76 h6" will result in an error so checking a few other possible entry methods would be prudent. Odd that none of the standards specifically mention implicit conversions like that but leading and trailing spaces are required to be removed and I guess it was just easier to remove a space in the middle of a number than to keep track that a space happened followed by more numbers.

    Comment


      #3
      May I ask why you even want to ask for two numbers at the same time instead of doing:

      input a
      input b

      ?

      If a program would ask me to input two numbers, I would never think about separating them with a space.

      Comment


        #4
        Originally posted by Timo W. View Post
        May I ask why you even want to ask for two numbers at the same time instead of doing....
        Quite simple: Commodore BASIC supports it and if I want to be able to load Commodore PRG files (= BASIC), then I must support it as well.
        With kind regards / met vriendelijke groet, Ruud Baltissen

        www.baltissen.org

        Comment


          #5
          I think that the answer is pretty simple--of course, leading spaces are ignored as are trailing spaces. So why not simply ignore all spaces? Saves code. Comma is the official delimiter in the ANSI BASIC definition as far as I can determine.

          Comment


            #6
            Multiple variables on a single INPUT statement were part of the BASIC standard. The standard and what MS aimed for allowed the separation of input with commas but if spaces were included next to the comma, those would be ignored. "123,456" and "123 , 456" are treated the same.

            Note that some level of conversion will be necessary unless using the simplest of Commodore BASIC programs. All the PEEKs and POKEs will have to be replaced with something else; nothing on an 8088 will be at the same address. Clearing the screen is another adjustment; Chr$(147) would produce "" instead if using the standard IBM fonts. The code needed to handle the specifics of the Commodore 64 architecture will be complex.

            Comment


              #7
              Yea, it's just comma separated values. Even for strings they were comma separated. Want more? Use LINE INPUT and parse it.

              Comment


                #8
                LINE INPUT (or in other BASICs INPUT$) are not part of Commodore BASIC.

                Comment


                  #9
                  Originally posted by krebizfan View Post
                  Note that some level of conversion will be necessary unless using the simplest of Commodore BASIC programs. All the PEEKs and POKEs will have to be replaced with something else....
                  I only want my BASIC files to be binary compatible with the Commodore ones. So a Commodore PRG will list in my BASIC as it was written by it. Running it is a complete different matter: I had no intention at all to emulate what the Commodore program would do but...

                  Clearing the screen is another adjustment;
                  That made me think. AFAIK standard BASIC doesn't have such a command. Commodore does it by using a CHR$ code. And it uses more CHR$ codes for other features. It won't hurt to have a look at these codes and see if I will use them as well. Thank you for pointing me to them!
                  With kind regards / met vriendelijke groet, Ruud Baltissen

                  www.baltissen.org

                  Comment


                    #10
                    Didn't someone do this already? https://github.com/mist64/cbmbasic

                    Comment


                      #11
                      IMHO: no. The main difference: my CBM-BASIC is written in ML and will run on a 8088. This CBMBASIC has been generated by a tool that converted the original C64 ROMs into C. Download it and have a look at the biggest file: it is all gibberish. And I don't think it will run on a 8088.
                      With kind regards / met vriendelijke groet, Ruud Baltissen

                      www.baltissen.org

                      Comment


                        #12
                        Originally posted by Ruud View Post
                        IMHO: no. The main difference: my CBM-BASIC is written in ML and will run on a 8088. This CBMBASIC has been generated by a tool that converted the original C64 ROMs into C. Download it and have a look at the biggest file: it is all gibberish. And I don't think it will run on a 8088.
                        Wow, I had not looked at it closely enough. It might work, but you can tell it was generated.
                        PDP-8 and PDP-11 enthusiast. But enjoy most older PC stuff too.

                        Comment

                        Working...
                        X