Searching \ for 'PicbasicPro w/inline assembly' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/languages.htm?key=basic
Search entire site for: 'PicbasicPro w/inline assembly'.

Truncated match.
PICList Thread
'PicbasicPro w/inline assembly'
2000\06\06@002817 by marius bratrein

flavicon
face
Is there a better way to pass variables (data) between the PBP
environment and the assembly environment OTHER than using RAM or memory
storage ? I can pass info from Assembly to PBP using the PEEK command,
but it seems a little inconvenient to have to put everything in temp
storage in RAM.

Thanks

Marius

2000\06\06@074321 by Les

flavicon
picon face
Hello marius
                   The way I pass parameters is by the use of the DEFINE
command. Unfortunately it is only applicable from PBP to assembler, as the
compiler does not recognize assembler defines at all. Its use is the same as
defineing in asembler. For example, passing the port and pin on which an
infrared detector is to be attached would look like this in PBP code: -

       DEFINE        IR_PORT    PortA             ' PortA used the detector
       DEFINE        IR_BIT        0                    ' Bit 0 of porta
selected

The assembler can use another define to make more sense i.e.
ASM
       #Define   IR_DET    IR_PORT,IR_BIT    ; IR_DET now holds the port
and bit

       BSF    IR_DET
   or
       BCF   IR_DET

Endasm

or just use the raw data:-

ASM
           BSF  IR_PORT,IR_BIT
Endasm

Again, unfortunately this is a one way proccess, PBP does NOT recognise its
own defines!!!  let alone ones created in assembler. Try reading the value
of the OSC define
in PBP? ,(an extremely large oversight!).

Passing variables cannot be done without using some form of scratch pad area
for the them. However, to eliminate the use of the underscore before the
variable name (which is a pain!) i.e _TEMPVAR, declare the variable as a
SYSTEM type: -

           TEMPVAR        VAR        BYTE        SYSTEM

I have been experimenting with macros as pseudo commands, with some success,
but ASM and PBP are poor bedfellows (OK if small asm subroutines are used)
for some strange reason, which is strange, because this is one of the
reasons most serious users buy the thing in the first place. PBP will report
errors and sometimes lock up the computer, if too much assembler is used
(espesially large amounts of assembler comments using ";", very strange!)

By the way there is no need to use the PEEK command in PBP, this is a
remnant from the PBC version. Just use

       TEMPVAR= XXX
or
       XXX=TEMPVAR


On the whole, PBP is a good product, but needs some thought on the
integration of assembler. Procedures and functions would help no end. I have
asking jeff for about a year now, if this could be the next feature in the
compiler. If not, I intend to write a pre-processor that will allow these.

                                               Hope this helped

                                                       Les

spam_OUTlesTakeThisOuTspamtop204.freeserve.co.uk




{Original Message removed}

More... (looser matching)
- Last day of these posts
- In 2000 , 2001 only
- Today
- New search...