annotate blastem.h @ 418:dbf4e1c86f3c

Implement basic joystick support
author Mike Pavone <pavone@retrodev.com>
date Sun, 23 Jun 2013 22:27:12 -0700
parents c26e48a93fa3
children d0cacb4ade0b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
66
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
1 #ifndef BLASTEM_H_
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
2 #define BLASTEM_H_
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
3
75
108e587165c0 Implement DMA (untested)
Mike Pavone <pavone@retrodev.com>
parents: 66
diff changeset
4 #include <stdint.h>
198
209a37eed3e7 Add support for breaking into the debugger while game is running
Mike Pavone <pavone@retrodev.com>
parents: 75
diff changeset
5 #include "m68k_to_x86.h"
288
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
6 #include "z80_to_x86.h"
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
7 #include "ym2612.h"
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
8 #include "vdp.h"
354
15dd6418fe67 Initial PSG support. Mostly works, noise channel is borked though.
Mike Pavone <pavone@retrodev.com>
parents: 351
diff changeset
9 #include "psg.h"
75
108e587165c0 Implement DMA (untested)
Mike Pavone <pavone@retrodev.com>
parents: 66
diff changeset
10
66
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
11 typedef struct {
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
12 uint32_t th_counter;
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
13 uint32_t timeout_cycle;
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
14 uint8_t output;
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
15 uint8_t control;
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
16 uint8_t input[3];
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
17 } io_port;
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
18
351
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 288
diff changeset
19 #define RAM_FLAG_ODD 0x1800
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 288
diff changeset
20 #define RAM_FLAG_EVEN 0x1000
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 288
diff changeset
21 #define RAM_FLAG_BOTH 0x0000
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 288
diff changeset
22
288
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
23 typedef struct {
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
24 m68k_context *m68k;
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
25 z80_context *z80;
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
26 vdp_context *vdp;
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
27 ym2612_context *ym;
354
15dd6418fe67 Initial PSG support. Mostly works, noise channel is borked though.
Mike Pavone <pavone@retrodev.com>
parents: 351
diff changeset
28 psg_context *psg;
351
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 288
diff changeset
29 uint8_t *save_ram;
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 288
diff changeset
30 uint32_t save_ram_mask;
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 288
diff changeset
31 uint32_t save_flags;
2f264d2a60c2 Support for SRAM with SEGA mapper. Half-finished support for SRAM without SEGA mapper.
Mike Pavone <pavone@retrodev.com>
parents: 288
diff changeset
32 uint8_t bank_regs[8];
288
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
33 } genesis_context;
a8ee7934a1f8 Add a YM2612 stub implementation with just timers and status registers so that games that depend on it can run.
Mike Pavone <pavone@retrodev.com>
parents: 198
diff changeset
34
66
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
35 #define GAMEPAD_TH0 0
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
36 #define GAMEPAD_TH1 1
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
37 #define GAMEPAD_EXTRA 2
398
c26e48a93fa3 Make keybindings data driven so they can be populated from a config file later
Mike Pavone <pavone@retrodev.com>
parents: 354
diff changeset
38 #define GAMEPAD_NONE 0xF
66
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
39
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
40 extern io_port gamepad_1;
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
41 extern io_port gamepad_2;
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
42
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
43 void io_adjust_cycles(io_port * pad, uint32_t current_cycle, uint32_t deduction);
75
108e587165c0 Implement DMA (untested)
Mike Pavone <pavone@retrodev.com>
parents: 66
diff changeset
44 uint16_t read_dma_value(uint32_t address);
198
209a37eed3e7 Add support for breaking into the debugger while game is running
Mike Pavone <pavone@retrodev.com>
parents: 75
diff changeset
45 m68k_context * debugger(m68k_context * context, uint32_t address);
398
c26e48a93fa3 Make keybindings data driven so they can be populated from a config file later
Mike Pavone <pavone@retrodev.com>
parents: 354
diff changeset
46 void handle_keydown(int keycode);
c26e48a93fa3 Make keybindings data driven so they can be populated from a config file later
Mike Pavone <pavone@retrodev.com>
parents: 354
diff changeset
47 void handle_keyup(int keycode);
418
dbf4e1c86f3c Implement basic joystick support
Mike Pavone <pavone@retrodev.com>
parents: 398
diff changeset
48 void handle_joydown(int joystick, int button);
dbf4e1c86f3c Implement basic joystick support
Mike Pavone <pavone@retrodev.com>
parents: 398
diff changeset
49 void handle_joyup(int joystick, int button);
dbf4e1c86f3c Implement basic joystick support
Mike Pavone <pavone@retrodev.com>
parents: 398
diff changeset
50 void handle_joy_dpad(int joystick, int dpad, uint8_t state);
66
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
51
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
52 #endif //BLASTEM_H_
7a22a0e6c004 Gamepad support
Mike Pavone <pavone@retrodev.com>
parents:
diff changeset
53