PDA

View Full Version : asm and pbp



pic beginner
- 10th July 2004, 15:21
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.

Melanie
- 11th July 2004, 10:40
> 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

Darrel Taylor
- 11th July 2004, 21:11
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

pic beginner
- 12th July 2004, 05:22
Thank Melanie
ThankDarrel Taylor
yourr help is vry helpful

lester
- 24th October 2004, 05:33
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.