15 April 2024, 17:29 | #1 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
Exporting/Importing absolute expressions
Hi,
I use XREF/XDEF for bigger projects in conjunction with a linker. It seems that I can only use them for labels. It doesn't work with absolute expressions like in this example: Code:
file.a XDEF absolute_expression absolute_expression EQU 5 file.b XREF absolute_expression move.w #absolute_expression*2,d0 ;Error: I can't use any computing on the importet absolute expression |
15 April 2024, 17:34 | #2 |
Semi-Retired
Join Date: Mar 2012
Location: Leiden / The Netherlands
Posts: 2,064
|
use an include (.i) file where you define absolute_expression?
Not really exporting/importing, though. |
15 April 2024, 17:57 | #3 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
|
15 April 2024, 18:07 | #4 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,076
|
That's not what XDEF/XREF are used for (EQUs&co).
You could see EQU/SET/RSSET/.. as "compile time" variables/constants. Now, if you would do something like: Code:
QQQ EQU 123 varQQQ: DC.L QQQ |
15 April 2024, 18:59 | #5 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,366
|
|
15 April 2024, 20:19 | #6 | |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
Quote:
file.a doesn't know the expression from file.b. A more precise example; file.a: Code:
XDEF v_BPLCON4 BPLCON4 EQU $0011 v_BPLCON4 EQU BPLCON4 file.b has its own value which will be combined with the value of file.a: Code:
XREF v_BPLCOBN4 BPLCON4 EQU 0 lea copperlist,a0 move.w #BPLCON4+v_BPLCON4,x(a0) |
|
15 April 2024, 21:11 | #7 | |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,366
|
Quote:
Code:
; file.i v_BPLCON4 EQU $0011 ; file.a include file.i BPLCON4 EQU v_BPLCON4 ; file.b include file.i BPLCON4 EQU 0 lea copperlist,a0 move.w #BPLCON4+v_BPLCON4,x(a0) |
|
15 April 2024, 21:39 | #8 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
In most cases you are right, but not in my case. I need the different scopes for each file which represent separate effects.
file.a sets up a view with some sprites with the first copperlist. The first copperlist calls the second copperlist with a COPJMP2. You can see file.a as a wrapper for file.b. file.b sets the viewport and uses the second copperlist. Now, if in the first copperlist the sprites colourbank is set, then the second copperlist should do the same. Otherwise the sprite colours would be weird, If I do only changes of the sprites colourbank in file.a, file.b has to know this after the linking. Anyway, I found a solution which works. If the importet value is not part of any computing formula, it can look like this: Code:
lea copperlist,a0 move.w #BPLCON4,d0 or.w #v_BPLCON4,d0 move.w d0,x(a0) |
15 April 2024, 23:57 | #9 |
Registered User
Join Date: Jun 2016
Location: europe
Posts: 1,076
|
1. Use SET instead of EQU so you can simply overwrite the symbol with a new value in file.b (EQU is for constants and can be used only once, while SET you can use multiple times)
Code:
; file.a: QQ SET 123 ; file.b: INCLUDE file.a QQ SET 0 Code:
; file.a: IFD IN_B QQ EQU 0 ELSE QQ EQU 123 ENDIF ; or ENDC ; file.b: IN_B EQU 1 INCLUDE file.a |
16 April 2024, 14:36 | #10 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
Thx for all your replies. I guess I found a solution for my case.
|
18 April 2024, 17:35 | #11 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,557
|
Quote:
symbol + addend(where addendcan also be negative or zero). |
|
26 April 2024, 08:45 | #12 |
Registered User
Join Date: Sep 2015
Location: Germany
Posts: 260
|
Well, there is a difference for O.M.A 2.04, otherwise it would work. An absolute value is not a relocatable symbol. That's the point why formulas dont't work with XREF/XDEF absolute values.
|
27 April 2024, 22:27 | #13 | |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,557
|
Quote:
I should have been more precise: There is no difference for the operators allowed in expressions involving externally defined relocatable or absolute symbols. |
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
vasm - Use defined object code in macros/expressions? | dansalvato | Coders. Asm / Hardware | 2 | 24 March 2022 01:38 |
About VASM expressions | JuanLuis | Coders. Asm / Hardware | 6 | 07 June 2020 10:28 |
Debug console / importing labels? | buzzybee | support.FS-UAE | 4 | 21 August 2019 12:31 |
Importing into Imagine 4.0's Spline Editor? | StrangeVoyager | support.Apps | 0 | 18 May 2019 07:08 |
Exporting, edit and importing fonts | tooki41 | request.Other | 7 | 14 January 2017 16:22 |
|
|