diff --git a/README.md b/README.md index f8f64a8..3252b99 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ Simple C library for the MEGA65 ~~~sh cd mega65-libc cmake -DCMAKE_PREFIX_PATH=$HOME/llvm-mos -B build + cd build make make test # if `xmega65` (Xemu) was in your path when running cmake ~~~ diff --git a/include/mega65/fcio.h b/include/mega65/fcio.h index e9251ba..2c76bad 100644 --- a/include/mega65/fcio.h +++ b/include/mega65/fcio.h @@ -516,7 +516,7 @@ fciInfo* fc_displayFCIFile(char* filename, byte x0, byte y0); void fc_plotExtChar(byte x, byte y, byte c); /** - * @brief plot petscii character + * @brief plot screencode character * * @param x screen column * @param y screen row @@ -524,6 +524,23 @@ void fc_plotExtChar(byte x, byte y, byte c); * @param color character colour * @param exAttr extended attributes */ +void fc_plotScreenChar(byte x, byte y, byte c, byte color, byte exAttr); + +/** + * @deprecated The function name is misleading as the supplied character code + * is expected to be a screen character code, not a PETSCII code. + * Use @ref fc_plotScreenChar(byte, byte, byte, byte, byte) instead. + * @brief plot screencode character + * + * @param x screen column + * @param y screen row + * @param c character code + * @param color character colour + * @param exAttr extended attributes + */ +#ifdef __clang__ +[[deprecated("Use fc_plotScreenChar() instead.")]] +#endif void fc_plotPetsciiChar(byte x, byte y, byte c, byte color, byte exAttr); #endif // __MEGA65_FCIO_H diff --git a/src/fcio.c b/src/fcio.c index 77f56ed..c13c8f0 100644 --- a/src/fcio.c +++ b/src/fcio.c @@ -341,7 +341,7 @@ himemPtr fc_allocPalMem(word size) return 0; } -char asciiToPetscii(byte c) +char asciiToScreencode(byte c) { // TODO: could be made much faster with translation table if (c == '_') { @@ -356,7 +356,7 @@ char asciiToPetscii(byte c) if (c >= 192) { return c - 128; } - return c; + return (char)c; } #ifdef __clang__ @@ -741,7 +741,7 @@ void cr(void) } } -void fc_plotPetsciiChar(byte x, byte y, byte c, byte color, byte exAttr) +void fc_plotScreenChar(byte x, byte y, byte c, byte color, byte exAttr) { word adrOffset; adrOffset = (x * 2) + (y * 2 * gScreenColumns); @@ -751,6 +751,11 @@ void fc_plotPetsciiChar(byte x, byte y, byte c, byte color, byte exAttr) lpoke(gFcioConfig->colourBase + adrOffset, 0); } +void fc_plotPetsciiChar(byte x, byte y, byte c, byte color, byte exAttr) +{ + fc_plotScreenChar(x, y, c, color, exAttr); +} + byte fc_wherex(void) { return gCurrentWin->xc; @@ -781,9 +786,9 @@ void fc_putc(char c) return; } - out = asciiToPetscii(c); + out = asciiToScreencode((byte)c); - fc_plotPetsciiChar(gCurrentWin->xc + gCurrentWin->x0, + fc_plotScreenChar(gCurrentWin->xc + gCurrentWin->x0, gCurrentWin->yc + gCurrentWin->y0, out, gCurrentWin->textcolor, gCurrentWin->extAttributes); gCurrentWin->xc++; @@ -800,7 +805,7 @@ void fc_putc(char c) } if (csrflag) { - fc_plotPetsciiChar(gCurrentWin->xc + gCurrentWin->x0, + fc_plotScreenChar(gCurrentWin->xc + gCurrentWin->x0, gCurrentWin->yc + gCurrentWin->y0, CURSOR_CHARACTER, gCurrentWin->textcolor, 16); } @@ -849,7 +854,7 @@ void fc_cursor(byte onoff) { csrflag = onoff; - fc_plotPetsciiChar(gCurrentWin->xc + gCurrentWin->x0, + fc_plotScreenChar(gCurrentWin->xc + gCurrentWin->x0, gCurrentWin->yc + gCurrentWin->y0, (csrflag ? CURSOR_CHARACTER : 32), gCurrentWin->textcolor, (csrflag ? 16 : 0)); }