Skip to main content
Visitor II
April 10, 2003
Question

Adding text in your code (Assembler)

  • April 10, 2003
  • 12 replies
  • 1756 views
Posted on April 10, 2003 at 17:00

Adding text in your code (Assembler)

    This topic has been closed for replies.

    12 replies

    brian4Author
    Visitor II
    April 9, 2003
    Posted on April 09, 2003 at 14:24

    How do you add text so that appears is the s19 file.

    I want to add software name / author in some code so that if you read back the device you can read the text.

    I want to do this in the ST7 assembler
    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 04:05

    You may do that directly in the window of the visual programmer, where the memory is free of any code. Or maybe by adding a constant declaration in your code.....

    Rgds

    F
    brian4Author
    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 06:09

    If I want to set up a constant how do you define a string in assembler.

    DS.B is a byte

    DS.W is a word ?

    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 06:33

    in your map file (for example):

    SEGMENT BYTE AT F000-FF00 'ROM'

    SEGMENT BYTE AT FF00-FFDF 'TITLE'

    in your source file

    SEGMENT 'TITLE'

    DC.B 'A'

    DC.B 'B'

    DC.B 'C'

    the string ABC will then be located starting from adress 0xff00 (check it in the window of the visual programmer)

    Rgds

    Florent

    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 07:03

    why not just use the STRING keyword, eg.

    segment 'rom'

    STRING ''teststring''

    Regards

    Spen
    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 07:10

    because I forgot this possibility

    Anyway, you still have to define the segment if you want to allocate it at a defined adress.

    F

    brian4Author
    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 07:24

    Thanks for that. Now done

    Regards, Brian
    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 07:33

    hello

    I've got a questions about this:

    How can I do this in C (Cosmic C-Compiler)?

    I mean to add software name / author in code.

    regards
    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 11:50

    define a new section in your linker file,eg.

    +seg .str -b 0xf000 -n .str # special const section

    +seg .text -n .text -a .str # program code

    +seg .const -a .text # constants follow code

    then to put our string in the special section use

    #pragma section const {str}

    const char * const pString = ''teststring'';

    #pragma section const {}

    Hope this helps

    Regards

    Spen
    Visitor II
    April 10, 2003
    Posted on April 10, 2003 at 12:52

    Thanks Spen!

    And if I want to make four different strings one behind the other:

    is this right or not:

    +seg .firm -b 0xf000 -n .firm # special const section

    +seg .autor -a .firma -n .autor # special const

    +seg .version -a .autor -n .version # special const

    +seg .kunde -a .version -n .kunde # special const

    +seg .text -n .text -a .kunde # program code

    +seg .const -a .text # constants follow code

    #pragma section const {firm}

    const char * const pString = ''testfirm'';

    #pragma section const {autor}

    const char * const pString = ''Ampel'';

    #pragma section const {version}

    const char * const pString = ''1.0.0.'';

    #pragma section const {kunde}

    const char * const pString = ''ST Micro'';

    #pragma section const {}

    ???

    regards