1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-26 12:49:21 +00:00
Commit Graph

2915 Commits

Author SHA1 Message Date
Sven Van de Velde
02d9eaf081 - Added banking signature to procedures in the comments of the assembler output file.
- Update test cases and reference data.
- Cleaned old test cases for stack calls.
2023-04-12 06:57:25 +02:00
Sven Van de Velde
82a6c56e0a - Resolved issue of nobank without parameters. Now it works ... The CPreprocessor adds () and the KickCParser.g4 demands brackets as part of the syntax. But you can write without in the code.
- Retested all test cases.
2023-04-11 21:48:26 +02:00
Sven Van de Velde
5c5ffd2736 - Removed unnecessary tests and logic for bank directive parsing.
- Retested all test cases.
2023-04-11 14:44:35 +02:00
Sven Van de Velde
477499b97b - Fixed #pragma nobank parameter issue.
- Optimized logic for #pragma bank.
- Updated test cases and references.
- Made #pragma NAME parameters optional.
- Retested all test cases.
2023-04-11 13:41:14 +02:00
Sven Van de Velde
acbf8f073f - Updated test case references. 2023-04-11 10:41:10 +02:00
Sven Van de Velde
0393958154 Merge remote-tracking branch 'origin/far-call-isolated' into far-call-isolated-#508 2023-04-11 10:14:10 +02:00
Sven Van de Velde
8bb0ae904f - processed some of the comments.
- documentation fixes.
2023-04-11 10:13:41 +02:00
Jesper Balman Gravgaard
e7d717e915 Apply 2 suggestion(s) to 2 file(s) 2023-04-11 08:02:06 +00:00
Jesper Balman Gravgaard
8b7beac0c1 ok 2023-04-11 07:42:41 +00:00
Sven Van de Velde
9cf5f4cd05 Merge commit 'f2bf3484ad84a75f644a47560f1d2a0dd42c1acd' into jesper_baseline_all_changes
(cherry picked from commit 74512e132625e2e4f8f0ae3a80beae043dcc642d)
2023-04-11 09:00:46 +02:00
Sven Van de Velde
f2bf3484ad - testing and regeneration of fragment references
- implementation of near, close, far through AsmFragmentSignature
- fragment consolidation (removal of prepare, execute, finalize)
- stackcall banked throws error + test cases
- overall test cases for phi
- implementation of fragments
2023-04-11 08:35:53 +02:00
Sven Van de Velde
b62430bfc3 - near, close, far implementation using fragments for phi calls
- fragment consolidation
- removal of platform
- stackcall banked throws error
- testing
2023-04-11 08:35:18 +02:00
Sven Van de Velde
a52b5dc4a9 Banking progress
(cherry picked from commit d0abf45529c34e14ed3ce43b9be3a140f78bc4a9)
2023-04-10 07:22:06 +02:00
Sven Van de Velde
c550a122da Banking progress
(cherry picked from commit b98f95facff43c7a0bb8f9e9f902b49cc10ef4fe)
2023-04-10 07:19:35 +02:00
Flight_Control
1499f8cecc - Added javadoc documentation in Bank.java.
- Added reworked procedure-callingconvention-phi-bank-5.c to reflect a good banking example for the documentation.
- Update ref for test cases.
2023-04-05 13:10:18 +02:00
Flight_Control
bdc4e28d0a - Fixed test cases going in error.
- Optimized test cases and documented them properly.
- Remove obscolete ref data.
2023-04-04 23:31:56 +02:00
Flight_Control
b13262beb8 - Added test cases.
- Merged remaining code change that is not in master remote.
2023-04-04 20:11:09 +02:00
Flight_Control
a6b021aaf0 Merge branch 'jesper_baseline' into far-call-isolated-#508
# Conflicts:
#	src/main/java/dk/camelot64/kickc/model/symbols/Procedure.java
#	src/main/java/dk/camelot64/kickc/passes/Pass0GenerateStatementSequence.java
2023-04-04 20:03:15 +02:00
Flight_Control
5bd84e7812 - Added test cases.
- Checked asm outputs.
- banking is only implemented for the cx16 for now.
2023-04-04 19:36:11 +02:00
Flight_Control
4706611564 - Mem[x] parameters in a banked function are always allocated in main memory.
- Mem[x] return value(s) in banked functions are always allocated in main memory.
- Mem[x] intermediate value(s) in banked functions are always placed in the designated data segment.

