Just to let you know - Page 2


+ Reply to Thread
Page 2 of 2 FirstFirst 12
Results 16 to 26 of 26

Thread: Just to let you know763 days old

  1. #16
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,887
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Just to let you know

    I know about push/pop, macros, and reserving a set of variables for passing to subroutines in Proton. Is there another way?
    None of the above are as tidy as the method used in P24 for devices with more memory.
    John
    Last edited by John Drew; 6th May 2018 at 00:32.

  2. 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. #17
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Just to let you know

    May not look so pretty but does do the job
    Code:
      Declare Stack_Size = 20
    
    
      .
      .
      GoSub SendKey[keyenter, NoModifier]            
      .
      .
    
    SendKey:                             
      Dim pKey As Byte
      Dim pModifier As Byte
      Pop pModifier
      Pop pKey
      .
      .
    George.

  4. 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. #18
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,887
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Just to let you know

    I should give it a try. I knew it existed but haven't used it.
    Thanks for the example.
    John

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

  7. #19
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,757
    Thumbs Up
    Received: 51
    Given: 96
    Total Downloaded
    1.33 GB

    0 Not allowed!

    Default Re: Just to let you know

    There is also $Define


    Code:
    ; Rounded division
    
        $define RoundedDiv(ValueNum, ValueDivisor, TheResult) dSTempDWord1 = ValueNum: wSTempWord1 = ValueDivisor'
        GoSub RoundedDivSub '
        TheResult = dSTempDWord1
        
        
    RoundedDivSub:
        wSTempWord2 = wSTempWord1 / 2
        dSTempDWord1 = wSTempWord2 + dSTempDWord1
        dSTempDWord1 = dSTempDWord1/wSTempWord1
        Return
    
    
    RoundedDiv(cSensorGapScaled,dTempDword1, wBubbleFlowrate50us)
    Tim

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

  9. #20
    Prolific Poster John Drew's Avatar
    Join Date
    Feb 2002
    Posts
    2,887
    Thumbs Up
    Received: 91
    Given: 34
    Total Downloaded
    4.60 GB

    0 Not allowed!

    Default Re: Just to let you know

    I've always felt the macro approach was an unnecessary complication, I can see that it makes main code easier to read. But I do struggle reading other programmers macros. If using their code I usually convert the macros into other code solutions. There's more than one way to skin a cat.

    On the other hand, George's example is in effect what Pascal does (either an address or a value pushed onto the stack), I can see that push/pop would be efficient. Probably my background with Pascal drives my interest in parameters, preferably including genuine temporary variables but I can only guess at the complexities this brings to Les's work with Proton.

    I'm getting lazy in my old age.
    John

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

  11. #21
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Just to let you know

    I've always felt the macro approach was an unnecessary complication, I can see that it makes main code easier to read. But I do struggle reading other programmers macros. If using their code I usually convert the macros into other code solutions. There's more than one way to skin a cat.
    Couldn't agree more.

    parameters, preferably including genuine temporary variables
    IMO any attempt to add the full house of local, global, static et al parameters would be massive overkill.

    BTW I'm sure you noticed that you can have a return value and that the sub pops parameters in the reverse order.

    Obviously any attempt to over or under load is doomed to failure.
    Last edited by towlerg; 7th May 2018 at 11:04.
    George.

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

  13. #22
    Fanatical Contributor Tim's Avatar
    Join Date
    Jan 2003
    Posts
    7,757
    Thumbs Up
    Received: 51
    Given: 96
    Total Downloaded
    1.33 GB

    0 Not allowed!

    Default Re: Just to let you know

    From my very limited experience of a procedural language with local variables, It uses a lot of vars. Way more than I would use.

    The $define example I used while a little more of a pain to set up is very neat to use in practice.

    Probably the most important change I have made in my coding recently was to use better prefixes on my variables

    eg dim bTempByte1 as byte

    dim cNumber as 23

    In my code now I also use this
    $define TestButtons Gosub SubTestButtons

    SubTestButtons

    Return


    TestButtons ()

    In the code I write there is rarely never any need to pass parameters around
    Tim

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

  15. #23
    Senior Member SimonJA's Avatar
    Join Date
    Mar 2006
    Posts
    842
    Thumbs Up
    Received: 14
    Given: 16
    Total Downloaded
    1.03 GB

    0 Not allowed!

    Default Re: Just to let you know

    It sounds like the new subroutines would be very similar to the procedures in proton24 in all but name.

    I much prefer to use the proton24 procedures and find very little need for global variables or subroutines, it makes the code much easier to keep track of, especially going back to an older programs and it also makes it easier to reuse sections of code in new programs.

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

  17. #24
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,560
    Thumbs Up
    Received: 76
    Given: 33
    Total Downloaded
    6.56 GB

    0 Not allowed!

    Default Re: Just to let you know

    Can I call a Sub from another Sub, keeping in mind same rules that apply to Gosub and Return with regards to stack?
    Regards

    Joseph

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

  19. #25
    Prolific Poster towlerg's Avatar
    Join Date
    Mar 2012
    Posts
    2,354
    Thumbs Up
    Received: 83
    Given: 183
    Total Downloaded
    5.30 GB

    0 Not allowed!

    Default Re: Just to let you know

    Of course you can. As long as each GoSub/Sub eventually executes a Return/EndSub the stack grows but remains balanced.

    Untill or indeed if Les adds parameters GoSub-Return and Sub-EndSub are functionally identical.
    George.

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

  21. #26
    Prolific Poster joesaliba's Avatar
    Join Date
    Sep 2004
    Posts
    2,560
    Thumbs Up
    Received: 76
    Given: 33
    Total Downloaded
    6.56 GB

    0 Not allowed!

    Default Re: Just to let you know

    Thanks George.
    Regards

    Joseph

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

     

Tags for this Thread

Posting Permissions

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