Irmen de Jong
1c55a6c6dc
shortcutting part one
2023-12-30 03:54:12 +01:00
Irmen de Jong
f790182f0b
adding short-circuit boolean expression evaluation (in IR codegen) also -noshortcircuit cli option
2023-12-30 01:08:41 +01:00
Irmen de Jong
9c1b11d605
some WARN messages are now INFO
2023-12-28 14:20:47 +01:00
Irmen de Jong
09c6cb4d6b
replace unwritten vars by consts. Improved const eval.
...
Fixed some slight bugs in library code
2023-12-28 05:17:15 +01:00
Irmen de Jong
2b8f613a00
added %option ignore_unused to suppress warnings about unused vars and subs in that module/block.
...
Also improved error for invalid directive.
2023-12-26 23:37:59 +01:00
Irmen de Jong
2eb137618e
refactor block options
2023-12-26 22:13:08 +01:00
Irmen de Jong
4bb2b8ca9b
make isArray a computed property by simply checking the datatype
2023-12-26 19:58:08 +01:00
Irmen de Jong
0a4de45453
get rid of vardecl.declareddatatype
2023-12-26 19:33:58 +01:00
Irmen de Jong
ffdc658dc8
type error tweaks
2023-12-26 18:49:01 +01:00
Irmen de Jong
0d44492086
push,pushw,pop and popw are no longer built-in functions but regular routines in sys
2023-12-26 14:47:31 +01:00
Irmen de Jong
8ae435549d
added -slabshigh N and -slabsgolden for memory() slabs
2023-12-23 20:45:30 +01:00
Irmen de Jong
9b113c0cbb
added -varsgolden to put BSS into Golden Ram at $0400
2023-12-23 20:11:50 +01:00
Irmen de Jong
0e0fac8c4b
BSSHIGHRAM_END more clearly defined (to be inclusive)
2023-12-23 19:05:06 +01:00
Irmen de Jong
ad9eaeafeb
call
now returns a word value
2023-12-22 22:24:11 +01:00
Irmen de Jong
6bc079c7b7
more asm symbol prefixing: variables with p8v_, subroutines with p8s_ etc
...
labels with p8l_ . All this to avoid symbol clashes in the generated assembly code.
Everything got its own distinguishing prefix so we're done with it once and for all and have only 1 breaking change moment.
2023-12-20 22:20:59 +01:00
Irmen de Jong
69f6afe420
block names in asm now prefixed with p8b_ (instead of p8_)
...
as part of fixing var versus block symbol conflict handling
2023-12-19 23:00:20 +01:00
Irmen de Jong
ae66fcac1e
added call
builtin function for indirect JSR
2023-12-17 15:45:28 +01:00
Irmen de Jong
a8be94de6b
better error message when attempting to cast a float to integer
2023-12-15 22:28:06 +01:00
Irmen de Jong
01c2112881
remove PtJump label, just use identifier with dummy
2023-12-13 04:16:49 +01:00
Irmen de Jong
a546c2247d
optimize if-else handling of asmsub boolean result in status flags
2023-12-13 04:03:21 +01:00
Irmen de Jong
8e4319cd5a
module directive %encoding to set the text encoding for that whole file (iso, petscii, etc.)
2023-12-06 23:54:08 +01:00
Irmen de Jong
f998888d6d
fix some unicode identifier issues
2023-12-05 17:38:23 +01:00
Irmen de Jong
c609e982fe
allow const expression intermediate values to be 32 bits integers to avoid needless overflow errors.
2023-12-03 01:48:12 +01:00
Irmen de Jong
ead8c59bda
allow all character encodings on all compilation targets.
2023-12-02 20:59:50 +01:00
Irmen de Jong
ae2d96c455
added peekf
and pokef
builtin functions. Fixed sizeof() to allow number argument as well.
2023-11-27 23:36:02 +01:00
Irmen de Jong
af5ca2d0b8
vm: treat floats as 64 bits doubles. 0.0 printed as "0".
2023-11-21 00:57:56 +01:00
Irmen de Jong
76c09da961
make pokemon() be like poke, but also return the old value in the memory location.
2023-11-09 22:48:44 +01:00
Irmen de Jong
f68b46fc60
add a %zpallowed option to specify the range of zeropage register that can be used
2023-11-03 00:19:25 +01:00
Irmen de Jong
16b24fadea
gfx2 future mode, upgrate to Kotlin 1.9.20
2023-11-01 23:18:44 +01:00
Irmen de Jong
0904712a00
remove last trace of getTempVar (arry index expression)
...
tiny optimization
2023-10-27 21:41:52 +02:00
Irmen de Jong
daca87c6d0
added -breakinstr compiler option
2023-10-15 21:55:09 +02:00
Irmen de Jong
a48ce35f0b
added %option verafxmuls
2023-10-05 22:06:33 +02:00
Irmen de Jong
b7a622c68e
fix alignment of uninitialized arrays in aligned blocks (make them initialized with zeros so they don't end up in the BSS section)
...
fix alignment of uninitialized arrays in aligned blocks (make them initialized with zeros so they don't end up in the BSS section)
2023-10-04 00:12:36 +02:00
Irmen de Jong
a289b32053
Revert "added -verafxmul compiler option to use vera fx multiplication routine on cx16"
...
This reverts commit 690782bf
.
It was too risky, using vera (especially fx) transparently in multiple places especially perhaps in IRQ handlers will create havoc unless much intricate care is taken to save/restore the vera state. Better to do vera fx explicitly where the programmer has full control.
2023-10-02 21:08:52 +02:00
Irmen de Jong
690782bf60
added -verafxmul compiler option to use vera fx multiplication routine on cx16
2023-10-01 22:44:45 +02:00
Irmen de Jong
755cc4835e
\n (newline) now also maps to Petscii $0d (return), like \r.
...
It used to map to $8d (shift-return)
2023-09-29 01:49:15 +02:00
Irmen de Jong
a684ea46e4
fix c64 zp test and improve error for text encoding problem
2023-09-29 01:25:05 +02:00
Irmen de Jong
8fbe13f99d
c64: $a5 removed from free ZP (it's actually used by kernal disk routines)
2023-09-29 00:28:04 +02:00
Irmen de Jong
880c0a5da8
allow taking address of array element
2023-09-18 04:37:41 +02:00
Irmen de Jong
95e4490a8a
adding setlsb() and setmsb() builtin functions
2023-09-15 02:39:16 +02:00
Irmen de Jong
6afdd4e6fd
preparing next version
2023-09-12 21:53:49 +02:00
Irmen de Jong
3caf9108ad
finalizing 9.4.1 release
2023-09-06 21:18:01 +02:00
Irmen de Jong
ff35ba3696
added warnshadow cli option to enable assembler warnings about symbol shadowing
2023-08-28 16:41:46 +02:00
Irmen de Jong
2c9e50873c
use math.square for optimized X*X calculation (words only).
...
Added IR SQUARE instruction.
2023-08-14 01:05:17 +02:00
Irmen de Jong
151a206617
experimental Commodore PET target
2023-08-12 23:25:07 +02:00
Irmen de Jong
a4d093afa1
added -sourcelines cli option to include src lines in generated assembly (which is now off by default)
2023-08-02 23:05:24 +02:00
Irmen de Jong
ba788bcf0f
put the original p8 source lines into the generated assembly as comments (not only the line numbers).
2023-08-02 02:18:13 +02:00
Irmen de Jong
1ae950a638
Merge branch 'remove_evalstack'
...
# Conflicts:
# codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
2023-07-31 21:57:43 +02:00
Irmen de Jong
9bb16e293c
vm: fix postincr/decr on indexed pointervariables
2023-07-31 19:37:30 +02:00
Irmen de Jong
c223702ea0
code cleanups
2023-07-30 18:42:45 +02:00
Irmen de Jong
fea297e409
cleanup some compilation warnings
2023-07-22 23:44:26 +02:00
Irmen de Jong
e2bb0de24d
clean up X register save/store in compiler code, remove temp vars for register saving
2023-07-15 22:25:58 +02:00
Irmen de Jong
6033a9e20c
remove optfloatx option
2023-07-15 22:24:22 +02:00
Irmen de Jong
84925ab69c
remove eval stack options
2023-07-15 22:24:19 +02:00
Irmen de Jong
3126959576
ir: several fixes
2023-07-07 16:53:32 +02:00
Irmen de Jong
70c9ab9074
upgrade libraries
2023-07-06 23:33:58 +02:00
Irmen de Jong
6d1fdf1ba6
upgrade to Kotlin 1.9.0
2023-07-06 23:03:47 +02:00
Irmen de Jong
204f5591a9
todos
2023-07-03 21:57:32 +02:00
Irmen de Jong
bdf8aa9168
get rid of newexpr compiler option
2023-07-02 15:26:04 +02:00
Irmen de Jong
bb95484c8a
uniform symbol prefixing with p8_
2023-07-02 06:15:09 +02:00
Irmen de Jong
cad18b8a3a
uniform symbol prefixing with p8_
2023-07-02 06:15:02 +02:00
Irmen de Jong
b0794cf35e
added hiram bank number to -varshigh
2023-06-27 00:27:34 +02:00
Irmen de Jong
eae41de27d
improve errors generated for undefined symbols
2023-06-25 15:19:51 +02:00
Irmen de Jong
b9d8ec1463
add -splitarrays command line option
2023-05-30 19:08:34 +02:00
Irmen de Jong
1842a7660d
fix compiler crash on missing arguments for clamp,min,max
2023-05-30 18:13:58 +02:00
Irmen de Jong
bbc02752c9
use split word arrays in various examples, fix codegen issue, docs
2023-05-29 15:34:33 +02:00
Irmen de Jong
c94e292176
more split array stuff
2023-05-27 12:47:11 +02:00
Irmen de Jong
52a77db60f
adding split array type
2023-05-26 19:11:07 +02:00
Irmen de Jong
91e1643627
update 3rd party libraries
2023-05-18 11:47:30 +02:00
Irmen de Jong
b43223cb7a
added clamp() builtin function and floats.clampf()
2023-05-17 23:12:58 +02:00
Irmen de Jong
85cf0e311c
Merge branch 'master' into version_9
...
# Conflicts:
# codeGenIntermediate/src/prog8/codegen/intermediate/ExpressionGen.kt
# docs/source/todo.rst
# intermediate/src/prog8/intermediate/IRInstructions.kt
2023-05-14 20:47:09 +02:00
Irmen de Jong
630c8a5faa
IR: fix romsub encoding
2023-05-14 18:08:06 +02:00
Irmen de Jong
1e469b3b0f
Merge branch 'master' into version_9
...
# Conflicts:
# docs/source/todo.rst
# examples/test.p8
2023-05-09 22:45:21 +02:00
Irmen de Jong
bff3c4f95c
IR now converts IRInlineAsmChunk (of type IR) into regular code chunks directly.
...
.p8ir files usually won't contain <INLINEASM> nodes any longer
2023-05-09 21:04:31 +02:00
Irmen de Jong
92062d056d
divmod() now works on multiple data types including float.
...
divmodw() has been removed
2023-05-02 01:19:53 +02:00
Irmen de Jong
06368ab0a1
sqrt() now works on multiple data types including float.
...
no need to use floats.sqrtf() anymore
2023-05-02 01:19:53 +02:00
Irmen de Jong
38efe25c68
abs() now works on multiple data types including float.
...
no need to use floats.fabs() anymore
2023-05-02 01:19:53 +02:00
Irmen de Jong
319079de7a
sqrt
2023-05-02 01:19:53 +02:00
Irmen de Jong
025bf900a5
min max docs, added floats.minf() and maxf()
2023-05-02 01:19:53 +02:00
Irmen de Jong
c07eda15b1
adding min() and max()
2023-05-02 01:19:53 +02:00
Irmen de Jong
76a203d4df
api change: rename builtin func sqrt16 to sqrtw
2023-05-02 01:19:53 +02:00
Irmen de Jong
3f64782023
c128: remove floats module
2023-04-28 17:48:54 +02:00
Irmen de Jong
f8d35f9502
c128: no FP support
2023-04-28 17:43:42 +02:00
Irmen de Jong
ea78d3ec9a
c128: better ZP definition
2023-04-28 17:08:56 +02:00
Irmen de Jong
c3d74f2ae9
fix golden ram area for x16, remove romsub restriction
...
note: romsubs still won't work in the VM but at least they compile again
2023-04-08 00:40:52 +02:00
Irmen de Jong
f47498888c
optimize imports
2023-04-07 22:34:23 +02:00
Irmen de Jong
2d85fd093e
Merge branch 'new-expr-codegen'
...
# Conflicts:
# codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt
# codeGenIntermediate/src/prog8/codegen/intermediate/BuiltinFuncGen.kt
# examples/test.p8
2023-03-29 23:56:16 +02:00
Irmen de Jong
d936568b76
added divmod()
and divmodw()
builtin functions to efficiently compute division and remainder in a single call
2023-03-29 23:46:44 +02:00
Irmen de Jong
729209574e
fixing str compares codegen
2023-03-28 20:01:26 +02:00
Irmen de Jong
f28206d989
new attempt
2023-03-28 20:01:26 +02:00
Irmen de Jong
629ed74d09
got rid of rpn deadend code...
2023-03-25 18:45:17 +01:00
Irmen de Jong
01461a196d
implementing optimized comparisons
2023-03-25 00:08:21 +01:00
Irmen de Jong
266f6ab919
check
2023-03-22 20:15:24 +01:00
Irmen de Jong
134fd62da8
RPN: better handling of bit shifts
2023-03-21 02:58:26 +01:00
Irmen de Jong
d265271148
fix rpn variable depth clobber and type error
2023-03-20 22:18:10 +01:00
Irmen de Jong
df2d7d4734
fix RPN comparison exprs
2023-03-19 16:08:48 +01:00
Irmen de Jong
374464a1f8
weird condition operator...
2023-03-19 01:32:20 +01:00
Irmen de Jong
6e4ae034b2
more Rpn optimizations
2023-03-19 00:48:12 +01:00
Irmen de Jong
52b560e72d
more Rpn optimizations
2023-03-18 19:13:32 +01:00
Irmen de Jong
7b802bfd3d
Merge branch 'master' into rpn-expressions
...
# Conflicts:
# codeGenCpu6502/src/prog8/codegen/cpu6502/AsmGen.kt
2023-03-18 13:39:14 +01:00
Irmen de Jong
f9c4632b8d
c64: remove 2 problematic ZP locations from the free list when using floating point
2023-03-18 13:36:19 +01:00
Irmen de Jong
94c06e13f4
implementing Rpn optimizations 2
2023-03-18 12:43:45 +01:00
Irmen de Jong
5b0e1b4f9e
a little rpn refactor
2023-03-17 23:04:56 +01:00
Irmen de Jong
8c0a93779b
added first implementation of RPN 6502 codegen - all via stackeval still
2023-03-17 22:28:22 +01:00
Irmen de Jong
9241479da4
add "-rpn" command line switch to transform exprs to RPN in codegen
2023-03-17 22:28:22 +01:00
Irmen de Jong
8ffca93cd5
added transform routine for expr -> RPN
2023-03-17 22:28:22 +01:00
Irmen de Jong
7fea0c124a
introduce PtRpn node to replace PtBinaryExpression later
2023-03-17 22:28:22 +01:00
Irmen de Jong
44676756ae
don't print weird position link for library files
2023-03-17 00:50:17 +01:00
Irmen de Jong
b399b0f182
don't print weird position link for dummy positions
2023-03-16 23:37:33 +01:00
Irmen de Jong
e2c101206c
removed a problematic asm optimization step that could result in dysfunctional code when writing to I/O addresses
2023-03-14 22:14:48 +01:00
Irmen de Jong
48fed4e6fb
slight tweak to codegenerator backend interface
2023-03-08 00:14:38 +01:00
Irmen de Jong
fd07ae5225
fix various IR file and symboltable issues
2023-03-07 19:40:11 +01:00
Irmen de Jong
448d176c24
fix vm crash on empty string
2023-03-04 15:35:54 +01:00
Irmen de Jong
3114ab87dc
add 8 bit sample width support
2023-03-03 17:12:44 +01:00
Irmen de Jong
d282a2d846
remove cx16.callrom()
just use callfar
2023-02-23 23:02:56 +01:00
Irmen de Jong
ba9268a09e
added -varshigh
compiler option to move BSS section.
...
Documented BSS a bit in the manual.
2023-02-22 22:44:29 +01:00
Irmen de Jong
5318ba6c6e
shrink evalstack from 2 to 1 page
...
c64=$cf00-$cfff, x16: $0700-$07ff
2023-02-21 22:52:04 +01:00
Irmen de Jong
435b9d8973
get rid of 'noreinit' option for now, because it resulted in unreliable code
2023-02-20 23:29:16 +01:00
Irmen de Jong
c3c82282ba
reinitGlobals option is clearer than the inverse
2023-02-19 19:09:29 +01:00
Irmen de Jong
dddf9a9396
remove explicit 'bss' from St var, changed to 'uninitialized'
2023-02-19 16:50:06 +01:00
Irmen de Jong
aaf375a57b
move some utility methods into Pt Ast nodes itself
2023-02-16 22:45:35 +01:00
Irmen de Jong
3cce985f03
check float bits
2023-02-16 22:22:12 +01:00
Irmen de Jong
c59df6ec20
optimize isZpVar
2023-02-16 00:41:20 +01:00
Irmen de Jong
5c3f41f64d
reintroduce explicit PtAugmentedAssign ast node
2023-02-15 22:54:32 +01:00
Irmen de Jong
0cbc56b82e
remove unused ast print func
2023-02-13 00:19:48 +01:00
Irmen de Jong
b95608f68a
new common ICodeGeneratorBackend interface for all code generator classes
2023-02-12 23:52:54 +01:00
Irmen de Jong
75d486b124
fix variable node casting
2023-02-12 17:04:58 +01:00
Irmen de Jong
4914609485
local varnames and fix uninitialized parents
2023-02-12 16:00:58 +01:00
Irmen de Jong
75bd66326a
fix variable zpwish
2023-02-11 15:18:57 +01:00
Irmen de Jong
ed68d604d6
fix break as indirect jump
...
fix subroutine param scoped name
2023-02-11 01:21:27 +01:00
Irmen de Jong
30d20a453b
tweak SymbolTable and fix its unittest
2023-02-09 22:58:21 +01:00
Irmen de Jong
fe29d8a23f
tweak codegen of inline sub
2023-02-09 21:59:09 +01:00
Irmen de Jong
694d088160
some cleanups about asmsub return registers and types
2023-02-09 03:19:57 +01:00
Irmen de Jong
6aabbffc62
some cleanups
2023-02-09 02:34:18 +01:00
Irmen de Jong
623329fb33
fix
2023-02-05 17:08:24 +01:00
Irmen de Jong
9f0074eef9
Merge branch 'master' into codegen-on-new-ast
...
# Conflicts:
# codeCore/src/prog8/code/ast/AstStatements.kt
2023-02-05 16:44:30 +01:00
Irmen de Jong
6733253826
added printer for Pt Ast tree
2023-02-05 16:42:06 +01:00
Irmen de Jong
c75b1581d2
lookup via new ST
2023-02-05 01:15:23 +01:00
Irmen de Jong
988a3e4446
group the three Pt nodes that represent a variable in the p8 source under single interface IPtVariable
2023-01-31 23:29:15 +01:00
Irmen de Jong
0f5cd22bb7
more codegen fixes
2023-01-31 22:57:26 +01:00
Irmen de Jong
5b6534bb28
fix symbol lookup in new ast and minor codegen errors
2023-01-31 00:18:21 +01:00
Irmen de Jong
07d5fafe2e
Merge branch 'master' into codegen-on-new-ast
...
# Conflicts:
# compiler/src/prog8/compiler/astprocessing/IntermediateAstMaker.kt
2023-01-29 13:34:00 +01:00
Irmen de Jong
e08da659e5
got rid of PtScopeVarsDecls node, just insert variable nodes directly
2023-01-29 13:25:15 +01:00
Irmen de Jong
8a4979f44c
vm target 'zeropage' more robust
2023-01-29 12:47:12 +01:00
Irmen de Jong
117d848466
consolidate builtin function definitions into codeCore
2023-01-25 00:23:00 +01:00
Irmen de Jong
b2cb125bd4
more 6502 codegen on new Pt-AST.
2023-01-22 17:10:52 +01:00
Irmen de Jong
5e8f767642
6502 codegen on new Pt-AST.
2023-01-22 17:10:52 +01:00
Irmen de Jong
6ee270d9d8
make name a var in new ast to allow cheap renames
2023-01-22 17:10:04 +01:00
Irmen de Jong
3718b9d768
less joins
2023-01-02 02:10:38 +01:00
Irmen de Jong
c25eb088ec
redo 8e730ef93d
to avoid larger code generated
2023-01-01 23:43:33 +01:00