English Amiga Board


Go Back   English Amiga Board > Coders > Coders. Asm / Hardware

 
 
Thread Tools
Old 23 March 2022, 19:46   #1
dansalvato
Registered User
 
Join Date: Jun 2009
Location: United States
Posts: 57
vasm - Use defined object code in macros/expressions?

I'm currently working on simplifying my workflow and was wondering if something like this is possible.
Code:
SomeLabel:
  dc.b   $3f                     ;Can this value be used in expressions?
  INCBIN "data.bin"              ;Same as above, but externally sourced, so no constants

SomeValue = INCBIN "data.bin"    ;Obviously doesn't work, but it's basically what I'm trying to do
I'm interested in doing this because I have some pre-generated binary files that need permuted versions of them to also be included in memory. I was thinking I could cut down on the amount of external file generation if I could use assembler expressions to do the permutation instead, during assembly.

I know that macros can retrieve the decimal/hex value of SomeLabel, but I don't know if they can retrieve the data present *at* SomeLabel. I know it would be easy if the data is always a constant that's directly present in code, but if I'm loading data via INCBIN then I'm not sure if it's possible.

Thanks for any insight!
dansalvato is offline  
Old 24 March 2022, 01:18   #2
phx
Natteravn
 
phx's Avatar
 
Join Date: Nov 2009
Location: Herford / Germany
Posts: 2,496
Quote:
Originally Posted by Haxxy View Post
wondering if something like this is possible.
No. A symbol, like
SomeLabel
, is either an absolute number (equate) or a label (memory address). You can make your macro generate code, which reads and permutates data at
SomeLabel
, but that would execute only at run-time.

Quote:
I was thinking I could cut down on the amount of external file generation
What is the contents of these external files? A single byte?

Quote:
would be easy if the data is always a constant that's directly present in code, but if I'm loading data via INCBIN then I'm not sure if it's possible.
I don't understand what you want to do, but does it have to be a binary file? Instead of
data.bin
you could generate a source file
data.inc
like this:
Code:
SomeValue = $3f
Then include it with
include "data.inc"
and use
SomeValue
in your macros?

But maybe you can give some more details? There may be other ways to help you, if we knew what you are trying to achieve.
phx is offline  
Old 24 March 2022, 01:38   #3
dansalvato
Registered User
 
Join Date: Jun 2009
Location: United States
Posts: 57
Quote:
Originally Posted by phx View Post
But maybe you can give some more details? There may be other ways to help you, if we knew what you are trying to achieve.
Thank you for your help. It was more of a curiosity rather than something I'm stuck on. The use case that first came to mind was to generate mirrored versions of sprites. Right now, I run my sprites through a script to generate mirrored versions, but I thought if I could do it in vasm using an expression (a very long one), I could eliminate that step. I know it sounds silly! It might make more sense to mirror the sprites at runtime anyway, and save myself the disk space.
dansalvato is offline  
 


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Similar Threads
Thread Thread Starter Forum Replies Last Post
About VASM expressions JuanLuis Coders. Asm / Hardware 6 07 June 2020 10:28
vasm/mot: macros sparhawk Coders. Asm / Hardware 8 06 January 2020 18:32
Macros for debugging in VASM mcgeezer Coders. Asm / Hardware 11 14 May 2019 15:27
does VASM support a pre-defined symbol identifying itself Apollo Coders. Asm / Hardware 2 09 December 2013 16:07
Help linking VASM object code clenched Coders. Asm / Hardware 2 24 May 2013 22:32

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 15:04.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.08842 seconds with 15 queries