From 095c8b23090a5ec06836964cd3264ddc102bc71d Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Thu, 15 Oct 2020 00:58:41 +0200 Subject: [PATCH] corrected name and added cx16logo library module for fun --- compiler/res/prog8lib/c64/syslib.p8 | 2 +- compiler/res/prog8lib/cx16/syslib.p8 | 8 ++++---- compiler/res/prog8lib/cx16logo.p8 | 29 ++++++++++++++++++++++++++++ examples/cxlogo.p8 | 17 ++++++++++++++++ 4 files changed, 51 insertions(+), 5 deletions(-) create mode 100644 compiler/res/prog8lib/cx16logo.p8 create mode 100644 examples/cxlogo.p8 diff --git a/compiler/res/prog8lib/c64/syslib.p8 b/compiler/res/prog8lib/c64/syslib.p8 index 1a0ab3322..8b604196b 100644 --- a/compiler/res/prog8lib/c64/syslib.p8 +++ b/compiler/res/prog8lib/c64/syslib.p8 @@ -220,7 +220,7 @@ romsub $FFE4 = GETIN() clobbers(X,Y) -> ubyte @Pc, ubyte @ A ; (via 810 ($32A romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns -romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, ubyte dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use c64scr.plot for a 'safe' wrapper that preserves X. +romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, ubyte dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices ; ---- end of C64 ROM kernal routines ---- diff --git a/compiler/res/prog8lib/cx16/syslib.p8 b/compiler/res/prog8lib/cx16/syslib.p8 index 38ac409d6..bd961d643 100644 --- a/compiler/res/prog8lib/cx16/syslib.p8 +++ b/compiler/res/prog8lib/cx16/syslib.p8 @@ -12,9 +12,9 @@ c64 { ; ---- kernal routines, these are the same as on the Commodore-64 (hence the same block name) ---- -; STROUT --> use screen.print -; CLEARSCR -> use screen.clear_screen -; HOMECRSR -> use screen.plot +; STROUT --> use txt.print +; CLEARSCR -> use txt.clear_screen +; HOMECRSR -> use txt.plot romsub $FF81 = CINT() clobbers(A,X,Y) ; (alias: SCINIT) initialize screen editor and video chip romsub $FF84 = IOINIT() clobbers(A, X) ; initialize I/O devices (CIA, SID, IRQ) @@ -53,7 +53,7 @@ romsub $FFE4 = GETIN() clobbers(X,Y) -> ubyte @Pc, ubyte @ A ; (via 810 ($32A romsub $FFE7 = CLALL() clobbers(A,X) ; (via 812 ($32C)) close all files romsub $FFEA = UDTIM() clobbers(A,X) ; update the software clock romsub $FFED = SCREEN() -> ubyte @ X, ubyte @ Y ; read number of screen rows and columns -romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, ubyte dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use c64scr.plot for a 'safe' wrapper that preserves X. +romsub $FFF0 = PLOT(ubyte col @ Y, ubyte row @ X, ubyte dir @ Pc) -> ubyte @ X, ubyte @ Y ; read/set position of cursor on screen. Use txt.plot for a 'safe' wrapper that preserves X. romsub $FFF3 = IOBASE() -> uword @ XY ; read base address of I/O devices } diff --git a/compiler/res/prog8lib/cx16logo.p8 b/compiler/res/prog8lib/cx16logo.p8 new file mode 100644 index 000000000..e4bc884d9 --- /dev/null +++ b/compiler/res/prog8lib/cx16logo.p8 @@ -0,0 +1,29 @@ +%import textio + +cx16logo { + sub logo_at(ubyte column, ubyte row) { + uword strptr + for strptr in logo_lines { + txt.plot(column, row) + txt.print(strptr) + row++ + } + } + + sub logo() { + uword strptr + for strptr in logo_lines + txt.print(strptr) + txt.chrout('\n') + } + + str[] logo_lines = [ + "\uf10d\uf11a\uf139\uf11b \uf11a\uf13a\uf11b\n", + "\uf10b\uf11a▎\uf139\uf11b \uf11a\uf13a\uf130\uf11b\n", + "\uf10f\uf11a▌ \uf139\uf11b \uf11a\uf13a \uf11b▌\n", + "\uf102 \uf132\uf11a▖\uf11b \uf11a▗\uf11b\uf132\n", + "\uf10e ▂\uf11a▘\uf11b \uf11a▝\uf11b▂\n", + "\uf104 \uf11a \uf11b\uf13a\uf11b \uf139\uf11a \uf11b\n", + "\uf101\uf130\uf13a \uf139▎\uf100" + ] +} diff --git a/examples/cxlogo.p8 b/examples/cxlogo.p8 new file mode 100644 index 000000000..b5a173cff --- /dev/null +++ b/examples/cxlogo.p8 @@ -0,0 +1,17 @@ +%import textio +%import cx16logo + +; Note: this program is compatible with C64 and CX16. + +main { + sub start() { + repeat { + ubyte col = rnd() % (txt.DEFAULT_WIDTH-12) + 3 + ubyte row = rnd() % (txt.DEFAULT_HEIGHT-7) + cx16logo.logo_at(col, row) + txt.plot(col-3, row+7 ) + txt.print("commander x16") + } + } +} +