Mercurial > repos > blastem
annotate sega_mapper.c @ 2313:ef5dc4d02d27
Fix goof in right analog stick mapping UI
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Thu, 30 Mar 2023 20:20:25 -0700 |
parents | b6fdedd3b070 |
children | b9cd3c64652d |
rev | line source |
---|---|
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
1 #include "genesis.h" |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
2 #include "util.h" |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
3 |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
4 uint16_t read_sram_w(uint32_t address, m68k_context * context) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
5 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
6 genesis_context * gen = context->system; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
7 address &= gen->save_ram_mask; |
2234
b6fdedd3b070
Fix SRAM endianness for word-wide SRAM combined with Sega mapper
Michael Pavone <pavone@retrodev.com>
parents:
2052
diff
changeset
|
8 uint16_t *word_storage = (uint16_t *)gen->save_storage; |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
9 switch(gen->save_type) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
10 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
11 case RAM_FLAG_BOTH: |
2234
b6fdedd3b070
Fix SRAM endianness for word-wide SRAM combined with Sega mapper
Michael Pavone <pavone@retrodev.com>
parents:
2052
diff
changeset
|
12 return word_storage[address >> 1]; |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
13 case RAM_FLAG_EVEN: |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
14 return gen->save_storage[address >> 1] << 8 | 0xFF; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
15 case RAM_FLAG_ODD: |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
16 return gen->save_storage[address >> 1] | 0xFF00; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
17 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
18 return 0xFFFF;//We should never get here |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
19 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
20 |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
21 uint8_t read_sram_b(uint32_t address, m68k_context * context) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
22 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
23 genesis_context * gen = context->system; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
24 address &= gen->save_ram_mask; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
25 switch(gen->save_type) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
26 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
27 case RAM_FLAG_BOTH: |
2234
b6fdedd3b070
Fix SRAM endianness for word-wide SRAM combined with Sega mapper
Michael Pavone <pavone@retrodev.com>
parents:
2052
diff
changeset
|
28 return gen->save_storage[address ^ 1]; |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
29 case RAM_FLAG_EVEN: |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
30 if (address & 1) { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
31 return 0xFF; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
32 } else { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
33 return gen->save_storage[address >> 1]; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
34 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
35 case RAM_FLAG_ODD: |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
36 if (address & 1) { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
37 return gen->save_storage[address >> 1]; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
38 } else { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
39 return 0xFF; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
40 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
41 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
42 return 0xFF;//We should never get here |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
43 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
44 |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
45 m68k_context * write_sram_area_w(uint32_t address, m68k_context * context, uint16_t value) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
46 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
47 genesis_context * gen = context->system; |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
48 if (gen->mapper_type == MAPPER_SEGA_MED_V2) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
49 if (gen->bank_regs[8] & 0x20) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
50 uint32_t bank = address >> 19; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
51 address &= 0x7FFFF; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
52 context->mem_pointers[gen->mapper_start_index + bank][address >> 1] = value; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
53 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
54 return context; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
55 } |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
56 if ((gen->bank_regs[0] & 0x3) == 1) { |
2234
b6fdedd3b070
Fix SRAM endianness for word-wide SRAM combined with Sega mapper
Michael Pavone <pavone@retrodev.com>
parents:
2052
diff
changeset
|
57 uint16_t *word_storage = (uint16_t *)gen->save_storage; |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
58 address &= gen->save_ram_mask; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
59 switch(gen->save_type) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
60 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
61 case RAM_FLAG_BOTH: |
2234
b6fdedd3b070
Fix SRAM endianness for word-wide SRAM combined with Sega mapper
Michael Pavone <pavone@retrodev.com>
parents:
2052
diff
changeset
|
62 word_storage[address >> 1] = value; |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
63 break; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
64 case RAM_FLAG_EVEN: |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
65 gen->save_storage[address >> 1] = value >> 8; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
66 break; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
67 case RAM_FLAG_ODD: |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
68 gen->save_storage[address >> 1] = value; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
69 break; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
70 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
71 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
72 return context; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
73 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
74 |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
75 m68k_context * write_sram_area_b(uint32_t address, m68k_context * context, uint8_t value) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
76 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
77 genesis_context * gen = context->system; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
78 if ((gen->bank_regs[0] & 0x3) == 1) { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
79 address &= gen->save_ram_mask; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
80 switch(gen->save_type) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
81 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
82 case RAM_FLAG_BOTH: |
2234
b6fdedd3b070
Fix SRAM endianness for word-wide SRAM combined with Sega mapper
Michael Pavone <pavone@retrodev.com>
parents:
2052
diff
changeset
|
83 gen->save_storage[address ^ 1] = value; |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
84 break; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
85 case RAM_FLAG_EVEN: |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
86 if (!(address & 1)) { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
87 gen->save_storage[address >> 1] = value; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
88 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
89 break; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
90 case RAM_FLAG_ODD: |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
91 if (address & 1) { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
92 gen->save_storage[address >> 1] = value; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
93 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
94 break; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
95 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
96 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
97 return context; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
98 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
99 |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
100 static void* write_med_ram_w(uint32_t address, void *vcontext, uint16_t value, uint16_t bank) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
101 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
102 m68k_context *context = vcontext; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
103 genesis_context * gen = context->system; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
104 if (gen->bank_regs[8] & 0x20) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
105 context->mem_pointers[gen->mapper_start_index + bank][address >> 1] = value; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
106 address += bank * 0x80000; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
107 m68k_invalidate_code_range(gen->m68k, address, address + 2); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
108 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
109 return vcontext; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
110 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
111 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
112 void* write_med_ram0_w(uint32_t address, void *vcontext, uint16_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
113 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
114 return write_med_ram_w(address, vcontext, value, 0); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
115 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
116 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
117 void* write_med_ram1_w(uint32_t address, void *vcontext, uint16_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
118 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
119 return write_med_ram_w(address, vcontext, value, 1); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
120 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
121 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
122 void* write_med_ram2_w(uint32_t address, void *vcontext, uint16_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
123 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
124 return write_med_ram_w(address, vcontext, value, 2); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
125 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
126 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
127 void* write_med_ram3_w(uint32_t address, void *vcontext, uint16_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
128 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
129 return write_med_ram_w(address, vcontext, value, 3); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
130 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
131 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
132 void* write_med_ram4_w(uint32_t address, void *vcontext, uint16_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
133 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
134 return write_med_ram_w(address, vcontext, value, 4); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
135 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
136 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
137 void* write_med_ram5_w(uint32_t address, void *vcontext, uint16_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
138 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
139 return write_med_ram_w(address, vcontext, value, 5); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
140 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
141 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
142 void* write_med_ram6_w(uint32_t address, void *vcontext, uint16_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
143 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
144 return write_med_ram_w(address, vcontext, value, 6); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
145 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
146 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
147 void* write_med_ram7_w(uint32_t address, void *vcontext, uint16_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
148 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
149 return write_med_ram_w(address, vcontext, value, 7); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
150 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
151 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
152 static void* write_med_ram_b(uint32_t address, void *vcontext, uint8_t value, uint16_t bank) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
153 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
154 m68k_context *context = vcontext; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
155 genesis_context * gen = context->system; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
156 if (gen->bank_regs[8] & 0x20) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
157 ((uint8_t*)context->mem_pointers[gen->mapper_start_index + bank])[address ^ 1] = value; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
158 address += bank * 0x80000; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
159 m68k_invalidate_code_range(gen->m68k, address, address + 1); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
160 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
161 return vcontext; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
162 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
163 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
164 void* write_med_ram0_b(uint32_t address, void *vcontext, uint8_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
165 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
166 return write_med_ram_b(address, vcontext, value, 0); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
167 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
168 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
169 void* write_med_ram1_b(uint32_t address, void *vcontext, uint8_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
170 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
171 return write_med_ram_b(address, vcontext, value, 1); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
172 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
173 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
174 void* write_med_ram2_b(uint32_t address, void *vcontext, uint8_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
175 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
176 return write_med_ram_b(address, vcontext, value, 2); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
177 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
178 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
179 void* write_med_ram3_b(uint32_t address, void *vcontext, uint8_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
180 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
181 return write_med_ram_b(address, vcontext, value, 3); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
182 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
183 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
184 void* write_med_ram4_b(uint32_t address, void *vcontext, uint8_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
185 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
186 return write_med_ram_b(address, vcontext, value, 4); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
187 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
188 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
189 void* write_med_ram5_b(uint32_t address, void *vcontext, uint8_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
190 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
191 return write_med_ram_b(address, vcontext, value, 5); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
192 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
193 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
194 void* write_med_ram6_b(uint32_t address, void *vcontext, uint8_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
195 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
196 return write_med_ram_b(address, vcontext, value, 6); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
197 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
198 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
199 void* write_med_ram7_b(uint32_t address, void *vcontext, uint8_t value) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
200 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
201 return write_med_ram_b(address, vcontext, value, 7); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
202 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
203 |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
204 m68k_context * write_bank_reg_w(uint32_t address, m68k_context * context, uint16_t value) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
205 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
206 genesis_context * gen = context->system; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
207 address &= 0xE; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
208 address >>= 1; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
209 if (!address) { |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
210 if (gen->mapper_type == MAPPER_SEGA_MED_V2) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
211 if (!value & 0x8000) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
212 //writes without protection bit set are ignored |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
213 return context; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
214 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
215 gen->bank_regs[8] = value >> 8; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
216 void *new_ptr = gen->cart + 0x40000*(value & 0x1F); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
217 if (context->mem_pointers[gen->mapper_start_index] != new_ptr) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
218 m68k_invalidate_code_range(gen->m68k, 0, 0x80000); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
219 context->mem_pointers[gen->mapper_start_index] = new_ptr; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
220 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
221 } else if (value & 1) { |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
222 //Used for games that only use the mapper for SRAM |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
223 if (context->mem_pointers[gen->mapper_start_index]) { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
224 gen->mapper_temp = context->mem_pointers[gen->mapper_start_index]; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
225 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
226 context->mem_pointers[gen->mapper_start_index] = NULL; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
227 //For games that need more than 4MB |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
228 for (int i = 4; i < 8; i++) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
229 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
230 context->mem_pointers[gen->mapper_start_index + i] = NULL; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
231 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
232 } else { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
233 //Used for games that only use the mapper for SRAM |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
234 if (!context->mem_pointers[gen->mapper_start_index]) { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
235 context->mem_pointers[gen->mapper_start_index] = gen->mapper_temp; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
236 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
237 //For games that need more than 4MB |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
238 for (int i = 4; i < 8; i++) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
239 { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
240 context->mem_pointers[gen->mapper_start_index + i] = gen->cart + 0x40000*gen->bank_regs[i]; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
241 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
242 } |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
243 } else if (gen->mapper_type != MAPPER_SEGA_SRAM) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
244 uint32_t mask = ((gen->mapper_type == MAPPER_SEGA_MED_V2 ? (16 *1024 * 1024) : nearest_pow2(gen->header.info.rom_size)) >> 1) - 1; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
245 void *new_ptr = gen->cart + ((0x40000*value) & mask); |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
246 if (context->mem_pointers[gen->mapper_start_index + address] != new_ptr) { |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
247 m68k_invalidate_code_range(gen->m68k, address * 0x80000, (address + 1) * 0x80000); |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
248 context->mem_pointers[gen->mapper_start_index + address] = new_ptr; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
249 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
250 } |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
251 gen->bank_regs[address] = value; |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
252 return context; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
253 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
254 |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
255 m68k_context * write_bank_reg_b(uint32_t address, m68k_context * context, uint8_t value) |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
256 { |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
257 genesis_context * gen = context->system; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
258 if (gen->mapper_type == MAPPER_SEGA_MED_V2) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
259 address &= 0xF; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
260 if (!address) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
261 //not sure if this is correct, possible byte sized writes are always rejected to $A130F0 |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
262 write_bank_reg_w(address, context, value << 8 | value); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
263 } else if (address > 2 && (address & 1)) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
264 write_bank_reg_w(address, context, value); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
265 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
266 } else if (address & 1) { |
1415
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
267 write_bank_reg_w(address, context, value); |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
268 } |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
269 return context; |
f7d653bb8899
Move Sega mapper implementation out of romdb.c
Michael Pavone <pavone@retrodev.com>
parents:
diff
changeset
|
270 } |
1444
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
271 |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
272 void sega_mapper_serialize(genesis_context *gen, serialize_buffer *buf) |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
273 { |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
274 save_buffer8(buf, gen->bank_regs, gen->mapper_type == MAPPER_SEGA_MED_V2 ? sizeof(gen->bank_regs) : sizeof(gen->bank_regs) - 1); |
1444
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
275 } |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
276 |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
277 void sega_mapper_deserialize(deserialize_buffer *buf, genesis_context *gen) |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
278 { |
2052
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
279 if (gen->mapper_type == MAPPER_SEGA_MED_V2) { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
280 uint16_t reg0 = load_int8(buf); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
281 for (int i = 1; i < sizeof(gen->bank_regs) - 1; i++) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
282 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
283 write_bank_reg_w(i * 2, gen->m68k, load_int8(buf)); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
284 } |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
285 reg0 |= load_int8(buf) << 8; |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
286 write_bank_reg_w(0, gen->m68k, reg0); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
287 } else { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
288 for (int i = 0; i < sizeof(gen->bank_regs) - 1; i++) |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
289 { |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
290 write_bank_reg_w(i * 2, gen->m68k, load_int8(buf)); |
3748a2a8a4b7
Support Sega mapper without 'SEGA SSF' in header or ROM DB entry and implement a subset of the extended Sega mapper implemented in the Mega Everdrive when 'SEGA SSF' is present
Michael Pavone <pavone@retrodev.com>
parents:
1863
diff
changeset
|
291 } |
1444
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
292 } |
14a2834d010c
Save/restore mapper state in native save states
Michael Pavone <pavone@retrodev.com>
parents:
1415
diff
changeset
|
293 } |