View previous topic :: View next topic |
Author |
Message |
Micha
Joined: 03 Oct 2006 Posts: 57
|
Posted: Sun Aug 09, 2020 6:58 pm Post subject: Using .def with same name but different registers in indepen |
|
|
Hello
I have written 2 small Libs. In both i have defined an alias for a register. But the register are different.
Have a look at these 2 libs:
In lib 1 I've written
Code: | [Test1]
.def rTmp = r18
Test1:
LDI rTmp,$11
RET
[End] |
and in the lib 2 I've written:
Code: | [Test2]
.def rTmp = r16
Test2:
LDI rTmp,$22
RET
[End] |
In main-program both libs are included with "$LIB".
Wenn I call the routine test1 and test2 only register r18 ist set. Tested with simulator.
It seems so that only 1 alias (.def) ist used, not both.
Can I not use the same alias in diffrernt libs?
Then the Libs are compiled, then it works correct. But not with using the lib-file.
Is it not possible in Bascom?
(BASCOM-AVR version : 2.0.8.3 ) |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Sun Aug 09, 2020 8:06 pm Post subject: |
|
|
the register def is global so you can not have the same name in multiple libs. that is correct. _________________ Mark |
|
Back to top |
|
|
Micha
Joined: 03 Oct 2006 Posts: 57
|
Posted: Mon Aug 10, 2020 6:42 am Post subject: |
|
|
Ok.
But then .def ist global, why did not occur an Error then a name is already used? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Mon Aug 10, 2020 11:27 am Post subject: |
|
|
that is a good question. i will check that.
a redefinition is allowed but a redefinition with a different register should raise an error. _________________ Mark |
|
Back to top |
|
|
Micha
Joined: 03 Oct 2006 Posts: 57
|
Posted: Tue Aug 11, 2020 3:18 pm Post subject: |
|
|
Have you checked that?
Do you need a sample code? |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5914 Location: Holland
|
Posted: Tue Aug 11, 2020 9:17 pm Post subject: |
|
|
yes i checked it. and i changed it. _________________ Mark |
|
Back to top |
|
|
Micha
Joined: 03 Oct 2006 Posts: 57
|
Posted: Wed Aug 12, 2020 8:33 am Post subject: |
|
|
Thank you! |
|
Back to top |
|
|
|