<article>
<title>cc65 function reference
-<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
-<date>2016-06-08
+<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
+<url url="mailto:greg.king5@verizon.net" name="Greg King">
+<date>2017-09-02
<abstract>
cc65 is a C compiler for 6502 based systems. This function reference describes
<item><ref id="cbm_k_open" name="cbm_k_open">
<item><ref id="cbm_k_readst" name="cbm_k_readst">
<item><ref id="cbm_k_save" name="cbm_k_save">
+<item><ref id="cbm_k_scnkey" name="cbm_k_scnkey">
<item><ref id="cbm_k_setlfs" name="cbm_k_setlfs">
<item><ref id="cbm_k_setnam" name="cbm_k_setnam">
+<item><ref id="cbm_k_talk" name="cbm_k_talk">
+<item><ref id="cbm_k_udtim" name="cbm_k_udtim">
<item><ref id="cbm_k_unlsn" name="cbm_k_unlsn">
<!-- <item><ref id="cbm_load" name="cbm_load"> -->
<!-- <item><ref id="cbm_open" name="cbm_open"> -->
<!-- <item><ref id="cbm_save" name="cbm_save"> -->
<!-- <item><ref id="cbm_write" name="cbm_write"> -->
<!-- <item><ref id="get_tv" name="get_tv"> -->
+<item><ref id="kbrepeat" name="kbrepeat">
</itemize>
(incomplete)
(incomplete)
+<sect1><tt/lz4.h/<label id="lz4.h"><p>
+
+<itemize>
+<item><ref id="decompress_lz4" name="decompress_lz4">
+</itemize>
+
+
<sect1><tt/modload.h/<label id="modload.h"><p>
<itemize>
<!-- <itemize> -->
<!-- <item><ref id="get_tv" name="get_tv"> -->
-<!-- <item><ref id="waitvblank" name="waitvblank"> -->
+<!-- <item><ref id="waitvsync" name="waitvsync"> -->
<!-- </itemize> -->
(incomplete)
</quote>
+<sect1>cbm_k_scnkey<label id="cbm_k_scnkey"><p>
+
+<quote>
+<descrip>
+<tag/Function/Scan the keyboard matrix.
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void cbm_k_scnkey (void);/
+<tag/Description/This function looks at the switches in the keyboard, to see
+if any of them are being pressed. If they are, then code numbers for them are
+stored in RAM. Other functions use those numbers to input text. Normally,
+the keyboard is scanned by the Kernal's Interrupt Service Routine. But, if
+you divert the "Jiffy interrupt" to a C-code ISR, then that ISR must call this
+function, in order to provide input from the keyboard.
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_getin" name="cbm_k_getin">,
+<ref id="cbm_k_udtim" name="cbm_k_udtim">,
+<ref id="cgetc" name="cgetc">,
+<!-- <ref id="getc" name="getc"> -->
+<!-- <ref id="getchar" name="getchar"> -->
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>cbm_k_setlfs<label id="cbm_k_setlfs"><p>
<quote>
</quote>
+<sect1>cbm_k_udtim<label id="cbm_k_udtim"><p>
+
+<quote>
+<descrip>
+<tag/Function/Update the Jiffy clock.
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/void cbm_k_udtim (void);/
+<tag/Description/This function adds one count to the Jiffy clock. That clock
+counts sixtieths of a second. It is used by the library's <tt/clock()/
+function. Normally, the Jiffy clock is updated by the Kernal's Interrupt
+Service Routine. But, if you divert the "Jiffy interrupt" to a C-code ISR,
+then that ISR must call this function, in order to keep the clock valid.
+<tag/Availability/cc65
+<tag/See also/
+<ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
+<ref id="clock" name="clock">
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>cbm_k_unlsn<label id="cbm_k_unlsn"><p>
<quote>
<tag/Header/<tt/<ref id="conio.h" name="conio.h">/
<tag/Declaration/<tt/char cgetc (void);/
<tag/Description/The function reads a character from the keyboard. If there is
-no character available, <tt/cgetc/ waits until the user presses a key. If the
+no character available, <tt/cgetc()/ waits until the user presses a key. If the
cursor is enabled by use of the <tt/cursor/ function, a blinking cursor is
displayed while waiting.
<tag/Notes/<itemize>
-<item>If the system supports a keyboard buffer, <tt/cgetc/ will fetch a key
-from this buffer and wait only if the buffer is empty.
+<item>If the system supports a keyboard buffer, <tt/cgetc()/ will fetch a key
+from that buffer; and, wait only if the buffer is empty.
+<item>The keyboard must be scanned periodically, in order for this function to
+see anything that you type. (See the description of <tt/cbm_k_scnkey()/.)
</itemize>
<tag/Availability/cc65
<tag/See also/
+<ref id="cbm_k_scnkey" name="cbm_k_scnkey">,
<ref id="cursor" name="cursor">,
<ref id="kbhit" name="kbhit">
<tag/Example/None.
<tag/Header/<tt/<ref id="time.h" name="time.h">/
<tag/Declaration/<tt/clock_t clock (void);/
<tag/Description/The <tt/clock/ function returns an approximaton of processor
-time used by the program. The time is returned in implementation defined
+time used by the program. The time is returned in implementation-defined
units. It can be converted to seconds by dividing by the value of the macro
<tt/CLOCKS_PER_SEC/.
<tag/Notes/<itemize>
-<item>Since the machines, cc65 generated programs run on, cannot run multiple
-processes, the function will actually return the time since some
-implementation defined point in the past.
+<item>Since the machines that cc65-generated programs run on cannot run multiple
+processes, the function actually will return the time since some
+implementation-defined point in the past.
+<item>The Jiffy clock must be "running", in order for this function to return
+changing values. (See the description of <tt/cbm_k_udtim()/.)
</itemize>
<tag/Availability/ISO 9899
<tag/See also/
+<ref id="cbm_k_udtim" name="cbm_k_udtim">,
<ref id="time" name="time">
<tag/Example/None.
</descrip>
</quote>
+<sect1>decompress_lz4<label id="decompress_lz4"><p>
+
+<quote>
+<descrip>
+<tag/Function/Uncompress a LZ4-compressed buffer.
+<tag/Header/<tt/<ref id="lz4.h" name="lz4.h">/
+<tag/Declaration/<tt/void decompress_lz4 (const unsigned char* src, unsigned char* const dst, const unsigned short uncompressed_size);/
+<tag/Description/<tt/decompress_lz4/ uncompresses a LZ4-compressed buffer.
+<tag/Notes/<itemize>
+<item>Use LZ4_compress_HC with compression level 16 for best compression.
+</itemize>
+<tag/Availability/cc65
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>div<label id="div"><p>
<quote>
<quote>
<descrip>
-<tag/Function/Check if a given character is a a white-space character.
+<tag/Function/Check if a given character is a white-space character.
<tag/Header/<tt/<ref id="ctype.h" name="ctype.h">/
<tag/Declaration/<tt/int __fastcall__ isspace (int c);/
<tag/Description/The function returns a non zero value if the given argument
</quote>
+<sect1>kbrepeat<label id="kbrepeat"><p>
+
+<quote>
+<descrip>
+<tag/Function/Set the keyboard repeat mode.
+<tag/Header/<tt/<ref id="cbm.h" name="cbm.h">/
+<tag/Declaration/<tt/unsigned char __fastcall__ kbrepeat (unsigned char mode);/
+<tag/Description/This function changes which keys have automatic repeat when
+being held down for a certain time. Possible values are <tt/KBREPEAT_CURSOR/
+(repeat only cursor-related keys), <tt/KBREPEAT_NONE/ (no repeat for any
+keys), and <tt/KBREPEAT_ALL/ (repeat all keys). The old mode is returned, so
+it can be restored later.
+<tag/Notes/<itemize>
+<item>The function is available only as a fastcall function; so, it may be used
+only in the presence of a prototype.
+</itemize>
+<tag/Availability/cc65
+<tag/Example/None.
+</descrip>
+</quote>
+
+
<sect1>labs<label id="labs"><p>
<quote>