PBP Wish List


Closed Thread
Results 1 to 6 of 6

Thread: PBP Wish List

  1. #1
    Radiance's Avatar
    Radiance Guest

    Lightbulb PBP Wish List

    A PicBasic Pro Wish List:

    Function Calls:
    Function Foo(var1,var2)

    var result
    result=var1*var2
    Foo=result
    (or this way, which I like better
    return result
    End Function

    This eliminates:

    Global Variables that mysteriously change
    lots of line labels
    the nasty GOSUB

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I agree, it would be nice to have functions built into PBP. But until that happens, here is a round about way of achieving the same thing, kinda, sorta.

    First, you need to create a "macro" that copies the passed parameters into known locations. Then create your subroutine just like normal, keeping in mind that the input and output are always thru the known Temp variables.

    After the macro copies the parameters to the Temp variables, it will call the code for the function. When the function is finished it will return to the macro which will copy the result to the third parameter. You can pass as many parameters as you want (as long as they fit on 1 line).
    Code:
    Temp1  var word
    Temp2  var word
    Temp3  var word
    
    asm
    Foo macro W1, W2, R1
       MOVE?WW   W1, _Temp1    ; Copy  first parameter to Temp Variable 1
       MOVE?WW   W2, _Temp2    ; Copy second parameter to Temp Variable 2
       L?CALL    _FooCode      ; call the Foo functions code
       MOVE?WW   _Temp3, R1    ; Copy Temp3 to result
       endm
    endasm
    
    
    FooCode:                  ' PBP code for the function
      Temp3 = Temp1 * Temp2
      ' and whatever else Foo does
      ' final result must be in Temp3
    return
    To use the new function

    Code:
    bar    var word
    bleh   var word
    belch  var word
    
    @ Foo  _bar, _bleh, _belch
    or

    Code:
    Dogs          var word
    FleasPerDog   var word
    TotalFleas    var word
    
    @ Foo  _Dogs, _FleasPerDog, _TotalFleas
    The example shown will only work with words, to use bytes: change the appropriate MOVE?WW to MOVE?BB

    The biggest benefit of a function is the ability to embed it in a math formula or conditional test. Unfortunately, this Macro type function DOES NOT allow you to do that. So I'm still hoping for true functions in PBP also.
    Last edited by Darrel Taylor; - 23rd July 2003 at 05:34.

  3. #3
    Join Date
    Aug 2003
    Posts
    985


    Did you find this post helpful? Yes | No

    Default

    Would be nice to have a fully labelled assembler version of every
    program without decompiling/relabelling yourself...
    Art.

  4. #4
    Robert Soubie's Avatar
    Robert Soubie Guest


    Did you find this post helpful? Yes | No

    Default

    Originally posted by Art
    Would be nice to have a fully labelled assembler version of every
    program without decompiling/relabelling yourself...
    Art.
    Well, you have it: if you use Microcode Studio, go to "options" and check "listing file". Same if you use mpasm rather than pm...

  5. #5
    jojokatada's Avatar
    jojokatada Guest


    Did you find this post helpful? Yes | No

    Default lcd 4 line

    hi anybody could help me how to display a 4 line character lcd.

    sample code

    main:
    pause 1

    lcdout $fe,1," Hello world", $fe,c0," hello again" ,fe,94,"welcome" fe,d4,"thank you"

    goto main

    end

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Wink

    jojokatada

    have a look in that thread

    Please, help us to keep thread/forum section as clean as they're supposed to be. You really don't need to post the same question twice.

    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

Similar Threads

  1. PBP Book
    By Bruce in forum Off Topic
    Replies: 83
    Last Post: - 4th October 2021, 12:55
  2. PBP List file???
    By MOUNTAIN747 in forum General
    Replies: 2
    Last Post: - 28th February 2010, 19:48
  3. List of instructions used in PBP ?
    By AndrewC in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd November 2007, 11:22
  4. PBP Editor Wish List:
    By blainecf in forum PBP Wish List
    Replies: 7
    Last Post: - 12th July 2006, 21:07
  5. PBP wish list.....
    By muddy0409 in forum PBP Wish List
    Replies: 7
    Last Post: - 21st November 2005, 09:51

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

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