Skip to main content
Visitor II
July 31, 2013
Question

how to make PC-N? on STVD assembler? without label

  • July 31, 2013
  • 11 replies
  • 1818 views
Posted on July 31, 2013 at 21:51

example:

btjt PB_IDR, #1, PC-1; need it, not working

.label

 btjt PB_IDR, #1, label; not need it, working

please help...
    This topic has been closed for replies.

    11 replies

    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 06:18

    BTJT PB_IDR, #1,*

    s1975Author
    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 10:08

    thank you,

    please answer:

    how to used records: *

    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 10:52

    Hello user75!

    Page 23 (section 4.3.6 - operands) of the ST Assembler-Linker User Manual that is distributed with STVD explains the meaning and some uses of the symbol '*'.

    In my opinion, * should be used only in inline-loops as in your example.

    As regards the other uses, it's always better to use labels.

    s1975Author
    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 11:02

    whether correctly I wrote down?

    btjt PB_IDR, #1, {*-1}

    s1975Author
    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 11:03

    example PC-1 ?

    s1975Author
    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 11:06

    I agree, but sometimes happens more convenient PC-N

    s1975Author
    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 11:10

    you from what country?

    I from Russia

    s1975Author
    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 11:11

    thank you, BR!

    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 11:28

    user75,

    consider * as a label which the assembler updates *before* translating the current instruction. For this reason, the instruction:

    BTJT PB_IDR,#0,*

    works, because * is the address of the first byte (of five bytes) that the assembler emits when it process this line. When you use {*-1} (I suggest you to use the curly brackets to avoid assembler errors), you avoid the assembler assistance in computing a valid jump destination. When your computation is wrong, there are no assembling errors, but only execution errors (if you are luky) or a strange behaviour which are difficult to debug. Why one should not use the assembler label feature to avoid these nasty errors?
    s1975Author
    Visitor II
    August 1, 2013
    Posted on August 01, 2013 at 11:41

    it is possible also a tag, I pass with AVR to ST, and it already simply a habit though the ST assembler allows more :)