diff --git a/compiler/res/prog8lib/c128/textio.p8 b/compiler/res/prog8lib/c128/textio.p8 index b42d15f29..ffd5844fb 100644 --- a/compiler/res/prog8lib/c128/textio.p8 +++ b/compiler/res/prog8lib/c128/textio.p8 @@ -1,4 +1,6 @@ ; Prog8 definitions for the Text I/O and Screen routines for the Commodore-128 +; All routines work with Screencode character encoding, except `print`, `chrout` and `input_chars`, +; these work with PETSCII encoding instead. %import syslib %import conv @@ -238,10 +240,10 @@ _scroll_screen ; scroll only the screen memory }} } -romsub $FFD2 = chrout(ubyte char @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. +romsub $FFD2 = chrout(ubyte char @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. asmsub print (str text @ AY) clobbers(A,Y) { - ; ---- print null terminated string from A/Y + ; ---- print null terminated string, in PETSCII encoding, from A/Y ; note: the compiler contains an optimization that will replace ; a call to this subroutine with a string argument of just one char, ; by just one call to cbm.CHROUT of that single char. @@ -427,7 +429,8 @@ asmsub print_w (word value @ AY) clobbers(A,X,Y) { } asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - ; ---- Input a string (max. 80 chars) from the keyboard. Returns length in Y. (string is terminated with a 0 byte as well) + ; ---- Input a string (max. 80 chars) from the keyboard, in PETSCII encoding. + ; Returns length in Y. (string is terminated with a 0 byte as well) ; It assumes the keyboard is selected as I/O channel! %asm {{ diff --git a/compiler/res/prog8lib/c64/textio.p8 b/compiler/res/prog8lib/c64/textio.p8 index 464a82885..c9d5ed6f0 100644 --- a/compiler/res/prog8lib/c64/textio.p8 +++ b/compiler/res/prog8lib/c64/textio.p8 @@ -1,4 +1,6 @@ ; Prog8 definitions for the Text I/O and Screen routines for the Commodore-64 +; All routines work with Screencode character encoding, except `print`, `chrout` and `input_chars`, +; these work with PETSCII encoding instead. %import syslib %import conv @@ -237,10 +239,10 @@ _scroll_screen ; scroll only the screen memory }} } -romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. +romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. asmsub print (str text @ AY) clobbers(A,Y) { - ; ---- print null terminated string from A/Y + ; ---- print null terminated string, in PESCII encoding, from A/Y ; note: the compiler contains an optimization that will replace ; a call to this subroutine with a string argument of just one char, ; by just one call to cbm.CHROUT of that single char. @@ -426,7 +428,8 @@ asmsub print_w (word value @ AY) clobbers(A,X,Y) { } asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - ; ---- Input a string (max. 80 chars) from the keyboard. Returns length in Y. (string is terminated with a 0 byte as well) + ; ---- Input a string (max. 80 chars) from the keyboard, in PETSCII encoding. + ; Returns length in Y. (string is terminated with a 0 byte as well) ; It assumes the keyboard is selected as I/O channel! %asm {{ diff --git a/compiler/res/prog8lib/cx16/textio.p8 b/compiler/res/prog8lib/cx16/textio.p8 index 32ca616ff..57c425829 100644 --- a/compiler/res/prog8lib/cx16/textio.p8 +++ b/compiler/res/prog8lib/cx16/textio.p8 @@ -1,4 +1,6 @@ ; Prog8 definitions for the Text I/O and Screen routines for the CommanderX16 +; All routines work with Screencode character encoding, except `print`, `chrout` and `input_chars`, +; these work with PETSCII encoding instead. %import syslib %import conv @@ -384,10 +386,10 @@ _nextline }} } -romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. +romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. asmsub print (str text @ AY) clobbers(A,Y) { - ; ---- print null terminated string from A/Y + ; ---- print null terminated string, in PETSCII encoding, from A/Y ; note: the compiler contains an optimization that will replace ; a call to this subroutine with a string argument of just one char, ; by just one call to cbm.CHROUT of that single char. @@ -572,7 +574,8 @@ asmsub print_w (word value @ AY) clobbers(A,X,Y) { } asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - ; ---- Input a string (max. 80 chars) from the keyboard. Returns length in Y. (string is terminated with a 0 byte as well) + ; ---- Input a string (max. 80 chars) from the keyboard, in PETSCII encoding. + ; Returns length in Y. (string is terminated with a 0 byte as well) ; It assumes the keyboard is selected as I/O channel! %asm {{ diff --git a/compiler/res/prog8lib/pet32/textio.p8 b/compiler/res/prog8lib/pet32/textio.p8 index 99683000a..886317f83 100644 --- a/compiler/res/prog8lib/pet32/textio.p8 +++ b/compiler/res/prog8lib/pet32/textio.p8 @@ -1,4 +1,6 @@ ; Prog8 definitions for the Text I/O and Screen routines for the Commodore PET +; All routines work with Screencode character encoding, except `print`, `chrout` and `input_chars`, +; these work with PETSCII encoding instead. %import syslib %import conv @@ -139,10 +141,10 @@ asmsub scroll_down () clobbers(A,X) { }} } -romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. +romsub $FFD2 = chrout(ubyte character @ A) ; for consistency. You can also use cbm.CHROUT directly ofcourse. Note: takes a PETSCII encoded character. asmsub print (str text @ AY) clobbers(A,Y) { - ; ---- print null terminated string from A/Y + ; ---- print null terminated string, in PETSCII encoding, from A/Y ; note: the compiler contains an optimization that will replace ; a call to this subroutine with a string argument of just one char, ; by just one call to cbm.CHROUT of that single char. @@ -328,7 +330,8 @@ asmsub print_w (word value @ AY) clobbers(A,X,Y) { } asmsub input_chars (uword buffer @ AY) clobbers(A) -> ubyte @ Y { - ; ---- Input a string (max. 80 chars) from the keyboard. Returns length in Y. (string is terminated with a 0 byte as well) + ; ---- Input a string (max. 80 chars) from the keyboard, in PETSCII encoding. + ; Returns length in Y. (string is terminated with a 0 byte as well) ; It assumes the keyboard is selected as I/O channel! %asm {{ diff --git a/docs/source/libraries.rst b/docs/source/libraries.rst index b3700ed28..07c07c738 100644 --- a/docs/source/libraries.rst +++ b/docs/source/libraries.rst @@ -155,6 +155,9 @@ dealing with text-based input and output (to the screen). Such as - scrolling the text on the screen - placing individual characters on the screen +All routines work with Screencode character encoding, except `print`, `chrout` and `input_chars`, +these work with PETSCII encoding instead. + Read the `source code `_ to see what's in there. (Note: slight variations for different compiler targets) @@ -418,6 +421,9 @@ but perhaps the provided ones can be of service too. ``mul16_last_upper () -> uword`` Fetches the upper 16 bits of the previous 16*16 bit multiplication. To avoid corrupting the result, it is best performed immediately after the multiplication. + Note: It is only for the regular 6502 cpu multiplication routine. + It does not work for the verafx multiplication routines on the Commander X16! + These have a different way to obtain the upper 16 bits of the result: just read cx16.r0. cx16logo