]> git.sur5r.net Git - cc65/blob - doc/nes.sgml
Fixed several build warnings.
[cc65] / doc / nes.sgml
1 <!doctype linuxdoc system>
2
3 <article>
4
5 <title>Nintendo Entertainment System specific information for cc65
6 <author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
7 Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org">
8 <date>2005-07-17
9
10 <abstract>
11 An overview over the NES runtime system as it is implemented for the
12 cc65 C compiler.
13 </abstract>
14
15 <!-- Table of contents -->
16 <toc>
17
18 <!-- Begin the document -->
19
20 <sect>Overview<p>
21
22 This file contains an overview of the NES runtime system as it comes
23 with the cc65 C compiler. It describes the memory layout, NES specific header
24 files, available drivers, and any pitfalls specific to that platform.
25
26 Please note that NES specific functions are just mentioned here, they are
27 described in detail in the separate <htmlurl url="funcref.html" name="function
28 reference">. Even functions marked as "platform dependent" may be available on
29 more than one platform. Please see the function reference for more
30 information.
31
32
33 <sect>Binary format<p>
34
35 The standard binary output format generated by the linker for the NES target
36 is a machine language program with an INES cartridge header. It is of course
37 possible to change this behaviour by using a modified startup file and linker
38 config.
39
40 <sect>Memory layout<p>
41
42 cc65 generated programs with the default setup run with the I/O area and a
43 CHR bank enabled, which gives a usable memory range of &dollar;8000 - &dollar;FFF3.
44 All boot ROM entry points may be called directly without additional code.
45
46 Special locations:
47
48 <descrip>
49   <tag/Text screen/
50   The text screen is located at VRAM &dollar;2000.
51
52   <tag/Stack/
53   The C runtime stack is located at &dollar;7FFF and growing downwards.
54
55   <tag/Heap/
56   The C heap is located at the end of the program and grows towards the C
57   runtime stack.
58
59 </descrip><p>
60
61
62
63 <sect>Platform specific header files<p>
64
65 Programs containing NES specific code may use the <tt/nes.h/ header file.
66
67
68 <sect1>NES specific functions<p>
69
70 <itemize>
71 <item>waitvblank
72 <item>get_tv
73 </itemize>
74
75
76
77 <sect1>Hardware access<p>
78
79 The following pseudo variables declared in the <tt/nes.inc/ include file do
80 allow access to hardware located in the address space.
81
82 <descrip>
83
84   <tag><tt/PPU/</tag>
85   The <tt/PPU/ defines allow access to the PPU chip.
86
87   <tag><tt/APU/</tag>
88   The <tt/APU/ defines allow access to the APU chip.
89
90 </descrip><p>
91
92
93
94 <sect>Loadable drivers<p>
95
96 All drivers must be statically linked because no file I/O is available.
97 See the documentation for the <htmlurl url="co65.html" name="co65 utility">
98 for information on how to do that.
99
100 <sect1>Graphics drivers<p>
101
102 <descrip>
103
104   <tag><tt/nes-64-56-2.tgi/</tag>
105   This driver features a resolution of 64&times;56 with 2 colors using the
106   CHR bank.
107
108 </descrip><p>
109
110 <sect1>Extended memory drivers<p>
111
112 No extended memory drivers are currently available for the NES.
113
114
115 <sect1>Joystick drivers<p>
116
117 A joystick driver for the standard four buttons joypad is available.
118
119 <sect1>Mouse drivers<p>
120
121 No mouse drivers are currently available for the NES.
122
123
124 <sect1>RS232 device drivers<p>
125
126 No serial drivers are currently available for the NES.
127
128
129
130 <sect>Limitations<p>
131
132 <sect1>Disk I/O<p>
133
134 The existing library for the NES doesn't implement C file
135 I/O. There are no hacks for the <tt/read()/ and <tt/write()/ routines.
136
137 To be more concrete, this limitation means that you cannot use any of the
138 following functions (and a few others):
139
140 <itemize>
141 <item>fclose
142 <item>fopen
143 <item>fread
144 <item>fprintf
145 <item>fputc
146 <item>fscanf
147 <item>fwrite
148 <item>...
149 </itemize>
150
151
152
153 <sect>Other hints<p>
154
155
156
157 <sect>Bugs/Feedback<p>
158
159 If you have problems using the library, if you find any bugs, or if you're
160 doing something interesting with it, I would be glad to hear from you. Feel
161 free to contact me by email (<htmlurl url="mailto:uz@cc65.org"
162 name="uz@cc65.org">).
163
164
165
166 <sect>License<p>
167
168 This software is provided 'as-is', without any expressed or implied
169 warranty.  In no event will the authors be held liable for any damages
170 arising from the use of this software.
171
172 Permission is granted to anyone to use this software for any purpose,
173 including commercial applications, and to alter it and redistribute it
174 freely, subject to the following restrictions:
175
176 <enum>
177 <item>  The origin of this software must not be misrepresented; you must not
178         claim that you wrote the original software. If you use this software
179         in a product, an acknowledgment in the product documentation would be
180         appreciated but is not required.
181 <item>  Altered source versions must be plainly marked as such, and must not
182         be misrepresented as being the original software.
183 <item>  This notice may not be removed or altered from any source
184         distribution.
185 </enum>
186
187 </article>
188
189
190