07 June 2020, 15:13 | #1 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
xref best practice?
Hi,
I have a library that is used by different source files that contains various useful functions defined with xdef. How do you tend to add the xref commands? I'm doing this at the moment: Code:
include "../Framework/IntroLibrary.i" ; Additional external symbols xref FW_CheckUserQuitSignal_A6 xref FW_ClearBuffer_BlitCPU_A6 xref FW_ClearBuffer_CPU xref FW_CopyBuffer_CPU xref FW_CPUClearBuffer xref FW_GetFrame xref FW_InitCopperBplPtrs xref FW_InitCopperColsFromPalette xref FW_IsFrameOver xref FW_PreMultCreate_W xref FW_SetLev3Irq xref FW_WaitFrame xref FW_WaitRaster_A6 xref FW_VBlankProxy xref LIB_RGB12_Interpolate_Fast xref LIB_RGB12_Interpolate_Fast_Palette xref LIB_NRV2S_Depack I could always create a new file like "IntroLibrary_xref.i" and just have all the xrefs in there and include them so I've always got all the functions available and don't have to think about it. But then vasm complains about xrefs to unused functions. You can turn that warning off with -nowarn=62 though. Had a quick look at the TrapRunner source and this seems to be doing the top version. Only adding the xrefs required in a particular file. Just curious on what others do |
07 June 2020, 18:39 | #2 |
Defendit numerus
Join Date: Mar 2017
Location: Crossing the Rubicon
Age: 53
Posts: 4,468
|
|
07 June 2020, 21:01 | #3 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Hmm. You saw what I did in Trap Runner, because I like to have an overview which symbols I imported from which modules. This is also the reason I implemented that warning - to make it easy to find unnecessary XREFs.
But there is no problem to XREF any symbol from any object you link with. It doesn't even appear in the object file, when an XREF is unused. There is also a third option: don't use XREF at all and don't specify the -x option. vasm will automatically import all unknown symbols (other assemblers might not). |
07 June 2020, 22:04 | #4 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
Hmm, I think I'll just ditch the -x. Less work all around for me
|
08 June 2020, 08:46 | #5 |
son of 68k
Join Date: Nov 2007
Location: Lyon / France
Age: 51
Posts: 5,323
|
|
08 June 2020, 09:22 | #6 |
OCS forever!
Join Date: Mar 2019
Location: Birmingham, UK
Posts: 418
|
I used to as well but in the initial versions of the visual studio code debugger I used it couldn’t handle source level debugging within includes so I got into the habit of separating everything. A bit of a pain at first but much neater now.
|
09 June 2020, 11:37 | #7 |
Registered User
Join Date: Sep 2019
Location: Essen/Germany
Age: 55
Posts: 463
|
In vasm, I use the '::' syntax to export symbols. I don't need to use any xref/xdef with this. Or am I missing something?
|
13 April 2023, 14:23 | #8 | |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
If I assemble a single assembly file to an object file (no linking) and put an "xdef randomsymbol" statement in the file, I get:
Quote:
If I change xdef to xref, I get the exact same warning, by the way. vasm command: vasmm68k_mot -quiet -m68000 -Fhunk -showcrit -x -o <object> <source> Last edited by hooverphonique; 13 April 2023 at 14:38. Reason: vasm line |
|
13 April 2023, 21:01 | #9 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
In fact
xdefand xrefrefer to the same function in vasm's mot-syntax module. It is best comparable to the .globaldirective of std-syntax (GNU-as). This means an xref'd/xdef'd symbol stays xref until it is defined, which makes it xdef. Maybe for better error checking and Devpac compatibility I should add some flags to differentiate between these two? |
14 April 2023, 10:56 | #10 |
ex. demoscener "Bigmama"
Join Date: Jun 2012
Location: Fyn / Denmark
Posts: 1,624
|
Well, that's up to you - it would be more intuitive to get an error when you export a non-existing symbol, but if not, I think at least you should update the documentation with something similar to what you said above
|
14 April 2023, 12:46 | #11 |
Natteravn
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
|
Done (last night).
Try today's daily source snapshot: http://sun.hasenbraten.de/vasm/daily/vasm.tar.gz |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Soldering practice: | Charlie | Hardware mods | 7 | 22 March 2010 14:14 |
Will Bridge Practice series needs an overhaul | mk1 | HOL data problems | 1 | 02 April 2009 21:55 |
|
|