annotate x86_backend.h @ 498:51bf87f76d15

Pull shader file names from config file.
author Mike Pavone <pavone@retrodev.com>
date Mon, 28 Oct 2013 23:59:59 -0700
parents 140af5509ce7
children 5af986d2b9da
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
467
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 351
diff changeset
1 /*
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 351
diff changeset
2 Copyright 2013 Michael Pavone
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 351
diff changeset
3 This file is part of BlastEm.
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 351
diff changeset
4 BlastEm is free software distributed under the terms of the GNU General Public License version 3 or greater. See COPYING for full license text.
140af5509ce7 Added copyright notice to source files and added GPL license text in COPYING
Mike Pavone <pavone@retrodev.com>
parents: 351
diff changeset
5 */
211
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
6 #ifndef X86_BACKEND_H_
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
7 #define X86_BACKEND_H_
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
8
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
9 #include <stdint.h>
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
10
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
11 #define INVALID_OFFSET 0xFFFFFFFF
252
63b9a500a00b Implement retranslating code when written to. Possibly broken, need to fix some other bugs before a proper test.
Mike Pavone <pavone@retrodev.com>
parents: 235
diff changeset
12 #define EXTENSION_WORD 0xFFFFFFFE
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
13
211
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 typedef struct {
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 int32_t disp;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 uint8_t mode;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17 uint8_t base;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18 uint8_t index;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
19 uint8_t cycles;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
20 } x86_ea;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
21
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
22 typedef struct {
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
23 uint8_t *base;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
24 int32_t *offsets;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
25 } native_map_slot;
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
26
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
27 typedef struct deferred_addr {
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
28 struct deferred_addr *next;
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
29 uint8_t *dest;
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
30 uint32_t address;
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
31 } deferred_addr;
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
32
343
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
33
351
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 343
diff changeset
34 #define MMAP_READ 0x01
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 343
diff changeset
35 #define MMAP_WRITE 0x02
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 343
diff changeset
36 #define MMAP_CODE 0x04
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 343
diff changeset
37 #define MMAP_PTR_IDX 0x08
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 343
diff changeset
38 #define MMAP_ONLY_ODD 0x10
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 343
diff changeset
39 #define MMAP_ONLY_EVEN 0x20
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 343
diff changeset
40 #define MMAP_FUNC_NULL 0x40
343
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
41
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
42 typedef uint16_t (*read_16_fun)(uint32_t address, void * context);
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
43 typedef uint8_t (*read_8_fun)(uint32_t address, void * context);
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
44 typedef void * (*write_16_fun)(uint32_t address, void * context, uint16_t value);
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
45 typedef void * (*write_8_fun)(uint32_t address, void * context, uint8_t value);
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
46
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
47 typedef struct {
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
48 uint32_t start;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
49 uint32_t end;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
50 uint32_t mask;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
51 uint16_t ptr_index;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
52 uint16_t flags;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
53 void * buffer;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
54 read_16_fun read_16;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
55 write_16_fun write_16;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
56 read_8_fun read_8;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
57 write_8_fun write_8;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
58 } memmap_chunk;
467bfa17004a Mostly working runtime generation of memory map read/write functions
Mike Pavone <pavone@retrodev.com>
parents: 282
diff changeset
59
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
60 typedef uint8_t * (*native_addr_func)(void * context, uint32_t address);
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
61
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
62 deferred_addr * defer_address(deferred_addr * old_head, uint32_t address, uint8_t *dest);
282
7b8a49220e3b Remove deferred address entries from abandoned translations inside z80_retrans_inst
Mike Pavone <pavone@retrodev.com>
parents: 252
diff changeset
63 void remove_deferred_until(deferred_addr **head_ptr, deferred_addr * remove_to);
235
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
64 void process_deferred(deferred_addr ** head_ptr, void * context, native_addr_func get_native);
d9bf8e61c33c Get Z80 core working for simple programs
Mike Pavone <pavone@retrodev.com>
parents: 211
diff changeset
65
211
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
66 #endif //X86_BACKEND_H_
464513050c85 Small bit of cleanup
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
67