v6502
The MOS 6502 Virtual Machine and Toolchain Infrastructure
object.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_object_h
27 #define ld6502_object_h
28 
29 #include <stdio.h>
30 #include <stdint.h>
31 
32 #include <as6502/symbols.h>
33 
36 typedef struct {
38  uint16_t start;
40  uint16_t len;
42  uint8_t *data;
44 
47 typedef struct {
53  int count;
55 
58 typedef enum {
59  ld6502_file_type_None = 0,
60  ld6502_file_type_iNES,
61  ld6502_file_type_FlatFile
63 
71 void ld6502_loadObjectFromFile(ld6502_object *object, const char *fileName, ld6502_file_type type);
77 void ld6502_addBlobToObject(ld6502_object *obj, uint16_t start);
79 void ld6502_appendByteToBlob(ld6502_object_blob *blob, uint8_t byte);
82 #endif
ld6502_object_blob * blobs
An array of ld6502_object_blob&#39;s.
Definition: object.h:51
ld6502_file_type
asdf
Definition: object.h:58
void ld6502_appendByteToBlob(ld6502_object_blob *blob, uint8_t byte)
Appends a single byte to an ld6502_object_blob.
Definition: object.c:110
void ld6502_loadObjectFromFile(ld6502_object *object, const char *fileName, ld6502_file_type type)
Creates an ld6502_object with the contents of an object file.
Definition: object.c:57
ld6502_object * ld6502_createObject(void)
Creates a new ld6502_object.
Definition: object.c:35
The assembler&#39;s representation of an object file in memory.
Definition: object.h:47
uint16_t len
The length of the data.
Definition: object.h:40
int count
The number of ld6502_object_blob&#39;s.
Definition: object.h:53
uint16_t start
The start address of the data.
Definition: object.h:38
as6502_symbol_table * table
The as6502_symbol_table that contains all symbols that correspond to each of the attached blobs...
Definition: object.h:49
Symbol table management.
void ld6502_addBlobToObject(ld6502_object *obj, uint16_t start)
Creates an empty ld6502_object_blob and adds it to an ld6502_object.
Definition: object.c:95
The assembler&#39;s per-object symbol table structure, which holds all symbols.
Definition: symbols.h:71
A single blob of typeless object data.
Definition: object.h:36
void ld6502_destroyObject(ld6502_object *obj)
Destroys an ld6502_object.
Definition: object.c:45
uint8_t * data
The data.
Definition: object.h:42