forked from MEGA65/mega65-user-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
libc.tex
42 lines (30 loc) · 1.77 KB
/
libc.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
\chapter{MEGA65 Standard C Library}
A C library is being developed for the MEGA65, and which already
includes a number of useful features. This library is available from
\url{http://github.com/mega65/mega65-libc}. The procedures,
functions and definitions it provides are documented in a separate
chapter.
\section{Structure and Usage}
The MEGA65 libc is purposely provided in source-form only, and with groups
of functions in separate files, and with separate header files for including.
The idea is that you include only the header files that you require, and
add only the source files required to the list of source files of the program
you are compiling. This avoids the risk of the compiler including functions
in your compiled program that are never used, and thus wasting precious memory
space.
Note that some library source files are written in C, and thus are present as
files with a \stw{.c} extension, while others are written in assembly language
either for efficiency or out of necessity, and have a \stw{.s} extension.
Typical usage is to either have the mega65-libc source code checked out in an
adjacent directory, or within the source directory of your own project. In the
latter case, this can be done using the git submodule facility.
The following sections document each of the header files and the corresponding
functions that they provide.
\section{conio.h}
\titleformat*{\subsection}{\normalfont\huge\bfseries\color{blue}}
\input{api-conio}
\subsection{VIC\_BASE}
{\em VIC\_BASE} is a pre-processor macro that provides the base address of the
VIC-IV chip, i.e., \$D000.
{\em IS\_H640} is a pre-processor macro that returns 0 if the current VIC-III/IV
video mode is set to 320 pixels accross (40 column mode), and non-zero if it is set to 640 pixels across (80 column mode).