From e22b4cbb67d3bdde67acafb58abcc8b8bec87b07 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Wed, 7 Oct 2020 01:35:23 +0200 Subject: [PATCH] fixed invalid errormessage about memory mapped strings --- .../src/prog8/ast/processing/AstChecker.kt | 2 +- examples/cx16/cobramk3-gfx.p8 | 2 ++ examples/cx16/mandelbrot-gfx-colors.p8 | 2 ++ examples/cx16/simplegraphics.p8 | 4 ++++ examples/test.p8 | 21 ------------------- examples/testarrays.p8 | 3 +-- 6 files changed, 10 insertions(+), 24 deletions(-) diff --git a/compiler/src/prog8/ast/processing/AstChecker.kt b/compiler/src/prog8/ast/processing/AstChecker.kt index 95baef504..f558d07fa 100644 --- a/compiler/src/prog8/ast/processing/AstChecker.kt +++ b/compiler/src/prog8/ast/processing/AstChecker.kt @@ -631,7 +631,7 @@ internal class AstChecker(private val program: Program, if(decl.datatype==DataType.STR) { if(decl.value==null) err("string var must be initialized with a string literal") - if(decl.value !=null && decl.value !is StringLiteralValue) + else if (decl.type==VarDeclType.VAR && decl.value !is StringLiteralValue) err("string var can only be initialized with a string literal") } diff --git a/examples/cx16/cobramk3-gfx.p8 b/examples/cx16/cobramk3-gfx.p8 index c8ffc3bd7..9cd43474b 100644 --- a/examples/cx16/cobramk3-gfx.p8 +++ b/examples/cx16/cobramk3-gfx.p8 @@ -4,6 +4,8 @@ ; TODO add all other Elite's ships, show their name, advance to next ship on keypress +; TODO fix crash + main { ; storage for rotated coordinates diff --git a/examples/cx16/mandelbrot-gfx-colors.p8 b/examples/cx16/mandelbrot-gfx-colors.p8 index c2d1d48f5..3f97e6a42 100644 --- a/examples/cx16/mandelbrot-gfx-colors.p8 +++ b/examples/cx16/mandelbrot-gfx-colors.p8 @@ -3,6 +3,8 @@ %import floats %zeropage basicsafe +; TODO fix crash + main { const uword width = 256 const uword height = 200 diff --git a/examples/cx16/simplegraphics.p8 b/examples/cx16/simplegraphics.p8 index 9e3e574e3..595745f98 100644 --- a/examples/cx16/simplegraphics.p8 +++ b/examples/cx16/simplegraphics.p8 @@ -3,12 +3,16 @@ %target cx16 %zeropage basicsafe +; TODO fix crash + + main { sub start() { void cx16.screen_set_mode($80) cx16.r0=0 + void cx16.screen_set_mode(0) cx16.FB_init() cx16.GRAPH_init() diff --git a/examples/test.p8 b/examples/test.p8 index 4a78f09a2..1830c7247 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -8,27 +8,6 @@ main { str planet_name = "12345678" sub start() { - &str ms1 = $c000 ; TODO fix invalid error message . what about memory mapped array? memory mapped struct? - - - c64.OPEN() ; works: function call droppign the value but preserving the statusregister - if_cs - return - - ubyte status - status = c64.OPEN() ; open 1,8,0,"$" - if_cs - return - - - ; TODO make this work as well, with the same warning: - ubyte status2 = c64.OPEN() ; open 1,8,0,"$" - if_cs - return - - txt.print_ub(status) - txt.print_ub(status2) - txt.print(planet_name) txt.chrout('\n') diff --git a/examples/testarrays.p8 b/examples/testarrays.p8 index 8f99a0d90..2b2922097 100644 --- a/examples/testarrays.p8 +++ b/examples/testarrays.p8 @@ -16,8 +16,7 @@ main { str s1 = "hello" str s2 = @"screencodes" - &str ms1 = $c000 ; TODO fix invalid error message - + &str ms1 = $c000 byte[4] barray ubyte[4] ubarray