1 <!doctype linuxdoc system>
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">
11 An overview over the NES runtime system as it is implemented for the
15 <!-- Table of contents -->
18 <!-- Begin the document -->
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.
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
33 <sect>Binary format<p>
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
40 <sect>Memory layout<p>
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 $8000 - $FFF3.
44 All boot ROM entry points may be called directly without additional code.
50 The text screen is located at VRAM $2000.
53 The C runtime stack is located at $7FFF and growing downwards.
56 The C heap is located at the end of the program and grows towards the C
63 <sect>Platform specific header files<p>
65 Programs containing NES specific code may use the <tt/nes.h/ header file.
68 <sect1>NES specific functions<p>
76 <sect1>Hardware access<p>
78 The following pseudo variables declared in the <tt/nes.inc/ include file do
79 allow access to hardware located in the address space.
84 The <tt/PPU/ defines allow access to the PPU chip.
87 The <tt/APU/ defines allow access to the APU chip.
93 <sect>Loadable drivers<p>
95 <sect1>Graphics drivers<p>
97 No graphics drivers are currently available for the NES.
99 <sect1>Extended memory drivers<p>
101 No extended memory drivers are currently available for the NES.
104 <sect1>Joystick drivers<p>
106 A joystick driver for the standard buttons is available, but must be
107 statically linked, because no file I/O is available. See the documentation for
108 the <htmlurl url="co65.html" name="co65 utility"> for information on how to do
111 <sect1>Mouse drivers<p>
113 No mouse drivers are currently available for the NES.
116 <sect1>RS232 device drivers<p>
118 No serial drivers are currently available for the NES.
126 The existing library for the NES doesn't implement C file
127 I/O. There are no hacks for the <tt/read()/ and <tt/write()/ routines.
129 To be more concrete, this limitation means that you cannot use any of the
130 following functions (and a few others):
149 <sect>Bugs/Feedback<p>
151 If you have problems using the library, if you find any bugs, or if you're
152 doing something interesting with it, I would be glad to hear from you. Feel
153 free to contact me by email (<htmlurl url="mailto:uz@cc65.org"
154 name="uz@cc65.org">).
160 This software is provided 'as-is', without any expressed or implied
161 warranty. In no event will the authors be held liable for any damages
162 arising from the use of this software.
164 Permission is granted to anyone to use this software for any purpose,
165 including commercial applications, and to alter it and redistribute it
166 freely, subject to the following restrictions:
169 <item> The origin of this software must not be misrepresented; you must not
170 claim that you wrote the original software. If you use this software
171 in a product, an acknowledgment in the product documentation would be
172 appreciated but is not required.
173 <item> Altered source versions must be plainly marked as such, and must not
174 be misrepresented as being the original software.
175 <item> This notice may not be removed or altered from any source