How to assemble multiple .asm files to multiple .prg files using CBM PRG Studio

You need an actual VIC.

Moderator: Moderators

Post Reply
User avatar
Lechuck
Vic 20 Enthusiast
Posts: 174
Joined: Wed Nov 11, 2020 7:23 am
Location: Madrid
Occupation: IT

How to assemble multiple .asm files to multiple .prg files using CBM PRG Studio

Post by Lechuck »

Hi,

I'm trying to assemble a CBM PRG Studio project that includes 3 .asm files and I need each of them to create its corresponding .prg file. I have found required options in 'Project Properties' menu but, since the third file is referring to multiple labels from the other two, I get many 'Invalid label' error messages when it tries to assemble that .asm file (the other two are correctly assembled to their .prg files because they don't require labels from the other files). I have tried checking the option 'All macros and Labels are global' but that didn't seem to have any effect (also tried adding a '$' at the end of label names to identify them as global with same result). I have also tried using the directive Incasm <filename> but result is that third .prg file is actually assembling the source code from all the three files.

So, my question is, is it possible to get CBM PRG Studio to identify labels from other .asm files when creating individual .prg files?

Thanks!
User avatar
thegg
Vic 20 Amateur
Posts: 69
Joined: Mon Aug 30, 2021 4:49 am
Location: England
Occupation: retired

Re: How to assemble multiple .asm files to multiple .prg files using CBM PRG Studio

Post by thegg »

I'm assuming that you are building your individual .prg files by selecting each .asm separately and using 'Build Program to file' option in the Build menu. When you build that way you are not building the project and the assembler will only have access to data defined within the file being assembled. This is different to building the project which can have multiple source files, but only one executable file: the one named in the project options.

If you really need to have separate executables for each part of the project, you will need to manage the global data by fixing the address of each label and declaring it in each file that uses it. For example you have the global variable foo, declare it as: foo = <fixed address> in each file that uses foo. Note that one program will need to initialise the foo data address.
User avatar
Lechuck
Vic 20 Enthusiast
Posts: 174
Joined: Wed Nov 11, 2020 7:23 am
Location: Madrid
Occupation: IT

Re: How to assemble multiple .asm files to multiple .prg files using CBM PRG Studio

Post by Lechuck »

Thanks Thegg,

Yes, by now I'm using the 'Build Program to file' option, to get the individual .prg files and then I 'paste' them into a .D64 image to try it in Vice. But I expected, if found a way to avoid the problem with the labels, to create the .D64 (with the three .prg files) directly from CBM PRG Studio (The 'Project properties' menu allows selecting a 'Batch mode' that creates the individual .prg files and, if 'Disk image' option is selected, it directly sends these to the Disk 'file'.
So, according to your explanation, I'll need to create a list of labels with corresponding addresses (and I'll need to remember to update them if any of them changes...). I think that CBM PRG Studio allows getting the list of labes and corresponding address so I guess I can use that as a kind of 'header' for my .asm files.

Thanks again
Post Reply