From c57ef7725eda2ed238f6a400bdfe41499b211853 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Mon, 3 Jan 2022 23:38:41 +0100 Subject: [PATCH] preparing v7.6 --- compiler/res/version.txt | 2 +- docs/source/index.rst | 2 +- docs/source/syntaxreference.rst | 6 ++++++ docs/source/todo.rst | 20 ++++++++++--------- examples/test.p8 | 34 ++++++++++++++++++++++++--------- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/compiler/res/version.txt b/compiler/res/version.txt index 5ac66004b..38abeb202 100644 --- a/compiler/res/version.txt +++ b/compiler/res/version.txt @@ -1 +1 @@ -7.6-dev +7.6 diff --git a/docs/source/index.rst b/docs/source/index.rst index 6cb433d67..aee9df5d5 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -185,7 +185,7 @@ using the ``-emu`` or ``-emu2`` command line options) For this to work you should make sure that the program is not using floating point, nor the ram/rom bank switching logic provided by the libraries. You can also choose to just stick with Prog8 6.4 (which still targets cx16 v38) and wait it out till the emulator r39 is officially released - but you won't be able to benefit from the compiler improvements - made since the previous release of prog8. + made since that old release of prog8. diff --git a/docs/source/syntaxreference.rst b/docs/source/syntaxreference.rst index c410189fb..f1de15eb3 100644 --- a/docs/source/syntaxreference.rst +++ b/docs/source/syntaxreference.rst @@ -481,6 +481,12 @@ logical: ``not`` ``and`` ``or`` ``xor`` about truths (boolean values). The result of such an expression is a 'boolean' value 'true' or 'false' (which in reality is just a byte value of 1 or 0). + .. note:: + Unlike most other programming languages, there is no short-cirquit or McCarthy-evaluation + for the ``and`` and ``or`` operators at this time. This means that prog8 currently always evaluates + all operands from these logical expressions, even when one of them already determines the outcome. + This may be changed in a future language version. + range creation: ``to`` Creates a range of values from the LHS value to the RHS value, inclusive. These are mainly used in for loops to set the loop range. Example:: diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 0cce2479a..c471cfda3 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -1,9 +1,9 @@ TODO ==== -For next compiler release (7.6) +For next compiler release (7.7) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -... +...tbd Need help with @@ -19,9 +19,9 @@ Blocked by an official Commander-x16 r39 release (I hope this will be included into the r39 roms when they get released) -Future -^^^^^^ -- add pipe operator ``|>`` ? +Future Things and Ideas +^^^^^^^^^^^^^^^^^^^^^^^ +- pipe operator ``|>`` - make it possible to use cpu opcodes such as 'nop' as variable names by prefixing all asm vars with something such as ``v_`` then we can get rid of the instruction lists in the machinedefinitions as well? - fix the asm-labels problem (github issue #62) @@ -29,7 +29,7 @@ Future but this requires all identifiers in the inlined expression to be changed to fully scoped names - simplifyConditionalExpression() should not split expression if it still results in stack-based evaluation - simplifyConditionalExpression() sometimes introduces needless assignment to r9 tempvar -- get rid of all TODO's in the code +- consider adding McCarthy evaluation to shortcircuit and and or expressions. First do ifs by splitting them up? Then do expressions that compute a value? - improve testability further, add more tests - use more of Result<> and Either<> to handle errors/ nulls better - rethink the whole "isAugmentable" business. Because the way this is determined, should always also be exactly mirrorred in the AugmentableAssignmentAsmGen or you'll get a crash at code gen time. @@ -41,18 +41,20 @@ Future - add a diskio.f_seek() routine for the Cx16 that uses its seek dos api? - make it possible for diskio to read and write from more than one file at the same time (= use multiple io channels)? - fix problems in c128 target +- add (u)word array type (or modifier?) that puts the array into memory as 2 separate byte-arrays 1 for LSB 1 for MSB -> allows for word arrays of length 256 - [problematic due to 64tass:] add a compiler option to not remove unused subroutines. this allows for building library programs. But this won't work with 64tass's .proc ... Perhaps replace all uses of .proc/.pend by .block/.bend will fix that? (but we lose the optimizing aspect of the assembler where it strips out unused code. There's not really a dynamic switch possible as all assembly lib code is static and uses one or the other) +- get rid of all TODO's in the code ;) -More code optimization ideas -^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +More optimization ideas +^^^^^^^^^^^^^^^^^^^^^^^ - if a for loop's loopvariable isn't referenced in the body, replace by a repeatloop - automatically convert if statements that test for multiple values (if X==1 or X==2..) to if X in [1,2,..] statements, instead of just a warning - byte typed expressions should be evaluated in the accumulator where possible, without (temp)var - for instance value = otherbyte >> 1 --> lda otherbite ; lsr a; sta value + for instance value = otherbyte >> 1 --> lda otherbite ; lsr a; sta value - rewrite expression tree evaluation such that it doesn't use an eval stack but flatten the tree into linear code that uses a fixed number of predetermined value 'variables' - this removes the need for the BinExprSplitter? (which is problematic and very limited now) - introduce byte-index operator to avoid index multiplications in loops over arrays? see github issue #4 diff --git a/examples/test.p8 b/examples/test.p8 index 9d9290b2c..f9021c6b2 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,17 +1,33 @@ %import textio +%import floats %zeropage basicsafe main { - uword buffer = memory("the quick brown fox jumps over the lazy dog", 2000) - uword buffer2 = memory("the quick brown fox jumps over the lazy dog", 2000) - sub start() { - txt.print_uwhex(buffer, true) - txt.print_uwhex(buffer2, true) - txt.print_uwhex("zzzz", true) - str xyz = "irmen" - xyz="2342344234" - txt.print_uwhex(xyz, true) + %asm {{ + lda #float5_111 + jsr floats.MOVFM + lda #float5_122 + jsr floats.FADD + jsr floats.FOUT + sta $7e + sty $7f + ldy #0 +_loop + lda ($7e),y + beq _done + jsr c64.CHROUT + iny + bne _loop +_done + rts + +float5_111 .byte $81, $0e, $14, $7a, $e1 ; float 1.11 +float5_122 .byte $81, $1c, $28, $f5, $c2 ; float 1.22 + + }} } }