News:

Printed Amstrad Addict magazine announced, check it out here!

Main Menu

writing for carts

Started by arnoldemu, 11:05, 15 December 10

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

arnoldemu

Last night I was thinking about this.

One way to do it would be to treat the rom as a rom-disk. It has "files" and the code reads the files as needed into ram.
This is the most easiest I think. I think I can change some existing code I have to do it this way.

Second would be to have an assembler which can split the code into 16k blocks, and you can reference the labels from any block.
Perhaps an assembler and linker is what is needed here, so that code can call between blocks. The assembler would also need to be able to warn if the code was too long.
In addition, the assembler may need to be able to think of the code in two different areas, because some banks can be switched into both &0000-&3fff and &c000-&ffff.

Some ideas.

TFM, if you are reading this, how did you code futureos? This is split over 4 roms, how did you manage the headache of calling code betweens roms? (e.g. code in rom 1 wants to call code in rom 3)?

EDIT: Thinking about it, it's probably no different than having lots of code in the extra 64k and banking that in and out.

redbox

Quote from: arnoldemu on 11:05, 15 December 10
Perhaps an assembler and linker is what is needed here, so that code can call between blocks. The assembler would also need to be able to warn if the code was too long.
EDIT: Thinking about it, it's probably no different than having lots of code in the extra 64k and banking that in and out.

Yes, I would just view it as being the same as banking code in and out of extra RAM.

I think you would need to get the code working and then assemble a binary to where you are going to page it in.  But you're right as doing this once you get towards the end of the development it would cause a bit of a headache - you would have to compile, save and then execute the whole thing every time you wanted to test something.

demoniak

I think the best way is to make a small routine in both rom/ram banks, like this:

LD B,#7F   ; or #DF to select rom
OUT (C),A
RET

This is only 5 bytes per bank.
To call this code, you should push to the stack the address where you want to go, and put in A register the bank number.

Or you can replace the RET with JP (HL) to avoid using the stack.

Powered by SMFPacks Menu Editor Mod