Commit Graph

1283 Commits

Author SHA1 Message Date
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
b6fe40ada4 fix: cx16.r0 now properly treated as zeropage var on cx16 so @(cx16.r0) won't copy it to temp var anymore 2021-12-05 21:21:41 +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
81deed143b fix grammar problem: \x and \u escape sequences didn't work in character literals. 2021-12-05 18:11:40 +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
e545ea9504 fix and optimize storing A into pointervar 2021-12-04 04:43:58 +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
a67a82c921 tweak 2021-11-30 03:05:25 +01:00
Irmen de Jong
ea0fe8d3d2 PrefixExpression doesn't cause clobber risk 2021-11-30 02:32:37 +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
4ac169b210 formatting 2021-11-29 01:25:21 +01:00
Irmen de Jong
cafab98d10 correction 2021-11-28 18:59:36 +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
d6abd72e55 fix push() of signed values 2021-11-28 13:01:46 +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
3d23b39f4c moved A to the end of the param list to avoid having to store its value 2021-11-28 04:03:18 +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
69dcb4dbda fix reporting of (not) unused code after GoSub jump 2021-11-27 21:22:34 +01:00
Irmen de Jong
c838821615 refactor fuction arguments codegen a bit 2021-11-27 21:14:21 +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
62485b6851 allow assigns to asmsub parameters (registers), but this is not very useful in practice. 2021-11-27 15:41:44 +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
58d9c46a9b got rid of old makeScopedName routine 2021-11-26 20:56:30 +01:00
Irmen de Jong
e4648e2138 proper rounding of builtin functions that return int from float 2021-11-26 20:32:12 +01:00
Irmen de Jong
110e047681 replace subroutine calls (statement) by GoSub 2021-11-26 19:47:01 +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
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
3c39baf1d6 don't optimize seemingly redundant assembly instructions away that manipulate IO memory space 2021-11-21 03:24:03 +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
31491c62c5 add some more const folding patterns 2021-11-20 22:40:12 +01:00
Irmen de Jong
eacf8b896a fix augmentable check to align with what the asmgen understands 2021-11-20 22:06:51 +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
8f379e2262 give an error when initializing an integer var with a float value instead of silently rounding 2021-11-18 01:56:11 +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
6af3209d4d add more const foldings 2021-11-17 00:57:00 +01:00
Irmen de Jong
5d362047e2 add some more comparison expression optimizations to compare against 0 if possible 2021-11-17 00:04:52 +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
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
c858ceeb58 compiler shouldn't use cx16.r15 as temp var 2021-11-14 02:38:59 +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
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
686483f51a fixed division of signed byte number by 2. (!) 2021-11-10 00:17:56 +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
b909facfe5 fix compiler stackoverflow crash on certain typecasted expressions containing floats. 2021-11-09 19:31:19 +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
4cb383dccb discovered crash about storage size mismatch 2021-11-08 21:44:06 +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
b9ce94bb68 migrated codeGeneration module to KoTest 2021-11-07 15:40:05 +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
57a9fed42b todo 2021-11-06 19:09:33 +01:00
Irmen de Jong
18d820da94 correct assignment type 2021-11-06 18:52:54 +01:00
Irmen de Jong
26e66f046f implement some more missing codegen for inplace Prefix expressions 2021-11-06 18:48:42 +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
37a46aa2cf complex memory assignment also tries to avoid estack evaluation (but not done yet) 2021-11-06 00:03:19 +01:00
Irmen de Jong
1d2d217b94 non-optimized typecast assignments now attempt to not use evalstack 2021-11-05 23:25:07 +01:00
Irmen de Jong
730b208617 relaxed some type checks on certain word register assignment
preparing to optimize asmsub arg passing for complex expressions
2021-11-04 23:57:25 +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
b0a865b0f1 update todo 2021-11-02 23:55:50 +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
1b576f826d remove unneeded sibling methods 2021-10-31 16:50: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
e3c00669c1 fixed improved asm generation for conditions that compare signed word to zero 2021-10-31 02:39:45 +02:00
Irmen de Jong
33d17afc32 improved asm generation for conditions that compare byte/word to zero 2021-10-31 01:58:16 +02:00
Irmen de Jong
2388359a99 improved asm generation for conditions that compare ubyte/uword to zero 2021-10-31 01:39:37 +02:00
Irmen de Jong
2df0c9503c improved asm generation for conditions that compare floats to zero 2021-10-31 01:28:08 +02:00
Irmen de Jong
61fa3bc77c comparisonjump tweak 2021-10-31 00:57:22 +02:00
Irmen de Jong
9ccc65bf8f more petscii tests 2021-10-30 15:15:11 +02:00
Irmen de Jong
495a18805c move asmgen test to codeGeneration module 2021-10-29 16:20:53 +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
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
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