diff --git a/compiler/res/prog8lib/cx16/sprites.p8 b/compiler/res/prog8lib/cx16/sprites.p8 index d9655eef7..e49c781c9 100644 --- a/compiler/res/prog8lib/cx16/sprites.p8 +++ b/compiler/res/prog8lib/cx16/sprites.p8 @@ -175,6 +175,14 @@ sprites { return mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word } + sub getxy(ubyte spritenum) -> word, word { + sprite_reg = VERA_SPRITEREGS + 2 + spritenum*$0008 + cx16.r0s = mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word + sprite_reg += 2 + cx16.r1s = mkword(cx16.vpeek(1, sprite_reg+1), cx16.vpeek(1, sprite_reg)) as word + return cx16.r0s, cx16.r1s + } + sub hide(ubyte spritenum) { cx16.vpoke_and(1, VERA_SPRITEREGS + 6 + spritenum*$0008, %11110011) } diff --git a/compiler/src/prog8/compiler/ErrorReporter.kt b/compiler/src/prog8/compiler/ErrorReporter.kt index 63e10ff41..0c4b8bd2b 100644 --- a/compiler/src/prog8/compiler/ErrorReporter.kt +++ b/compiler/src/prog8/compiler/ErrorReporter.kt @@ -36,7 +36,13 @@ internal class ErrorReporter(val colors: IConsoleColors): IErrorReporter { // For undefined symbol errors, remove all other errors and warnings on the same source line, // because those are very likely caused by the unknown symbol. This reduces error clutter. - val undefinedSymbolErrors = messages.filter { it.severity == MessageSeverity.ERROR && it.message.contains("undefined symbol") } + val undefinedSymbolErrors = messages + .asSequence() + .filter { it.severity == MessageSeverity.ERROR && it.message.contains("undefined symbol") } + .map { it to (it.position.file to it.position.line)} + .groupBy { it.second } + .map { it.value.first().first } + for(e in undefinedSymbolErrors) { messages.removeIf { it !== e diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 86726f109..dc09854cf 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -1,8 +1,6 @@ TODO ==== -- change library routines that now return 1 value + say, another in R0, to just return 2 values now that this is supported for normal subroutines too. - - add paypal donation button as well? - announce prog8 on the 6502.org site? @@ -13,6 +11,7 @@ Future Things and Ideas ^^^^^^^^^^^^^^^^^^^^^^^ - Kotlin: can we use inline value classes in certain spots? +- allow multi-value variable initialization (var a,b,c = 1,2,3) - Improve the SublimeText syntax file for prog8, you can also install this for 'bat': https://github.com/sharkdp/bat?tab=readme-ov-file#adding-new-syntaxes--language-definitions - Compiling Libraries: improve ability to create library files in prog8; for instance there's still stuff injected into the start of the start() routine AND there is separate setup logic going on before calling it. Make up our mind! Maybe all setup does need to be put into start() ? because the program cannot function correctly when the variables aren't initialized properly bss is not cleared etc. etc. diff --git a/examples/test.p8 b/examples/test.p8 index cc095c61a..de69daa02 100644 --- a/examples/test.p8 +++ b/examples/test.p8 @@ -1,57 +1,32 @@ -%import textio +%import sprites %option no_sysinit %zeropage basicsafe main { sub start() { - uword a - ubyte b - bool c - a=9999 - b=255 - c=false - a, b, c = multi() - txt.print_uw(a) - txt.spc() - txt.print_uw(b) - txt.spc() - txt.print_bool(c) - txt.nl() - a=9999 - b=255 - c=false - a, void, c = multi() - txt.print_uw(a) - txt.spc() - txt.print_uw(b) - txt.spc() - txt.print_bool(c) - txt.nl() - a=9999 - b=255 - c=false - void, b, c = multi() - txt.print_uw(a) - txt.spc() - txt.print_uw(b) - txt.spc() - txt.print_bool(c) - txt.nl() - a=9999 - b=255 - c=false - void multi() - txt.print_uw(a) - txt.spc() - txt.print_uw(b) - txt.spc() - txt.print_bool(c) - txt.nl() + cx16.mouse_config2(1) + + sprites.init(1, 0, 0, sprites.SIZE_64, sprites.SIZE_64, sprites.COLORS_16, 0) + + sprites.pos(1, 100, 100) + + repeat { + word x,y + x,y = sprites.getxy(0) + sprites.pos(1, x, y) + } + + cx16.r0L = single() + cx16.r0L, cx16.r1L = multi() + } + + sub single() -> ubyte { + return xx } - sub multi() -> uword, ubyte, bool { - return 12345, 66, true + sub multi() -> ubyte, ubyte { + return xx, yy } }