Irmen de Jong
7e1e7a0780
fix conv.str_ub and conv.str_b for missing tens digits
2024-03-13 23:03:25 +01:00
Irmen de Jong
1fc79ff6dd
implement the missing in-place array operators for split word arrays and numeric operand
2024-03-13 21:16:49 +01:00
Irmen de Jong
3535c1acda
fix broken boolean != comparison optimization
2024-03-13 20:23:42 +01:00
Irmen de Jong
33c8caac8f
get rid of containment expression restriction
2024-03-12 23:39:54 +01:00
Irmen de Jong
51d708bbdd
fix monogfx issue
2024-03-12 23:27:15 +01:00
Irmen de Jong
820541e427
fixed and optimized pointervar indexed in-place operations
2024-03-11 23:27:48 +01:00
Irmen de Jong
80f39e8097
Merge branch 'booleans'
...
# Conflicts:
# compiler/res/prog8lib/cx16/monogfx.p8
# compiler/res/prog8lib/virtual/monogfx.p8
# compiler/src/prog8/compiler/astprocessing/BoolRemover.kt
# compiler/test/TestTypecasts.kt
# docs/source/todo.rst
# examples/cx16/highresbitmap.p8
# examples/test.p8
# httpCompilerService/src/prog8/http/TestHttp.kt
2024-03-11 01:00:48 +01:00
Irmen de Jong
eef8ae00b8
replace str return type by uword
2024-03-09 15:38:46 +01:00
Irmen de Jong
f739e679e4
added sys.exit2 and sys.exit3 to set more result registers at program exit
...
todo
2024-03-09 03:30:05 +01:00
Irmen de Jong
52649a8e4f
conv routines now return the string buffer address.
2024-03-08 02:12:46 +01:00
Irmen de Jong
bdfb01f6a0
VM: implemented a few core routines in diskio (load/save)
...
textelite can now load and save your progress like it already could in the real version
2024-03-06 23:21:01 +01:00
Irmen de Jong
1137e57393
update VTUI lib
2024-03-06 21:39:30 +01:00
Irmen de Jong
04f7b772a3
lib updates, removed unused and obsolete http and dbus modules
2024-03-05 23:42:35 +01:00
Irmen de Jong
6d29b00a80
fix monogfx horizontal line and text draw in invert mode
2024-03-05 22:38:34 +01:00
Irmen de Jong
9826d7c494
optimize certain boolean comparisons more
2024-03-05 03:09:53 +01:00
Irmen de Jong
4d7e96d423
add monogfx inverted (eor) draw mode
2024-03-03 23:28:37 +01:00
Irmen de Jong
449461e412
tweak monogfx stipple plot
2024-03-03 21:47:42 +01:00
Irmen de Jong
607275ec66
tweak
2024-03-03 19:52:46 +01:00
Irmen de Jong
e55cde2a81
more nonstrictbool conversions
2024-03-03 19:43:48 +01:00
Irmen de Jong
84afb374e6
nostrictbool array conversions
2024-03-03 17:48:52 +01:00
Irmen de Jong
da1620807f
fixed all todos in ifelse gen
2024-03-03 12:10:42 +01:00
Irmen de Jong
f39ef8f565
optimize byte comparison assignment to use rol trick instead of branching
2024-03-03 00:01:14 +01:00
Irmen de Jong
fe8b6e820c
getting rid of problematic fallback (infinite recursion)
2024-03-02 23:19:55 +01:00
Irmen de Jong
f29d24e96a
fixup split words array comparisons
2024-03-02 23:19:55 +01:00
Irmen de Jong
620ffe54ec
asm optimizer: don't remove labels. remove redundant cmp/cpx/cpy instructions.
2024-03-02 23:19:53 +01:00
Irmen de Jong
ceaa4cd07d
array issue
2024-03-02 23:19:39 +01:00
Irmen de Jong
af17f903ee
fix that if not fcall() wasn't transformed to a conditional branch instruction
2024-03-02 23:19:39 +01:00
Irmen de Jong
c532e28841
fix several remaining bool return values in library routines
2024-03-02 23:19:39 +01:00
Irmen de Jong
dba0846866
optimize word >, word <=
2024-03-02 23:19:39 +01:00
Irmen de Jong
bed629998a
fix large code for some compares
2024-03-02 23:19:39 +01:00
Irmen de Jong
bc2ede76bf
tweak to byte compares
2024-03-02 23:19:39 +01:00
Irmen de Jong
2a1fec2ed2
fix codegen error for comparisons
2024-03-02 23:19:39 +01:00
Irmen de Jong
004048e5a7
fix IR codegen error for b=float>value
2024-03-02 23:19:39 +01:00
Irmen de Jong
37b346740b
fix 6502 casting uword and float to bool
2024-03-02 23:19:39 +01:00
Irmen de Jong
f5e332daf7
remove redundant IR instructions like SNZ
2024-03-02 23:19:39 +01:00
Irmen de Jong
fe9a9fc5cb
new if tests
2024-03-02 23:19:39 +01:00
Irmen de Jong
cc57477b99
IR: support for indirect jump after if
2024-03-02 23:19:39 +01:00
Irmen de Jong
a1574a7187
added txt.print_bool, several fixes
2024-03-02 23:19:39 +01:00
Irmen de Jong
a5110b1f96
improved De Morgan rewrite rules
2024-03-02 23:19:39 +01:00
Irmen de Jong
006713fe13
optimize boolean to ubyte assignment (skip type cast)
2024-03-02 23:19:39 +01:00
Irmen de Jong
7868e672e0
ifelse more
2024-03-02 23:19:39 +01:00
Irmen de Jong
e1a133c2c0
ifelse more
2024-03-02 23:19:39 +01:00
Irmen de Jong
c77cd0da39
ifelse more
2024-03-02 23:19:39 +01:00
Irmen de Jong
577333f2c4
new ifelse codegen
2024-03-02 23:19:39 +01:00
Irmen de Jong
7d8cdcbfea
more bool fixes and optimizations in codegen
2024-03-02 23:19:39 +01:00
Irmen de Jong
acd841dbb6
bool changes in 6502 assignment codegen
2024-03-02 23:19:37 +01:00
Irmen de Jong
10d12f73d6
IR/VM: testing the boolean changes, added in-place and/or.
2024-03-02 23:19:20 +01:00
Irmen de Jong
92527b4c1d
examples: add ==0 or !=0 to expressions that depend on implicit conversion from byte to bool
2024-03-02 23:19:18 +01:00
Irmen de Jong
a282b17286
added asm optimizer for <= byte (bcc+beq->bcs)
2024-03-02 15:34:54 +01:00
Irmen de Jong
58d9463f16
consolidate word comparison codegen
2024-03-02 14:00:12 +01:00
Irmen de Jong
047decd552
consolidate byte comparison codegen
2024-03-01 22:21:22 +01:00
Irmen de Jong
040d75dafa
VM now supports indirect jump instruction
2024-02-22 16:19:26 +01:00
Irmen de Jong
b5e691f367
IR: fix chunk reachability: via unchopped chunk label directly so that they don't get removed
2024-02-21 23:18:57 +01:00
Irmen de Jong
d4b087ea3f
added txt.bell() to make terminal beep/bell sound on most systems
2024-02-21 17:35:37 +01:00
Irmen de Jong
96b5a30f60
slightly less strict
2024-02-20 23:01:51 +01:00
Irmen de Jong
0e17a0474a
added type check to catch invalid comparisons, fix maze example
2024-02-20 22:53:15 +01:00
Irmen de Jong
88458f5355
faster array copy and fix for length 256
2024-02-11 23:57:38 +01:00
Irmen de Jong
8201408f16
fix element size calc when copying array
2024-02-10 22:58:44 +01:00
Irmen de Jong
8b8caa1c2e
added math.randrange() and math.randrangew()
2024-02-10 22:16:13 +01:00
Irmen de Jong
d7f72056fc
rest of the array copying
2024-02-10 17:16:06 +01:00
Irmen de Jong
906d9d858c
implementing the array copys
2024-02-10 01:40:36 +01:00
Irmen de Jong
6eacf1bddd
added a few more IR syscalls for often used copy routines
2024-02-09 23:56:44 +01:00
Irmen de Jong
6c8c8e11cc
fix cpu register overwrites when using @(...) arguments to an asmsub
2024-02-09 19:55:35 +01:00
Irmen de Jong
68669dbef0
fix & of pointervar indexing
2024-02-08 23:03:53 +01:00
Irmen de Jong
6a48de9a9f
IR: fix & of array-element
2024-02-08 21:27:53 +01:00
Irmen de Jong
9d6d98930b
fix ast printing of & array-element
2024-02-08 21:27:53 +01:00
Irmen de Jong
386a391fd9
added string.lstripped() and string.ltrimmed()
2024-02-07 23:07:45 +01:00
Irmen de Jong
d33aed4ed5
added txt.petscii2scr() and txt.petscii2scr_str()
2024-02-07 22:36:43 +01:00
Irmen de Jong
24944ad49e
added string.strip() and string.trim() and l/r variants.
...
fixed memsizer for pointers-to-ubyte.
2024-02-07 02:09:08 +01:00
Irmen de Jong
26ed231f61
version
2024-02-07 00:03:39 +01:00
Irmen de Jong
8485b8429f
optimizing +=1/-=1
2024-02-06 23:49:40 +01:00
Irmen de Jong
358215e4dd
removed postIncrDecr (still allow ++/-- to be parsed into +=1/-=1)
2024-02-06 18:50:08 +01:00
Irmen de Jong
2cadb546d5
optimized in-place memory/pointervar operations some more
2024-02-04 15:17:24 +01:00
Irmen de Jong
3c77f8a020
IR: optimize pointer access
2024-02-04 07:51:50 +01:00
Irmen de Jong
8e00408e3e
optimize pointer indexing a bit
2024-02-03 23:24:33 +01:00
Irmen de Jong
abcdfd8e28
optimize postincrdecr on memory a bit
2024-02-03 22:33:27 +01:00
Irmen de Jong
b0f5b6925d
getting rid of pointer[idx] in ast, instead always use @(ptr+idx)
2024-02-03 19:22:04 +01:00
Irmen de Jong
ef198f1493
fix for certain invalid expression evaluation code.
...
it no longer reuses the same temporary variable all the time.
todo
2024-01-31 21:18:21 +01:00
Irmen de Jong
48ef856c0b
identified wrong expr eval code - still need solution. Crash for now.
2024-01-30 23:00:50 +01:00
Irmen de Jong
e0055bc431
IR: working on inplace +/-
2024-01-29 22:08:47 +01:00
Irmen de Jong
9553248ed6
IR: integrate inplace assignment ops
2024-01-28 22:33:16 +01:00
Irmen de Jong
39d2194d8f
IR: implemented inplace prefix op on split array
...
VM: NEG instructions also set N and Z flags
2024-01-28 22:33:13 +01:00
Irmen de Jong
0800033b47
fixed split-word array in-place element +/- (other operators not yet...)
2024-01-28 22:30:45 +01:00
Irmen de Jong
8cf0b6cf51
IR: optimize code for ==0 and !=0 augmented assigns
2024-01-25 00:30:47 +01:00
Irmen de Jong
f2010bf7a5
IR: better code for array element assignments (w.i.p.)
2024-01-23 00:56:06 +01:00
Irmen de Jong
64c132ee0a
changed -breakinstr option so that you now specify the exact instruction to use for a %breakpoint.
...
also fixed a IR issue with x=not x.
2024-01-22 22:01:47 +01:00
Irmen de Jong
a8c09d6144
removed a problematic bitshift replacement in the const evaluator
2024-01-21 23:05:51 +01:00
Irmen de Jong
87c46ba730
check boolean array size mismatch.
...
check for weird string assignment.
check for X16 problematic cpu instructions rmb, smb, bbr, bbs.
tweak number node equality wrt bool type
2024-01-21 19:15:22 +01:00
Irmen de Jong
504d1440cc
fixed rol(),rol2(),ror(),ror2()
2024-01-17 21:02:17 +01:00
Irmen de Jong
e0de662f8e
fix signed word bitshift right (>8 shifts)
2024-01-16 01:08:16 +01:00
Irmen de Jong
66a836d094
added support for reverse() on split word arrays
2024-01-16 00:52:09 +01:00
Irmen de Jong
80095f4962
added support for any() on split word arrays
2024-01-15 23:51:19 +01:00
Irmen de Jong
7de665d1e4
support for split wordarrays rol/ror and rol2/ror2
...
optimized rol and ror codegen
optimize/fix ror/ror2/rol/rol2 on word arrays
2024-01-15 03:22:37 +01:00
Irmen de Jong
0a356ba73a
added containment check of float arrays
2024-01-14 14:14:09 +01:00
Irmen de Jong
41de8caa13
added sprites.set_mousepointer_image(), sprites.set_mousepointer_hand() and sprites.get_data_ptr()
2024-01-14 00:38:56 +01:00
Irmen de Jong
968609d06d
IR: fix problems with symbol offsets and unused subroutines/chunks
2024-01-13 16:43:41 +01:00
Irmen de Jong
3b199a2a87
added cx16 example: automatons.
...
added debug mode and RTC to cx16 emulator launchers.
dt error details.
2024-01-12 21:40:30 +01:00
Irmen de Jong
bc3f2db3de
Fix call graph to no longer mark subroutines unused, that still get their variables referenced somewhere.
...
Revert palette.default_colors_16[] back to palette.set_default16.colors.
2024-01-11 22:12:01 +01:00
Irmen de Jong
ddb2ff4216
IR: use SCS opcode to set carry status flag into register
2024-01-09 23:46:27 +01:00
Irmen de Jong
f27e3478b9
fix const value of AddressOf for certain types
2024-01-09 22:10:25 +01:00
Irmen de Jong
f8084e7955
fix const replacement optimization error on memory mapped variable
2024-01-07 18:48:18 +01:00
Irmen de Jong
d85c347a6c
optimize /256 more, and fixed a unsigned byte word cast error
2024-01-07 02:34:05 +01:00
Irmen de Jong
7dd758a753
better optimize WORD & $xx00 , WORD & $00xx
2024-01-06 22:01:21 +01:00
Irmen de Jong
8e6b91cb9e
some optimizations
2024-01-06 00:44:00 +01:00
Irmen de Jong
334e6dca28
added string.contains().
...
fixed string and array containment check for length 1.
2024-01-05 20:46:26 +01:00
Irmen de Jong
37638e7ed0
added Absorption laws optimization
2024-01-05 00:36:47 +01:00
Irmen de Jong
8a0e650511
apply De Morgan's laws for logical not, results in smaller code
2024-01-04 23:45:46 +01:00
Irmen de Jong
8ba5a0d90c
tweak planet name display in starmap
2024-01-04 21:52:52 +01:00
Irmen de Jong
bfd3edb617
fix expression evaluation bug where intermediate values were overwritten, yielding the wrong result
2024-01-04 21:04:11 +01:00
Irmen de Jong
56ba24962c
fixed 'not not x' optimization to just 'x'
2024-01-04 15:02:21 +01:00
Irmen de Jong
19a2110ba2
fix exit() now actually correctly setting the return code in A
...
also, moved some cleanup stuff such as CLRCHN from exit() to the cleanup routine that is always called.
finally, also call the cleanup routine when %option no_sysinit is used
2024-01-04 00:43:35 +01:00
Irmen de Jong
242a3eec63
fix data type difference error on range from and to values
2024-01-03 21:46:22 +01:00
Irmen de Jong
6aed7e429a
allow containment check in a range expression ("run time" range expression)
2024-01-03 01:17:13 +01:00
Irmen de Jong
d446b57d05
fix unittest
2024-01-01 16:11:50 +01:00
Irmen de Jong
d1f8ee1e56
replace most common subexpressions by a single temp variable
2024-01-01 14:57:24 +01:00
Irmen de Jong
75fd263e85
fix expericodegen crash related to shortcircuiting
2023-12-31 01:28:17 +01:00
Irmen de Jong
1e1f444cab
cleanups.
...
also checked that value(12) < x < value(100) is indeed properly shortcircuited if x is 12 or less
2023-12-30 04:34:07 +01:00
Irmen de Jong
265e7aefbf
clean up unused codegen for logical ops on words, also fix no-shortcircuit exception
2023-12-30 04:06:02 +01:00
Irmen de Jong
1c55a6c6dc
shortcutting part one
2023-12-30 03:54:12 +01:00
Irmen de Jong
8f18b5b8a7
keep distinction between logical and bitwise boolean operators
2023-12-30 01:08:42 +01:00
Irmen de Jong
f790182f0b
adding short-circuit boolean expression evaluation (in IR codegen) also -noshortcircuit cli option
2023-12-30 01:08:41 +01:00
Irmen de Jong
813007a5d8
adjusted options of library modules
2023-12-29 22:21:44 +01:00
Irmen de Jong
932bbd0381
allow casting of byte<->ubyte and word<->uword
2023-12-29 16:23:24 +01:00
Irmen de Jong
01bd648cb2
added math.crc16() and math.crc32()
2023-12-29 08:00:02 +01:00
Irmen de Jong
e35cfd4971
get rid of the redundant 'f' suffix of several funtions in floats module (breaking change!)
...
Unfortunately a few routines (minf, maxf, clampf) remain unchanged, because removing the 'f' would make them clash with a builtin function.
floats.rndf -> floats.rnd
floats.parse_f -> floats.parse
floats.rndseedf -> floats.rndseed
floats.print_f -> floats.print
floats.str_f -> floats.tostr
2023-12-29 03:12:44 +01:00
Irmen de Jong
a0594cbce3
const optimizer now knows about a bunch of library functions, such as math.*
2023-12-28 20:14:13 +01:00
Irmen de Jong
09c6cb4d6b
replace unwritten vars by consts. Improved const eval.
...
Fixed some slight bugs in library code
2023-12-28 05:17:15 +01:00
Irmen de Jong
dfce292294
allow chained comparisons i<x<j (desugared into: i<x and x<j)
2023-12-28 01:18:59 +01:00
Irmen de Jong
2eb137618e
refactor block options
2023-12-26 22:13:08 +01:00
Irmen de Jong
0a4de45453
get rid of vardecl.declareddatatype
2023-12-26 19:33:58 +01:00
Irmen de Jong
ffdc658dc8
type error tweaks
2023-12-26 18:49:01 +01:00
Irmen de Jong
f948917124
added floats.push() and floats.pop()
...
fixed vm pop.f
2023-12-26 15:19:49 +01:00
Irmen de Jong
0d44492086
push,pushw,pop and popw are no longer built-in functions but regular routines in sys
2023-12-26 14:47:31 +01:00
Irmen de Jong
8ae435549d
added -slabshigh N and -slabsgolden for memory() slabs
2023-12-23 20:45:30 +01:00
Irmen de Jong
4cd9bb8f99
allow Python-style negative array indexing to count from the end
2023-12-23 16:37:28 +01:00
Irmen de Jong
ad9eaeafeb
call
now returns a word value
2023-12-22 22:24:11 +01:00
Irmen de Jong
6cd392909c
added verafx.copy() routine for fast vram-to-vram copying ('blitting')
2023-12-22 17:52:43 +01:00
OODLER
e7698686fa
fixed a glitch in the prog8/vtui example ( #117 )
...
When the program starts, before the screen is modified, save_rec
is called to capture the cx16 logo.
The fix was to not do the second call to save_rec until after
vtui is used to draw the boxes on the screen.
Before the this fix, the initial replacement issue was of the
logo and not the portion of the screen originally modified by
vtui.
2023-12-20 23:49:47 +01:00
Irmen de Jong
6bc079c7b7
more asm symbol prefixing: variables with p8v_, subroutines with p8s_ etc
...
labels with p8l_ . All this to avoid symbol clashes in the generated assembly code.
Everything got its own distinguishing prefix so we're done with it once and for all and have only 1 breaking change moment.
2023-12-20 22:20:59 +01:00
Irmen de Jong
299419917e
added symbol ambiguity error (variable vs block name for scoped symbols)
...
fixes #114
2023-12-20 00:28:15 +01:00
Irmen de Jong
69f6afe420
block names in asm now prefixed with p8b_ (instead of p8_)
...
as part of fixing var versus block symbol conflict handling
2023-12-19 23:00:20 +01:00
Irmen de Jong
e14b854d7b
cx16: added audio kernal routines example
2023-12-19 01:47:05 +01:00
Irmen de Jong
8bd7c601c0
cx16: added all remaining audio kernal routines. added the three x16edit kernal entry points.
2023-12-18 22:16:44 +01:00
Irmen de Jong
997288fa03
added cbm.CLEARST() to reset ST to 0
2023-12-18 01:20:24 +01:00
Irmen de Jong
ae66fcac1e
added call
builtin function for indirect JSR
2023-12-17 15:45:28 +01:00
Irmen de Jong
a8be94de6b
better error message when attempting to cast a float to integer
2023-12-15 22:28:06 +01:00
Irmen de Jong
b24df31c2b
IR: fix codegen for routines returning in CPU Status register flag
2023-12-14 21:16:14 +01:00
Irmen de Jong
58400f53bc
optimize: flip if true/else blocks if the else block only contains a jump (inverting the condition)
2023-12-13 22:06:53 +01:00
Irmen de Jong
a546c2247d
optimize if-else handling of asmsub boolean result in status flags
2023-12-13 04:03:21 +01:00
Irmen de Jong
0da9142009
asm: also work for asmsub that return N or Z flag (Carry already worked)
2023-12-13 02:11:15 +01:00