This to accommodate better banking logic for far function calls. (There might be more complexity for other type of variables, but for equinoxe it's working!).

(cherry picked from commit 649a187d7e9290b630a951d8968ce5ece6ba2216)
2023-03-27 21:42:52 +02:00
Flight_Control
b650ba99a9 - Fix far call kernal servicing address! It was wrong! Now it's fixed!
(cherry picked from commit e9ddfaeb3ab519cd393f26ca30632c06c59de1fe)
2023-03-26 18:31:47 +02:00
Flight_Control
2513e59266 - Inline code can never be banked.
(cherry picked from commit 249b7600a9262ea673e63d133db75690af43ca05)
2023-03-26 18:30:53 +02:00
Flight_Control
f81c5ce040 Adding the fix code segment in far call bank.
Added the currentBankLocation to the procedure definition.

(cherry picked from commit 0d90caebe8)
(cherry picked from commit 8cbf1b5b4bd7f62326e454bbff7ab5456647615d)
2023-03-26 18:30:09 +02:00
Flight_Control
944fbd3021 - removed gen files 2023-03-26 10:30:23 +02:00
Flight_Control
19b8de78a4 Merge commit 'db49ca6aabe96f0ca9ec355f33a4fadf33324f93' into far-call-isolated 2023-03-26 09:52:14 +02:00
Jesper Balman Gravgaard
7098b28cb2 Merge branch 'error-handling' into 'master'
Catching a RunTimeException only when there is no UnknownFragmentException ...

See merge request camelot/kickc!25
2023-02-18 18:48:24 +00:00
Jesper Balman Gravgaard
addfe05454 Merge branch 'fix-procedure-code-segment-updates' into 'master'
Fixes functions declared in header files not assigned the correct code segment.

See merge request camelot/kickc!26
2023-02-18 18:47:36 +00:00
Flight_Control
5fefeac7b6 Fixes functions declared in header files not assigned the correct code segment.
So the declarations of the functions receive also the currentCodeSegment, but only when the function is defined, the currentCodeSegment is to be assigned to the function (procedure!). During declaration of functions the code segment is likely Code ...
2022-11-22 07:30:22 +01:00
Flight_Control
db49ca6aab Major changes:
- Renamed #pragma far() to #pragma bank() upon design recommendations of @jesper.
- renamed #pragma near to #pragma nobank, to avoid using bank(-1).
- renamed __far directive to __bank directive.
- introduced bank area upon design recommendation of jesper, and replaced this with the already present code segment linkage to banking. So the structured stayed the same, only the naming changed! This unlink from segment indeed makes things easier when no segments are in scope of the program.
- added bank area as part of the fragment signature, so now call_far_[platform]_[bankarea]_prepare.asm, call_far_[platform]_[bankarea]_execute.asm, call_far_[platform]_[bankarea]_finalize.asm are expected to be present in the compiler.
- removed the c code prepare, execute, finalize idea. The fragments seem to be enough for the moment.
- added ram and rom fragments for far calls for the cx16.
- Cleaned banking logic from Statement level.
2022-11-21 18:17:35 +01:00
Flight_Control
1a63d437a0 - Refactored far call logic during parsing. The pragmaFarSegs hash table has been removed from the Pass0GenerateStatementSequence. Instead, a currentFarSegment is controlling the #pragma logic.
- 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.
2022-11-20 09:56:10 +01:00
Flight_Control
d19c005d79 Fine tune of the phi-far-4 example to clearly illustrate #pragma near_seg utilization. 2022-11-19 08:19:18 +01:00
Flight_Control
d7a135aaee Implementation of #pragma near_seg without prameters.
There was a change needed to update the parameter parsing main algorithm, to make parameters optional instead of mandatory.
2022-11-19 08:06:52 +01:00
Flight_Control
1ef785a254 Parsing implementation of
#pragma far_seg(segment, bank, call_prepare, call_execute, call_finalize)
with variable parameters, other option is:
   #pragma far_seg(segment, bank)

After parsing a FarSegment HashMap is created that is later used for the far or near call determination.
Added currentFarSegment variable.
Added near in KickCLexer for __near directive.
Added far_seg and near_seg #pragma keywords.

near_seg is to be parsed in the next commit.
2022-11-19 07:45:07 +01:00
Flight_Control
2f2028f3a1 far calls 2022-11-17 07:43:08 +01:00
Flight_Control
379a3c1999 Catching a RunTimeException only when there is no UnknownFragmentException ...
and throw either
- Compile Error
- UnknownFragmentException (passing through).
2022-11-16 22:30:37 +01:00
Flight_Control
8801a3e5e2 Fixing bugs:
- far calls are now ALL iterated and flagged with a bank!
- procedure objects are taken as the base for far call asm generation, not the call objects anymore (too tricky). But i have kept the call objects to be also updated with the bank for any reference later!
2022-11-16 22:19:22 +01:00
Flight_Control
d7405d8669 Fixing bugs:
- far calls are now ALL iterated and flagged with a bank!
- procedure objects are taken as the base for far call asm generation, not the call objects anymore (too tricky). But i have kept the call objects to be also updated with the bank for any reference later!
2022-11-16 22:18:48 +01:00
Sven Van de Velde
f948ce0571 far call test cases. 2022-11-16 17:41:25 +01:00
Sven Van de Velde
4a4d6f72d0 far calls for __stackcall calling convention functions. 2022-11-16 17:11:18 +01:00
Flight_Control
828e38a8b3 far calls 2022-11-16 06:54:44 +01:00
Jesper Balman Gravgaard
152832fd4e Merge branch '807-fix-multiplication-bug' into 'master'
Closes #807 bug when rewriting multiplication with power of 2, where the...

Closes #807

See merge request camelot/kickc!24
2022-11-13 10:23:23 +00:00
jespergravgaard
63932ef555 Closes #807 bug when rewriting multiplication with power of 2, where the constant is the left operand. 2022-11-13 11:11:27 +01:00
jespergravgaard
95aa5ec6c4 Fixed problem where the compiler sometimes deletes a resource file when called. Closes #775 2022-06-19 09:14:21 +02:00
jespergravgaard
13a7063df0 Added some fragments. 2022-05-12 18:27:55 +02:00
jespergravgaard
e15c02839d Added some fragments. 2022-04-02 10:24:24 +02:00
jespergravgaard
d4b68806f8 Added PoC script for creating executable on MacOs using jpackage. #757 2022-02-20 21:14:26 +01:00
jespergravgaard
d9d7f2cf03 touching fragment cache. 2022-02-18 10:46:49 +01:00
jespergravgaard
46f66c5499 Merge remote-tracking branch 'origin/master' 2022-02-18 09:18:17 +01:00
jespergravgaard
c7550fbd37 Updated version 2022-02-18 09:18:08 +01:00
Jesper Balman Gravgaard
4c23b4ad9f Merge branch '770-update-45gs02-to-reflect-changed-z-indexing-when-doing-ldq' into 'master'
Resolve "Update 45GS02 to reflect changed Z-indexing when doing LDQ."

Closes #770

See merge request camelot/kickc!18
2022-02-13 21:48:03 +00:00