cancel
Showing results for 
Search instead for 
Did you mean: 

Adding text in your code (Assembler)

brian4
Associate II
Posted on April 10, 2003 at 17:00

Adding text in your code (Assembler)

12 REPLIES 12
brian4
Associate II
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
florent2399
Associate II
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
brian4
Associate II
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 ?

florent2399
Associate II
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

sjo
Associate II
Posted on April 10, 2003 at 07:03

why not just use the STRING keyword, eg.

segment 'rom'

STRING ''teststring''

Regards

Spen
florent2399
Associate II
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

brian4
Associate II
Posted on April 10, 2003 at 07:24

Thanks for that. Now done

Regards, Brian
csameling
Associate II
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
sjo
Associate II
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