From ea3871d0c497fa0443f6308868f0653ecc1bd667 Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Mon, 30 Sep 2024 23:10:10 +0200 Subject: [PATCH] comment about builtin function call ast node type --- compiler/res/prog8lib/cx16/graphics.p8 | 3 +-- compiler/src/prog8/compiler/astprocessing/AstChecker.kt | 4 ++++ compiler/test/TestCompilerOnExamples.kt | 1 + docs/source/todo.rst | 1 - examples/test.p8 | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/compiler/res/prog8lib/cx16/graphics.p8 b/compiler/res/prog8lib/cx16/graphics.p8 index a0c4fd395..d8a2afd14 100644 --- a/compiler/res/prog8lib/cx16/graphics.p8 +++ b/compiler/res/prog8lib/cx16/graphics.p8 @@ -1,5 +1,4 @@ %import syslib -%import textio ; Bitmap pixel graphics module for the CommanderX16 ; Wraps the graphics functions that are in ROM. @@ -35,7 +34,7 @@ graphics { sub disable_bitmap_mode() { ; enables text mode, erase the text screen, color white void cx16.screen_mode(0, false) - txt.clear_screen() + cbm.CHROUT(147) } diff --git a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt index d3e1184f1..c143e1f2a 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt @@ -1272,11 +1272,15 @@ internal class AstChecker(private val program: Program, } override fun visit(bfc: BuiltinFunctionCall) { + // most function calls, even to builtin functions, are still regular FunctionCall nodes here. + // they get converted to the more specialized node type in BeforeAsmTypecastCleaner checkLongType(bfc) super.visit(bfc) } override fun visit(functionCallStatement: FunctionCallStatement) { + // most function calls, even to builtin functions, are still regular FunctionCall nodes here. + // they get converted to the more specialized node type in BeforeAsmTypecastCleaner val targetStatement = functionCallStatement.target.checkFunctionOrLabelExists(program, functionCallStatement, errors) if(targetStatement!=null) { checkFunctionCall(targetStatement, functionCallStatement.args, functionCallStatement.position) diff --git a/compiler/test/TestCompilerOnExamples.kt b/compiler/test/TestCompilerOnExamples.kt index 08b02a916..42efd38f7 100644 --- a/compiler/test/TestCompilerOnExamples.kt +++ b/compiler/test/TestCompilerOnExamples.kt @@ -168,6 +168,7 @@ class TestCompilerOnExamplesBothC64andCx16: FunSpec({ "cube3d-gfx", "dirlist", "fibonacci", + "fractal-tree", "line-circle-gfx", "line-circle-txt", "maze", diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 315082023..b6dd78266 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -14,7 +14,6 @@ Future Things and Ideas - Add a new SublimeText syntax file for prog8, and also install this for bat: https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-syntaxes--language-definitions - callfar() should allow setting an argument in the X register as well? -- AST weirdness: why is call(...) a normal FunctionCallStatement and not a BuiltinFunctionCall? What does ror() produce for instance? - Can we support signed % (remainder) somehow? - Don't add "random" rts to %asm blocks but instead give a warning about it? (but this breaks existing behavior that others already depend on... command line switch? block directive?) - IR: implement missing operators in AssignmentGen (array shifts etc) diff --git a/examples/test.p8 b/examples/test.p8 index f9d238a3b..e973ba8a0 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -5,7 +5,7 @@ main { sub start() { - word x1 = -118 + word @shared x1 = -118 floats.print(x1 as float) txt.nl() floats.print(x1 as float/1.9)