Search found 30 matches

by hth313
Wed Oct 26, 2022 5:38 am
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

Regarding interrupts in C. If you do it, avoid making function calls as that will generate a lot of save overhead. Well, you can make calls to small functions provided that they are inlined. Refer to the user guide about inlining and how to control it (to some degree).
by hth313
Wed Oct 26, 2022 5:34 am
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

The load to 0x1000 looks right, that is the best way of doing it, using a custom named section and placing it at the address in the linker rules file.

You can define an interrupt function using the interrupt attribute:


__attribute__((interrupt))
void MyIRQ() {
// some code
}


The compiler ...
by hth313
Wed May 25, 2022 5:34 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816


wait so it's a limitation of the object file format? then what is cc65 using that it works there? or is it because cc65's section symbols are just regular old symbols that get defined at the linking stage, instead of special ".sectionxyz" directives?


Unresolved expressions are turned into ...
by hth313
Tue May 24, 2022 8:46 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

ah! so like the ".section stack" and such at the start of the cstartup file?

Yes, that just makes it know to the assembler, it does not put anything into the stack or define its size in any way.

but now I'm getting this error:
cstartup.s:35: expression cannot be represented in object file ...
by hth313
Tue May 17, 2022 7:37 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

I know the Clang system (I use its preprocessor for the assembler) has some ideas of file extensions and that they change the meaning of the input. Also, as you say, assembler extensions are all over the place. I will see if I can make it less picky about the extension used for assembly language, as ...
by hth313
Sat May 14, 2022 10:06 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816



so i'll modify the startup code to just remove the whole reset section, and put the address of __program_start into the header, hopefully that works.
though the assembler syntax will take some getting used to. plus it's like 5 in the morning here and i haven't slept yet, so i'll do all of that ...
by hth313
Sat May 14, 2022 2:07 am
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

The startup code is provided with the product, both in precompiled form in the library and as source code. This code is short and cruical to get the system initialized properly before you enter the main() function. It is not only doing data copying, it is also clearing variables that are 0 ...
by hth313
Thu May 12, 2022 8:44 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

Håkan thanks for the Calypsi toolchain. Do you have any plans to make it available on Ubuntu Linux ARM64?

Having the Calypsi tools on ARM64 is something I want, but it will not happen in the very near future. The code base uses a GHC (Haskell) compiler that is four years old. GHC has only ...
by hth313
Thu May 12, 2022 8:36 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816


anyways i've been trying for some time to get something working, but i'm getting kinda hung up on the whole segements thing.
for example: you can have "code" and "data" in the same memory, you can have "data" and "bss" in the same memory, so why can you not have "code" and "bss" in the same memory ...
by hth313
Wed May 04, 2022 8:03 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

akohlbecker wrote:
Thanks again!

Maybe I missed it in the docs, but if not, a paragraph describing this behaviour might be a worthwhile addition.
That is a good point. I added that to the section about the assembly language interface for the next release.
by hth313
Tue May 03, 2022 10:42 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

Thank you for your answer, much appreciated.

Is there an optimization where it sees multiple 8-bit accesses in succession and decides to switch M to 8-bit? Considering 16-bit accesses have a one-cycle penalty. You said "when required" but it is unclear to me what those cases are?
This comes to ...
by hth313
Tue May 03, 2022 9:41 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

Thanks. I'll rephrase my question in case there is doubt about what I meant: Is Calypsi generally executing code by default using 16 bit memory accesses or 8 bit accesses, is it switching the indexes or accumulator sizes itself automatically (depending on type size for example?), or do you have to ...
by hth313
Sat Apr 30, 2022 9:41 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816



Ok, and then anything it cant place in a register, it puts on the stack?

Yes, any parameter that is not placed in a register is placed on the stack. For the 65816 it is the hardware stack and for the 6502 it uses a simulated stack that can be up to 64K (provided you have RAM and space for it ...
by hth313
Sat Apr 30, 2022 9:35 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

Just to let you know that my C compiler tools are now available from https://www.calypsi.cc/

I released 3.6.2 yesterday, but I do not plan to post here every time I make a release in the future, just check the page out from time to time if you are interested.
by hth313
Thu Feb 24, 2022 6:24 pm
Forum: Programming
Topic: Calypsi C compiler toolchain for 6502 and 65816
Replies: 81
Views: 15079

Re: Calypsi C compiler toolchain for 6502 and 65816

a question for OP. docs say:

What determines when parameters are passed on the stack vs registers?

The safest is to look at the generated code. What it does is to scan the parameter list left to right and bind registers in a given order. First it uses the CPU register(s) for a single parameter ...