From d22359b6e7ecfa6d8708d1543958cf4c7b8c2e4f Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Sun, 12 Nov 2023 16:40:13 +0100 Subject: [PATCH] removed cx16.FB_cursor_position2() because it was only for use in the graphics module --- compiler/res/prog8lib/cx16/graphics.p8 | 18 +++++---- compiler/res/prog8lib/cx16/palette.p8 | 56 +++++++++++--------------- compiler/res/prog8lib/cx16/syslib.p8 | 1 - 3 files changed, 34 insertions(+), 41 deletions(-) diff --git a/compiler/res/prog8lib/cx16/graphics.p8 b/compiler/res/prog8lib/cx16/graphics.p8 index b0bdf469f..e4088eb31 100644 --- a/compiler/res/prog8lib/cx16/graphics.p8 +++ b/compiler/res/prog8lib/cx16/graphics.p8 @@ -16,6 +16,8 @@ graphics { %option no_symbol_prefixing + romsub $feff = FB_cursor_position2() clobbers(A,X,Y) ; alias for the normal FB_cursor_position() call but reuses existing r0 and r1 + const uword WIDTH = 320 const ubyte HEIGHT = 240 @@ -91,31 +93,31 @@ graphics { while xx>=yy { cx16.r0 = xcenter + xx cx16.r1 = ycenter + yy - cx16.FB_cursor_position2() + FB_cursor_position2() cx16.FB_set_pixel(stroke_color) cx16.r0 = xcenter - xx - cx16.FB_cursor_position2() + FB_cursor_position2() cx16.FB_set_pixel(stroke_color) cx16.r0 = xcenter + xx cx16.r1 = ycenter - yy - cx16.FB_cursor_position2() + FB_cursor_position2() cx16.FB_set_pixel(stroke_color) cx16.r0 = xcenter - xx - cx16.FB_cursor_position2() + FB_cursor_position2() cx16.FB_set_pixel(stroke_color) cx16.r0 = xcenter + yy cx16.r1 = ycenter + xx - cx16.FB_cursor_position2() + FB_cursor_position2() cx16.FB_set_pixel(stroke_color) cx16.r0 = xcenter - yy - cx16.FB_cursor_position2() + FB_cursor_position2() cx16.FB_set_pixel(stroke_color) cx16.r0 = xcenter + yy cx16.r1 = ycenter - xx - cx16.FB_cursor_position2() + FB_cursor_position2() cx16.FB_set_pixel(stroke_color) cx16.r0 = xcenter - yy - cx16.FB_cursor_position2() + FB_cursor_position2() cx16.FB_set_pixel(stroke_color) yy++ diff --git a/compiler/res/prog8lib/cx16/palette.p8 b/compiler/res/prog8lib/cx16/palette.p8 index d1ea70910..ee49129d2 100644 --- a/compiler/res/prog8lib/cx16/palette.p8 +++ b/compiler/res/prog8lib/cx16/palette.p8 @@ -79,15 +79,13 @@ palette { sub set_grayscale() { vera_palette_ptr = $fa00 + cc=0 repeat 16 { - cc=0 - repeat 16 { - cx16.vpoke(1, vera_palette_ptr, cc) - vera_palette_ptr++ - cx16.vpoke(1, vera_palette_ptr, cc) - vera_palette_ptr++ - cc += $11 - } + cx16.vpoke(1, vera_palette_ptr, cc) + vera_palette_ptr++ + cx16.vpoke(1, vera_palette_ptr, cc) + vera_palette_ptr++ + cc += $11 } } @@ -150,40 +148,34 @@ palette { sub set_c64pepto() { vera_palette_ptr = $fa00 - repeat 16 { - for cc in 0 to 15 { - uword ccp = C64_colorpalette_pepto[cc] - cx16.vpoke(1, vera_palette_ptr, lsb(ccp)) ; G, B - vera_palette_ptr++ - cx16.vpoke(1, vera_palette_ptr, msb(ccp)) ; R - vera_palette_ptr++ - } + for cc in 0 to 15 { + uword ccp = C64_colorpalette_pepto[cc] + cx16.vpoke(1, vera_palette_ptr, lsb(ccp)) ; G, B + vera_palette_ptr++ + cx16.vpoke(1, vera_palette_ptr, msb(ccp)) ; R + vera_palette_ptr++ } } sub set_c64light() { vera_palette_ptr = $fa00 - repeat 16 { - for cc in 0 to 15 { - uword ccp = C64_colorpalette_light[cc] - cx16.vpoke(1, vera_palette_ptr, lsb(ccp)) ; G, B - vera_palette_ptr++ - cx16.vpoke(1, vera_palette_ptr, msb(ccp)) ; R - vera_palette_ptr++ - } + for cc in 0 to 15 { + uword ccp = C64_colorpalette_light[cc] + cx16.vpoke(1, vera_palette_ptr, lsb(ccp)) ; G, B + vera_palette_ptr++ + cx16.vpoke(1, vera_palette_ptr, msb(ccp)) ; R + vera_palette_ptr++ } } sub set_c64dark() { vera_palette_ptr = $fa00 - repeat 16 { - for cc in 0 to 15 { - uword ccp = C64_colorpalette_dark[cc] - cx16.vpoke(1, vera_palette_ptr, lsb(ccp)) ; G, B - vera_palette_ptr++ - cx16.vpoke(1, vera_palette_ptr, msb(ccp)) ; R - vera_palette_ptr++ - } + for cc in 0 to 15 { + uword ccp = C64_colorpalette_dark[cc] + cx16.vpoke(1, vera_palette_ptr, lsb(ccp)) ; G, B + vera_palette_ptr++ + cx16.vpoke(1, vera_palette_ptr, msb(ccp)) ; R + vera_palette_ptr++ } } diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index 4874d8a86..e661d32ee 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -367,7 +367,6 @@ romsub $fef6 = FB_init() clobbers(A,X,Y) romsub $fef9 = FB_get_info() clobbers(X,Y) -> byte @A, uword @R0, uword @R1 ; width=r0, height=r1 romsub $fefc = FB_set_palette(uword pointer @R0, ubyte index @A, ubyte colorcount @X) clobbers(A,X,Y) romsub $feff = FB_cursor_position(uword x @R0, uword y @R1) clobbers(A,X,Y) -romsub $feff = FB_cursor_position2() clobbers(A,X,Y) ; alias for the previous routine, but avoiding having to respecify both x and y every time romsub $ff02 = FB_cursor_next_line(uword x @R0) clobbers(A,X,Y) romsub $ff05 = FB_get_pixel() clobbers(X,Y) -> ubyte @A romsub $ff08 = FB_get_pixels(uword pointer @R0, uword count @R1) clobbers(A,X,Y)