Using ASM with PBP variables.


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116

    Default Using ASM with PBP variables.

    Hi,

    Does anyone out there have any examples of using PBP variables in asm?

    In particular I was thinking of reading TMR1H, & TMR1L into a 16 bit PBP variable, or setting up registers, doing A to D conversions, maybee some simple maths.

    Anything really, just trying to get my head around a little asm. I am trying to save some code space on a project where I can't change the chip I am using, but have run out of memory. But I want to learn anyway. As much as I love PBP it is always nicer to use asm where it is not to difficult, and use PBP for the more comples parts.

    Kind regards
    Bob.

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


    Did you find this post helpful? Yes | No

    Default Re: Using ASM with PBP variables.

    The easiest way is to use PBP macro, so you don't need to bother about BANK switching.

    MOVE?WW TMR1L, _YourWordVariable
    MOVE?BB TMR1L, YourWordVariable
    MOVE?BB TMR1H, (YourWordVariable +1)

    you can still use the asm way, but you do not gain any codespace, the MOVE?xx macro are pretty tight.
    The whole set of MOVE?xx macro are listed in the .lib fil in the PBP installation folder.

    for simple maths... hard to tell, what you consider to be simple... division by 7 seems to be easy, but nightmare to code in asm the first time :s

    check out the piclist website. Or come with a specific requirement and some may give this a shot.
    Steve

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

  3. #3
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Using ASM with PBP variables.

    Thank's for that. I had no idea about the .lib files. Very interesting stuff.

    Will also check out the piclist website.

    Regards
    Bob...

  4. #4
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Using ASM with PBP variables.

    Ok, I have been doing a little more delving into asm. So I now have a specific question.
    How do I use a macro?
    I have tried using it in PBP, and inbetween the ASM, ENDASM commands, but I can't seem to get the syntax right.

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


    Did you find this post helpful? Yes | No

    Default Re: Using ASM with PBP variables.

    Which macro? the one of PBP or your own?

    If PBP one well, no real problem
    ByteA VAR BYTE
    ByteB VAR BYTE

    @ MOVE?CB 123, _ByteA
    @ MOVE?BB _ByteA, _ByteB
    ByteB is now equal to 123

    don't forget, it is CASE SENSITIVE. Try it, and if you still have problem, post your code here, we will have a look to it.

    Also, you can refer to various DT include files, or my KeyPad or my Nokia GLCD. Lot's of macro use in those
    Steve

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

  6. #6
    Join Date
    Feb 2005
    Location
    Holmfirth England
    Posts
    116


    Did you find this post helpful? Yes | No

    Default Re: Using ASM with PBP variables.

    Ahh I see what I was doing wrong. I thought the asm part saw all pbp names as _CAPITALS.

    Thanks.

Members who have read this thread : 0

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

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