llvm-mos / llvm-mos-sdk

SDK for developing with the llvm-mos compiler
https://www.llvm-mos.org
Other
284 stars 56 forks source link

MEGA65 target #44

Closed mlund closed 2 years ago

mlund commented 2 years ago

I have set up a small project to use llvm-mos-sdk with rust with the aim to run on the Mega65 computer. This has a C64 compatibility mode (go 64 a la C128) where the test program runs fine. I wonder what is required to make a true Mega65 target? I'm aware that the mos-llvm project currently doesn't generate CSG4510 instructions (based on 65CE02), but that's perhaps not initially a problem as it's 6502 compatible. I have started a fork with what I think are the structural parts, but so far it's merely a clone of the C64 target. Any input would be highly appreciated.

mysterymath commented 2 years ago

Hey Mikael,

Thanks for reaching out! We have two guides on our Wiki that might be relevant: First, the Porting https://llvm-mos.org/wiki/Porting guide, which describes how the compiler and SDK target interactions work at a low level. Second, the Extending The SDK https://llvm-mos.org/wiki/Extending_SDK guide, which describes how our SDK's CMake build is structured.

Given the similarities between the C64 and the Mega65, using it as a base makes sense. There's already a mechanism in the SDK for one target to be based on another "incomplete target"; this is in an attempt to reduce code duplication between the targets. For example, all targets derive from the "common" target, and if you look at the NES targets, you can see an actual tree of targets based on board and mapper type.

Depending on the specifics of the differences between the Mega65 and the C64, it may be possible to use this mechanism directly, otherwise, it may be best to extract out the common bits into a "commodore" target, then make both C64 and Mega64 derive from it.

Please do at least skim through those guides; they should get you up to speed on how everything ticks on the inside. Afterwards, feel free to drop by our Slack Group https://join.slack.com/t/llvm-mos/shared_invite/zt-t88fyh4i-EGCLe~MSlHdz3~h~yYHgFA; I'm online frequently to answer questions, and there's other folks there who've gone through the same process.

Take care! -- Dan

On Tue, Jun 21, 2022 at 10:18 AM Mikael Lund @.***> wrote:

I have setup a small project https://github.com/mlund/mega65-adventure to use llvm-mos-sdk with rust with the aim to run on Mega65 https://www.mega65.org computer. This has a C64 compatibility mode (go 64 ala C128) where the test program runs fine. I wonder what is required to make a true Mega65 target? I'm aware that the mos-llvm project currently doesn't generate CSG4510 instructions (based on 65CE02), but that's perhaps not initially a problem as it's 6502 compatible. I have started a fork https://github.com/mlund/llvm-mos-sdk with what I think are the structural parts, but so far it's merely a clone of the C64 target. Any input would be highly valuable.

— Reply to this email directly, view it on GitHub https://github.com/llvm-mos/llvm-mos-sdk/issues/44, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABD6W4LGK5OA6UAWMAJR6RTVQH2PLANCNFSM5ZNCQJHQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mlund commented 2 years ago

Hi Dan, thanks for information - I completely missed the porting guide which looks exactly what I was after. Will get back when I run into trouble. Thanks / Mikael