From 5656ec11d3f91c627bc491f1dd020182c57f6585 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Fri, 24 Jun 2022 01:51:54 +0200 Subject: [PATCH] fix missing abs(byte) routine --- compiler/res/prog8lib/prog8_funcs.asm | 4 ++-- docs/source/todo.rst | 2 +- examples/test.p8 | 4 ++++ 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/res/prog8lib/prog8_funcs.asm b/compiler/res/prog8lib/prog8_funcs.asm index 8173a376f..1d7c2f26f 100644 --- a/compiler/res/prog8lib/prog8_funcs.asm +++ b/compiler/res/prog8lib/prog8_funcs.asm @@ -86,9 +86,9 @@ func_all_w_stack .proc abs_b_stack .proc ; -- push abs(A) on stack (as unsigned word) - jsr abs_b_into_A + jsr abs_b_into_AY sta P8ESTACK_LO,x - stz p8ESTACK_HI,x + stz P8ESTACK_HI,x dex rts .pend diff --git a/docs/source/todo.rst b/docs/source/todo.rst index b963532a1..12bd142b2 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -4,7 +4,7 @@ TODO For next release ^^^^^^^^^^^^^^^^ - bug: 2 repeats in same subroutine -> duplicate label error? see repeat_bug.p8 -- bug: f_read() can't deal with running out of banked ram? +- bug: f_read() can't deal with running out of banked ram? maybe only cx16diskio.f_read()? - add McCarthy evaluation to shortcircuit and/or expressions. Both conditional expressions and assignments! - add some more optimizations in vmPeepholeOptimizer - vm Instruction needs to know what the read-registers/memory are, and what the write-register/memory is. diff --git a/examples/test.p8 b/examples/test.p8 index 1a56c406f..2c40ae5ed 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -48,6 +48,10 @@ main { sub start() { ubyte value uword wvalue + byte svalue = -99 + + wvalue = 3*abs(svalue) +abs(svalue)+abs(svalue)+abs(svalue) + txt.print_uw(wvalue) txt.print("short and with false (word): ") wvalue = funcw() and funcFalseWord() and funcw() and funcw()