- Refactored pragmaCodeSegs HashMap, which has been removed from Pass0GenerateStatementSequence and moved to Program. It controls which code segment have been defined, and a validation is implemented in the far_seg pragmas. - Refactored __far() to use the code segments, in analogy to far_seg pragmas. - Refactored Procedure, which implements functions to use the FarSegment to decide on far declaration and far bank retrieval. - refactored CallingConvention. Removed earlier quick implementation of bankFar variable as a local property, and declaredFar in the Procedure class. Now everyting is controlled through the farSegment. - Refactored Procedure, the removal of FAR_CALL calling convention. It is wrong to implement FAR_CALL calling convention, because far and near calls can be stack calls, phi calls and even a varcall can be near of far. - Removed the Pass1ProcedureFar because far and near implementation is not defined in statement level, it is defined on procedure level. But I've kept Pass1ProcedureFar to suppor the logic for inline prepare, execute, finalize routines during further implementation. - Refactored directive FAR to match the directive far_seg() structure. - Refactored complete logic during Pass4CodeGeneration to process statement call fragment generation to decide on near or far calls within the logic, taking into account the calling convention used. - Added new fragments call_far[platform]_prepare.asm, call_far[platform]_execute.asm, call_far[platform]_finalize.asm and deleted call_far[platform]_entry.asm, call_far[platform]_exit.asm - Renamed pragmas far_seg and near_seg to simply far and near respectively. Updated test cases with this change. - Added test cases. TODO: The actual inline implementation of prepare, execute, finalize functions when platform .asm fragments are not used. TODO: Implementation of the near directive.
KickC - Optimizing C-compiler for 6502 platforms
KickC is a C-compiler for 6502-based platforms creating optimized and readable assembler code.
The language is 95% standard C99 with a few limitations, and a few extensions to ensure an optimal fit for creating 6502 assembler code.
The KickC-compiler includes all necessary linker and header files to makes it easy to create and test binaries for the following 6502-based platforms out-of-the-box:
- Commodore VIC 20
- Commodore 64
- Commodore Plus/4 (Commodore 16 , Commodore 116)
- Atari 2600
- Atari XL/XE
- Nintendo NES
- MEGA65
- Commander X16
KickC uses the very versatile Kick Assembler. The KickC Compiler produces assembler code for the MOS Technology 6502 processor family. Specifically the compiler supports 6502, 65C02, 65CE02 and 45GS02 CPUs.
Resources
-
Download the newest Release
-
Download a nightly build
-
Read the Reference Manual
-
See the included C standard library
-
Follow the features being developed
-
Discuss the compiler and receive news on facebook
-
Chat on discord
-
Examine the Compiler Source Code
-
Contribute to the development of KickC
BETA
KickC is currently in beta, and at times crash or creates ASM code that does not work properly. Feel free to test it and report any problems or errors you encounter, but do not expect it to produce production quality code. Also, be prepared that breaking changes (to syntax, to semantics, etc.) may be implemented in the next versions.