added sprites.getxy()

fix compiler crash on return xxx,yyy  when symbol is not defined
This commit is contained in:
Irmen de Jong 2025-01-10 22:26:38 +01:00
parent 2ab2130000
commit 4f096a7511
4 changed files with 37 additions and 49 deletions

View File

@ -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)
}

View File

@ -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

View File

@ -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.

View File

@ -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 multi() -> uword, ubyte, bool {
return 12345, 66, true
sub single() -> ubyte {
return xx
}
sub multi() -> ubyte, ubyte {
return xx, yy
}
}