annotate sms.h @ 2232:0c42982dd4d8

Make sure 68K interrupt is executed immediately when resuming core if it has a target cycle <= current. Fixes IRQ tests in mcd-verificator
author Michael Pavone <pavone@retrodev.com>
date Thu, 08 Sep 2022 20:50:18 -0700
parents 40290a923886
children 8cf7cadc17ee
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef SMS_H_
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define SMS_H_
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
3
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
4 #include "system.h"
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
5 #include "vdp.h"
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
6 #include "psg.h"
1752
d6d4c006a7b3 Initial attempt at interrupts in new Z80 core and integrating it into main executable
Michael Pavone <pavone@retrodev.com>
parents: 1595
diff changeset
7 #ifdef NEW_CORE
d6d4c006a7b3 Initial attempt at interrupts in new Z80 core and integrating it into main executable
Michael Pavone <pavone@retrodev.com>
parents: 1595
diff changeset
8 #include "z80.h"
d6d4c006a7b3 Initial attempt at interrupts in new Z80 core and integrating it into main executable
Michael Pavone <pavone@retrodev.com>
parents: 1595
diff changeset
9 #else
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
10 #include "z80_to_x86.h"
1752
d6d4c006a7b3 Initial attempt at interrupts in new Z80 core and integrating it into main executable
Michael Pavone <pavone@retrodev.com>
parents: 1595
diff changeset
11 #endif
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
12 #include "io.h"
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
13
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
14 #define SMS_RAM_SIZE (8*1024)
1149
6b0da6021544 Don't lock up CPU if performing a read with writes configured when in PBC mode. Allow access to VDP debug commands from Z80 debugger in PBC mode. Handle Mode 4 in VDP debug print functions
Michael Pavone <pavone@retrodev.com>
parents: 1141
diff changeset
15 #define SMS_CART_RAM_SIZE (32*1024)
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
16
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
17 typedef struct {
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
18 system_header header;
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
19 z80_context *z80;
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
20 vdp_context *vdp;
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
21 psg_context *psg;
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
22 sega_io io;
1141
7e199bebde2f Initial support for Sega's family of SMS mappers
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
23 uint8_t *rom;
7e199bebde2f Initial support for Sega's family of SMS mappers
Michael Pavone <pavone@retrodev.com>
parents: 1117
diff changeset
24 uint32_t rom_size;
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
25 uint32_t master_clock;
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
26 uint32_t normal_clock;
2179
9a8dd4ba2753 Implement frame advance debugger command
Michael Pavone <pavone@retrodev.com>
parents: 1752
diff changeset
27 uint32_t last_frame;
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
28 uint8_t should_return;
2195
40290a923886 Implement Game Gear start button and region register
Michael Pavone <pavone@retrodev.com>
parents: 2179
diff changeset
29 uint8_t start_button_region;
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
30 uint8_t ram[SMS_RAM_SIZE];
1149
6b0da6021544 Don't lock up CPU if performing a read with writes configured when in PBC mode. Allow access to VDP debug commands from Z80 debugger in PBC mode. Handle Mode 4 in VDP debug print functions
Michael Pavone <pavone@retrodev.com>
parents: 1141
diff changeset
31 uint8_t bank_regs[4];
6b0da6021544 Don't lock up CPU if performing a read with writes configured when in PBC mode. Allow access to VDP debug commands from Z80 debugger in PBC mode. Handle Mode 4 in VDP debug print functions
Michael Pavone <pavone@retrodev.com>
parents: 1141
diff changeset
32 uint8_t cart_ram[SMS_CART_RAM_SIZE];
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
33 } sms_context;
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
34
1595
360d5bab199f Update controller config when changed in UI without restart
Michael Pavone <pavone@retrodev.com>
parents: 1201
diff changeset
35 sms_context *alloc_configure_sms(system_media *media, uint32_t opts, uint8_t force_region);
1117
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
36
928a65750345 Initial support for Genesis/Megadrive PBC mode. VDP still needs Mode 4 to be useful.
Michael Pavone <pavone@retrodev.com>
parents:
diff changeset
37 #endif //SMS_H_