At least! I know how to create a megarom with SDCC in the correct way.

By samsaga2

Resident (62)

samsaga2's picture

03-06-2021, 11:50

With the last SDCC version (I don't know with the previous) the z80 target has support for banks. You can create a megarom without doing weird things. Calling methods from one page to another is totaly transparent (with a little performance cost).

You can see my test project at https://github.com/samsaga2/sdcc_megarom. It is far from finished, now it only supports changing the second page. But it works and we can have a complete solution with a little of work.

Summary
- Generate banking code directly from the SDCC
- Call to a function in the same module has not any performance penalty, only calling from one bank to another.
- I am using the SDCC way, is not an external utility that could stop working with new SDCC versions.
- My code is unfinished but a complete solution can be done.

Login or register to post comments

By samsaga2

Resident (62)

samsaga2's picture

06-06-2021, 18:00

I have updated the github code. Now it is a fully workable konami megarom compiled with sdcc.
You can call any function in any page and sdcc, transparently, it will manage the page changes for you.

By geijoenr

Champion (364)

geijoenr's picture

06-06-2021, 18:44

Congratulations...

Not to diminish your achievement, but this has been solved for a long time in different ways in previous versions of sdcc. See:

https://github.com/retrodeluxe/sdcc-msx
https://github.com/retrodeluxe/rlengine-msx
https://github.com/MartinezTorres/sdcc_msx

By samsaga2

Resident (62)

samsaga2's picture

07-06-2021, 08:56

I was already familiar with the K5link. The others I didn't, even though I had been diving a lot in github.

Anyway, all of these only works with previous versions of SDCC. With SDCC 4 the things has changed a little. And I think it is important to update. In the near future it seems that they are going to implement functions parameters using registers in z80 and the register allocator is being improved.

geijoenr wrote:

Congratulations...

Not to diminish your achievement, but this has been solved for a long time in different ways in previous versions of sdcc. See:

https://github.com/retrodeluxe/sdcc-msx
https://github.com/retrodeluxe/rlengine-msx
https://github.com/MartinezTorres/sdcc_msx

By ARTRAG

Enlighted (6935)

ARTRAG's picture

23-01-2022, 22:56

@samsaga2
Very good! Going to test your code very soon

By ARTRAG

Enlighted (6935)

ARTRAG's picture

24-01-2022, 00:06

@samsaga2
The read.me mentions module.c to be included but the package includes only module.s
Something doesn't match...

By ARTRAG

Enlighted (6935)

ARTRAG's picture

26-02-2022, 18:08

Qustion: how can I import in the openmsx debugger the symbols generated by adcc?

By salutte

Master (164)

salutte's picture

26-02-2022, 19:20

Just a note, k5link is deprecated and no longer updated. It's successor is Megalinker, which is compatible with newer versions of sdcc:

https://github.com/MartinezTorres/megalinker