1
0
mirror of https://gitlab.com/camelot/kickc.git synced 2024-11-22 16:33:48 +00:00
Commit Graph

2902 Commits

Author SHA1 Message Date
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
jespergravgaard
e867c3a1d0 Updated LDQ z-indexing. 2022-02-13 22:35:08 +01:00
Jesper Balman Gravgaard
230776a2da Merge branch '766-add-huc6280-tst-instruction-addressing-modes' into 'master'
Finished implementing support for huc6280 transfer instructions with abs,abs,abs addressing mode.

Closes #766

See merge request camelot/kickc!17
2022-02-13 11:05:44 +00:00
jespergravgaard
dec47ab811 merged master. 2022-02-13 11:52:34 +01:00
jespergravgaard
2791a0e099 Finished implementing support for huc6280 transfer instructions with abs,abs,abs addressing mode. 2022-02-13 11:49:02 +01:00
Jesper Balman Gravgaard
49abe6cdb7 Merge branch '766-add-huc6280-tst-instruction-addressing-modes' into 'master'
Resolve "Add Huc6280 TST instruction addressing modes"

Closes #766

See merge request camelot/kickc!15
2022-02-12 07:22:16 +00:00
jespergravgaard
42e31f6e69 Finished implementing support for huc6280 TST #imm.zp / #imm,abs / #imm,zp,x / #imm,abs,x. 2022-02-12 07:35:59 +01:00
jespergravgaard
ad48dfb7cf fixed test. 2022-02-10 21:16:39 +01:00
jespergravgaard
9c28ee4615 Made immediate word and relative word addressing modes explicit. Improved opcode-guesser to include search for these modes. 2022-02-09 07:14:19 +01:00
jespergravgaard
0b4a53ae12 Fixed new addressing modes. 2022-02-04 07:06:02 +01:00
Jesper Balman Gravgaard
34d258c3c5 Merge branch '767-problem-with-z-register-on-cpu-huc6280' into 'master'
Resolve "Problem with Z-register on CPU HuC6280"

Closes #767

See merge request camelot/kickc!16
2022-02-04 05:59:13 +00:00
jespergravgaard
48ed6891aa Removed Z register from huc6280 2022-02-04 06:46:25 +01:00
jespergravgaard
517b2af6d5 Added support for CPU HUC6280. 2022-01-30 21:41:50 +01:00
Jesper Balman Gravgaard
ec3120fc1d Merge branch 'jespergravgaard-master-patch-82001' into 'master'
Fixed mkdir problem.

See merge request camelot/kickc!13
2022-01-24 08:26:29 +00:00