Typical flat BASIC Program Layout


+ Reply to Thread
Results 1 to 5 of 5

Thread: Typical flat BASIC Program Layout39 days old

  1. #1
    Junior Member Giuseppe's Avatar
    Join Date
    Jul 2019
    Posts
    29
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    437.99 MB

    0 Not allowed!

    Default Typical flat BASIC Program Layout

    Hello everyone
    looking at the proton manual on page 36 you can see the basic structure of a program.
    I ask if it is correct to put the initial setting of the various registers between the Declare and the variable declarations?
    Also I ask if the includes should always be put between the declare and the variables?
    I have sometimes noticed on programs that the include is placed right in the main program is correct?
    Thank you

Attention

This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

The advertisements we display are relevant to this web site and your browsing history

Please consider supporting us by disabling your ad blocker.


Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

If you can, please report issues in the forum area WebSite / Forum Issues


Thank you for your attention.

  • #2
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,689
    Thumbs Up
    Received: 47
    Given: 95
    Total Downloaded
    1.32 GB

    0 Not allowed!

    Default Re: Typical flat BASIC Program Layout

    How exactly you lay it out it is of personal preference but the basics are you need to declare the variable, constant, register etc before you use them. Not 100% on declares.

    eg

    Reg info
    Variables
    Declares
    Includes

    Code

    You can if desired declare variables just before you use them eg.
    mysub:
    Dim var abc as byte
    ABC = 1
    etc


    After awhile you will develop your own preference. The only tip I have that I recommend is naming variables. Prefix them with the type eg:-

    Dim bABC as Byte
    Dim wCBA as word
    Dim cBAC as 10

    Note the use of a lowercase prefix to describe the type. No confusion later over what var type it is.

    HTH Tim
    Tim

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #3
    Member keytapper's Avatar
    Join Date
    Jun 2019
    Posts
    104
    Thumbs Up
    Received: 4
    Given: 3
    Total Downloaded
    319.88 MB

    0 Not allowed!

    Default Re: Typical flat BASIC Program Layout

    The layout might depend on the compiler to process the input in a certain manner.
    I put a concern regarding where the includes might be. They are included exactly where its statement lays. Therefore anything prior and after the include will depend from the include itself. In most of the cases it don't matter if they are placed on the top of the program, but for certain programming method, conditional includes might be necessary to be placed to the wanted position that it should appear.

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #4
    Prolific Poster See_Mos's Avatar
    Join Date
    Feb 2004
    Posts
    1,299
    Thumbs Up
    Received: 17
    Given: 0
    Total Downloaded
    872.27 MB

    0 Not allowed!

    Default Re: Typical flat BASIC Program Layout

    As Tim wrote, everyone has their own preferred way but I had a problem a few weeks ago where the 'include' was below the declares and variables and caused a compile error which cleared when I moved the include to the top of the code directly after the device and xtal lines.

    I also prefer to put the config lines at the end of the code out of the way.
    My RAM is failing

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  • #5
    Junior Member Giuseppe's Avatar
    Join Date
    Jul 2019
    Posts
    29
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    437.99 MB

    0 Not allowed!

    Default Re: Typical flat BASIC Program Layout

    Thanks everyone for replying

  • Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

    Thread Information

    Users Browsing this Thread

    There are currently 1 users browsing this thread. (0 members and 1 guests)

       

    Similar Threads

    1. Wanted somone to create a program in Proton Basic
      By chudson in forum Wanted and For Sale
      Replies: 12
      Last Post: 24th February 2011, 22:04
    2. New forum layout
      By Daniel in forum The Lounge
      Replies: 5
      Last Post: 24th October 2010, 22:14
    3. PCB Layout
      By pic-ignorant in forum The Lounge
      Replies: 10
      Last Post: 15th April 2009, 21:21
    4. [SOLVED !] Manual Layout
      By Copy'nPaste in forum Wish List / Product Feedback
      Replies: 8
      Last Post: 16th September 2007, 20:30
    5. [SOLVED !] How can I call Bootloader from Basic program?
      By Kabron in forum Mecanique - IDE
      Replies: 3
      Last Post: 14th December 2005, 16:44

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts