Irmen de Jong
23a8bebd9e
fix invalid addressing mode on 6502 cpu for bytevalue +/- bytearray[i]
2023-09-07 21:40:07 +02:00
Irmen de Jong
3caf9108ad
finalizing 9.4.1 release
2023-09-06 21:18:01 +02:00
Irmen de Jong
b570bdaed7
fix codegen for array[i] += float expression
2023-09-05 22:38:52 +02:00
Irmen de Jong
8c0843cc87
fix an invalid 6502 instruction on c64 in certain float assignment
2023-09-05 21:54:52 +02:00
Irmen de Jong
eb018ae660
code optimization for bytearray[x] +/- bytearray[y]
...
use adc array,y or sbc array,y instead of tempvar
2023-09-04 23:01:53 +02:00
Irmen de Jong
c3fbdf34ca
fixed c64 float problem
2023-09-03 16:40:10 +02:00
Irmen de Jong
48bd51e1a5
c64 float problem
2023-09-03 16:29:01 +02:00
Irmen de Jong
10d0b03a90
use less tempvars
2023-09-03 01:32:47 +02:00
Irmen de Jong
e1b3582f08
fix wordvar -= @(memory)
2023-09-03 01:12:26 +02:00
Irmen de Jong
95be1c9e22
fix optimized swapped in-place byte comparisons
2023-09-03 00:47:55 +02:00
Irmen de Jong
1ce8fe06d5
fix in-place <= for bytes
2023-09-03 00:01:11 +02:00
Irmen de Jong
e97303c226
fix word multiplication to not clobber r0 and r1 anymore
...
This was causing corruption in certain programs such as the cx16/amiga example.
The problem was introduced in 9.4 with the new multiply_words routine
2023-09-02 20:52:16 +02:00
Irmen de Jong
3b786c819d
avoid using temp var even more
2023-09-01 23:47:01 +02:00
Irmen de Jong
04959dbd8b
optimize asm: don't use temp var for some additions
2023-09-01 22:24:17 +02:00
Irmen de Jong
f14ea1b3de
micro optimization to save 2 cycles: change some pha+pla into tax+txa
2023-09-01 20:37:24 +02:00
Irmen de Jong
09a7a4bbe5
optimize comparison against zero
2023-09-01 02:28:11 +02:00
Irmen de Jong
aa4d23a3d5
fix register stack saving on certain expression code that was broken on 6502 but not on 65c02
2023-08-29 11:50:35 +02:00
Irmen de Jong
bad9dd3b3b
mention shadowing warnings from assembler
2023-08-28 16:55:28 +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
75514fc7af
fix some invalid instructions on 6502 (instead of 65c02) target for bit shifts
2023-08-14 21:58:26 +02:00
Irmen de Jong
bc8126eb16
2x faster word multiplication routine
2023-08-14 18:11:30 +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
e3fbe37f9f
fixed optimized code for >= and <=
2023-08-12 13:45:08 +02:00
Irmen de Jong
dc870cd5ea
fixed optimized code for > and <
2023-08-12 13:15:32 +02:00
Irmen de Jong
584be44743
fix compiler error on float comparison expressions
2023-08-12 00:09:38 +02:00
Irmen de Jong
7c0bde7310
parser: allow curly brace on next line for asmsub too
...
downgrade antlr4 one version again to what is used in IntelliJ's antlr plugin, to avoid potential version conflicts
2023-08-09 20:01:12 +02:00
Irmen de Jong
017ef8a837
optimization of > and <= in expressions
2023-08-07 21:23:31 +02:00
Irmen de Jong
0d63cdcb96
optimization of < and >= in expressions
2023-08-07 04:54:35 +02:00
Irmen de Jong
68a6f99c9f
optimization of < in expressions
2023-08-07 02:32:07 +02:00
Irmen de Jong
60781bcfc4
optimization of == and != in expressions
2023-08-07 01:25:41 +02:00
Irmen de Jong
77fa2e2722
optimization in + or - assignment to word array
2023-08-05 23:28:40 +02:00
Irmen de Jong
c36afd872e
optimization in assignment to memory
2023-08-04 23:54:11 +02:00
Irmen de Jong
7e58a4c130
optimization in assignment to array
2023-08-04 23:06:55 +02:00
Irmen de Jong
19a4bf1088
clean up AugmentableAssignmentAsmGen a bit
2023-08-04 21:48:02 +02:00
Irmen de Jong
9678bbae4b
dedup
2023-08-02 23:19:52 +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
f2c62bee7e
docs
2023-08-01 22:49:55 +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
c9385e93fe
fix postincr/decr on indexed pointervariables
2023-07-31 20:13:49 +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
0cba736446
Merge branch 'master' into remove_evalstack
2023-07-30 14:53:40 +02:00
Irmen de Jong
0816a57032
never add rts to inline asmsubs and always inline them regardless of optimization setting
...
otherwise they can't specify a sequence of assembly instructions that should be inserted in-place, such as those that manipulate the cpu stack.
for instance cx16.irqsafe_set_irqd() / cx16.irqsafe_clear_irqd()
2023-07-30 14:52:37 +02:00
Irmen de Jong
6cda76a116
comments
2023-07-29 17:32:27 +02:00
Irmen de Jong
46c12a8899
fix byte in array assignment,
...
remove no longer needed array assignment ast transformation
2023-07-28 22:40:06 +02:00
Irmen de Jong
c5219dfb3f
fix assignment of register into byte array
2023-07-28 22:16:01 +02:00
Irmen de Jong
e1b6bb154a
Merge branch 'master' into remove_evalstack
...
# Conflicts:
# compiler/res/prog8lib/cx16/gfx2.p8
# docs/source/todo.rst
# examples/test.p8
2023-07-28 02:09:45 +02:00
Irmen de Jong
2f756f1e3a
fix and optimize inplace invert and negate
2023-07-24 23:28:32 +02:00
Irmen de Jong
fea297e409
cleanup some compilation warnings
2023-07-22 23:44:26 +02:00
Irmen de Jong
70ed2b4203
fix compilation of large bitshifts
2023-07-22 23:08:22 +02:00
Irmen de Jong
d5707b7bf3
rebuilding floating point stack evaluation (using cpu stack)
2023-07-20 00:45:04 +02:00
Irmen de Jong
9f247901d4
Merge branch 'master' into remove_evalstack
...
# Conflicts:
# codeGenCpu6502/src/prog8/codegen/cpu6502/BuiltinFunctionsAsmGen.kt
# codeGenCpu6502/src/prog8/codegen/cpu6502/assignment/AssignmentAsmGen.kt
# compiler/src/prog8/buildversion/BuildVersion.kt
# examples/test.p8
2023-07-16 23:45:04 +02:00
Irmen de Jong
5659742d97
fixed assigning byte to word not clearing msb sometimes
2023-07-16 23:16:32 +02:00
Irmen de Jong
450eaf7c4a
fixed lsb() to uword problem
2023-07-16 20:05:59 +02:00
Irmen de Jong
47485e4b49
added more missing codegen for bit shifts
2023-07-16 17:42:10 +02:00
Irmen de Jong
64254e758d
cleaned up cx16 keyboardhandler example and some compiler warnings for redundant else
2023-07-16 13:23:53 +02:00
Irmen de Jong
ab8173637a
remove redundant asm optimizer
2023-07-16 11:15:28 +02:00
Irmen de Jong
3841cef497
implemented missing bitshift codegen (non-stack)
2023-07-15 22:26:56 +02:00
Irmen de Jong
b717f1c7eb
little refactor of huge if statement
2023-07-15 22:26:56 +02:00
Irmen de Jong
da57f76de3
fix augassign
2023-07-15 22:26:56 +02:00
Irmen de Jong
41af63b333
remove even more X register save/restore code
2023-07-15 22:26:54 +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
b791fae9ce
remove stack based ExpressionAsmGen
2023-07-15 22:24:22 +02:00
Irmen de Jong
708e296774
remove eval stack assignment source and targets
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
b3cb9b7fe2
added optimizer to remove needless pha/pla pairs
2023-07-15 22:19:48 +02:00
Irmen de Jong
6b6427492d
fix forloop 6502 codegen in case of descending word values
2023-07-10 23:10:16 +02:00
Irmen de Jong
fc8955941b
slight optimization for certain word multiplications
2023-07-07 21:30:37 +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
1f7180d9a8
math.multiply_words returns lower 16 bits of the result also in AY (to avoid repeating some load instructions)
2023-07-06 22:54:13 +02:00
Irmen de Jong
c544b7f5ba
fixing up p8_ prefixing
2023-07-02 21:15:05 +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
aac5a4c27f
optimize word repeat loop codegen
2023-07-02 04:51:22 +02:00
Irmen de Jong
04da44eb98
fix certain inefficient codegen when assigning a type casted value
2023-06-29 22:56:26 +02:00
Irmen de Jong
c9ef777e0f
fix rest of possible temp variable conflicts
2023-06-28 23:24:48 +02:00
Irmen de Jong
30c531b39e
attempting to fix array expression inplace assign
2023-06-28 00:38:08 +02:00
Irmen de Jong
a9f5dc036c
fix cpu stack corruption in array assignment codegen
2023-06-27 18:49:49 +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
c6b2639ca4
fix compiler crash due to missing 6502 codegen
...
(assigning a direct memory read byte to a cx16 virtual register)
2023-06-14 21:10:01 +02:00
Irmen de Jong
ea6926e57d
fix float expression crash: fl = abs/sqrt (fl)+0.5
2023-06-09 19:28:34 +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
9896bc110e
fix some split array issues in 6502 codegen
2023-05-28 22:49:33 +02:00
Irmen de Jong
82898f7bba
fix some split array issues in 6502 codegen
2023-05-28 22:24:56 +02:00
Irmen de Jong
d61283a8bc
Merge branch 'master' into split-arrays
2023-05-28 14:25:37 +02:00
Irmen de Jong
1ee3f826cc
fix sqrt() regression
2023-05-28 14:23:47 +02:00
Irmen de Jong
3ac9036c79
more split array stuff for 6502
2023-05-27 22:44:45 +02:00
Irmen de Jong
c94e292176
more split array stuff
2023-05-27 12:47:11 +02:00
Irmen de Jong
e18119e24c
Merge branch 'master' into split-arrays
2023-05-26 19:25:57 +02:00
Irmen de Jong
52a77db60f
adding split array type
2023-05-26 19:11:07 +02:00
Irmen de Jong
0513c250fb
Merge branch 'v8_maintenance'
2023-05-23 20:42:51 +02:00
Irmen de Jong
48864ad6cf
add a unit test that checks for 64tass availability
2023-05-23 20:42:36 +02:00
Irmen de Jong
061617122a
Merge branch 'v8_maintenance'
...
# Conflicts:
# examples/test.p8
2023-05-20 18:07:57 +02:00
Irmen de Jong
125ce3240f
expr operands assignment refactor
2023-05-20 18:04:46 +02:00
Irmen de Jong
7215efe167
fix expr eval error in certain situations
...
such as pokew() with 2 complex operands
2023-05-20 17:42:35 +02:00
Irmen de Jong
91e1643627
update 3rd party libraries
2023-05-18 11:47:30 +02:00
Irmen de Jong
dcba4f4098
fix resultregister crash
2023-05-18 00:00:37 +02:00
Irmen de Jong
b43223cb7a
added clamp() builtin function and floats.clampf()
2023-05-17 23:12:58 +02:00
Irmen de Jong
f37f062cdc
fix for loop pre-check
2023-05-17 00:33:55 +02:00
Irmen de Jong
bd2bcb6994
Merge branch 'master' into version_9
...
# Conflicts:
# codeGenIntermediate/src/prog8/codegen/intermediate/AssignmentGen.kt
# compiler/res/prog8lib/c128/syslib.p8
# compiler/res/prog8lib/c64/syslib.p8
# compiler/res/prog8lib/cx16/syslib.p8
# docs/source/todo.rst
# examples/test.p8
# intermediate/src/prog8/intermediate/IRInstructions.kt
2023-05-08 23:17:52 +02:00
Irmen de Jong
4c8898a639
fix typecheck crash on certain byte to word assignments
2023-05-08 23:02:48 +02:00
Irmen de Jong
ef46fb2685
refactor
2023-05-08 21:51:55 +02:00
Irmen de Jong
d5d6dd3614
optimize typecast expr
2023-05-08 03:30:14 +02:00
Irmen de Jong
6c233c6a0a
optimize add/sub expr
2023-05-08 02:41:34 +02:00
Irmen de Jong
6db715d879
optimize multiplication expr
2023-05-08 02:10:54 +02:00
Irmen de Jong
ab02e8a546
optimize more carry flag assembly
2023-05-07 23:55:34 +02:00
Irmen de Jong
8cbfe64f19
optimize some carry flag assembly
2023-05-07 23:27:49 +02:00
Irmen de Jong
fd1e9971e4
asmsub Pc params and returnvalue must be boolean
2023-05-07 22:59:30 +02:00
Irmen de Jong
68336a76c5
optimized word comparison expressions
2023-05-07 20:40:48 +02:00
Irmen de Jong
393e914a86
optimized word equality comparison expressions
2023-05-07 18:55:17 +02:00
Irmen de Jong
ffb54110e9
optimized byte comparison expressions
2023-05-07 15:15:58 +02:00
Irmen de Jong
533d825f1a
optimized ubyte comparison expressions
2023-05-07 14:47:31 +02:00
Irmen de Jong
c65279b672
optimized logical expressions more
2023-05-07 13:29:45 +02:00
Irmen de Jong
21bc505d85
for loops no longer execute when from var already reached beyond the end
2023-05-03 00:43:03 +02:00
Irmen de Jong
d81fdf6d6b
for loops...
2023-05-02 22:55:58 +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
2885f4f7b1
fix
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
4274296cf3
api change: new 'cbm' module that now contains the common CBM kernal variables and routines.
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
c35a183a64
extra fix
2023-04-29 17:24:01 +02:00
Irmen de Jong
9cdd5fe7f2
fix byte to word sign extension error in certain cases
2023-04-29 17:14:50 +02:00
Irmen de Jong
c21428215e
fix possible mkword() error
2023-04-29 14:39:14 +02:00
Irmen de Jong
e056a28316
c128: fix memory bank resetting
2023-04-28 04:02:07 +02:00
Irmen de Jong
7c1d5cadd7
fix sort and reverse on strings on 6502 codegen
2023-04-10 19:33:24 +02:00
Irmen de Jong
c560abedba
fix compiler crash on rol/ror array value
2023-04-09 22:29:11 +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
4598a83e8e
fixing new comparisons
2023-03-29 22:06:32 +02:00
Irmen de Jong
f4bf00ad31
fix string compare and ifelse
2023-03-28 22:46:01 +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
a7b9f53967
fix word comparison bug in asmgen
2023-03-26 23:44:06 +02:00
Irmen de Jong
1fa2e2e37d
3rd party library versions upgrades
2023-03-26 21:36:21 +02:00
Irmen de Jong
5cbf859458
cleanup
2023-03-26 15:08:57 +02:00
Irmen de Jong
629ed74d09
got rid of rpn deadend code...
2023-03-25 18:45:17 +01:00
Irmen de Jong
ca2af2ca63
todo
2023-03-25 18:23:33 +01:00
Irmen de Jong
52ab089615
rpn: implement more comparisons
2023-03-25 18:21:10 +01:00
Irmen de Jong
01461a196d
implementing optimized comparisons
2023-03-25 00:08:21 +01:00
Irmen de Jong
04832f052a
working on doing comparison codegen differently
2023-03-25 00:08:21 +01:00
Irmen de Jong
c8b2c8ae50
extra asmvars now also moved into BSS section instead of taking up space inline
2023-03-25 00:00:29 +01:00
Irmen de Jong
fc3ec57437
fix wrong branch in in-place byte equality expression
2023-03-23 00:45:47 +01:00
Irmen de Jong
cc81d6fe82
remove traces of ** operator
2023-03-22 00:51:58 +01:00
Irmen de Jong
9c71e2f1c8
rpn optimizations
2023-03-21 18:41:37 +01:00
Irmen de Jong
134fd62da8
RPN: better handling of bit shifts
2023-03-21 02:58:26 +01:00
Irmen de Jong
2afd283582
optimize RPN
2023-03-21 00:05:32 +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
b40e397b28
fix rpn result type mismatch
2023-03-20 00:58:48 +01:00
Irmen de Jong
35ff1d996a
only reuse actual counter vars
2023-03-19 21:53:49 +01:00
Irmen de Jong
deea0b05cb
tweak cx16 system init and reset to not reset Vera any more
...
uses new audio routine to silence the audio
2023-03-19 21:16:23 +01:00
Irmen de Jong
a819b4a5a5
fix RPN issues
2023-03-19 17:35:28 +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
c8d0bf27af
get rid of useless scope param
2023-03-19 00:58:45 +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
9b971ad222
fix PeekW and PokeW optimizations
2023-03-18 17:36:32 +01:00
Irmen de Jong
3613162d09
fix RPN string comparisons
2023-03-18 16:55:03 +01:00
Irmen de Jong
84b31e65e1
more rpn optimization
2023-03-18 14:23:17 +01:00
Irmen de Jong
dd78a3a686
fix typo in comparison function
2023-03-18 12:52:50 +01:00
Irmen de Jong
94c06e13f4
implementing Rpn optimizations 2
2023-03-18 12:43:45 +01:00
Irmen de Jong
e8bebe5a75
implementing Rpn optimizations
2023-03-18 01:13:02 +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
c07cd72e85
restored the non=problematic asm optimization steps...
2023-03-14 22:30:50 +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
ebd9f1471b
fix crash when using const word as pointer and implement 2 missing assign codegen paths
2023-03-11 15:39:03 +01:00
Irmen de Jong
d76547ead4
don't crash on certain undefined symbols, give proper error instead
...
Also the error handlers in unit tests now de-duplicate messages just like the compiler itself does
2023-03-11 14:58:41 +01:00
Irmen de Jong
4600772e05
fix pokew mistake
2023-03-11 01:03:34 +01:00
Irmen de Jong
f350137a14
fix array in place assignments
...
fixes balls and snow examples amongst others
2023-03-10 04:07:50 +01:00
Irmen de Jong
6c34672549
array in-place assignment problem
2023-03-10 02:02:47 +01:00
Irmen de Jong
c968bacb01
fix pokew() crash with certain address expressions
2023-03-08 23:29:57 +01:00
Irmen de Jong
48fed4e6fb
slight tweak to codegenerator backend interface
2023-03-08 00:14:38 +01:00
Irmen de Jong
fd269453a4
todos
2023-03-04 14:14:01 +01:00
Irmen de Jong
540b3ae2f4
tweak BinaryExpression splitting
2023-02-28 21:45:38 +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
fb9902c536
avoid const fold loop on const bool thing=true
...
fixes #97
2023-02-22 21:27:08 +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
d9e4f39ddc
memset BSS section to zero all at once, less individual var=0 assigns
2023-02-21 00:26:21 +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
0ea70ba656
fix proper initialization of zeropagevars with 'noreinit'
2023-02-20 23:05:27 +01:00
Irmen de Jong
92a07b87d2
clearer
2023-02-20 02:32:36 +01:00
Irmen de Jong
c3c82282ba
reinitGlobals option is clearer than the inverse
2023-02-19 19:09:29 +01:00
Irmen de Jong
adc15c24ef
introduce bss segments
2023-02-19 18:12:37 +01:00
Irmen de Jong
9ca6860ffa
tweak
2023-02-19 15:08:16 +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
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
b95608f68a
new common ICodeGeneratorBackend interface for all code generator classes
2023-02-12 23:52:54 +01:00
Irmen de Jong
f09bcf3fcf
Merge branch 'master' into codegen-on-new-ast
2023-02-12 17:36:18 +01:00
Irmen de Jong
d0b18dec8e
shuffle variable sorting around to attempt smaller compiled programs
2023-02-12 17:34:33 +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
8f904f75bb
Merge branch 'master' into codegen-on-new-ast
2023-02-11 14:40:23 +01:00
Irmen de Jong
549c598f51
variables sorted in asm
2023-02-11 14:35:56 +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
c75b1581d2
lookup via new ST
2023-02-05 01:15:23 +01:00
Irmen de Jong
109e118aba
fix sub return register
2023-02-03 21:16:44 +01:00
Irmen de Jong
201b77d5b6
boolean vs byte cast fixing, and pointervar error
2023-02-02 00:57:20 +01:00
Irmen de Jong
a5ca08f33d
fix popCpuStack to load values into asmsub register params
2023-02-01 22:00:37 +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
2f5bed36b3
remove bool to ubyte typecasts
2023-01-31 01:25:44 +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
e31e5b2477
got rid of PtScopeVarsDecls
2023-01-29 13:49:27 +01:00
Irmen de Jong
8a4979f44c
vm target 'zeropage' more robust
2023-01-29 12:47:12 +01:00
Irmen de Jong
e67464325f
fix missing symboltable entries for asmgen
2023-01-28 00:00:23 +01:00
Irmen de Jong
c78d1e3c39
implemented Pt findTarget and siblings
2023-01-27 01:51:21 +01:00
Irmen de Jong
48c9349ce9
working on codegen fixes
2023-01-25 01:57:25 +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
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
a04839dd6b
vm: add property for custom breakpoint handler
2022-12-30 15:10:13 +01:00
Irmen de Jong
002006517a
rewrite bool=bool^1 into bool=not bool
2022-12-29 19:42:38 +01:00
Irmen de Jong
ded9ada9bc
allow "not xx in array" expression in 6502 codegen
...
fix compiler crash on certain bool to byte casts
2022-12-23 17:07:34 +01:00
Irmen de Jong
578969c34c
optimize redundant rts/bra or rts/jmp generation in when statement
2022-12-10 17:21:15 +01:00
Irmen de Jong
ca1089b881
optimized codegen for logical expressions with simple right operand (such as c64.READST() & $40 )
2022-12-06 20:23:56 +01:00
Irmen de Jong
a82b2da16e
Fix some FP related assignment issues in 6502 codegen.
2022-12-04 13:03:38 +01:00
Irmen de Jong
f2273c0acc
fix several FP rom routine addresses on cx16.
2022-12-03 19:56:54 +01:00
Irmen de Jong
5e896cf582
preparing to add Golden RAM
2022-12-03 00:21:31 +01:00
Irmen de Jong
10760a53a8
optimize cmp word equal/notequal
2022-11-29 20:14:35 +01:00
Irmen de Jong
eee805183c
don't overwrite temp vars in complex comparison expressions. Fixes #89
2022-11-29 04:13:25 +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
ec64a68a71
fixed compiler crash: unsigned = (-(unsigned as word) as uword)
2022-11-27 17:25:47 +01:00
Irmen de Jong
db55562f6a
fixed adpcm playback
2022-11-27 16:36:30 +01:00
Irmen de Jong
e2f20ebf94
fix crash on empty conditional branch statement (if_cc { } )
2022-11-23 02:14:48 +01:00
Irmen de Jong
922033c1b2
main block element order now remains the same as in source
2022-11-16 00:32:00 +01:00
Irmen de Jong
836a2700f2
func(x>>1) no longer uses slow stack eval
2022-11-15 02:49:40 +01:00
Irmen de Jong
562d722ad5
codegen: added missing codegen for float array inplace modification
2022-11-03 20:08:46 +01:00
Irmen de Jong
224f490455
Merge branch 'master' into labeledchunks
...
# Conflicts:
# codeGenIntermediate/src/prog8/codegen/intermediate/AssignmentGen.kt
# codeGenIntermediate/src/prog8/codegen/intermediate/ExpressionGen.kt
# examples/test.p8
2022-10-29 18:26:09 +02:00
Irmen de Jong
434515d957
fix: array[x] = ~array[x] no longer crashes the codegen
2022-10-27 23:56:38 +02:00
Irmen de Jong
094f7803b7
fix: array[x] = -array[x] no longer crashes the codegen
2022-10-27 23:20:40 +02:00
Irmen de Jong
b0c7bad391
fix: array[x] = -value no longer crashes the codegen
2022-10-27 21:58:37 +02:00
Irmen de Jong
e9a4a905ef
preparing to fix the array indexing compiler issue
2022-10-26 23:53:17 +02:00
Irmen de Jong
76428b16f0
Merge branch 'master' into labeledchunks
...
# Conflicts:
# codeGenIntermediate/src/prog8/codegen/intermediate/BuiltinFuncGen.kt
# docs/source/todo.rst
# examples/test.p8
# virtualmachine/src/prog8/vm/VirtualMachine.kt
2022-10-23 12:19:02 +02:00
Irmen de Jong
0d7b14e2d8
fix crash when assigning certain memory read to word variable. Fixes #82
2022-10-23 11:57:23 +02:00
Irmen de Jong
e94bf4c63c
replace rnd()/rndw() builtin functions by regular routines in math module
2022-10-22 17:02:43 +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
e7a3a89bfb
fix windows issue
2022-09-27 22:41:48 +02:00
Irmen de Jong
06cf2e0bd7
vm: fix memory slabs (bsieve example)
2022-09-27 16:32:44 +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
b1e4347e10
fix compiler crash sometimes when casting byte to word
2022-09-22 13:00:47 +02:00
Irmen de Jong
97aa91c75e
removed 16 bits sin/cos routines from math library (sin16, sin16r etc)
2022-09-22 12:55:00 +02:00
Irmen de Jong
d07d00fa41
Join codeAst and codeCore modules
2022-09-19 17:28:18 +02:00
Irmen de Jong
fc0a0105b3
move memoryslab administration from allocator to symboltable
2022-08-21 19:48:56 +02:00
Irmen de Jong
40aa733ea7
clearer name
2022-08-15 20:55:35 +02:00
Irmen de Jong
f249ccd414
added asm optimization for same pointer index
2022-08-14 12:50:46 +02:00
Irmen de Jong
44ee4b989f
optimize code for logical expressions more if right operand is simple
2022-08-12 00:49:40 +02:00
Irmen de Jong
18790d867c
optimize conditional expression WORD & $ff00 to just msb(WORD)&$ff
2022-08-12 00:21:44 +02:00
Irmen de Jong
d6b8936376
fix mkword(@(ptr), 0) wrong asm
2022-08-11 23:01:19 +02:00
Irmen de Jong
2d34fdd28f
in a block marked option force_output, make all subroutines in asm use .block rather than .proc
...
this fixes some obscure assembly issues where subroutines were omitted from the output program by 64tass
2022-08-10 21:28:40 +02:00
Irmen de Jong
68abda1219
fix a few small compiler errors (removing functioncall, removing block, assigning virtual register return value)
2022-08-09 23:38:29 +02:00
Irmen de Jong
f778f08f76
tweak
2022-08-08 21:09:49 +02:00
Irmen de Jong
4644c9b621
got rid of GoSub ast node and codegen complexity related to that.
...
sometimes programs get smaller, sometimes bigger.
2022-08-07 03:24:20 +02:00
Irmen de Jong
00b717cde8
tweak
2022-08-04 18:35:10 +02:00
Irmen de Jong
310219e5d7
make sure memory slabs block is at the bottom of the asm file to not allocate needless space in the resulting prg
2022-07-31 15:37:36 +02:00
Irmen de Jong
a0deb463c9
optimized codegen for some equality comparison expressions and some logical expressions
2022-07-31 15:25:54 +02:00
Irmen de Jong
046dceb5c2
added optimized case for signed division by 2
2022-07-24 13:59:35 +02:00
Irmen de Jong
dcc1f00048
fix rounding errors in signed divide by power-of-two
...
The optimized bit-shifting division is removed (for now)
2022-07-24 12:34:55 +02:00
Irmen de Jong
5189eaca36
move the vm unit tests to codeGenVirtual module and remove virtualmachine dependency in the compiler module
2022-07-17 12:56:22 +02:00
Irmen de Jong
f690f58bd4
callfar() now accepts a variable as address, so it can be used to indirect JSR to a subroutine whose address is not fixed. ('goto' already could indirect JMP to a variable address.)
2022-07-14 19:29:59 +02:00
Irmen de Jong
2d600da8b6
fix codegen crash on certain nested typecast
2022-07-13 22:24:31 +02:00
Irmen de Jong
7a26646e1b
tweak bool type handling
2022-07-11 02:08:12 +02:00
Irmen de Jong
1163543a98
fix bool param lookup problem
2022-07-07 22:23:56 +02:00
Irmen de Jong
65daf29acd
fix compiler crash related to word types in certain comparison expressions
2022-07-07 22:23:56 +02:00
Irmen de Jong
298b25cf7d
fix compiler crash on certain typecasting assignment
2022-07-07 22:23:56 +02:00
Irmen de Jong
41f4e22a17
introduce BOOL type
2022-07-07 22:23:56 +02:00
Irmen de Jong
288c57c144
ack to allow user to override the following two with command line redefinition:
2022-07-07 22:16:08 +02:00
Irmen de Jong
b41779bd02
added -D command line option to define symbols in the assembly file
2022-07-06 23:40:36 +02:00
Irmen de Jong
e1c77ce236
fix pop() name scoping
2022-07-02 23:27:08 +02:00
Irmen de Jong
965340ff90
logical and/or/xor/not all replaced by bitwise &,|,^,~ (ast, codegens)
...
this also fixed some invalid outcomes of logical expressions!
2022-07-02 00:38:17 +02:00
Irmen de Jong
fb989ae62f
cx16: reset rom/ram/monitor banks at program exit to sane values.
2022-07-01 00:14:38 +02:00
Irmen de Jong
4b358abbb7
"not" operator removed from ast and codegen (it's been replaced with x==0 as equivalent)
2022-06-29 01:13:08 +02:00
Irmen de Jong
ef92451d1a
fix logical expressions on arbitrary values, for now with boolean() around the operands
2022-06-28 01:18:36 +02:00
Irmen de Jong
bb1cda0916
fix: boolean values of terms in logical expressions are now properly evaluated
2022-06-26 23:55:34 +02:00