asm and pbp


Closed Thread
Results 1 to 5 of 5

Thread: asm and pbp

  1. #1
    pic beginner's Avatar
    pic beginner Guest

    Default asm and pbp

    Hi
    I want to study the asm output file of my program that written in pbp and compiled with it. But i get in to trouble. When I open asm file with notepad the questiom marks between lines confuse me. I put a part of asm file. please tell me how i can solve this problem .

    #define _CCP1CON_4 CCP1CON, 004h
    #define _y_0 _y, 000h
    #define _CCP1CON_5 CCP1CON, 005h
    #define _y_1 _y, 001h
    INCLUDE "10BITP~2.MAC"
    INCLUDE "PBPPIC14.LIB"

    LOW?T _TRISC_2
    MOVE?CB 00Ch, CCP1CON
    MOVE?CB 014h, T2CON
    MOVE?CB 0FFh, PR2

    LABEL?L _main
    MOVE?CW 000h, _y
    LABEL?L L00001
    CMPGT?WCL _y, 003FFh, L00002
    LCDOUT?C 0FEh
    LCDOUT?C 001h
    LCDOUT?C 079h
    LCDOUT?C 03Dh
    LCDOUTCOUNT?C 000h
    LCDOUTNUM?W _y
    LCDOUTDEC?

    The macro files have this marks also.

  2. #2
    Join Date
    Jul 2003
    Posts
    2,358


    Did you find this post helpful? Yes | No

    Default

    > I want to study the asm output file of my program that written in pbp...

    Unless you have a macro fetish, the listings that the MeLabs Compilers produce are not going to turn you on, and you're not going to learn very much real Assembler.

    The code produced by the PBP compiler is not Assembler in the true sense of the word, but rather long lists of macro calls. It's not very readable and you don't learn a great deal from it.

    If you want to write in BASIC and then study a true, readable Assembler listing produced by the Compiler, then you have to look at one of MeLabs competitive products (like Crownhill's Proton+).

    The only other alternative for you would be to take the final HEX file, and reverse-assemble it back into a readable Assembler. MPLAB used to have this function a couple of years back, I haven't checked if it still has, however there are several reverse-assemblers about on the Internet if you spend some time searching. Naturally you will lose all your mnemonics and comments.

    Melanie

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


    Did you find this post helpful? Yes | No

    Default

    Hi Pic B.

    In assembly, the question mark is just another character. It doesn't have any special meaning to the compiler, and does not get replaced with anything else.

    However, it does have a meaning in the context of these macro's. It is a delimiter between the COMMON macro name and the parameter types that will follow. For instance:

    MOVE?CW 000h, _y

    MOVE is a common macro that can be used to copy variables and constants to another variable. After the question mark the 2 letters CW indicate the type of variables that it will use for the copy. The letters are as follows.

    A = W register
    T = Bit
    C = Constant
    B = Byte
    W = Word
    L = Label

    So, in the MOVE example above, it will copy the constant 0 the the word size variable y.
    <hr>
    CMPGT?WCL _y, 003FFh, L00002

    This one is "Compare Greater than", it will compare a Word against a Constant and if it is greater, it jumps to Label L00002<hr>
    LCDOUT?C 0FEh

    Will send the Constant 0FEh to the LCD<hr>
    The actual macros that are used can be found in the PBPPIC14.LIB file in your PBP folder, and also in the PBPPIC14.MAC file.

    I think you will learn a lot by looking through those files. There's no need to switch to Proton to learn how Picbasic Pro compiles it's programs.

    HTH,
    &nbsp;&nbsp;&nbsp;Darrel

  4. #4
    pic beginner's Avatar
    pic beginner Guest


    Did you find this post helpful? Yes | No

    Talking Thank

    Thank Melanie
    ThankDarrel Taylor
    yourr help is vry helpful

  5. #5
    Join Date
    Apr 2003
    Location
    Cambridge - UK
    Posts
    1,033


    Did you find this post helpful? Yes | No

    Default

    There is NO NEED to switch to Proton, I totally agree.

    However you can download a free fully functional copy and use it to view the assembly created by programs written in PICBASIC, for educational purposes the ability to look at chunks of assembly commented with PICBASIC commands is a real eye opener. - As is the ability to single step through the PICBASIC code and watch it execute in a graphical environment.

    Downloading Proton Development Suite - Lite from http://www.picbasic.org/ will allow anyone to get a real grip with assembly based upon PICBASIC.

    Granted the assembly produced by Proton is NOT the same as the assembly produced by PBP, but the knowledge gained by studying the assembly commented with PICBASIC is fundamental and can be applied to the code produced by the PBP compiler, which as Malanie says "is not Assembler in the true sense of the word"

    The transition from writing in PICBASIC to writing Assembler is an arduous one, using the Lite version of the Proton Development Suite will make your life easier and help you get the most from your compiler.

Similar Threads

  1. PBP, ASM and LST files
    By HenrikOlsson in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 12th January 2010, 13:43
  2. ASM or PBP First?
    By mackrackit in forum Off Topic
    Replies: 4
    Last Post: - 10th October 2009, 12:08
  3. pbp - asm variable passing
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 25th May 2009, 08:49
  4. Anyone do a comparison of the ASM code generated by PBP??
    By Frozen001 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 19th November 2008, 20:01
  5. 10f Pbp & Asm
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 14th February 2006, 21:23

Members who have read this thread : 2

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