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
Irmen de Jong
3feb3e52f8
optimizing scoped names in zeropage
2022-12-31 03:57:51 +01:00
Irmen de Jong
8e730ef93d
optimizing scoped names more and fix scoping of identifier names in arrays (pointers) in SymbolTable
2022-12-31 03:20:20 +01:00
Irmen de Jong
e0913a39ab
optimizing
2022-12-30 18:50:45 +01:00
Irmen de Jong
d1d0115aed
removed unused option 'keepIR'
2022-12-09 18:44:44 +01:00
Irmen de Jong
17bedac96c
vm: memory is randomized on start instead of 0. P8ir file now has BSS segment. Vm clears BSS vars to 0.
2022-12-03 17:46:06 +01:00
Irmen de Jong
4831fad27a
x16 emulators are now launched with PULSE_LATENCY_MSEC=10 env setting to mitigate static noise
2022-12-03 16:19:26 +01:00
Irmen de Jong
5e896cf582
preparing to add Golden RAM
2022-12-03 00:21:31 +01:00
Irmen de Jong
f470576822
it's now possible to use symbols that are the same name as 6502 instructions
...
because these are now prefixed internally before generating assembly.
2022-11-30 18:39:56 +01:00
Irmen de Jong
b8fb391022
- ir codegen now allows subroutine having the same name as its block
...
this is not possible for the 6502 codegen due to 64tass scoping limitation
2022-11-28 21:54:33 +01:00
Irmen de Jong
9d7b9771c2
p8ir file format is now valid XML
2022-11-11 23:35:52 +01:00
Irmen de Jong
30ee65fd14
ir: ensure that block and sub labels are also on the first chunk in said block/sub
2022-10-23 18:54:08 +02:00
Irmen de Jong
6fc89607d3
ir: moving to labeled chunks, no more IRLabel nodes
2022-10-07 00:34:56 +02:00
Irmen de Jong
af6be44676
ir: adding register usage inspections
...
fix compiler problems with untrimmed inlined asm, and when only a single return statement is present in a subroutine
2022-09-30 20:25:00 +02:00
Irmen de Jong
0d4dd385b8
added '%ir' to write inline IR code, '%asm' is now only for real 6502 assembly.
...
(%ir is probably only used in the library modules for the virtual machine target)
2022-09-30 15:12:26 +02:00
Irmen de Jong
7c1bdfe713
ir: uninitialized vars remain empty, bss section classifier (unused for now as there are no segements yet)
2022-09-28 16:56:50 +02:00
Irmen de Jong
7ea7e63f44
use require() more often
2022-09-27 18:27:55 +02:00
Irmen de Jong
0da117efd2
vm: get rid of .p8virt file and cruft
2022-09-26 19:28:40 +02:00
Irmen de Jong
1d65d63bd9
ir: making sure all names are scoped properly. textelite now runs in vm
2022-09-25 18:02:35 +02:00
Irmen de Jong
0e1886e6bd
vm: fix nested label prefixing
2022-09-24 16:00:25 +02:00