Environment variable - How to make? - ASM HCS08

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Environment variable - How to make? - ASM HCS08

1,439 Views
Leojunin
Contributor III

Hello to the whole community. While I seek to do this I will describe:

 

I program in relocatable assembler and want to have an environment variable accessed from any of my .asm files, I can also modify it with a macro. This variable is just a char number, (I mean a single byte $00 to $FF), something like a value created by SET with the difference that SET is private in a .asm file and can not read its value from another .asm. They understood what I want to do? I have read the help of environment variables but I can not make it work

Labels (1)
0 Kudos
7 Replies

1,149 Views
mariaotero
Contributor II

you need to name it in the .INC file, like this:

Example:

MAIN.ASM


; variable/data section

MY_ZEROPAGE: SECTION  SHORT         ; Insert here your data definition

mainEnvironment_Variable     DS.B 1 ;this variable is equal to the position 0x70:

     CLR       Environment_Variable

If the variable in main.asm is in the position 0x70 then in the .INC file located in Project_Headers folder:

Environment_Variable      EQU     $70.


SPANISH:

Tenes que nombrar la variable en el archivo .INC, por ejemplo:


si en el source MAIN.ASM tenes nombrada la variable asi:


; variable/data section

MY_ZEROPAGE: SECTION  SHORT         ; Insert here your data definition

main_variable     ds.b 1 ;Esta variable es equivalente al sector de memoria 0x70

clr     variable

En el archivo .INC que se encuentra en la carpeta project_headers (por ejemplo MC9S08AW32.inc), tenes que nombrar la posicion de memoria en la que se encuentre la variable (0x70):

variable      equ     $70

Saludos.

0 Kudos

1,149 Views
Leojunin
Contributor III

Hola, entiendo lo que decis, lo se, pero no es lo que deseo hacer, lo que yo digo es ( y a ver si me ayuadas a traducirlo mejor) es una variable de entorno de programacion, del compilador, osea una especie de SET pero publica. Me explico?

Te recuerdo que programo en relocatable assembler:

Un SET que pueda definir e inciar un valor en "main.asm", por ejemplo:

main.asm

VARIABLE_EJEMPLO SET 3

code     SECTION

            lda          #VARIABLE_EJEMPLO

luego desde "rutinas.asm" leer VARIABLE_EJEMPLO y asignarlo a algo y modificarlo, por ejemplo: 

rutinas.asm

Etiqueta     FCB    VARIABLE_EJEMPLO

VARIABLE_EJEMPLO   SET  VARIABLE_EJEMPLO + 2

y si deseara seguiria en otro archivo

rutinas2.asm

Etiqueta2     FCB    VARIABLE_EJEMPLO

VARIABLE_EJEMPLO   SET  VARIABLE_EJEMPLO + 2

me explico? hasta ahora lo estoy haciendo de otra manera, pero no es lo que deseo.

Si quieres traducirlo para todos, podes ayudarme, usaste un acento medio argentino.

0 Kudos

1,149 Views
mariaotero
Contributor II

De que manera lo estas haciendo?

0 Kudos

1,149 Views
mariaotero
Contributor II

Me mataste, pero creo que entiendo lo que necesitas y la única manera que encontré de hacer lo que decís, es utilizando includes.

Soy de buenos aires.

0 Kudos

1,149 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi,

SET derivative is similar as #define in C language. the related expression doesn't have a memory address.and it can not be viewed by external module.

user can define a symbol with XDEF. for example,

XDEF myglo;

then use XREF to refer it in other module:

XREF myglo;


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

1,149 Views
Leojunin
Contributor III

Hi Jennie.

I know what you're talking about, but not what I do. That makes me a variable public I'm programming the software. What I look for is an environment variable (CW itself) which can use its value. Example:

main.asm

      Environment_Variable = 1

       lda    #Environment_Variable

othercode.asm

       Environment_Variable = Environment_Variable + 1

       lda      #Environment_Variable

I mean, have a variable that can vary its value from an .asm and read from another .asm. Not the address of a variable. It is understood? There are environment variables as:

ERRORFILE

TMP

USERNAME

LIBPATH

and there is an option...

-Env: Set Environment Variable

Group

HOST

Syntax

-Env <Environment Variable> = <Variable Setting> 

Arguments

<Environment Variable> : Environment variable to be set.

<Variable Setting> : Setting of the environment variable.

Description

This option sets an environment variable. The environment variable may be used in the maker or to overwrite system environment variables.

and I do not understand how to use it

0 Kudos

1,149 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

I never use environment in this way, but i suggest you read document

http://cache.nxp.com/files/soft_dev_tools/doc/ref_manual/HC08ASMRM.pdf?fsrch=1&sr=1&pageNum=1

chapter 3, environment.


Have a great day,
Jennie Zhang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos