vs64 icon indicating copy to clipboard operation
vs64 copied to clipboard

Confused on how to load SID resources

Open tercerapersona opened this issue 11 months ago • 8 comments

Hi, this might be trivial to you, but there's no example in your README.

I want to play a simple SID file (no raster irq, nothing fancy).

I have this file structure:

❯ tree src
src
├── main.asm
└── music.sid

1 directory, 2 files

This is main.asm,

*=$0801
!byte $0c,$08,$b5,$07,$9e,$20,$32,$30,$36,$32,$00,$00,$00 ; loader
init
    jsr music_init_address

loop
    jsr music_play_address
    jmp loop

and my project-config.json,

{
    "name": "lab",
    "description": "Project lab",
    "toolkit": "acme",
    "sources": [
        "src/main.asm",
        "src/music.sid"
    ],
    "build": "debug",
    "definitions": [],
    "includes": [],
    "args": [],
    "compiler": ""
}

I've seen that the SID got converted to build/src/music.asm, it is included in the ACME build args, and I can reference its labels in my main.asm. However SID data isn't loaded into its load address ($1000), when I monitor the bytes, SID data is located just after my code.

Could you explain how to properly load a SID file in its load address?

tercerapersona avatar May 15 '25 17:05 tercerapersona

Oh, found out I need to place the memory somewhere in my code, so that the compiler knows.

Worked by adding at bottom of main.asm

*=1000 music

tercerapersona avatar May 15 '25 20:05 tercerapersona

Hi, I think you found the simplest solution. I guess the other option (to keep .prg size minimal) is to not specify the address, and instead copy the sid data from load to target address at startup, same for other resources that you need to add but have to go to a specific location.

rolandshacks avatar May 17 '25 06:05 rolandshacks

Thanks! mm do you have an example, not sure if I understood

tercerapersona avatar May 18 '25 04:05 tercerapersona

Not really, but there should be plenty of existing code to show you how to do that.

rolandshacks avatar May 18 '25 10:05 rolandshacks

The thing is that vs64 concatenates all built .asm files. In my case it was easy because at the bottom of my main.asm I change org address to $1000 and music.asm (the only extra resource) got inserted after, but if I have multiple resources I won't be able to relocate them like this.

If all resources are concatenated like this, and I need to relocate them at runtime it will require double the space in the commodore, the one for the code, the one after relocation. Am I missing something?

tercerapersona avatar May 21 '25 13:05 tercerapersona

Maybe I am not the best to give advice on ACME, but you might want to also use the !source directives to include other asm files, like in this example: https://github.com/rolandshacks/vs64/tree/master/examples/acme

rolandshacks avatar May 22 '25 04:05 rolandshacks

Yeah, we could use !source, however is there a way to compile resources with vs64 but don't concatenate .asm built files so that they can be included manually with !source? vs64 resource compiler is great!

tercerapersona avatar May 22 '25 22:05 tercerapersona

That's a good point - KickAss should not have that problem as you always have to include sources manually. With ACME, I would have to add a flag for the build system that disables automatic compilation/integration and instead just performs the code generator step - later on, you could then just !src these files (with optional *=$xxxx in front of it)

rolandshacks avatar May 27 '25 15:05 rolandshacks