v6502
The MOS 6502 Virtual Machine and Toolchain Infrastructure
ines.h
Go to the documentation of this file.
1 
4 /*
5  * Copyright (c) 2013 Daniel Loffgren
6  *
7  * Permission is hereby granted, free of charge, to any person obtaining a copy
8  * of this software and associated documentation files (the "Software"), to
9  * deal in the Software without restriction, including without limitation the
10  * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
11  * sell copies of the Software, and to permit persons to whom the Software is
12  * furnished to do so, subject to the following conditions:
13  *
14  * The above copyright notice and this permission notice shall be included in
15  * all copies or substantial portions of the Software.
16  *
17  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
23  * IN THE SOFTWARE.
24  */
25 
26 #ifndef ld6502_ines_h
27 #define ld6502_ines_h
28 
29 #include <ld6502/object.h>
30 
32 typedef enum {
33  ines_videoMode_NTSC,
34  ines_videoMode_PAL
36 
38 typedef struct {
42 
44 int fileIsINES(FILE *infile);
45 
47 void writeToINES(FILE *outfile, ld6502_object_blob *prg_rom, ld6502_object_blob *chr_rom, ines_properties *props);
48 
50 void readFromINES(FILE *infile, ld6502_object_blob *prg_rom, ld6502_object_blob *chr_rom, ines_properties *props);
51 
53 void ld6502_writeObjectToINES(ld6502_object *obj, FILE *file);
55 void ld6502_readObjectFromINES(ld6502_object *obj, FILE *file);
56 
57 #endif
void ld6502_writeObjectToINES(ld6502_object *obj, FILE *file)
Writes an ld6502_object directly to an iNES file.
Definition: ines.c:115
The assembler&#39;s representation of an object file in memory.
Definition: object.h:47
ines_videoMode
An enum to denote possible NES video modes.
Definition: ines.h:32
int fileIsINES(FILE *infile)
Tests the first four bytes of a file to see if it is has iNES magic. This function will not rewind...
Definition: ines.c:50
void writeToINES(FILE *outfile, ld6502_object_blob *prg_rom, ld6502_object_blob *chr_rom, ines_properties *props)
Take fully linked single flat ld6502_object_blob of program code, a ld6502_object_blob of the CHR ROM...
Definition: ines.c:66
All of the properties that get compiled into the four flag bytes in an iNES header.
Definition: ines.h:38
Binary object management.
A single blob of typeless object data.
Definition: object.h:36
void ld6502_readObjectFromINES(ld6502_object *obj, FILE *file)
Read an ld6502_object from an iNES file. This expects an already allocated ld6502_object.
Definition: ines.c:132
ines_videoMode videoMode
NTSC/PAL.
Definition: ines.h:40
void readFromINES(FILE *infile, ld6502_object_blob *prg_rom, ld6502_object_blob *chr_rom, ines_properties *props)
Load an iNES ROM in, populate an ines_properties struct using the header data, and split the ROM into...
Definition: ines.c:91