Commit Graph

309 Commits

Author SHA1 Message Date
Irmen de Jong
6bc1fc4464 Merge branch 'master' into next_compositetypes
# Conflicts:
#	codeCore/src/prog8/code/optimize/Optimizer.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
2024-10-23 21:53:21 +02:00
Irmen de Jong
fdd18c615c more ifexpresssion codegen tweaks 2024-10-23 21:04:55 +02:00
Irmen de Jong
47c1bba41d Merge branch 'master' into next_compositetypes
# Conflicts:
#	codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
#	compiler/src/prog8/compiler/astprocessing/IntermediateAstPostprocess.kt
#	compiler/test/ast/TestVariousCompilerAst.kt
2024-10-23 00:29:38 +02:00
Irmen de Jong
9927af1095 about var inits 2024-10-22 01:08:42 +02:00
Irmen de Jong
b23f1f4b72 Merge branch 'master' into next_compositetypes
# Conflicts:
#	codeCore/src/prog8/code/core/BuiltinFunctions.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt
#	compiler/src/prog8/compiler/astprocessing/IntermediateAstPostprocess.kt
#	compiler/test/ast/TestIntermediateAst.kt
2024-10-21 01:08:11 +02:00
Irmen de Jong
a6159702da defers are now only registered/called when flow of control actually reached the defer statement
a defer statement sets its corresponding bit in a bitmask that is shifted in the defer handler routine to see what defer blocks to call.
2024-10-21 00:55:51 +02:00
Irmen de Jong
0247fb0d84 some ast2 var tweaks 2024-10-21 00:20:54 +02:00
Irmen de Jong
db0c77c09e rename 2024-10-19 23:01:41 +02:00
Irmen de Jong
af7cc9c761 Merge branch 'master' into next_compositetypes
# Conflicts:
#	codeCore/src/prog8/code/ast/AstExpressions.kt
#	codeCore/src/prog8/code/core/BuiltinFunctions.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt
#	compiler/test/ast/TestIntermediateAst.kt
2024-10-19 22:45:39 +02:00
Irmen de Jong
9851d14fb9 added if expression: ubyte a = if b>0 44 else 55
it doesn't generate the best code yet, like regular ifs do.
2024-10-19 15:34:04 +02:00
Irmen de Jong
d8f1822c12 fixes 2024-10-18 20:32:46 +02:00
Irmen de Jong
ce7d094adb Zig-like "defer" to clean up stuff when leaving the scope of the current routine. 2024-10-18 01:30:20 +02:00
Irmen de Jong
c218234efe Merge branch 'master' into next_compositetypes
# Conflicts:
#	codeCore/src/prog8/code/SymbolTable.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/ProgramAndVarsGen.kt
#	compiler/test/TestSymbolTable.kt
#	examples/test.p8
#	intermediate/src/prog8/intermediate/IRFileReader.kt
#	intermediate/src/prog8/intermediate/IRSymbolTable.kt
#	intermediate/src/prog8/intermediate/Utils.kt
#	virtualmachine/src/prog8/vm/VmProgramLoader.kt
2024-10-16 22:40:45 +02:00
Irmen de Jong
38ef394e15 IR codegen: global vars with numeric initialization value are now also put into the VARIABLESWITHINIT section rather than requiring explicit code instructions to initialize them in INITGLOBALS.
Note that something similar, such as putting those variables inline in the program initialized with their value and all, cannot be done for the 6502 codegen: the program needs a mechanism to reset ALL variables when it runs a second time.
2024-10-16 22:15:51 +02:00
Irmen de Jong
cbc4b75e50 IR now contains "bool" as a type instead of already erasing it into "ubyte". (boolean literals still are simply just 1 and 0 values) 2024-10-16 01:03:35 +02:00
Irmen de Jong
0f72bdb4a2 Merge branch 'master' into next_compositetypes
# Conflicts:
#	codeCore/src/prog8/code/core/BuiltinFunctions.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt
#	codeGenIntermediate/src/prog8/codegen/intermediate/BuiltinFuncGen.kt
#	codeOptimizers/src/prog8/optimizer/ConstantIdentifierReplacer.kt
#	compiler/src/prog8/compiler/astprocessing/AstChecker.kt
#	compiler/src/prog8/compiler/astprocessing/LiteralsToAutoVars.kt
#	compiler/test/ast/TestAstChecks.kt
2024-10-13 21:48:33 +02:00
Irmen de Jong
e9edffa9f0 remove support for array-to-array assignments (other than initialization of variable declaration)
Just use an explicit sys.memcopy(src, dest, sizeof(dest))  or assign array members individually.
2024-10-13 20:02:43 +02:00
Irmen de Jong
aef211e5f3 stricter array literal element type handling (number,bool,address-of).
More consistent implicit address-of handling if array literals contain by-ref identifiers (such as subroutine names)
2024-10-13 17:46:41 +02:00
Irmen de Jong
fa5479ee5f fix ast printing of arrays with duplicate elements 2024-10-13 04:30:46 +02:00
Irmen de Jong
7afd716fab Merge branch 'master' into next_compositetypes
# Conflicts:
#	codeCore/src/prog8/code/core/BuiltinFunctions.kt
#	compiler/src/prog8/compiler/astprocessing/AstChecker.kt
#	examples/test.p8
2024-10-08 22:58:26 +02:00
Irmen de Jong
eaa22a9d13 added callfar2() builtin function that allows to set A,X,Y and Carry arguments. 2024-10-08 21:36:04 +02:00
Irmen de Jong
5890a1ca1e Merge branch 'master' into next_compositetypes
# Conflicts:
#	examples/test.p8
2024-09-14 23:18:38 +02:00
Irmen de Jong
c7b1e8d772 fixed a variable scopedname issue where it took the fully scoped name instead of just the local name
this made 64tass not strip out that code if it was unused
2024-09-14 23:17:26 +02:00
Irmen de Jong
f45fd517ac fix merge 2024-09-12 23:53:36 +02:00
Irmen de Jong
a737547fe9 Merge branch 'master' into next_compositetypes
# Conflicts:
#	codeCore/src/prog8/code/ast/AstExpressions.kt
#	codeCore/src/prog8/code/optimize/Optimizer.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/ForLoopsAsmGen.kt
#	codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
#	codeGenIntermediate/src/prog8/codegen/intermediate/ExpressionGen.kt
#	codeGenIntermediate/src/prog8/codegen/intermediate/IRCodeGen.kt
#	codeOptimizers/src/prog8/optimizer/StatementOptimizer.kt
#	compiler/src/prog8/compiler/astprocessing/LiteralsToAutoVars.kt
#	compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt
#	docs/source/todo.rst
#	examples/test.p8
2024-09-12 23:32:23 +02:00
Irmen de Jong
255c5bfaca improve containment check for few values 2024-09-11 03:24:30 +02:00
Irmen de Jong
01c6754928 get rid of problematic common-subexpression optimization 2024-09-11 01:10:42 +02:00
Irmen de Jong
8f5d42dbc2 more tests and some cleanups/fixes 2024-09-08 23:01:49 +02:00
Irmen de Jong
759babb4c1 rename back to DataType 2024-09-08 22:59:08 +02:00
Irmen de Jong
a1dfcd07a8 fixing things 2024-09-08 22:58:40 +02:00
Irmen de Jong
5cbf1cd2b1 cleanup imports 2024-09-08 22:58:36 +02:00
Irmen de Jong
c41dc98936 making datatype more capable (subtypes) 2024-09-08 22:58:36 +02:00
Irmen de Jong
e80c22275d making datatype more capable (subtypes) 2024-09-08 22:58:35 +02:00
Irmen de Jong
74e305b90c making datatype more capable (subtypes) 2024-09-08 22:57:49 +02:00
Irmen de Jong
29dd758302 Fix compiler crash in for loops with just 1 iteration 2024-09-05 21:26:46 +02:00
Irmen de Jong
2c2ae64194 replace java Stack by kotlin ArrayDeque 2024-09-02 00:15:28 +02:00
Irmen de Jong
bdeac74cfc removed the -nostrictbool compiler option
boolean types and bytes are no longer implicitly interchangeable using this option
2024-09-01 20:53:39 +02:00
Irmen de Jong
8f6eaeac2c half width katakana conversion 2024-08-21 18:51:34 +02:00
Irmen de Jong
b4facaeb3c add "kata" string encoding (Katakana) 2024-08-20 21:40:43 +02:00
Irmen de Jong
d12b7ccc6b fix syslib importing for raw outputs. fixes #144 2024-08-19 13:33:02 +02:00
Irmen de Jong
c67f877857 Codegen: use BIT instruction for memory location bit 7 and 6 tests (use N and V flags) 2024-07-24 19:26:54 +02:00
Irmen de Jong
3681d6ee1c optimize division by powers of 2 better (into bit shifts) 2024-07-21 21:34:38 +02:00
Irmen de Jong
0af17cdc33 todo's for division optimizations 2024-07-21 20:32:03 +02:00
Irmen de Jong
484677b4b1 Get rid of any() and all() builtin functions.
Replaced by regular subroutines in the anyall module.
2024-07-06 18:49:03 +02:00
Irmen de Jong
25f25a8767 Get rid of sort() and reverse() builtin functions.
Sort() had too many gotchas and reverse() is kinda redundant you can loop in decreasing order through an array too.
2024-07-06 17:07:58 +02:00
Irmen de Jong
4f8aaf9244 some tweaks and todos 2024-06-26 21:22:40 +02:00
Irmen de Jong
c9a4235669 update to kotlin 2.0, fix several code style issues 2024-06-04 01:00:46 +02:00
Irmen de Jong
1feead2260 tweaks 2024-05-29 02:30:06 +02:00
Irmen de Jong
c719e274d5 java version tweaks 2024-05-18 20:25:44 +02:00
Irmen de Jong
4a710ecdfc cleanups 2024-05-17 18:48:04 +02:00