Jump to content
IGNORED

Creating cartridge file out of source code


gorgh

Recommended Posts

Hi folks,

I've got a question. As I understand setting "opt f+h-" in mads assembler makes binary file without headers (orgs). Is this right?
My next question is how to prevent different "orgs" set to the same value to be overridden by each other?

thanks

Link to comment
Share on other sites

MADS tend to take care of that for you as it tends to force you to work in continually ascending order.

This can become a bit of a pain when you are using multiple banks and want to include blocks that you want relocate to RAM.

A way around that though is to compile those first to individual binary files and then 'ins' those in a final source that builds the rom file.

Link to comment
Share on other sites

MADS team will be better place to guide as most things I try tend to be a fudge as I'm more familiar doing carts with CC65.

 

The issue arise from wanting to compile multiple blocks to the same area, but MADS will error for different reasons depending on which way you try to get around it.

An example would be an XEGS cart where there is a fixed 8K bank at $A000 and a selectable 8K bank at $8000.

Maybe take a look at how phaeron approaches it in the Altirra Extended Basic sources on this thread.


If your dependencies are such, you can build a section and export it's labels & addresses

mads my_data.asm -l:my_data.lst -o:my_data.bin -c -hm:my_data.inc

You can then include just the 'inc' file with the next section's sources to resolve those labels and do this across a number of individual blocks.

 

Then the final source then brings this all together in one binary:

mads -l:final.lst -final.lbl -o:final.rom my_rom.asm

e.g. with my_rom.asm being along the lines of:


 

    OPT h -
    OPT f +

    ORG 0
    ins "my_data.bin"
    
    ORG $2000
    ins "my_code_1.bin"

    ORG $4000
    ins "my_code_2.bin"

    ORG $6000
    ins "my_music.bin"

remembering that the final block will contain your Cart Vectors, e.g.

    ORG $BFF9
CartInit:
    RTS
    
    .WORD CartRun
    .BYTE     0 ;  
    .BYTE     4 ;  
    .WORD CartInit

 

Link to comment
Share on other sites

>My next question is how to prevent different "orgs" set to the same value to be overridden by each other?

 

I assume you refer to banked cartridge type (otherwise you don#t have that case).

Before the ORG of new 8/16k you have to disable the FILL mode again with "OPT F-".

 

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...