Irmen de Jong
475e927178
version 8.8
2022-12-17 23:00:49 +01:00
Irmen de Jong
8ab47d3321
fix_autostart_square() now preserves X register correctly
2022-12-14 01:07:44 +01:00
Irmen de Jong
def7e87151
fixed silly if-goto expression code in IR codegen where it used too many branching instructions
2022-12-12 22:47:15 +01:00
Irmen de Jong
27568c2bef
fixed silly code generated by some NOT-expressions (unused temporary)
2022-12-12 21:57:22 +01:00
Irmen de Jong
832601b36b
workaround for black square issue at start
2022-12-11 11:48:41 +01:00
Irmen de Jong
d1d0115aed
removed unused option 'keepIR'
2022-12-09 18:44:44 +01:00
Irmen de Jong
a1d04f2aad
added more $03xx vector definitions to C64/C128/CX16 syslib
2022-12-06 20:23:56 +01:00
Irmen de Jong
bf0604133c
fix error in IR for inline asm and BSS vars.
2022-12-04 16:48:44 +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
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
5e896cf582
preparing to add Golden RAM
2022-12-03 00:21:31 +01:00
Irmen de Jong
add3491c57
fix possible vardecl issue for prefixed params
2022-11-30 22:56:54 +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
ec64a68a71
fixed compiler crash: unsigned = (-(unsigned as word) as uword)
2022-11-27 17:25:47 +01:00
Irmen de Jong
d8409a9d2b
fix compiler crash: if uwordvar > label
2022-11-26 14:39:03 +01:00
Irmen de Jong
7b6c742178
fixed diskio.f_read() for small read sizes
2022-11-24 00:23:37 +01:00
Irmen de Jong
d4a35ba6ff
got rid of diskio.have_first_byte overhead
2022-11-23 21:53:36 +01:00
Irmen de Jong
68b112837a
fix cx16logo.logo() printing correct newlines
2022-11-23 02:25:20 +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
f870e4965a
added cx16diskio.f_seek() function to seek to a position in an opened file
...
f_open uses channel 12 now, f_open_w uses 13
2022-11-23 01:48:04 +01:00
Irmen de Jong
7ebcb219d6
void func() now gives warning if func doesn't return a value
2022-11-22 22:54:40 +01:00
Irmen de Jong
77e956a29f
API change: diskio.list_files doesn't have an internal buffer anymore, you now have to supply a buffer + size yourself. Renamed to list_filenames
2022-11-20 23:27:22 +01:00
Irmen de Jong
08275c406a
added chdir/mkdir/rmdir/relabel to cx16diskio
2022-11-20 22:59:44 +01:00
Irmen de Jong
2931e1b87b
diskio file lister routines now also put file type (prg, seq, dir) in new diskio.list_filetype variable
2022-11-20 20:22:09 +01:00
Irmen de Jong
153b422496
cx16: retain display mode (composite etc)
2022-11-20 19:19:01 +01:00
Irmen de Jong
0f6a6d6fea
attempt to make gfx2 screen mode 0 cleanup more robust on real hardware
2022-11-18 22:53:28 +01:00
Irmen de Jong
91fdb3e2d4
ir: store labels in blocks, but still useless
2022-11-17 00:37:45 +01:00
Irmen de Jong
d8e87bd881
make uword xx = 1<<shift into a word shifting
2022-11-16 01:39:34 +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
f4f355c74a
added cx16/diskspeed example
2022-11-14 17:55:55 +01:00
Irmen de Jong
b465fc5aaf
fix bug in word array containment check (prog8_lib.containment_wordarray) that could hang the loop
2022-11-12 23:19:01 +01:00
Irmen de Jong
2d78eaa48d
fix gfx2 text color, added cx16 snow example
2022-11-12 22:08:07 +01:00
Irmen de Jong
e6688f4b9d
clearer error for VM limitation cannot load label address as value
2022-11-12 13:45:02 +01:00
Irmen de Jong
9d7b9771c2
p8ir file format is now valid XML
2022-11-11 23:35:52 +01:00
Irmen de Jong
3dcf628fdb
fixed subroutine name shadow check
2022-11-10 22:51:37 +01:00
Irmen de Jong
e614e9787a
ir: write values as hex into p8ir file
2022-11-08 21:59:05 +01:00
Irmen de Jong
e426fc0922
version 8.7
2022-11-06 22:58:39 +01:00
Irmen de Jong
5d4bfffc7e
float.rndseedf() now takes float seed value and is consistent for all CBM compilation targets
2022-11-06 22:53:57 +01:00
Irmen de Jong
207cdaf7a4
fix kefrenbars example (use gfx2 instead of kernal routines)
2022-11-06 17:33:30 +01:00
Irmen de Jong
7315b581ce
added gfx2.pget(x,y) to get the pixel color value
2022-11-06 13:40:55 +01:00
Irmen de Jong
38efaae7b2
ir/vm: syscall params in high base register to avoid push/pop
2022-11-06 12:52:09 +01:00
Irmen de Jong
469e042216
vm: replaced prog8_lib.string_compare and others with syscalls
2022-11-04 23:12:13 +01:00
Irmen de Jong
0f1a4b9d8f
fixed certain type check error when passing boolean value to ubyte function parameter
...
fixed virtual machine string comparison syscall
2022-11-03 23:06:03 +01:00
Irmen de Jong
7303c00296
vm: prog8lib.wordarray_contains() fixed
2022-11-03 22:48:47 +01:00
Irmen de Jong
fc55b34d84
ir: fix asmsub multi-value return codegen
2022-11-03 22:29:41 +01:00
Irmen de Jong
06b032af91
refactor
2022-11-03 00:20:31 +01:00
Irmen de Jong
e67c05c274
ir: fix asmsub contents not appearing in IR file
2022-11-02 20:50:51 +01:00
Irmen de Jong
b22804efaf
ir: fix inlineasm linking
2022-10-31 23:59:33 +01:00
Irmen de Jong
cc5fc0b892
Merge branch 'master' into labeledchunks
...
# Conflicts:
# examples/test.p8
2022-10-30 23:46:44 +01:00
Irmen de Jong
5b6569d0f9
ir: fix overwriting chunk label
2022-10-30 19:03:02 +01:00
Irmen de Jong
0eda7ac498
vm: don't crash on empty code chunks
2022-10-30 17:05:08 +01:00
Irmen de Jong
a5ef353484
ir: fix memory mapped var as for loop counter
2022-10-30 14:54:47 +01:00
Irmen de Jong
67a36d8d31
more robust 'return' statement checks in subroutines
2022-10-30 14:41:28 +01:00
Irmen de Jong
7cc3cc3990
ir: fix non-code chunk linkage
2022-10-30 12:55:06 +01:00
Mark J. Reed
c2f062a391
fix: don't ignore shape argument to cx16.mouse_config2
2022-10-29 17:10:06 -04: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
5b35232ab4
fix "fpReg1 out of bounds" crash for vm target for in-place float array assignment. #85
2022-10-29 17:04:39 +02:00
Irmen de Jong
6d6db70e42
remove type widening for bit shifts, to be consistent with other arithmetic operations. Fixes #83
2022-10-29 16:29:41 +02:00
Irmen de Jong
6830e15b4e
print warning when bit shifts are too large and result in 0. #83
2022-10-29 15:23:39 +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
7b6cd0cfbe
cx16.macptr() now has additional argument in the carry flag, to reflect recent X16 kernal api change.
...
Also now allow bool type for status flag args and returnvalues.
2022-10-26 20:41:10 +02:00
Irmen de Jong
cfa7258ff4
various
2022-10-25 23:18:42 +02:00
Irmen de Jong
da8eb464b8
add cx16diskio.vload_raw() to load headerless files into vram
2022-10-25 21:12:11 +02:00
Irmen de Jong
8f9d1cfa30
fix regression: indexing pointer variable with word (>255) didn't work anymore since release 8.2 or so
2022-10-24 23:43:47 +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
a9d19d02b3
helpful error for programs still using the old builtin rnd() and rndw()
2022-10-22 22:36:44 +02:00
Irmen de Jong
adcbe55307
replaced integer RNG with smaller and faster routine.
2022-10-22 22:01:57 +02:00
Irmen de Jong
00afa1ce52
ir: replace RND opcode by syscalls
2022-10-22 17:20:46 +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
ec5adffdc2
rnd()/rndf() routines can now be seeded with new rndseed()/rndseedf() routines. fixes #80
2022-10-22 13:34:22 +02:00
Irmen de Jong
53b0b562e6
fix check for routine that returns multiple values but in status bit. Fixes #79
2022-10-19 23:23:49 +02:00
Irmen de Jong
7b722a0001
ir: fix count register uses
2022-10-04 00:25:55 +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
5a8f97a0b6
ir: adding last missing features to be able to encode all of Prog8
2022-09-30 16:01: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
43e31765e5
kotlin 1.7.20
2022-09-29 18:41:20 +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
9f09784b55
version 8.6.2
2022-09-27 22:45:48 +02:00
Irmen de Jong
1d2ce2cbeb
consolidate IR line parse function
2022-09-27 18:02:57 +02:00
Irmen de Jong
06cf2e0bd7
vm: fix memory slabs (bsieve example)
2022-09-27 16:32:44 +02:00
Irmen de Jong
db1aa8fcbd
vm: new translation of IRProgram into vm program list
2022-09-27 01:50:00 +02:00
Irmen de Jong
11c000f764
moved codeGenVirtual module into virtualmachine module
2022-09-26 20:00:40 +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
533c368e32
make IRFileReader's file source more general
2022-09-26 14:47:28 +02:00
Irmen de Jong
dcc9a71455
version 8.6.1
2022-09-25 21:54:35 +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
387a4b7c35
added string.lowerchar() and string.upperchar()
2022-09-25 20:20:38 +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
dda19c29fe
vm: fix symbols to be case sensitive properly in p8virt assembler
2022-09-25 15:51:50 +02:00
Irmen de Jong
ca41669f4f
vm: fix scoped name in address-of inside array
2022-09-24 18:26:35 +02:00
Irmen de Jong
0e1886e6bd
vm: fix nested label prefixing
2022-09-24 16:00:25 +02:00
Irmen de Jong
c26e116f0e
vm: fix crashes when array contains pointers/strings
2022-09-24 14:42:07 +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
46dac909ef
vm/math.p8: complete the sin and cos routines
2022-09-22 15:49:19 +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
fb22f78fb3
added '-keepIR' option to save the IR file if it's generated.
2022-09-20 12:30:22 +02:00
Irmen de Jong
d6393cdbe5
'-vm' option now also reads .p8ir files
2022-09-20 12:14:33 +02:00
Irmen de Jong
b4352ad38b
refactor IR codegen into separate module
2022-09-19 19:24:24 +02:00
Irmen de Jong
d07d00fa41
Join codeAst and codeCore modules
2022-09-19 17:28:18 +02:00
Irmen de Jong
627ed51a1b
IR: mem mapped vars and memory slabs
2022-09-19 15:20:40 +02:00
Irmen de Jong
3091e3a1c8
IR support for instructions operating on cpu regs
2022-09-18 01:51:04 +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
e34bab9585
change syntax of address-of in p8virt code to &X, instead of {X}
2022-09-13 23:28:52 +02:00
Irmen de Jong
6428ced157
added subroutine params to IRSubroutine
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
101b33c381
split intermediate representation into separate module
2022-09-13 23:06:05 +02:00
Irmen de Jong
b0704e86f0
block structure
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
3ab5e5ac48
added cx16.kbdbuf_clear()
2022-09-01 18:40:17 +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
6b41734d6a
check memory() calls before entering codegen
2022-08-21 19:02:34 +02:00
Irmen de Jong
c33dc0f3be
version
2022-08-21 14:37:10 +02:00
Irmen de Jong
a878c9a61d
add some documentation to the psg module
2022-08-19 22:17:23 +02:00
Irmen de Jong
6454bf8ec4
added mouse cursor to amiga example
...
slightly sped up text rendering in gfx2 highres mode
2022-08-16 04:25:59 +02:00
Irmen de Jong
f37a822725
move
2022-08-14 13:17:03 +02:00
Irmen de Jong
d8e18df3a1
added c64 starfield example
2022-08-14 12:02:23 +02:00
Irmen de Jong
78d3d9d27d
vm: get rid of jumpi traces, fix IR value issue with STOREIX
2022-08-13 20:00:13 +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
b6eef3612f
added some ported bench8 test programs
2022-08-12 22:08:27 +02:00
Irmen de Jong
666d62dd7a
fix cx16.r0 base address to be $04 on the C-64, and fix zeropage duplicate free addresses
2022-08-12 17:49:31 +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
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
4b7b1379d9
also binexpr split on and,or,xor if appropriate
2022-08-08 00:09:18 +02:00
Irmen de Jong
e560e2ab3f
vm instructions now contain info on input/output registers
2022-08-07 18:49:16 +02:00
Irmen de Jong
93ce74eeb1
removed problematic expression "simplifications" (that introduced arbitrary r9 temp register usage)
2022-08-07 12:26:11 +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
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
197081f10d
keyboardhandler
2022-08-04 23:04:16 +02:00
Irmen de Jong
00b717cde8
tweak
2022-08-04 18:35:10 +02:00
Irmen de Jong
34aa917ca4
allow bool return type (and arguments) for asmsub / romsub
2022-08-02 23:07:42 +02:00
Irmen de Jong
a38ddcb364
diskio use other filename buffer to avoid always having large buffer
2022-08-02 00:58:32 +02:00
Irmen de Jong
5b9576df4e
added diskio.send_command()
...
diskio now reuses some buffer internally for file names to save some memory
2022-08-01 22:59:27 +02:00
Irmen de Jong
90ddec2ad8
avoid multiple change events in watch mode
...
added bsieve example
2022-07-31 11:58:27 +02:00
Irmen de Jong
f6b03d5a78
added diskio.diskname(), improved error checking in diskio.directory()
2022-07-30 13:35:42 +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
05f935b598
simplify & fix recursion detector
2022-07-22 22:22:43 +02:00
Irmen de Jong
f2d27403c5
add string.endswith() to efficiently test for a suffix without copying
...
add string.startswith() to efficiently test for string prefix without copying
2022-07-21 00:38:30 +02:00
Irmen de Jong
473efbe67a
tweaks
2022-07-17 22:09:56 +02:00
Irmen de Jong
80ab552ad8
fix wrong code for signed word >= 0
2022-07-17 19:02:56 +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
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
cfb31377fc
c64 zeropage: added a few more locations to Kernalsafe free list that should be safe
...
this makes $02-$21 inclusive, available for use later (x16 virtual registers are placed here on x16...)
2022-07-17 12:12:47 +02:00
Irmen de Jong
a07c52e112
conv.any2uword / conf.hex2uword can now deal with iso lower and upper case letters as well.
2022-07-17 02:39:40 +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
7cb9a6ba60
diskio.status() more robust (stops at newline char instead of overwriting buffer), diskio.f_open better detects error status
2022-07-15 22:21:34 +02:00
Irmen de Jong
350dc731f1
cx16: sys.reset_system() now resets vera fully as well (such as PSG sound), kernal didn't seem to do that
2022-07-14 23:44:53 +02:00
Irmen de Jong
4bc65e9ef7
fix stack crash in cx16.push_vera_context()
2022-07-14 16:33:09 +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
feb5c8be95
vm: some more peephole optimizations
2022-07-12 19:04:19 +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
840331347b
added a few more vm optimizations and unit tests
2022-07-12 12:42:37 +02:00
Irmen de Jong
6181b12ab8
added -esa option to override the evalstack location, and shift cx16.r0-r15 accordingly
2022-07-11 19:29:04 +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
92eb3b0bf6
bool logical testcase
2022-07-09 22:29:38 +02:00
Irmen de Jong
97f90d9684
Merge branch 'master' into bool_type
2022-07-09 22:09:49 +02:00
Irmen de Jong
f91786367f
added maze example
2022-07-09 22:00:46 +02:00
Irmen de Jong
6a57337a68
improved bool type checking
2022-07-08 22:59:35 +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
81b3d2db4f
fix compiler crash
2022-07-08 21:50:06 +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
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
b41779bd02
added -D command line option to define symbols in the assembly file
2022-07-06 23:40:36 +02:00
Irmen de Jong
fee58e98c5
tiny optimization
2022-07-03 13:05:30 +02:00
Irmen de Jong
c51c1da618
psg micro optimizations
2022-07-03 11:55:13 +02:00
Irmen de Jong
ea2812f50f
add max volume to psg envelope
2022-07-03 11:26:56 +02:00
Irmen de Jong
3ec05709d5
convert the sounds in cx16 tehtriz to use the psg module instead
2022-07-03 01:40:29 +02:00
Irmen de Jong
4bdac7404a
added sustain to psg envelope
2022-07-03 00:55:25 +02:00
Irmen de Jong
cc41218d37
added nicer vm example
2022-07-03 00:41:04 +02:00
Irmen de Jong
4b336b1853
if passing a subroutine or label name as an uword argument, without &, add the addressof automatically
2022-07-02 23:55:32 +02:00
Irmen de Jong
e1c77ce236
fix pop() name scoping
2022-07-02 23:27:08 +02:00
Irmen de Jong
064d412ec8
added cx16.push_vera_context() and cx16.pop_vera_context() for use in irq handlers
2022-07-02 23:13:00 +02:00
Irmen de Jong
7fff4f249d
optimize msb(cx16.r0) -> cx16.r0H, lsb(cx16.r0) -> cx16.r0L
2022-07-02 21:38:22 +02:00
Irmen de Jong
7a3745f642
psg tweaks
2022-07-02 20:33:40 +02:00
Irmen de Jong
f8658f6afa
precalc vera freq to not use floating point math anymore
2022-07-02 19:40:18 +02:00
Irmen de Jong
223b725a10
psg abstraction and attack/release envelope
2022-07-02 18:47:12 +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
2eb41a8caf
temporary workaround for code problem around 'not'
2022-07-01 00:38:19 +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
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
4ca0805de1
bump version
2022-06-29 01:35:14 +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
dc82a0fc16
better not(x) replacement by x==0
2022-06-28 23:50:23 +02:00
Irmen de Jong
435d6f6f3f
vm: and/or/xor/not are all bitwise operations again
2022-06-28 03:17:51 +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
0fcd57192b
cx16diskio.f_read() now correctly deals with banked ram boundary
2022-06-26 21:42:56 +02:00
Irmen de Jong
c75bd97537
update kotest
2022-06-26 18:51:03 +02:00
Irmen de Jong
eea09f4de5
fix invalid asm label sometimes generated for multiple loops in same subroutine
2022-06-24 02:26:45 +02:00
Irmen de Jong
5656ec11d3
fix missing abs(byte) routine
2022-06-24 01:51:54 +02:00
Irmen de Jong
df36983049
version 8.2
2022-06-15 22:31:29 +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
bf9d120081
logical operators now always return a boolean byte result, instead of sometimes word type as well
...
(preparing for codegen simplifications for these)
2022-06-13 01:37:16 +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
c6e92ecac4
some code cleanup
2022-06-12 16:15:08 +02:00
Irmen de Jong
8f9a0a244a
trying to add zsound pcm player example as well
2022-06-10 23:35:37 +02:00
Irmen de Jong
710f27afa9
bump library versions
2022-06-09 22:44:17 +02:00
Irmen de Jong
f7183e38ee
tweak trivial subroutine inlining
2022-06-08 21:05:03 +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
d56eb397f9
fix codegen for rol/ror on pointer indexed
2022-06-06 16:07:45 +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
8f1c86f550
fixed several old test files
2022-06-05 14:20:08 +02:00
Irmen de Jong
af2ca7a67e
fix problematic characters that cause path errors on Windows
2022-06-05 11:46:37 +02:00
Irmen de Jong
9e3e2ff81a
fix assembly generation error when pipe character is part of string literal
2022-06-04 22:25:51 +02:00
Irmen de Jong
a862a81480
added unit test for name shadowing warning
2022-06-04 21:35: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
8618ba1b60
fix 6502 expression codegen for pointer indexing
2022-06-04 18:46:16 +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
0349d1d57c
diskio: moved cx16 optimized f_read() to cx16diskio instead
...
so unfortunately you have to select the faster version yourself when on cx16
2022-06-04 00:33:27 +02:00
Irmen de Jong
73a3a61729
swap() checks for unsupported code gen
2022-06-03 23:41:24 +02:00
Irmen de Jong
c7eafd7c79
cx16: fix macptr() signature and use it in diskio.f_read() for big increase in load speed
2022-06-02 00:37:18 +02:00
Irmen de Jong
10b5fb5d72
fix for total size returnvalue of diskio.f_read_all()
2022-06-01 01:13:19 +02:00
Irmen de Jong
a735939d1e
removed confusing GPL software license reference and copyright header from library files. (because of exclusion in output files)
...
Reworded software license and exclusion clause somewhat again in attempt to make it even clearer.
2022-05-30 20:12:20 +02:00
Irmen de Jong
6ed5f04970
version 8.1
2022-05-25 20:00:26 +02:00
Irmen de Jong
b646f50265
vm: implemented in-memory bit shift instructions
2022-05-23 20:15:20 +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
4e1184a400
vm: added some of the sin cos tables in math.p8
2022-05-17 22:56:00 +02:00
Irmen de Jong
52f9956e92
clarify use of direct-memory in functions that modify in place such as rol/swap
2022-05-16 22:41:31 +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
4be7bc8323
vm: limit float instructions to just 2 register args
2022-05-11 22:09:46 +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
dad5b17ac8
fix regression compiler crash in string comparison
2022-05-08 13:47:24 +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
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
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
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
6471c0c536
upgrade antlr to 4.10.1
2022-04-24 23:29:15 +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
6f2fdbe447
added %option merge, also fixed problem with unit test building in newer IntelliJ version
2022-04-15 22:38:32 +02:00
Irmen de Jong
0f4a197e34
improve ast check on pipe expressions
2022-04-14 00:49:06 +02:00
Irmen de Jong
7dbff5b9e6
abs: remove support for floats. Use floats.fabs() instead.
...
this solves: can't use abs() etc in pipe expression because return type depends on argument type
2022-04-14 00:38:31 +02:00
Irmen de Jong
220246278a
removed sum(), max(), min(). abs() now always returns uword type.
...
This greatly simplifies internal handling of builtin functions by always having one fixed return type.
2022-04-14 00:21:16 +02:00
Irmen de Jong
349e5a15e9
min/max give proper error for string args
...
als implmented more vm builtin functions/syscalls
2022-04-13 23:09:25 +02:00
Irmen de Jong
ab1766a559
moved all *integer* builtin trig functions (sin8u, cos8u etc) as regular asmsubs in math module
2022-04-13 00:27:35 +02:00
Irmen de Jong
a2c7273801
vm: use memory load instruction better
2022-04-11 20:55:06 +02:00
Irmen de Jong
c25d07259a
add block directive options to PtBlock
2022-04-10 21:37:47 +02:00
Irmen de Jong
a01aee3111
add sideEffects boolean to PtBuiltinFunctionCall
2022-04-10 21:08:54 +02:00
Irmen de Jong
3f6393f732
PtNumber can now be compared
2022-04-10 17:48:03 +02:00
Irmen de Jong
b6eb343234
moving string escaping out of antlr project
2022-04-10 17:31:30 +02:00
Irmen de Jong
207a7e5160
move operator lists
2022-04-10 13:24:17 +02:00
Irmen de Jong
a0face4a28
vm: implementing rol/ror
2022-04-09 11:13:49 +02:00
Irmen de Jong
a8cf9f5cc4
vm: syscalls can now return value
2022-04-05 20:46:34 +02:00
Irmen de Jong
461b38e653
add -vm option to load an existing p8virt file directly in the virtual machine
2022-04-05 18:42:31 +02:00
Irmen de Jong
036d9dbe59
got rid of unnecessary cast of boolean expressions by making their type dynamically adjust to byte or word
2022-04-04 23:43:55 +02:00
Irmen de Jong
1d342cc6af
optimize cx16 textio.setcc()/setcc2()
2022-04-04 22:23:06 +02:00
Irmen de Jong
62b32b2211
todos
2022-04-03 22:56:13 +02:00
Irmen de Jong
ae45ce517e
cleanups
2022-04-03 17:33:50 +02:00
Irmen de Jong
95f16c38a9
removed 'aug' property in PtAssignment , it wasn't used for anything
2022-04-03 15:56:14 +02:00
Irmen de Jong
d616cb283b
vm: implemented Pipe expression
2022-04-03 15:25:32 +02:00
Irmen de Jong
9874fe2c23
fix superfluous printing of WARN/ERROR words
2022-04-02 22:16:47 +02:00
Irmen de Jong
520a142992
version 8.0
2022-04-02 19:10:18 +02:00
Irmen de Jong
1e63615592
tweaks
2022-04-02 18:04:41 +02:00
Irmen de Jong
3e62ffed0a
x16 r39: optimize diskio.load_raw() to use kernal's headerless load support
2022-04-02 03:26:48 +02:00
Irmen de Jong
b133d51a83
make the parser report '&&' as an error instead of treating it as bitwise and followed by address-of.
2022-04-02 02:08:01 +02:00
Irmen de Jong
037b89f018
x16 r39: tweak kbdbuf_peek() result value
2022-04-01 23:47:09 +02:00
Irmen de Jong
156cf7315c
x16 r39: add new keyboard apis and more vector location definitions
2022-04-01 21:41:38 +02:00
Irmen de Jong
6be3b62d78
fix new Ast gosub node translation
2022-04-01 18:07:06 +02:00
Irmen de Jong
fb6e9fa58f
x16 r39: fix textio routines for new vera memory layout
2022-03-31 23:47:11 +02:00
Irmen de Jong
b2ce1e8029
x16 r39: fix gfx2.text() charset rendering due to new Vera mem layout
2022-03-31 18:51:54 +02:00
Irmen de Jong
d90c51220f
x16 r39: additional FP routine changes
2022-03-31 18:43:32 +02:00
Irmen de Jong
d1b14b68fa
x16 r39: more free ZP registers possible by enabling floatsafe option
2022-03-31 18:30:26 +02:00
Irmen de Jong
d911728611
x16 r39: cx16.mouse_config() API changed, added mouse_config2() convenience wrapper
2022-03-31 18:24:23 +02:00
Irmen de Jong
86a7200012
x16 r39: cx16.screen_set_mode() -> cx16.screen_mode()
2022-03-31 18:17:28 +02:00
Irmen de Jong
582c498fe3
major version bump because upcoming breaking changes in cx16 r39 release target (kernal routines)
2022-03-31 00:12:26 +02:00
Irmen de Jong
0a0c58d450
added for loop over constant ranges
2022-03-30 23:42:15 +02:00
Irmen de Jong
3e1a7c6102
fix vm signed comparisons
2022-03-29 00:57:33 +02:00
Irmen de Jong
6d79903eb3
workin on vm issues
2022-03-28 01:49:43 +02:00
Irmen de Jong
e166329f34
fix error for certain typecasted expressions inside comparisons
2022-03-28 01:38:01 +02:00
Irmen de Jong
bb1bf6a88c
working on vm
2022-03-28 00:40:15 +02:00
Irmen de Jong
30cbb6c9a8
implementing more of the vm
2022-03-27 21:59:46 +02:00
Irmen de Jong
4e33ab1e89
cx16 target: update float routine addresses to new r39 kernal FP package
2022-03-27 19:34:49 +02:00
Irmen de Jong
5494f309c0
working on vm
2022-03-27 17:46:15 +02:00
Irmen de Jong
3b6e7eccdd
simplified containment check, only possible on string and arrays (as per the docs)
2022-03-27 16:59:55 +02:00
Irmen de Jong
e41d6787bb
working on vm
2022-03-27 14:23:01 +02:00
Irmen de Jong
ed30108961
removed '**' power-operator. Use floats.pow() instead.
2022-03-27 13:16:34 +02:00
Irmen de Jong
12712ef812
working on vm
2022-03-27 11:48:44 +02:00
Irmen de Jong
3e44620966
add unit test for the string encoders special handling of 0x0000 and 0x8000-0x80ff
2022-03-25 18:26:23 +01:00
Irmen de Jong
7424f1f768
remove kernal bug workaround for joystick_get() routine. Fixes #39
2022-03-25 18:03:33 +01:00
Irmen de Jong
b5331d821c
fix string encoding for escaped characters
2022-03-25 00:17:41 +01:00
Irmen de Jong
27f6d47efa
working on vm codegen
2022-03-24 23:26:57 +01:00
Irmen de Jong
dbc7ad2ec4
no more Gosub node in new Ast, back to Functioncalls there.
2022-03-22 22:48:19 +01:00
Irmen de Jong
7b27d270a2
gosub only uses an identifier
2022-03-22 20:53:06 +01:00
Irmen de Jong
97b3a0b093
don't use the temp-variables introducing optimizations for the vm target
2022-03-22 20:21:32 +01:00
Irmen de Jong
fd581ffc37
moved pattern_match() from prog8_lib to string module
2022-03-21 21:32:10 +01:00
Irmen de Jong
ff57c5e9d3
working on vm and new ast
2022-03-21 01:36:11 +01:00
Irmen de Jong
9b16d7c786
working on vm
2022-03-20 15:06:29 +01:00
Irmen de Jong
7d2bf892b1
added start of virtual machine compilation target
2022-03-19 00:57:35 +01:00
Irmen de Jong
92737bb695
better handling of loadAddress
2022-03-13 16:21:02 +01:00
Irmen de Jong
9b81955544
optimizing new Ast
2022-03-13 11:49:07 +01:00
Irmen de Jong
4a0031080a
getting rid of directives in new Ast
2022-03-13 00:30:20 +01:00
Irmen de Jong
40e9fba312
working on new Ast and XML export to test it
2022-03-12 22:38:16 +01:00
Irmen de Jong
e227cc92ff
new ast: regular subroutine has just 0 or 1 return type
2022-03-12 14:12:06 +01:00
Irmen de Jong
73dbdbcbe6
module rename
2022-03-11 21:24:16 +01:00
Irmen de Jong
3961f26635
consolidating modules
2022-03-11 20:45:39 +01:00
Irmen de Jong
e51c274a18
reducing dependencies
2022-03-11 20:32:35 +01:00
Irmen de Jong
e75d0c58a9
reducing dependencies
2022-03-10 23:46:43 +01:00
Irmen de Jong
9a798360f4
introduced codeAst and codeCore modules to reduce dependencies
2022-03-10 22:38:16 +01:00
Irmen de Jong
844ad09464
reducing dependencies
2022-03-10 21:36:51 +01:00
Irmen de Jong
abcdd331db
started with a simulator
2022-03-10 21:23:00 +01:00
Irmen de Jong
775d136b91
new compileText result
2022-03-10 21:22:32 +01:00
Irmen de Jong
dc93691fd9
working on new ast
2022-03-10 21:22:32 +01:00
Irmen de Jong
48d782c69c
added flat mapping to symboltable
2022-03-10 21:22:31 +01:00
Irmen de Jong
0a04e626d7
added new intermediate (simplified) AST meant for new codegen
2022-03-10 21:21:15 +01:00
Irmen de Jong
e7c4bf5ebf
reducing dependencies
2022-03-10 21:17:31 +01:00
Irmen de Jong
251b6fcf70
reducing dependencies
2022-03-10 02:09:34 +01:00
Irmen de Jong
ab1fffb721
reducing dependencies
2022-03-10 01:41:42 +01:00
Irmen de Jong
da352a322c
reducing dependencies
2022-03-10 01:27:27 +01:00
Irmen de Jong
7d20458e82
fixed arrayliteral regression
2022-03-10 01:02:40 +01:00
Irmen de Jong
5a54066f81
unravel more dependency of SymbolTable on the ASt nodes (Expression), and fix initializing zp-allocated array
2022-03-09 01:42:05 +01:00
Irmen de Jong
a58e5a3399
simplify result handling of assembly phase
2022-03-08 18:51:07 +01:00
Irmen de Jong
9872f43cbf
repeat-forever loop is now replaced by label+jump
2022-03-08 03:25:34 +01:00
Irmen de Jong
1078cc4642
remove debug
2022-03-07 21:45:29 +01:00
Irmen de Jong
db7ae028b2
simplified CompilationResult a bit
2022-03-07 21:41:12 +01:00
Irmen de Jong
f7aa0c45df
optimize imports
2022-03-05 15:54:42 +01:00
Irmen de Jong
a72d58cdf9
updated 3rd party library versions
2022-03-05 15:28:22 +01:00
Irmen de Jong
067283834a
got rid of old IVariablesAndConsts object
2022-03-05 14:40:41 +01:00
Irmen de Jong
496245c801
working on symboltable
2022-03-05 12:10:20 +01:00
Irmen de Jong
859ab36347
variables extraction moved to the very end, so no need anymore to change the table after the fact
2022-03-04 23:12:24 +01:00
Irmen de Jong
1d740c7c36
removed need to store ast scope on each zp allocated var, now uses scoped name to find them
2022-03-04 22:58:05 +01:00
Irmen de Jong
a03c4c3659
working on symbol table
2022-03-04 22:26:46 +01:00
Irmen de Jong
094ecceaac
fix bug where non-inlined asmsub didn't always get a proper RTS, causing program crash
...
was caused by a change in 7.8; 8ae3bad6f7
"fix rts in empty asmsub"
2022-03-03 01:10:33 +01:00
Irmen de Jong
2812736ae5
preparing version 7.9
2022-03-03 00:42:53 +01:00
Irmen de Jong
38beebe720
fix pipe check for number of args
2022-03-02 21:29:09 +01:00
Irmen de Jong
fc1c3c6808
working on altered pipe syntax
2022-03-02 20:58:38 +01:00
Irmen de Jong
96ba895b84
working on altered Pipe syntax
2022-02-27 02:42:28 +01:00
Irmen de Jong
df35dfe3bf
added atari XEX output format with default $2000 load address
2022-02-26 15:36:22 +01:00
Irmen de Jong
c5504c6657
added ATASCII encoding table for atari
2022-02-25 23:48:39 +01:00
Irmen de Jong
6cce47b2f1
fix launching emulator for atari target
2022-02-24 23:22:02 +01:00
Freddy
ad9933f0f6
fixed chrout for atari and added two examples
2022-02-23 16:42:22 +01:00
Irmen de Jong
eeb3c968d6
streamline handling of launcher type and program load address. %address is now required if not using a basic-launcher.
2022-02-22 22:43:14 +01:00
Irmen de Jong
406658a10f
reimplemented sys.memcopy and sys.memset on cx16 to work without kernal too
2022-02-22 21:07:19 +01:00
Irmen de Jong
6a0551cea1
added 'atari' compiler target beginnings (Atari 800 XL)
...
also default char and string encoding now taken from compiler target
2022-02-22 00:52:35 +01:00
Irmen de Jong
553f3b45d2
compile time calculated values of sin/cos routines fixed to be identical to the results of the run-time functions
2022-02-21 21:30:42 +01:00
Irmen de Jong
064a8e785c
cleanups
2022-02-21 03:26:17 +01:00
Irmen de Jong
21e9723bb2
allow the last term in a pipe statement to be a variable, rewrites this as var = <rest of pipe>
2022-02-21 02:33:19 +01:00
Irmen de Jong
60b2c44a44
fix returntype handling of builtinfunctions, fix errors in pipe expressions
2022-02-21 01:44:29 +01:00
Irmen de Jong
c4fe3ecc0a
refactor
2022-02-20 22:04:18 +01:00
Irmen de Jong
2f18a8f6d0
introduced BuiltinFunctionCall (expression) node for codegen
2022-02-20 02:48:27 +01:00
Irmen de Jong
5ac784e18a
cleanup
2022-02-19 00:30:59 +01:00
Irmen de Jong
7a2164b4d0
introduced BuiltinFunctionCallStatement node for codegen
2022-02-18 23:27:11 +01:00
Irmen de Jong
0a43eae184
rework registerArgsViaStackEvaluation to use cpu hardware stack instead
2022-02-18 22:38:00 +01:00
Irmen de Jong
3117e2b2a3
more tweaks
2022-02-18 01:25:08 +01:00
Irmen de Jong
7aa807ec7f
proper error if attempting to do a containment check against non const range, and some cleanup in asmgen
2022-02-16 00:39:19 +01:00
Irmen de Jong
4d16e1e14a
now checks for invalid text encodings for given compilation target
2022-02-15 01:39:12 +01:00
Irmen de Jong
73fc18099e
properly report duplicate label names
2022-02-15 00:39:10 +01:00
Irmen de Jong
e34dac8dbb
remove unit test issue
2022-02-15 00:38:51 +01:00
Irmen de Jong
af0e7f7187
searching names in inlined assembly now ignores source comments
2022-02-13 13:41:12 +01:00
Irmen de Jong
a3a6812608
version 7.8
2022-02-12 17:40:32 +01:00
Irmen de Jong
2725c4ad4d
slight tweaks to zp and allocator
2022-02-12 00:15:52 +01:00
Irmen de Jong
c8cd6e9460
removed old @"screencodes" string encoding syntax (use sc:"hello" instead)
2022-02-11 22:07:14 +01:00
Irmen de Jong
b47fc1c020
renames of some Ast node classes
2022-02-11 00:34:36 +01:00
Irmen de Jong
f95fe8f1da
note about removing VarDecls
2022-02-10 23:20:19 +01:00
Irmen de Jong
bd0dee5db5
cleanup
2022-02-10 22:22:50 +01:00
Irmen de Jong
c13b7fd883
report free/occupied Zeropage space at end of compilation
2022-02-10 21:59:44 +01:00
Irmen de Jong
343f01d5e1
re-enabled unused variable removal from library modules (+fixed some @shared vars in libraries)
2022-02-10 03:10:47 +01:00
Irmen de Jong
08bacdd090
temp vars are now dynamically added to AST as needed
2022-02-10 02:52:47 +01:00
Irmen de Jong
41b1c80492
label name from memory() no longer interned as string var
2022-02-10 00:45:20 +01:00
Irmen de Jong
e5d7316e5d
streamlining non-zpvars asmgen using new mechanism
2022-02-10 00:09:09 +01:00
Irmen de Jong
b043c3a6da
streamlining vars asmgen using new mechanism
2022-02-09 21:58:25 +01:00
Irmen de Jong
98b2855b9c
cleanups
2022-02-09 16:35:52 +01:00
Irmen de Jong
8c2e6971fc
start using vars instead of callgraph (2)
2022-02-08 21:09:00 +01:00
Irmen de Jong
1903990f30
start using vars instead of callgraph
2022-02-08 20:40:10 +01:00
Irmen de Jong
7d67005709
more rewrite variable allocation
2022-02-08 20:40:10 +01:00
Irmen de Jong
72dfb0bda3
fix: undefined sys.memcopy when initializing array on cx16
2022-02-08 20:29:47 +01:00
Irmen de Jong
101fb0b8aa
some naming changes and cleanups
2022-02-06 23:14:44 +01:00
Irmen de Jong
10de7dc1f9
fixed the concurrent modification issue on zeropage when running unit tests in parallel, by not having machine targets be static objects
2022-02-06 21:29:06 +01:00
Irmen de Jong
d2309b8114
introducing IVariableAllocation (WIP)
2022-02-06 18:57:23 +01:00
Irmen de Jong
6bdd81623f
cleaning up AsmGen interface
2022-02-06 17:07:03 +01:00
Irmen de Jong
f538c9f0c3
remove bogus double var decl check
2022-02-06 14:04:54 +01:00
Irmen de Jong
8ae3bad6f7
fix rts in empty asmsub
2022-02-06 05:05:58 +01:00
Irmen de Jong
77de99b383
rts-check for non-inlined subroutines + var init adjustment when noreinit, moved out of codegen
2022-02-06 04:03:03 +01:00
Irmen de Jong
312949f336
added experimental codegen backend option
2022-02-05 21:42:03 +01:00
Irmen de Jong
1ab635bd7e
small tweak of parse messages
2022-02-05 14:02:24 +01:00
Irmen de Jong
b35abd548c
less noisy output about what module files are being imported.
2022-02-05 04:25:34 +01:00
Irmen de Jong
30e1c3307c
simplify SourceCode: just read the full text immediately. Also optimized imports.
2022-02-05 03:50:54 +01:00
Irmen de Jong
08e052380a
comments
2022-02-05 03:14:26 +01:00
Natt Akuma
49d37c016e
Optimize strcmp_mem
2022-02-04 22:07:03 +07:00
Natt Akuma
73dfb5f443
Optimize sign extension to AY
2022-02-04 00:59:44 +07:00
Irmen de Jong
69b9dfa468
fix invalid recursion warning for code referencing subroutine but not via a call
2022-02-01 23:09:52 +01:00
Irmen de Jong
5c8c64242f
callgraph: nameInAssemblyCode searches smarter (for unused())
2022-02-01 00:33:05 +01:00
Irmen de Jong
ddf96943f0
remove Nop ast node.
2022-01-31 22:36:10 +01:00
Irmen de Jong
e773be2f58
remove no longer needed asmSymbol scoping prefixing, now asmSymbolName are identical to asmVarName
2022-01-31 01:47:22 +01:00
Irmen de Jong
990c8e1f18
split out 6502 codegen module from various compilertargets module.
2022-01-28 00:32:09 +01:00
Irmen de Jong
a170506356
simplify IdentifierReference equality check back to default (name+pos)
2022-01-27 23:32:55 +01:00
Irmen de Jong
5ecf2a3357
enable more optimizations for typecasted assignments. Fixed missing codegen for assigning bytes to words in certain cases.
2022-01-27 18:05:25 +01:00
Irmen de Jong
fa48746ba9
increase internal buffer for diskio.list_files to be able to list larger directories
2022-01-26 03:17:33 +01:00
Irmen de Jong
e2b8c069d7
check for missing '&' in string + value expressions (can't just add a value to a string)
2022-01-24 23:30:40 +01:00
Irmen de Jong
08db72903c
for long containment checks use a subroutine instead of huge cmp-table
2022-01-24 22:40:22 +01:00
Irmen de Jong
46f9fab140
library API change: string.find now returns index of character + carry bit status (instead of substring address)
2022-01-24 21:37:04 +01:00
Irmen de Jong
b7d06f2c0a
API change: added alignment parameter to memory() function
2022-01-24 18:58:57 +01:00
Irmen de Jong
118196a0bf
library API change: moved cx16.vload() to cx16diskio module
2022-01-24 18:31:18 +01:00
Irmen de Jong
adb979df38
tweak comment
2022-01-23 22:34:05 +01:00
Irmen de Jong
3401cb5b4a
fixed compiler recursion crash when returning certain typecasted value
2022-01-23 19:13:20 +01:00
Irmen de Jong
5766208207
fix compiler crash when initializing an array var with another array var
2022-01-23 14:23:34 +01:00
Irmen de Jong
1e053783f3
fix invalid size copied when assigning non-byte arrays
2022-01-23 02:42:36 +01:00
Irmen de Jong
7afc96112b
now correctly requires using & (address-of) when assigning the address of a label or subroutine, used to generate invalid code when it was omitted
2022-01-23 02:23:30 +01:00
Irmen de Jong
7bb41a30ed
fixed compiler crash when assigning number larger than 65535
2022-01-23 01:44:16 +01:00
Irmen de Jong
3d1b0eb843
fixed compiler crash when using cx16.r0H as function call argument
2022-01-23 01:28:16 +01:00
Irmen de Jong
5b9af0b5ae
tweaks
2022-01-21 23:38:54 +01:00
Irmen de Jong
9219ec539d
allow "goto pointervar" for indirect jumps
2022-01-21 22:55:59 +01:00
Irmen de Jong
c8bd57cd4d
fixed signature of mouse_get(): it returns the buttonstatus in A. Added convenience cx16.mouse_pos() routine.
2022-01-21 22:06:17 +01:00
Irmen de Jong
651c383668
refactor encoder to be the same for all 3 machine targets now
2022-01-19 21:21:33 +01:00
Irmen de Jong
674295e800
improve error reporting from string encoders
2022-01-19 21:21:33 +01:00
Irmen de Jong
6b02f2eea0
implement iso encoding and new string encoding syntax, fixes #38
2022-01-19 21:21:32 +01:00
Irmen de Jong
5237e55326
added txt.iso() to enable iso-charset on cx16
2022-01-18 21:35:29 +01:00
Irmen de Jong
3b59592110
generalize string encoding flag into enum
2022-01-18 21:21:49 +01:00
Irmen de Jong
d916027e75
labels no longer start with '_' fixes #62
2022-01-17 22:03:53 +01:00
Irmen de Jong
8966d2aa06
comments and prepare new version 7.7
2022-01-16 23:03:00 +01:00
Irmen de Jong
de7ea04f54
when zp option = dontuse, print error for any variable with @requirezp
2022-01-16 18:13:24 +01:00
Irmen de Jong
fe51698579
tweak how zp varnames are stored
2022-01-16 17:20:36 +01:00
Irmen de Jong
a798fe72d3
cx16 reserved zp vars (virtual registers)
2022-01-16 17:20:36 +01:00
Irmen de Jong
fba98d03a5
improve %zpreserved error messages
2022-01-16 17:20:36 +01:00
Irmen de Jong
7dd2517f67
fix Zp allocation issues
2022-01-16 17:20:36 +01:00
Irmen de Jong
641477d6f6
add @requirezp and allow str/array to be on zp (with warning)
2022-01-16 17:20:32 +01:00
Irmen de Jong
8e56656c8d
fix broken code generated for certain ==/!= expressions
2022-01-16 17:10:49 +01:00
Irmen de Jong
6fcb51cea2
add warning when encoded string contains 0-byte
2022-01-15 17:11:40 +01:00
Irmen de Jong
c58b8a4973
fix ast to source: @shared wasn't printed
...
fix grammar: @shared and @zp can occur in any order now in vardecl
2022-01-13 02:29:55 +01:00
Irmen de Jong
c8f4ab4f06
doc
2022-01-12 22:21:01 +01:00
Irmen de Jong
056ec986c2
use var initializer assignments in a clearer way
2022-01-11 00:34:44 +01:00
Irmen de Jong
de3b2fb95b
slightly optimized certain list iterations into sequences
2022-01-10 23:15:24 +01:00
Irmen de Jong
b29c3152db
Assignment: make its origin explicit
2022-01-10 02:25:02 +01:00
Irmen de Jong
3831679772
VarDecl: make its origin explicit
2022-01-10 01:53:03 +01:00
Irmen de Jong
895534f32b
don't remove dead variable assignments if they are a function call
2022-01-09 18:41:01 +01:00
Irmen de Jong
50c16fe6de
code size optimization: don't copy floats with inlined copy code but use copy_float routine
2022-01-09 16:18:13 +01:00
Irmen de Jong
c1a39c269e
optimized code for stack eval comparisons with zero
2022-01-09 03:19:49 +01:00
Irmen de Jong
6fa3f0b6cd
small refactor
2022-01-08 18:02:38 +01:00
Irmen de Jong
d99d977d2b
fix more typecasting issues
2022-01-08 17:04:25 +01:00
Irmen de Jong
7dd7e562bc
pipes also as expressions, cleanup codegen, fix various typecasting issues
2022-01-08 13:45:19 +01:00
Irmen de Jong
17694c1d01
better error handling of invalid number casts
2022-01-07 22:12:13 +01:00
Irmen de Jong
749ad700d8
naming consistency for some expression classes
2022-01-07 21:02:55 +01:00
Irmen de Jong
8f3df3039a
added pipe operator `|>
`
2022-01-06 22:54:18 +01:00
Irmen de Jong
02c315c194
add missing unit tests and type checking for 'in' expression
2022-01-06 00:01:49 +01:00
Irmen de Jong
c57ef7725e
preparing v7.6
2022-01-04 20:40:35 +01:00
Irmen de Jong
96225efd96
library doc tweaks
2022-01-03 23:15:34 +01:00
Irmen de Jong
74257163b1
fix that memory("name", ...) also allocates a STR variable for the name
2022-01-02 17:07:04 +01:00
Irmen de Jong
7bc75fd220
fix that memory("a b c", ...) produces invalid symbol
2022-01-02 16:11:53 +01:00
Irmen de Jong
a23281afab
added experimental -noreinit option
2022-01-01 16:35:36 +01:00
Irmen de Jong
c15a75556d
Merge branch 'master' into c128target
...
# Conflicts:
# compiler/src/prog8/CompilerMain.kt
# examples/test.p8
2021-12-30 18:22:05 +01:00
Irmen de Jong
5267e06969
added -asmlist cli option to produce assembler listing output
2021-12-30 14:42:09 +01:00
Irmen de Jong
b62183adcb
slightly optimized binexpr evaluation for ==/!= in some cases
2021-12-30 02:00:36 +01:00
Irmen de Jong
5d2dec1803
added missing codegen for augmented ==/!=
2021-12-30 01:34:10 +01:00
Irmen de Jong
9f8c70b326
fix warning about testing multiple values
2021-12-30 00:49:36 +01:00
Irmen de Jong
05a1ddad05
Merge branch 'master' into c128target
...
# Conflicts:
# examples/test.p8
2021-12-29 18:14:24 +01:00
Irmen de Jong
4be3d63c0e
slight optimization of if-in
2021-12-29 18:13:43 +01:00
Irmen de Jong
de6ce4a46e
add "X in [1,2,3]" expression (efficient containment check)
2021-12-29 17:26:00 +01:00
Irmen de Jong
7a9e5afb93
fix: for loop over array literal no longer crashes the compiler
2021-12-28 17:51:38 +01:00
Irmen de Jong
b2876b0a03
add a suggestion to use when statement if it seems appropriate
2021-12-28 16:38:12 +01:00
Irmen de Jong
b66f66fe6a
fix renames
2021-12-28 14:32:27 +01:00
Irmen de Jong
30f04962d4
Merge branch 'master' into c128target
...
# Conflicts:
# codeGeneration/src/prog8/codegen/target/C128Target.kt
# codeGeneration/src/prog8/codegen/target/c128/C128MachineDefinition.kt
# codeGeneration/src/prog8/codegen/target/c128/C128Zeropage.kt
# compiler/src/prog8/CompilerMain.kt
# compiler/src/prog8/compiler/Compiler.kt
2021-12-28 14:30:11 +01:00
Irmen de Jong
0feeb88024
codegen package rename 2
2021-12-28 14:23:36 +01:00
Irmen de Jong
56d21de001
Merge branch 'master' into c128target
...
# Conflicts:
# examples/test.p8
2021-12-28 13:57:27 +01:00
Irmen de Jong
7b54aa0c7d
more consistent naming of the statement classes
2021-12-28 13:56:47 +01:00
Irmen de Jong
6e11b8ada1
GoSub no longer inherits from Jump node, fixes subtle ast/codegen bugs related to jsrs
2021-12-28 01:55:13 +01:00
Irmen de Jong
1c7c4fc3b0
optimized if-goto codegeneration
2021-12-28 00:42:00 +01:00
Irmen de Jong
97e84d0977
tweak if statement handling
2021-12-27 15:04:25 +01:00
Irmen de Jong
9906b58818
tweak while desugaring, moved postfixexpr optimizations to VariousCleanups regardless of optimizer setting because asmgen requires these for conditional expressions
2021-12-27 12:41:26 +01:00
Irmen de Jong
1c10839c14
moved peek/poke desugaring to other walker
2021-12-27 02:08:47 +01:00
Irmen de Jong
c55fdd9834
removed special code generation for while and util expression (replaced by jumps)
...
also added exhaustive parent node checker in validation step
2021-12-27 02:04:28 +01:00
Irmen de Jong
67b0890a6e
remove unneeded var inits when an assignment is already present
2021-12-25 23:31:25 +01:00
Irmen de Jong
4da4f96669
lower code: break -> goto after (simplifies codegen)
2021-12-25 22:30:38 +01:00
Irmen de Jong
d4153da8b9
setup float routine addresses for c128
2021-12-25 02:34:52 +01:00
Irmen de Jong
fc33ab8905
shuffled some system functions back to c64 block to remain compatible with existing code, added missing float and graphics library stubs
2021-12-24 00:08:32 +01:00
Irmen de Jong
8fa84de28e
fix c128 clearscreen and bdmusic sound issue
2021-12-22 22:59:36 +01:00
Irmen de Jong
3e3da38de1
correctly disable charset switching
2021-12-22 21:47:41 +01:00
Irmen de Jong
cabf1e82e8
some shadow registers added to make uppercase()/lowercase() work
2021-12-22 21:20:34 +01:00
Irmen de Jong
836d40072f
c128 evalstack corrections
2021-12-22 00:07:05 +01:00
Irmen de Jong
431401d90e
c128 corrections
2021-12-21 23:37:15 +01:00
Irmen de Jong
6da83e2bd7
first steps to add C128 compiler target
2021-12-21 19:08:33 +01:00
Irmen de Jong
e051e09c1d
trim down number of warnings a bit
2021-12-17 20:21:14 +01:00
Irmen de Jong
77c2b2b326
fix position of @shared in array var declarations so that the order is now type[] @shared
2021-12-16 20:36:05 +01:00
Irmen de Jong
3cf9b9d9a5
code size optimization: subroutine calls with 2 byte arg will pass it via A/Y registers instead of separate param assignments at every call site
2021-12-16 01:48:22 +01:00
Irmen de Jong
629117e594
code size optimization: subroutine calls with 1 int arg will pass it via register instead of separate param assignment at every call site
2021-12-16 00:56:59 +01:00
Irmen de Jong
08f87c321f
fixed capitalization of operator sets to be consistent with other sets names
2021-12-15 23:43:14 +01:00
Irmen de Jong
1ff13723fe
implicit int to float conversion is now an error if floats are not enabled.
2021-12-15 01:52:28 +01:00
Irmen de Jong
510bda1b28
fix compiler crash when using floats in a comparison expression
2021-12-15 01:24:25 +01:00
Irmen de Jong
890327b381
the returnvalue of the diskio.load() function family now is just the last load address+1 (like kernal's LOAD routine).
...
This fixes the inconsistent attempt to calculate a size, just let the caller do this if required.
Added a small helper function in cx16diskio to do this for loads that span multiple banks.
2021-12-14 23:54:42 +01:00
Irmen de Jong
b21f7411dd
fix compiler crash when trying to concatenate string var and string literal.
2021-12-14 23:07:46 +01:00
Irmen de Jong
5df623bd2e
doc
2021-12-14 22:40:03 +01:00
Irmen de Jong
02010170ce
fix compiler crash when attempting to call a non-function
2021-12-11 13:20:13 +01:00
Irmen de Jong
35998142fe
version 7.5
2021-12-10 20:18:17 +01:00
Irmen de Jong
3d743a1ba1
added more constfolding
2021-12-09 23:32:48 +01:00
Irmen de Jong
abca618008
added more constfolding
2021-12-09 23:12:12 +01:00
Irmen de Jong
0d2c3901a3
added more constfolding
2021-12-09 22:12:31 +01:00
Irmen de Jong
d901a1531f
added missing vectors to syslib
2021-12-09 21:38:00 +01:00
Irmen de Jong
d8d56b195f
comments
2021-12-09 21:13:13 +01:00
Irmen de Jong
98315de723
allow using ubyte[] as subroutine parameter type (because it is equivalent to uword pointer var)
2021-12-07 23:28:45 +01:00
Irmen de Jong
dcf487bdc1
fix: correctly insert return statement if needed to prevent 'fall through' into following subroutine
...
this wasn't working correctly anymore when the last statement before the subroutine was a jump/goto
2021-12-07 21:34:50 +01:00
Irmen de Jong
547b1d3720
comment corrections
2021-12-06 23:33:18 +01:00
Irmen de Jong
84f75f4156
tweaked some more .getOrElse
2021-12-06 21:22:00 +01:00
Irmen de Jong
ff69da3fa2
error when 'else' choice in when statemetn isn't the last one, also generate slightly better code for when statements
2021-12-05 21:54:46 +01:00
Irmen de Jong
edffe92a24
astchecker is smarter in detecting rts in inline assembly
2021-12-05 21:28:31 +01:00
Irmen de Jong
837804b231
test for string x and u escape sequences
2021-12-05 18:39:34 +01:00
Irmen de Jong
900cdd3fa1
added cx16diskio with load() and load_raw() that are HIMEM bank-aware
2021-12-05 02:20:48 +01:00
Irmen de Jong
0018dc6ce7
refactor machinedefinition
2021-12-04 19:07:19 +01:00
Irmen de Jong
c92f914081
gradle build settings tweak to avoid jdk version conflict
2021-12-04 18:36:47 +01:00
Irmen de Jong
0498444ef2
moved all unit tests into single project to avoid dependency issues
2021-12-04 18:20:22 +01:00
Irmen de Jong
ce3c34e458
tweak in error output for file links, corrected column number off-by-one
2021-12-04 16:52:03 +01:00
Irmen de Jong
20401b99d8
added cx16.getrambank() / getrombank() to retrieve the current ram and rom bank numbers.
2021-12-04 15:27:54 +01:00
Irmen de Jong
b867d8f731
cleanups
2021-12-04 01:03:51 +01:00
Irmen de Jong
9a68864b67
version 7.5-dev
2021-12-04 00:18:44 +01:00
Irmen de Jong
72d7178762
added diskio.load_raw() to load headerless files
2021-12-04 00:07:21 +01:00
Irmen de Jong
fbcd9a0c1d
reduce number of similar errors for type problem in assignment
2021-12-02 17:44:52 +01:00
Irmen de Jong
5b56e0462d
also deal with zero args
2021-12-01 22:26:36 +01:00
Irmen de Jong
b7fffbb6df
release 7.4.1 - oops, funcion call arg count validation was broken
2021-12-01 21:44:03 +01:00
Irmen de Jong
1f346230e3
release 7.4
2021-11-30 22:50:12 +01:00
Irmen de Jong
3d1d0696b9
refactor compiler arguments passing
2021-11-30 01:40:21 +01:00
Irmen de Jong
9ecf95b075
fix syntaxerror in const processing of ranges if it contained variables
2021-11-29 23:36:41 +01:00
Irmen de Jong
7748c261da
rsave/rrestore moved from sys to builtin function to solve the stack related problem when calling it as a regular subroutine
2021-11-29 23:13:04 +01:00
Irmen de Jong
a2db44f80c
also consider Y register for clobber check for functioncall arguments
2021-11-29 22:09:05 +01:00
Irmen de Jong
b438d8aec0
fix invalid range size check when stepval is not a positive integer
2021-11-29 02:01:19 +01:00
Irmen de Jong
56dc6d7f1e
comment
2021-11-29 01:10:11 +01:00
Irmen de Jong
45b8762188
use inc/ina instead of adc
2021-11-29 00:07:15 +01:00
Irmen de Jong
32068a832a
split some additional binary expressions to avoid stack-based evaluation
2021-11-28 18:27:28 +01:00
Irmen de Jong
47c2c0376a
added some cpu stack related assembly-level optimizations
2021-11-28 17:27:01 +01:00
Irmen de Jong
f0dadc4a43
optimize 1-arg functioncalls
2021-11-28 16:55:10 +01:00
Irmen de Jong
960b60cd2d
tweak
2021-11-28 14:06:12 +01:00
Irmen de Jong
0a568f2530
fix the check of double-defined subroutine variables
2021-11-28 12:52:32 +01:00
Irmen de Jong
c52aa648c0
use an AnonymousScope to contain GoSub changes instead of adding separate statements
2021-11-28 12:09:13 +01:00
Irmen de Jong
f3a4048ebf
improved setting Carry bit as asmsub parameter
2021-11-28 03:31:32 +01:00
Irmen de Jong
1b07637cc4
better error checking for wrong pop()
2021-11-28 02:49:18 +01:00
Irmen de Jong
68b75fd558
fix: also allow pass-by-reference arguments to builtin functions that accept UWORD (adds implicit type cast)
2021-11-28 02:34:53 +01:00
Irmen de Jong
7c5ec1853d
nice error message if pop() argument is wrong
2021-11-28 02:20:35 +01:00
Irmen de Jong
e8f4686430
undid failed attempt of using sys.push/sys.pop for stack args - now using new push(), pushw(), pop(), popw() builtin functions
2021-11-28 01:22:40 +01:00
Irmen de Jong
02348924d0
failed attempt of using sys.push/pop for stack args
2021-11-27 23:52:47 +01:00
Irmen de Jong
c838821615
refactor fuction arguments codegen a bit
2021-11-27 21:14:21 +01:00
Irmen de Jong
8b4ac7801f
fix sys.push() signature for c64
2021-11-27 20:18:41 +01:00
Irmen de Jong
e8e25c6fd6
added sys.push() and sys.pop() to put values on cpu stack. Added missing builtin functions to syntax-files.
2021-11-27 18:09:15 +01:00
Irmen de Jong
54025d2bf5
small refactor and spelling fixes
2021-11-27 14:49:18 +01:00
Irmen de Jong
f5ebf79e71
make sure X register is also saved if needed when GoSub is used
2021-11-26 22:11:52 +01:00
Irmen de Jong
110e047681
replace subroutine calls (statement) by GoSub
2021-11-26 19:47:01 +01:00
Irmen de Jong
17d403d812
Merge branch 'ref-subroutine-param' into v7.4-dev
...
# Conflicts:
# compilerAst/src/prog8/ast/AstToplevel.kt
2021-11-26 01:12:14 +01:00
Irmen de Jong
0a53bd4956
fix parameter name conflict
2021-11-26 01:01:59 +01:00
Irmen de Jong
e52d05c7db
fix some scoping related symbol lookup issues, clarified scoping rules in docs
2021-11-23 23:43:23 +01:00
Irmen de Jong
b00db4f8a2
no longer report unknown type errors as well for unknown symbols,
...
added a bunch more unit tests for symbol scoping rules
2021-11-23 22:45:57 +01:00
Irmen de Jong
0c2f30fd45
links to 6502 bresenham line algorithms
2021-11-23 21:51:18 +01:00
Irmen de Jong
e08871c637
oops! replace phx/plx 65C02 (cx16) instructions by 6502 (c64) compatible alternative.
...
Couldn't assemble code that used some of the routines in conv on c64 before...
2021-11-22 21:02:43 +01:00
Irmen de Jong
ff715881bc
allow scoped identifiers to reference a subroutine parameter directly.
...
also for asmsubroutines, but the asm generation for that is not yet done.
2021-11-21 23:21:39 +01:00
Irmen de Jong
0e2e5ffa52
fix parameter name conflict
2021-11-21 22:12:35 +01:00
Irmen de Jong
8095c4c155
added GoSub node (internal use only later for calling subroutines)
2021-11-21 16:23:48 +01:00
Irmen de Jong
8887e6af91
fix substituting 0 only if its actually the same variable that's substituted
2021-11-21 12:34:57 +01:00
Irmen de Jong
dde4c751da
version 7.4-dev
2021-11-21 03:28:13 +01:00
Irmen de Jong
b292124f3c
replaced many short/int values by unsigned types if appropriate
2021-11-21 00:55:56 +01:00
Irmen de Jong
c0035ba1a2
char encodings now use UByte type instead of short
2021-11-21 00:07:17 +01:00
Irmen de Jong
107935ed31
add some more const folding patterns
2021-11-20 22:47:49 +01:00
Irmen de Jong
adfaddbcf4
give a nicer error when given a wrong compilation target.
2021-11-20 18:30:55 +01:00
Irmen de Jong
74db5c6be7
fix referencesIdentifier() and better removal of unnecessary assignments
2021-11-20 17:41:41 +01:00
Irmen de Jong
f9399bcce7
r=(q+r)-c and r=q+(r-c) are now both also 'augmentable', and BinExprSplitter doesn't check for associativeOperator anymore
2021-11-20 02:03:32 +01:00
Irmen de Jong
87600b23db
fix constvalue parent linkage for prefix and typecast
2021-11-20 00:20:35 +01:00
Irmen de Jong
cedfb17b18
fix too aggressive removal of vars that weren't completely unused
2021-11-19 22:49:35 +01:00
Irmen de Jong
fa4c83df6b
added 3 tests for discovered problems
2021-11-18 23:55:20 +01:00
Irmen de Jong
42c8720e8b
fix float rounding tests
2021-11-18 22:54:49 +01:00
Irmen de Jong
b334d89715
refactor and fix the way memory addresses are checked to be in IO space or regular ram
2021-11-18 22:47:58 +01:00
Irmen de Jong
4f5d36a84d
optimization added: bitwise operations with a negative constant number -> replace the number by its positive 2 complement
2021-11-18 02:51:42 +01:00
Irmen de Jong
fa11a6e18b
removed faulty and too aggressive assembly optimization of double-store
2021-11-18 01:43:22 +01:00
Irmen de Jong
4c82af36e6
fix improperly changed behavior about =0 initializer
2021-11-18 00:17:22 +01:00
Irmen de Jong
dafa0d9138
fix compiler crash bug due to reused ast expression nodes. Now all (relevant) Nodes have a copy() function to make a clone.
2021-11-17 23:05:59 +01:00
Irmen de Jong
2e0450d7ed
fix bug where variable=0 initializer was forgotten if vardecl is followed by an augmented assignment
2021-11-17 22:31:43 +01:00
Irmen de Jong
f48d6ca9f8
simplified NumericLiteral to always just contain a Double instead of a Number for the value
2021-11-16 23:52:54 +01:00
Irmen de Jong
1f60a2d8b9
comments
2021-11-15 01:30:12 +01:00
Irmen de Jong
5fd83f2757
version 7.3
2021-11-14 22:55:13 +01:00
Irmen de Jong
c80df4140b
until-loop condition now also simplified to avoid stack-eval
2021-11-14 22:51:02 +01:00
Irmen de Jong
53e1729e2f
introduce option to use internal scratch variables via prog8_lib definitions (ony for compiler, not for user code!)
2021-11-14 16:01:54 +01:00
Irmen de Jong
ab2d1122a9
conditional expressions are optimized more intelligently (simple ones are not split off in separate assignments)
2021-11-14 12:38:56 +01:00
Irmen de Jong
5190594c8a
added several more assembly-level optimizations to remove redundant instructions
2021-11-14 12:23:46 +01:00
Irmen de Jong
c858ceeb58
compiler shouldn't use cx16.r15 as temp var
2021-11-14 02:38:59 +01:00
Irmen de Jong
f0f52b9166
optimize typecasted binary expression to avoid even more estack use. also fix wrong parent crash in removal of unused variable's assignments.
2021-11-13 14:22:37 +01:00
Irmen de Jong
00c6f74481
tweak temp float
2021-11-13 12:56:59 +01:00
Irmen de Jong
2177ba0ed2
added signed versions of the cx16 virtual registers
2021-11-13 02:42:21 +01:00
Irmen de Jong
3483515346
preparing for more optimizations
2021-11-12 23:23:51 +01:00
Irmen de Jong
75a06d2a40
preparing for more optimizations
2021-11-12 02:17:37 +01:00
Irmen de Jong
53ac11983b
better unused variable removal
2021-11-11 03:03:21 +01:00
Irmen de Jong
69f4a4d4f8
tweak expr.typecastTo() a bit
2021-11-11 00:15:09 +01:00
Irmen de Jong
222bcb808f
optimize load-store-load combo in output asm
2021-11-10 23:47:35 +01:00
Irmen de Jong
8df3da11e3
add cosr8, sinr8, cosr16 and sinr16 builtin functions that take a degree 0..179 (= 0..358 in 2 degree steps)
...
to more easily scale halves/quarters etc of a circle than possible with the ones that take 0..255 'degrees'.
2021-11-09 23:39:26 +01:00
Irmen de Jong
84dafda0e4
fix error message for type mismatch on builtin-function parameter
2021-11-09 22:19:07 +01:00
Irmen de Jong
b909facfe5
fix compiler stackoverflow crash on certain typecasted expressions containing floats.
2021-11-09 19:31:19 +01:00
Irmen de Jong
7780d94de1
discovered crash related to float typecasting in asm assignment codegen
2021-11-09 03:45:07 +01:00
Irmen de Jong
4937e004b5
fix compiler crash where it used wrong datatype in split assignment
...
fixes crash for "ubyte bb ;; uword ww ;; bb = not bb or not ww"
2021-11-09 01:13:23 +01:00
Irmen de Jong
857724c7e6
attempt to make if-statement not use stack eval anymore
2021-11-08 19:07:36 +01:00
Irmen de Jong
2d1e5bbc7e
remove unimportant empty tests
2021-11-08 17:00:10 +01:00
Irmen de Jong
7961a09d16
converting compiler module's testcases to kotest assertions
2021-11-08 16:14:22 +01:00
Irmen de Jong
613efcacc7
converting compiler module's testcases to kotest (ongoing)
2021-11-08 15:08:48 +01:00
Irmen de Jong
7e8db16e18
moved to kotest assertions in compilerAst module tests
2021-11-07 21:18:18 +01:00
Irmen de Jong
f4c4ee78d9
re-use global returnvalue temp var instead of duplicating it in every subroutine that needs it
2021-11-07 14:19:21 +01:00
Irmen de Jong
72a7e61fd0
version 7.2
2021-11-06 23:42:13 +01:00
Irmen de Jong
f40620aa25
"not x" as a condition (if, while, until) is optimized into "x==0", this avoids calculating the value
2021-11-06 23:25:32 +01:00
Irmen de Jong
4270c04856
don't crash but give proper error on "-X" expression where X is not a signed type
2021-11-06 18:06:01 +01:00
Irmen de Jong
62dc824bc0
tweaks
2021-11-06 17:14:07 +01:00
Irmen de Jong
1605791f1b
float swap() no longer uses evaluation stack but a single temp var instead + FAC1
2021-11-06 03:36:14 +01:00
Irmen de Jong
23961f695d
fixed some parse tree node position end-columns. cleanup some todo's
2021-11-05 22:48:28 +01:00
Irmen de Jong
eea3fb48a8
add command line option 'optfloatx' to explicitly re-enable float expr optimization as this can increase code size significantly.
...
The output size of the various example programs using floating point, when not using this optimization, has been reduced significantly.
The resulting code runs a (tiny) bit slower though.
2021-11-03 22:52:08 +01:00
Irmen de Jong
b4fa72c058
fix parent node linkage for reading array parameter
2021-11-03 21:57:31 +01:00
Irmen de Jong
3410aea788
fix regression: don't add 0 initializer when variable is assigned to anyway (or is loopvar in a for-loop)
2021-11-02 21:23:59 +01:00
Irmen de Jong
7e287a5359
proper parent node linkage in generated const values out of typecast expressions. Fixes crash mentioned in #72
2021-11-02 00:47:01 +01:00
Irmen de Jong
1110bd0851
fix vardecl initialization value to not use stack eval anymore but separate assignment
...
(this causes the optimized assignment code gen to be used instead)
but some programs now end up larger in output size
2021-11-01 00:24:15 +01:00
Irmen de Jong
fe17566370
improved reporting of slow stack based evaluation code
2021-10-31 14:18:49 +01:00
Irmen de Jong
03ac9b6956
various cleanups, slight update to dbus
2021-10-30 19:30:19 +02:00
Irmen de Jong
dfbef8495d
got rid of ParsingFailedError
2021-10-30 17:05:23 +02:00
Irmen de Jong
7b17c49d8f
update petscii tables with improvements to box drawing chars. fixes #68
2021-10-30 16:45:23 +02:00
Irmen de Jong
4b3f31c2ee
added option to suppress assembler output (and enabled this in unit tests)
2021-10-30 15:26:40 +02:00
Irmen de Jong
9ccc65bf8f
more petscii tests
2021-10-30 15:15:11 +02:00
Irmen de Jong
f9e22add03
fix crash when using array as paramater type
2021-10-30 15:15:00 +02:00
Irmen de Jong
97836e18b2
simplified gradle config, automatically run installDist task after build
2021-10-30 12:01:52 +02:00
Irmen de Jong
7b69df4db2
todos
2021-10-30 00:38:48 +02:00
Irmen de Jong
3767b4bbe7
'Program' is not an ast Node
2021-10-30 00:25:34 +02:00
Irmen de Jong
d7d2eefa4f
implemented CharLiteral.constValue()
2021-10-30 00:05:55 +02:00
Irmen de Jong
6737f28d1e
moved unittests of compilerInterfaces into compiler module itself
2021-10-29 23:46:51 +02:00
Irmen de Jong
3da9404c2d
removed memsizer arg from all builtin functions
2021-10-29 23:38:31 +02:00
Irmen de Jong
1137da37c3
reshuffle ErrorReporter
2021-10-29 17:02:03 +02:00
Irmen de Jong
495a18805c
move asmgen test to codeGeneration module
2021-10-29 16:20:53 +02:00
Irmen de Jong
a226b82d0b
cleanup imports
2021-10-29 05:30:12 +02:00
Irmen de Jong
0b5ddcdc9b
split out the code generator into own project submodule
2021-10-29 05:00:30 +02:00
Irmen de Jong
5ff481ce3c
make sure tmp folders exist for unit tests
2021-10-29 03:04:16 +02:00
Irmen de Jong
f21dcaa6fb
split out the code optimizers into own project submodule
2021-10-29 02:42:10 +02:00
Irmen de Jong
2c940de598
better name
2021-10-29 01:06:01 +02:00
Irmen de Jong
ce75b776bb
refactor loadAsmIncludeFile response
2021-10-29 01:01:24 +02:00
Irmen de Jong
7d22b9b9f9
simplified name conflict check for sub params
2021-10-29 00:20:33 +02:00
Irmen de Jong
6cb8b3b5cd
removed unneeded scope param from lookup()
2021-10-29 00:01:28 +02:00
Irmen de Jong
2bf4017f2b
fix nested label lookups in anon scopes
...
fixed non-global qualified names lookup
2021-10-28 23:48:01 +02:00
Irmen de Jong
08d2f8568b
refactoring symbol lookups
2021-10-27 23:48:12 +02:00
Irmen de Jong
ac5f45d2d4
fix nested label lookups in anon scopes (partly)
2021-10-27 02:41:24 +02:00
Irmen de Jong
3cc7ad7d20
slightly improve error message for unknown module import
2021-10-27 00:38:36 +02:00
Irmen de Jong
d4513364fb
fix compiler crash when file on command line doesn't exist
2021-10-27 00:23:54 +02:00
Irmen de Jong
9684f4e42a
add unit tests for AnonScope refactoring, cleaned up imports
2021-10-27 00:05:46 +02:00
Irmen de Jong
141689e697
change many uses of .definingScope to just the parent node
2021-10-26 23:25:16 +02:00
Irmen de Jong
743c8b44a2
AnonymousScope refactor: it's no longer a INameScope
...
because it doesn't contain scoped variables (these are moved to the subroutine's scope)
2021-10-26 23:01:51 +02:00
Irmen de Jong
5e1459564a
no longer take AddressOf a str-variable that is a subroutine's parameter with str type (it's just an address/uword already)
2021-10-25 23:49:01 +02:00
Irmen de Jong
69a8813a3d
first steps to add support for str parameter type
2021-10-24 20:57:10 +02:00
Irmen de Jong
17175df835
more precise error messages checks
2021-10-24 19:14:46 +02:00
Irmen de Jong
6b32535cb6
don't complain about uninitialized str var if it's not a var
2021-10-24 15:13:38 +02:00
Irmen de Jong
2815a14bb5
(7.2) can now test for specific error messages, and specify to omit invoking assembler in tests
2021-10-22 01:25:26 +02:00
Irmen de Jong
f4dfa60790
(7.2) tests for pass by ref parameters
2021-10-22 00:41:34 +02:00
Irmen de Jong
35e88dd529
(7.2) correctly parse datatype of array parameters
2021-10-21 22:06:21 +02:00
Irmen de Jong
4d5094a517
(7.2) cleanup Petscii converter errorhandling, add unit tests for error scenarios
2021-10-20 23:48:20 +02:00
Irmen de Jong
dd5abae721
move testcase to proper location
2021-10-20 23:08:40 +02:00
Irmen de Jong
8f2fb20934
Merge branch 'v7.1' into v7.2
2021-10-20 22:51:14 +02:00
Irmen de Jong
440abf4998
fix test to recognise inserted return statements
2021-10-20 22:50:18 +02:00
Irmen de Jong
74555a32ed
Merge branch 'v7.1' into v7.2
2021-10-20 22:37:43 +02:00
Irmen de Jong
85956b5828
code generator: add a return (RTS) to empty subroutines. Fixes #67
2021-10-20 22:36:13 +02:00
Irmen de Jong
41e40cad03
optimizer bug: don't remove empty subroutine if it's referenced. Fixes #67
2021-10-20 22:25:10 +02:00
Irmen de Jong
df2d5c6585
tests for callgraph and unused subroutine removal in optimizer
2021-10-20 22:24:10 +02:00
Irmen de Jong
e6c41eac93
Merge branch 'v7.1' into v7.2
2021-10-19 23:22:38 +02:00
Irmen de Jong
82d20dea39
a few comment and TODO cleanups.
...
remove remark about chars UBYTE type, kotlin's closest native type that can contain 0-255 is a short.
2021-10-19 23:20:34 +02:00
Irmen de Jong
804bb06859
clarified isInRegularRAM() by making it an extension method on AssignTarget
2021-10-19 22:36:05 +02:00
Irmen de Jong
5afa7e53f8
got rid of program arg for isInRegularRAM
2021-10-19 22:30:30 +02:00
Irmen de Jong
7f15b7b716
remove unneeded check for duplicate module names as this is now caught by the logic in Program.addModule itself
2021-10-19 22:12:54 +02:00
Irmen de Jong
552e0c2248
rename mainModule to toplevelModule.
...
failed module no longer retains in the Ast.
improved some tests on that.
2021-10-19 21:49:05 +02:00
Irmen de Jong
502bf90007
comments
2021-10-19 01:12:28 +02:00
Irmen de Jong
4011dce31b
added a few more tests for the file element of Position
2021-10-19 00:26:02 +02:00
Irmen de Jong
14aad2358f
version 7.2 started
2021-10-16 18:46:08 +02:00
Irmen de Jong
cf0e395921
got rid of SourceCode.pathString() and the 'need' to strip < and >
2021-10-16 17:15:22 +02:00
Irmen de Jong
9626c5dead
attempt to fix Windows path issue with "library:" prefixes in AsmGen
2021-10-16 14:50:08 +02:00
Irmen de Jong
aea364e43d
paths are now always relative to the current directory. Fixes #64
2021-10-16 14:26:33 +02:00
Irmen de Jong
06defd0cb0
paths are now always relative
2021-10-16 02:43:22 +02:00