From 2af86a10b2aa227cdfb0d63bb4f59f878c4a41b4 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Fri, 13 Mar 2020 00:50:50 +0100 Subject: [PATCH] remove stack error comments --- docs/source/todo.rst | 3 +-- examples/arithmetic/bitshift.p8 | 2 +- examples/arithmetic/div.p8 | 10 +++------- examples/arithmetic/minus.p8 | 6 +----- examples/arithmetic/mult.p8 | 6 +----- examples/arithmetic/plus.p8 | 14 +++----------- examples/arithmetic/postincrdecr.p8 | 15 ++++----------- examples/arithmetic/remainder.p8 | 4 +--- examples/fibonacci.p8 | 2 +- examples/sorting.p8 | 2 +- examples/tehtriz.p8 | 2 +- examples/testprints.p8 | 2 +- 12 files changed, 19 insertions(+), 49 deletions(-) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index d9ebb4697..98a3462fa 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -4,8 +4,7 @@ TODO - option to load library files from a directory instead of the embedded ones - exit('message', returncode) function to immediately exit the program with this message (restores stack) -- fix stack clobbering issue in postincr decr (see the arithmetic example of this) -- vector inc/dec/add/sub/lsl/asl/mul/div +- vector inc/dec/add/sub/lsl/asl/mul/div...? Memory Block Operations integrated in language? diff --git a/examples/arithmetic/bitshift.p8 b/examples/arithmetic/bitshift.p8 index 880f24aa6..a253a5328 100644 --- a/examples/arithmetic/bitshift.p8 +++ b/examples/arithmetic/bitshift.p8 @@ -36,7 +36,7 @@ main { } sub start() { - ; TODO unimplemented() + ; TODO call this too: unimplemented() lsr(A) lsl(A) diff --git a/examples/arithmetic/div.p8 b/examples/arithmetic/div.p8 index 7add1f126..db55aa5c5 100644 --- a/examples/arithmetic/div.p8 +++ b/examples/arithmetic/div.p8 @@ -9,27 +9,23 @@ main { div_ubyte(0, 1, 0) div_ubyte(100, 6, 16) div_ubyte(255, 2, 127) - check_eval_stack() div_byte(0, 1, 0) div_byte(100, -6, -16) div_byte(127, -2, -63) - check_eval_stack() div_uword(0,1,0) div_uword(40000,500,80) div_uword(43211,2,21605) - check_eval_stack() ; TODO fix stack error (caused by print_uw) div_word(0,1,0) div_word(-20000,500,-40) div_word(-2222,2,-1111) - check_eval_stack() ; TODO fix stack error (caused by print_w) div_float(0,1,0) div_float(999.9,111.0,9.008108108108107) - check_eval_stack() ; TODO should no longer give error once the above is fixed + check_eval_stack() } sub div_ubyte(ubyte a1, ubyte a2, ubyte c) { @@ -69,7 +65,7 @@ main { else c64scr.print("err! ") c64scr.print("uword ") - c64scr.print_uw(a1) ; TODO print_uw causes X stack error + c64scr.print_uw(a1) c64scr.print(" / ") c64scr.print_uw(a2) c64scr.print(" = ") @@ -84,7 +80,7 @@ main { else c64scr.print("err! ") c64scr.print("word ") - c64scr.print_w(a1) ; TODO print_w causes X stack error + c64scr.print_w(a1) c64scr.print(" / ") c64scr.print_w(a2) c64scr.print(" = ") diff --git a/examples/arithmetic/minus.p8 b/examples/arithmetic/minus.p8 index 5398c35e5..21ac4727a 100644 --- a/examples/arithmetic/minus.p8 +++ b/examples/arithmetic/minus.p8 @@ -10,20 +10,17 @@ main { minus_ubyte(200, 0, 200) minus_ubyte(200, 100, 100) minus_ubyte(100, 200, 156) - check_eval_stack() minus_byte(0, 0, 0) minus_byte(100, 100, 0) minus_byte(50, -50, 100) minus_byte(0, -30, 30) minus_byte(-30, 0, -30) - check_eval_stack() minus_uword(0,0,0) minus_uword(50000,0, 50000) minus_uword(50000,20000,30000) minus_uword(20000,50000,35536) - check_eval_stack() ; TODO fix stack error minus_word(0,0,0) minus_word(1000,1000,0) @@ -31,13 +28,12 @@ main { minus_word(1000,500,500) minus_word(0,-3333,3333) minus_word(-3333,0,-3333) - check_eval_stack() ; TODO fix stack error minus_float(0,0,0) minus_float(2.5,1.5,1.0) minus_float(-1.5,3.5,-5.0) - check_eval_stack() ; TODO fix stack error + check_eval_stack() } sub minus_ubyte(ubyte a1, ubyte a2, ubyte c) { diff --git a/examples/arithmetic/mult.p8 b/examples/arithmetic/mult.p8 index 7bb05e21a..641756c59 100644 --- a/examples/arithmetic/mult.p8 +++ b/examples/arithmetic/mult.p8 @@ -9,29 +9,25 @@ main { mul_ubyte(0, 0, 0) mul_ubyte(20, 1, 20) mul_ubyte(20, 10, 200) - check_eval_stack() mul_byte(0, 0, 0) mul_byte(10, 10, 100) mul_byte(5, -5, -25) mul_byte(0, -30, 0) - check_eval_stack() mul_uword(0,0,0) mul_uword(50000,1, 50000) mul_uword(500,100,50000) - check_eval_stack() ; TODO fix stack error mul_word(0,0,0) mul_word(-10,1000,-10000) mul_word(1,-3333,-3333) - check_eval_stack() ; TODO fix stack error mul_float(0,0,0) mul_float(2.5,10,25) mul_float(-1.5,10,-15) - check_eval_stack() ; TODO fix stack error + check_eval_stack() } sub mul_ubyte(ubyte a1, ubyte a2, ubyte c) { diff --git a/examples/arithmetic/plus.p8 b/examples/arithmetic/plus.p8 index fbdd17436..ff6e5d99e 100644 --- a/examples/arithmetic/plus.p8 +++ b/examples/arithmetic/plus.p8 @@ -10,36 +10,28 @@ main { plus_ubyte(0, 200, 200) plus_ubyte(100, 200, 44) - check_eval_stack() - plus_byte(0, 0, 0) plus_byte(-100, 100, 0) plus_byte(-50, 100, 50) plus_byte(0, -30, -30) plus_byte(-30, 0, -30) - check_eval_stack() - plus_uword(0,0,0) plus_uword(0,50000,50000) plus_uword(50000,20000,4464) - check_eval_stack() ; TODO fix stack error caused by print_uw - plus_word(0,0,0) plus_word(-1000,1000,0) plus_word(-500,1000,500) plus_word(0,-3333,-3333) plus_word(-3333,0,-3333) - check_eval_stack() ; TODO fix stack error caused by print_w - plus_float(0,0,0) plus_float(1.5,2.5,4.0) plus_float(-1.5,3.5,2.0) plus_float(-1.1,3.3,2.2) - check_eval_stack() ; TODO should no longer give error if the above is fixed + check_eval_stack() } sub plus_ubyte(ubyte a1, ubyte a2, ubyte c) { @@ -79,7 +71,7 @@ main { else c64scr.print("err! ") c64scr.print("uword ") - c64scr.print_uw(a1) ; TODO causes X stack error + c64scr.print_uw(a1) c64scr.print(" + ") c64scr.print_uw(a2) c64scr.print(" = ") @@ -94,7 +86,7 @@ main { else c64scr.print("err! ") c64scr.print("word ") - c64scr.print_w(a1) ; TODO causes X stack error + c64scr.print_w(a1) c64scr.print(" + ") c64scr.print_w(a2) c64scr.print(" = ") diff --git a/examples/arithmetic/postincrdecr.p8 b/examples/arithmetic/postincrdecr.p8 index 69c8fd55e..9aca48a05 100644 --- a/examples/arithmetic/postincrdecr.p8 +++ b/examples/arithmetic/postincrdecr.p8 @@ -32,8 +32,6 @@ main { warr[1]++ flarr[1] ++ - check_eval_stack() - check_ub(ub, 201) Y=100 Y++ @@ -53,8 +51,6 @@ main { check_uw(uwarr[1], 2001) check_w(warr[1], -999) - check_eval_stack() - c64scr.print("--\n") ub-- bb-- @@ -68,8 +64,6 @@ main { flarr[1] -- check_ub(ub, 200) - check_eval_stack() - Y=100 Y-- check_ub(Y, 99) @@ -148,11 +142,10 @@ main { sub check_eval_stack() { - c64scr.print("x=") - c64scr.print_ub(X) - if X==255 - c64scr.print(" ok\n") - else + if X!=255 { + c64scr.print("x=") + c64scr.print_ub(X) c64scr.print(" error!\n") + } } } diff --git a/examples/arithmetic/remainder.p8 b/examples/arithmetic/remainder.p8 index f24a380dd..fd499a15f 100644 --- a/examples/arithmetic/remainder.p8 +++ b/examples/arithmetic/remainder.p8 @@ -11,14 +11,12 @@ main { remainder_ubyte(255, 2, 1) remainder_ubyte(255, 20, 15) - check_eval_stack() - remainder_uword(0,1,0) remainder_uword(40000,511,142) remainder_uword(40000,500,0) remainder_uword(43211,12,11) - check_eval_stack() ; TODO fix stack error + check_eval_stack() } sub remainder_ubyte(ubyte a1, ubyte a2, ubyte c) { diff --git a/examples/fibonacci.p8 b/examples/fibonacci.p8 index 825628ac9..be86c3a8a 100644 --- a/examples/fibonacci.p8 +++ b/examples/fibonacci.p8 @@ -16,7 +16,7 @@ main { c64.CHROUT('\n') } - check_eval_stack() ; TODO fix stack error + check_eval_stack() } sub fib_setup() { diff --git a/examples/sorting.p8 b/examples/sorting.p8 index 5c0938faa..62706bb9a 100644 --- a/examples/sorting.p8 +++ b/examples/sorting.p8 @@ -30,7 +30,7 @@ main { c64scr.print("reversed\n") print_arrays() - check_eval_stack() ; TODO fix stack error + check_eval_stack() return diff --git a/examples/tehtriz.p8 b/examples/tehtriz.p8 index d3a5cdeae..098d5af16 100644 --- a/examples/tehtriz.p8 +++ b/examples/tehtriz.p8 @@ -40,7 +40,7 @@ newgame: spawnNextBlock() waitkey: - check_eval_stack() ; TODO fix stack error + check_eval_stack() if c64.TIME_LO>=(60-4*speedlevel) { c64.TIME_LO = 0 diff --git a/examples/testprints.p8 b/examples/testprints.p8 index e4f504d4c..ba2062a45 100644 --- a/examples/testprints.p8 +++ b/examples/testprints.p8 @@ -58,7 +58,7 @@ main { c64scr.print_w(-0) c64.CHROUT('\n') - check_eval_stack() ; TODO fix stack error + check_eval_stack() }