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
326eab3dd1
unit test for defer, describe defer and if expression in docs
2024-10-22 22:19:49 +02:00
Irmen de Jong
7585b6ef6f
fix issues with calling the defer handler
2024-10-21 19:49:38 +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
6de760885f
fix defer push/pop typecasting issues
2024-10-19 21:45:49 +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
a40d120f2a
more defer sanity checks
2024-10-18 22:32:49 +02:00
Irmen de Jong
fcdd9414d9
fix defer interfering with return value, fix prefix expression error when operand is functioncall that doesn't return a value.
2024-10-18 21:43:09 +02:00
Irmen de Jong
2a52241f1c
defer is now done *after* calculating a return value
2024-10-18 20:56:27 +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
a0cf1889a3
omit more redundant 0-initializations ("stz's")
2024-10-17 22:51:39 +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
abbf7c7cb0
compiler name change: prog8c (was p8compile)
...
fat jar file also changed: prog8c-X.Y-all.jar (was: prog8compiler-X.Y-all.jar)
2024-10-16 18:36:19 +02:00
Irmen de Jong
ca5f7ae32f
global (block-level) variables that get initialized with an array index expression now get a constant value as well if possible. This reduces the number of instructions in the init globals code block
2024-10-16 02:14:19 +02:00
Irmen de Jong
65ddcf91d0
remove unused syscalls
2024-10-15 18:24:55 +02:00
Irmen de Jong
e17fafb364
fixes after merge
2024-10-13 22:19:34 +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
5280e1b449
err msgs
2024-10-13 21:33:13 +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
66829203d8
New [x]*42 syntax to create array literals with repeated values (like "abc"*10 already exists for strings)
...
Should be used in place of array initializer expressions that contain only a single numeric value to initialize the whole array with. That isn't supported anymore.
2024-10-13 05:16:08 +02:00
Irmen de Jong
7a0eaf3148
Remove array initialization by single value.
...
New compiler and kotlin version.
2024-10-13 04:31:56 +02:00
Irmen de Jong
03412cacba
added examples/cx16/balloonflight.p8
2024-10-13 00:51:07 +02:00
Irmen de Jong
4f2b068438
Merge branch 'master' into next_compositetypes
2024-10-12 17:40:20 +02:00
Irmen de Jong
fb23452383
optimize monogfx.fill()
2024-10-12 17:18:00 +02:00
Irmen de Jong
ba6db8f905
Merge branch 'master' into next_compositetypes
...
# Conflicts:
# compiler/src/prog8/compiler/astprocessing/AstChecker.kt
# compiler/src/prog8/compiler/astprocessing/StatementReorderer.kt
# compiler/src/prog8/compiler/astprocessing/VariousCleanups.kt
# compiler/test/TestSubroutines.kt
2024-10-12 13:40:39 +02:00
Irmen de Jong
ab7dde1450
todo
2024-10-12 13:04:19 +02:00
Irmen de Jong
8d9bc2f5ff
fixing all sorts of things about assigning arrays to arrays
2024-10-12 12:33:46 +02:00
Irmen de Jong
7651ccc84e
fix a type error
2024-10-11 00:50:05 +02:00
Irmen de Jong
1a6b95b388
house cleaning
2024-10-10 20:46:18 +02:00
Irmen de Jong
3d76240c84
Merge branch 'master' into next_compositetypes
...
# Conflicts:
# compiler/test/TestNumericLiteral.kt
# compilerAst/src/prog8/ast/expressions/AstExpressions.kt
# docs/source/todo.rst
2024-10-09 23:33:42 +02:00
Irmen de Jong
7e38d26c33
added several color fade functions to the palette module (cx16)
2024-10-09 21:48:04 +02:00
Irmen de Jong
ed09dd4e9e
improve automatic type conversions for return values, fixes #155
2024-10-09 20:04:05 +02:00
Irmen de Jong
d217d4ab01
Merge branch 'master' into next_compositetypes
...
# Conflicts:
# compiler/src/prog8/compiler/astprocessing/AstChecker.kt
# compiler/src/prog8/compiler/astprocessing/StatementReorderer.kt
# examples/test.p8
2024-10-09 00:58:44 +02:00
Irmen de Jong
5731b79554
don't allow problematic string and array assignments anymore, improve error messages.
...
In certain cases you will need to use string.copy() explicitly to overwrite strings with new strings.
2024-10-09 00:51:05 +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
b2bdfe8482
fix ir rndseed()
2024-10-08 20:40:00 +02:00
Irmen de Jong
fea531be9a
add sys.sizeof_bool, _ubyte, _uword constants
2024-10-07 20:45:13 +02:00
Irmen de Jong
7c69d38588
scan all asmsubs to see if another subroutine is referenced. Fixes #153
2024-10-07 20:39:49 +02:00
Irmen de Jong
a088ee56b0
function inlining can no longer get into an infinite loop. Fixes #154
2024-10-07 19:58:04 +02:00
Irmen de Jong
ae669af904
add sys.sizeof_byte, _word, _float constants
...
because Antlr doesn't allow the grammar to contain a sizeof(typename) rule to override the sizeof(identifier) rule
2024-10-07 19:17:37 +02:00
Irmen de Jong
d1ddf05e38
check that block address leaves room for program startup logic
2024-10-03 22:30:06 +02:00