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
1d2ce2cbeb
consolidate IR line parse function
2022-09-27 18:02:57 +02:00
Irmen de Jong
1a56743bb1
fix IR repeat loop codegen when amount is 0
2022-09-25 20:48:17 +02:00
Irmen de Jong
ca2fb6cef3
IR no longer depends on VM syscalls but has its own syscall list for the few builtin functions that still require it
2022-09-23 14:27:51 +02:00
Irmen de Jong
11d87e4725
VM: support cpu registers
2022-09-19 17:13:46 +02:00
Irmen de Jong
627ed51a1b
IR: mem mapped vars and memory slabs
2022-09-19 15:20:40 +02:00
Irmen de Jong
2f3e7d1c27
IR support for storing incbins and romsubs
2022-09-17 16:07:41 +02:00
Irmen de Jong
0e831d4b92
fix superfluous usage of addressOf()
2022-09-16 00:31:04 +02:00
Irmen de Jong
6428ced157
added subroutine params to IRSubroutine
2022-09-13 23:06:05 +02:00
Irmen de Jong
30a42ec1bd
IR tweak
2022-09-13 23:06:05 +02:00
Irmen de Jong
aacea3e9db
incbin in IR
2022-09-13 23:06:05 +02:00
Irmen de Jong
6886b61186
also output inline asm chunks
2022-09-13 23:06:05 +02:00
Irmen de Jong
0744c9fa29
properly flatten label names for the IR code
2022-09-13 23:06:05 +02:00
Irmen de Jong
502a665ffc
getting address-of into IR without allocations
2022-09-13 23:06:05 +02:00
Irmen de Jong
3c315703c0
making IR file reader
2022-09-13 23:06:05 +02:00
Irmen de Jong
12ed07a607
comments
2022-09-13 23:06:05 +02:00
Irmen de Jong
97f4316653
rename IR classes
2022-09-13 23:06:05 +02:00
Irmen de Jong
a182b13e5a
fixup for memoryslabs
2022-09-13 23:06:05 +02:00
Irmen de Jong
80b630a1e4
added memoryslabs to symboltable
2022-09-13 23:06:05 +02:00
Irmen de Jong
475efbe007
steps to make actual IR based on VM code. For now, as experimental codegen.
2022-09-13 23:06:05 +02:00
Irmen de Jong
176ec8ac7d
fix 6502 codegen bug: complex comparison expression is evaluated wrong.
...
Fixed by reintroducing splitting of comparison expression in if statements by using a temporary variable and/or register to precompute left/right values.
2022-08-23 00:05:57 +02:00
Irmen de Jong
fc0a0105b3
move memoryslab administration from allocator to symboltable
2022-08-21 19:48:56 +02:00
Irmen de Jong
7ef4ddf0f3
fixed operator precedence: bitwise must come before comparisons
2022-08-14 12:34:00 +02:00
Irmen de Jong
0aa0ec5abd
fix c64 zeropage locations of cx16 virtual registers
2022-08-13 00:14:19 +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
4d840c7db8
optimized mkword(0, X)
2022-08-11 22:51:09 +02:00
Irmen de Jong
4d2b21816d
optimized uword <<8 and >>8
2022-08-11 22:25:15 +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
ac1bd2fb7b
virtual: properly output "memmapped" variables too
...
still as regular variables though
2022-08-08 20:42:17 +02:00
Irmen de Jong
4b7b1379d9
also binexpr split on and,or,xor if appropriate
2022-08-08 00:09:18 +02:00
Irmen de Jong
1e441c2ddf
tweak vm codegen
2022-08-07 13:45:03 +02:00
Irmen de Jong
f718f4251b
working on better encoding of romsub in new ast/vmtarget
2022-08-07 12:21:10 +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
f531daa872
on C64, the cx16.r0...cx16.r15 virtual regs are now in zeropage as well when using kernalsafe or full
2022-07-28 19:13:33 +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
05f935b598
simplify & fix recursion detector
2022-07-22 22:22:43 +02:00
Irmen de Jong
7d4695c5b2
cx16: graphics module y resolution corrected from 200 to 240. added 'cx16/circles' example.
2022-07-17 18:59:52 +02:00
Irmen de Jong
8e1071aa89
fix compiler crashes: txt.chrout("a"), uword[] a = ["ls", subroutine] without & before subroutine.
2022-07-15 23:17:03 +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
35af53828a
fix endless loop in optimizer, fix cx16 register clobbering in psg interrupt handler, fix crash on certain arrays, fix undefined symbol when it's in another imported module
2022-07-13 18:42:06 +02:00
Irmen de Jong
10ddd5b127
fixed missing non-boolean operand cast in logical expressions
2022-07-12 22:28:06 +02:00
Irmen de Jong
edf12bec71
improve bool params typecasting, fix compiler crash on abs(floatvar)
2022-07-12 17:52:37 +02:00
Irmen de Jong
ff1fc28287
added immediate value vm logical instructions because these are so common
2022-07-12 16:12:32 +02:00
Irmen de Jong
314398ba4c
added immediate value vm arithmetic instructions because these are so common
2022-07-12 15:21:26 +02:00
Irmen de Jong
68da661edc
optimize comparison to true/1 into comparison to zero, optimize while/until conditions
2022-07-11 16:42:52 +02:00
Irmen de Jong
88cbb6913d
tweak bool type handling
2022-07-11 14:55:50 +02:00
Irmen de Jong
7a26646e1b
tweak bool type handling
2022-07-11 02:08:12 +02:00
Irmen de Jong
211e2bb37a
improved bool type checking
2022-07-08 22:29:13 +02:00
Irmen de Jong
d2d08bf143
fix compiler error about bool vs ubyte
2022-07-08 22:03:05 +02:00
Irmen de Jong
8acb37b6c2
use bool type in examples and libraries
2022-07-08 21:50:32 +02:00
Irmen de Jong
1dfa8ee7d8
add ARRAY_BOOL array type
2022-07-07 23:07:30 +02:00
Irmen de Jong
1163543a98
fix bool param lookup problem
2022-07-07 22:23:56 +02:00
Irmen de Jong
bdb7de34be
added several compiler checks against weird boolean type use in expressions
2022-07-07 22:23:56 +02:00
Irmen de Jong
9500fc11ac
document new bool datatype and removal of boolean() conversion function
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
cc41218d37
added nicer vm example
2022-07-03 00:41:04 +02:00
Irmen de Jong
b2c9b7635d
revert restriction on certain associative operator reshuffling
...
it caused larger generated code
2022-07-02 13:59:24 +02:00
Irmen de Jong
24d13dd120
fix problematic optimizations to logical expressions
2022-07-02 00:56:24 +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
8e36fe6bef
temporary workaround for code problem around 'not'
2022-07-01 01:01:15 +02:00
Irmen de Jong
f675dbc726
vm var allocator now also recognises the memory-mapped variables. no longer crashes
2022-06-30 22:09:49 +02:00
Irmen de Jong
97cb0cbd08
tweak "not" removal/rewriting
2022-06-30 02:16:30 +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
06184bdcb1
get rid of failed mccarthy shortcut evaluation
2022-06-27 21:44:52 +02:00
Irmen de Jong
af98d01053
failed attempt at McCarthy shortcut evaluation
2022-06-27 21:40:48 +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
Irmen de Jong
5656ec11d3
fix missing abs(byte) routine
2022-06-24 01:51:54 +02:00
Irmen de Jong
eb53e44cb0
zsound stream test
2022-06-24 01:51:33 +02:00
Irmen de Jong
bda016bb3b
optimized 6502 codegen for logical expressions
2022-06-15 22:17:15 +02:00
Irmen de Jong
cc174b7b85
added boolean() builtin function and use it to get rid of !=0 comparisons
2022-06-14 23:34:45 +02:00
Irmen de Jong
775c85fc18
don't swap operands that would change function evaluation order + vm: fix label casing error
2022-06-13 00:25:45 +02:00
Irmen de Jong
5a756aaed9
Pipe expression "|>" removed from the language
2022-06-12 18:41:42 +02:00
Irmen de Jong
dca092fd7c
fix pipe expression when start term is constant number
2022-06-12 16:59:28 +02:00
Irmen de Jong
c6e92ecac4
some code cleanup
2022-06-12 16:15:08 +02:00
Irmen de Jong
f537793b0b
added zsound demo player example (cx16)
2022-06-08 23:57:01 +02:00
Irmen de Jong
f7183e38ee
tweak trivial subroutine inlining
2022-06-08 21:05:03 +02:00
Irmen de Jong
0a65dfdd10
optimized codegen for some more simple expressions with +/-
2022-06-07 22:30:08 +02:00
Irmen de Jong
3075578245
optimized codegen for assigning value or variable to indexed pointer. (6502)
2022-06-06 18:30:19 +02:00
Irmen de Jong
b042b7705e
fix invalid removal of repeated assignments.
2022-06-06 17:27:06 +02:00
Irmen de Jong
3054a1d32d
api change: removed swap() builtin function (too complex in codegen for little used function)
2022-06-06 16:01:11 +02:00
Irmen de Jong
0a3cd652b0
vm: fix codegen for storing to pointer indexed
2022-06-06 14:18:12 +02:00
Irmen de Jong
f70b914779
fix optimized codegen for 2 arg functions, sometimes was passing wrong arg value due to register overwriting
2022-06-06 13:21:45 +02:00
Irmen de Jong
46ca0ac10d
properly optimize X - -1 and X + -1, this also fixes type change of ubyte - 2 + 10
2022-06-05 15:35:29 +02:00
Irmen de Jong
031f647952
allow casting negative numbers to unsigned, result = 2's complement
2022-06-05 14:21:10 +02:00
Irmen de Jong
dbb92881a1
fixed X register corruption in some cases of rol() and ror()
2022-06-04 21:10:48 +02:00
Irmen de Jong
10bf7f5d07
fix: again gives proper name redefinition errors in same scope
2022-06-04 20:15:46 +02:00
Irmen de Jong
1e61d84fd1
vm: fix expression codegen for pointer indexing
2022-06-04 19:32:35 +02:00
Irmen de Jong
2002412026
optimized codegen for pointer indexing (read expressions)
2022-06-04 17:20:17 +02:00
Irmen de Jong
7f69517fd4
preparing optimizing pointer indexing
2022-06-04 16:18:27 +02:00
Irmen de Jong
c40cfaa388
preparing optimizing pointer indexing
2022-06-04 14:23:02 +02:00
Irmen de Jong
5fe6aa2800
fix swap() code for pointervars
2022-06-03 23:13:35 +02:00
Irmen de Jong
b459b09b2f
vm: fix comparison datatype error; primes.p8 works again
2022-05-24 18:26:07 +02:00
Irmen de Jong
3f5877dbcc
vm: fix array iteration
2022-05-23 21:24:36 +02:00
Irmen de Jong
e659b91c4d
vm: fix storezm/storezx instructions
2022-05-23 21:01:02 +02:00
Irmen de Jong
b646f50265
vm: implemented in-memory bit shift instructions
2022-05-23 20:15:20 +02:00
Irmen de Jong
0a48ef3030
vm: just use new register instead of trying to (ab)use reg 0
2022-05-22 23:38:46 +02:00
Irmen de Jong
ba614801ee
cleanup
2022-05-22 23:11:22 +02:00
Irmen de Jong
fd6eb47e68
added inlining certain trivial non-asm subroutine calls
2022-05-22 20:22:09 +02:00
Irmen de Jong
e69aeb8b98
added warning about shadowing variables
2022-05-22 17:34:08 +02:00
Irmen de Jong
26ea1da146
vm: add in-place bitwise or,and,xor
2022-05-20 20:50:27 +02:00
Irmen de Jong
461b6499ef
vm: add in-place add/sub
2022-05-19 22:54:50 +02:00
Irmen de Jong
c769920b6e
vm: fix signed divide
2022-05-19 22:24:57 +02:00
Irmen de Jong
181b98ef9e
vm: implemented some self-assign instructions
2022-05-18 22:15:42 +02:00
Irmen de Jong
4e1184a400
vm: added some of the sin cos tables in math.p8
2022-05-17 22:56:00 +02:00
Irmen de Jong
e52d9e3210
vm: split off assignment codegen to its own file
2022-05-17 22:38:31 +02:00
Irmen de Jong
dc6475c91b
vm: fixed non-byte array indexing
2022-05-17 18:53:33 +02:00
Irmen de Jong
0bf00d1ca4
c64/c128 targets: perform cleanup at program exit such as re-enabling run-stop key and character set switching.
2022-05-15 16:44:26 +02:00
Irmen de Jong
d1a707df57
fix assigning a pointer (uword) to string not copying the correct memory
2022-05-15 16:10:58 +02:00
Irmen de Jong
4dc9b45297
vm: fixed string comparisons, added missing vm string module
2022-05-13 23:10:13 +02:00
Irmen de Jong
6e31eebfb5
vm: ifElse codegen uses proper branching instructions now
2022-05-12 21:26:17 +02:00
Irmen de Jong
a7df828932
vm: codegen uses INCM/DECM if possible
2022-05-12 19:40:31 +02:00
Irmen de Jong
517cf61d11
vm: limit int instructions to just 2 register args
2022-05-11 22:36:47 +02:00
Irmen de Jong
4be7bc8323
vm: limit float instructions to just 2 register args
2022-05-11 22:09:46 +02:00
Irmen de Jong
74c05d00a9
vm: fix comparison operator codegen for floats
2022-05-11 17:07:21 +02:00
Irmen de Jong
bacba629a5
vm: use shift-one instructions in codegen
2022-05-11 15:50:51 +02:00
Irmen de Jong
14e36f1362
vm: fix assignment to array
2022-05-11 15:26:54 +02:00
Irmen de Jong
d43ad849d1
vm: actually use the store-zero instructions in codegen
2022-05-11 15:18:36 +02:00
Irmen de Jong
627aa61184
clean up subroutine inlining, basis for new try
2022-05-09 15:42:58 +02:00
Irmen de Jong
fef52c0112
automatically convert multi-compare expression (if X==1 or X==2..) to contaiment check if X in [1,2,..]
2022-05-08 13:21:34 +02:00
Irmen de Jong
8c4765b386
vm: support non-unary functions in pipe expressions
2022-05-07 20:42:05 +02:00
Irmen de Jong
7c121bfc01
first steps to support multiple args in pipe expressions
2022-05-07 19:00:47 +02:00
Irmen de Jong
942c5cc04b
fix crash when optimizing pipe expression too aggressively
2022-05-07 17:29:36 +02:00
Irmen de Jong
348b3036ff
now correctly accepts "xxx" * constexpr (where constexpr is not just a single const number)
2022-05-05 23:21:20 +02:00
Irmen de Jong
09d3451d9d
vm: accept %asmbinary (but it is eventually ignored in code execution)
2022-05-05 21:43:31 +02:00
Irmen de Jong
b1a49e5f29
vm: implement rest of float instructions
2022-05-04 22:31:45 +02:00
Irmen de Jong
da01a5b4dc
vm: implement float to integer cast, any, all, reverse
2022-05-04 22:08:21 +02:00
Irmen de Jong
3f9cdd9b56
vm: fix mul and div instructions
2022-05-04 01:10:59 +02:00
Irmen de Jong
0f9e87d7bb
fixed compiler crash when casting float to integer, fixed float to int cast value error on cx16
2022-05-03 23:43:38 +02:00
Irmen de Jong
0869789214
vm: implement float type casts to integer types
2022-05-02 23:38:32 +02:00
Irmen de Jong
10c8cc35c5
vm: implement float divide multiply sub add
2022-05-02 21:53:43 +02:00
Irmen de Jong
30c2e3e8ff
vm: fix comparisons codegen
2022-05-02 21:32:45 +02:00
Irmen de Jong
86cc2f1075
vm: implementing more fp instructions
2022-05-02 21:06:14 +02:00
Irmen de Jong
b32641db87
remove syscall() builtin functions
...
vm code can do this via inline assembly
2022-05-01 00:41:30 +02:00
Irmen de Jong
0ee790969d
vm: allow inline "assembly"
2022-04-30 23:24:25 +02:00
Irmen de Jong
7844ace934
vm: implementing floating-point
2022-04-29 22:27:02 +02:00
Irmen de Jong
0fab806f36
vm: some preparations for floating point
2022-04-27 17:45:58 +02:00
Irmen de Jong
be2113d291
vm: starting to implement floating point instructions
2022-04-26 21:25:59 +02:00
Irmen de Jong
625d5b2313
vm: some preparations for floating point
2022-04-26 21:08:32 +02:00
Irmen de Jong
cf50e4f6ec
vm: printing of numbers now via conv module.
...
assigning strings now converted to strcopy function call in the compiler ast.
2022-04-23 02:15:51 +02:00
Irmen de Jong
7eea97d741
- floats: remove all floating point builtin functions and move them to the floats module instead
2022-04-22 00:45:54 +02:00
Irmen de Jong
88b55ab93e
vm: add abs() and fix 6502 abs() code.
2022-04-18 21:20:17 +02:00
Irmen de Jong
ee36d47c27
vm: added cmp() and most of the status-branch instructions
2022-04-18 19:59:48 +02:00
Irmen de Jong
0f36be0001
vm: simple optimizations for +/-/*/div with constants
2022-04-14 22:42:25 +02:00
Irmen de Jong
0f4a197e34
improve ast check on pipe expressions
2022-04-14 00:49:06 +02:00