Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Targeting machines other than Apple Ii #87

Open
ccureau opened this issue Feb 15, 2024 · 5 comments
Open

Targeting machines other than Apple Ii #87

ccureau opened this issue Feb 15, 2024 · 5 comments

Comments

@ccureau
Copy link

ccureau commented Feb 15, 2024

I've built a couple of 65816-based systems and have used ca65 for most of the code. Even though the 6502 landscape is slim when it comes to compilers, ones with a 65816 target are slim to none.

Is it possible to use the compiler with a generic target, or a target that can be defined in config or code? Even stopping after the assembly generation step would be better then nothing.

@MikeW50
Copy link
Contributor

MikeW50 commented Feb 15, 2024

Yes, it is possible. The compiler and the code it generates don't really care what machine you are targeting. The compiler itself has been used to target other machines before--particularly the 65816 Nintendo.

There are two issues you will face.

The first is the compiler itself runs on an Apple IIGS or emulator. It would be a heavy lift to port it.

The second is the runt time libraries. Most, like floating-point math and string functions, are platform agnostic, but IO commands definitely are not. You would either need to rewrite the ones you use for your target machine or not use them.

Source is included for the run time libraries, wo rewriting them is a viable option.

@jawaidbazyar2
Copy link

jawaidbazyar2 commented Feb 15, 2024 via email

@sheumann
Copy link
Contributor

As Mike and Jawaid mentioned, this is possible. A couple more points:

  1. ORCA/C can be run as a cross-compiler on modern computers using Golden Gate. A number of people use this for development targeting the IIGS, but it can also be used when targeting other systems.

  2. ORCA/C generates object files, not assembly code. It comes with a linker and other tools for working with its object file format (OMF). If need be, you could modify those tools (the source code is available) or write your own (the OMF format is documented in the Apple IIGS GS/OS Reference and the ORCA/M manual).

@MikeW50
Copy link
Contributor

MikeW50 commented Feb 15, 2024

Isn't the makebin tool still in there somewhere? I'm relying on some pretty old memories here, but look for a utility with that name in the ORCA install. Once the program is linked, it is still an Apple IIGS object file, as mentioned, but makebin converts it to a binary image set up to run at a specific address.

if you prefer to write your own loader so you can do relocatable loading like the Apple IIGS does, makebin already has most of the code.

@ccureau
Copy link
Author

ccureau commented Feb 15, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants