58
static int msm5205next;
60
59
static void toki_adpcm_int (device_t *device)
62
static int toggle = 0;
64
msm5205_data_w (device, msm5205next);
69
cputag_set_input_line(device->machine, "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
61
toki_state *state = device->machine().driver_data<toki_state>();
63
msm5205_data_w (device, state->m_msm5205next);
64
state->m_msm5205next >>= 4;
68
cputag_set_input_line(device->machine(), "audiocpu", INPUT_LINE_NMI, PULSE_LINE);
72
71
static WRITE8_DEVICE_HANDLER( toki_adpcm_control_w )
75
UINT8 *RAM = device->machine->region("audiocpu")->base();
74
UINT8 *RAM = device->machine().region("audiocpu")->base();
78
77
/* the code writes either 2 or 3 in the bottom two bits */
79
78
bankaddress = 0x10000 + (data & 0x01) * 0x4000;
80
memory_set_bankptr(device->machine, "bank1",&RAM[bankaddress]);
79
memory_set_bankptr(device->machine(), "bank1",&RAM[bankaddress]);
82
81
msm5205_reset_w(device,data & 0x08);
85
84
static WRITE8_HANDLER( toki_adpcm_data_w )
86
toki_state *state = space->machine().driver_data<toki_state>();
87
state->m_msm5205next = data;
91
91
/*****************************************************************************/
93
static ADDRESS_MAP_START( toki_map, ADDRESS_SPACE_PROGRAM, 16 )
93
static ADDRESS_MAP_START( toki_map, AS_PROGRAM, 16 )
94
94
AM_RANGE(0x000000, 0x05ffff) AM_ROM
95
95
AM_RANGE(0x060000, 0x06d7ff) AM_RAM
96
96
AM_RANGE(0x06d800, 0x06dfff) AM_RAM AM_BASE_SIZE_GENERIC(spriteram)
97
97
AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
98
AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE(&toki_background1_videoram16)
99
AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE(&toki_background2_videoram16)
100
AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE_MEMBER(toki_state, videoram)
98
AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE_MEMBER(toki_state, m_background1_videoram16)
99
AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE_MEMBER(toki_state, m_background2_videoram16)
100
AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE_MEMBER(toki_state, m_videoram)
101
101
AM_RANGE(0x080000, 0x08000d) AM_READWRITE(seibu_main_word_r, seibu_main_word_w)
102
AM_RANGE(0x0a0000, 0x0a005f) AM_WRITE(toki_control_w) AM_BASE(&toki_scrollram16)
102
AM_RANGE(0x0a0000, 0x0a005f) AM_WRITE(toki_control_w) AM_BASE_MEMBER(toki_state, m_scrollram16)
103
103
AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW")
104
104
AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS")
105
105
AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM")
108
108
/* In the bootleg, sound and sprites are remapped to 0x70000 */
109
static ADDRESS_MAP_START( tokib_map, ADDRESS_SPACE_PROGRAM, 16 )
109
static ADDRESS_MAP_START( tokib_map, AS_PROGRAM, 16 )
110
110
AM_RANGE(0x000000, 0x05ffff) AM_ROM
111
111
AM_RANGE(0x060000, 0x06dfff) AM_RAM
112
112
AM_RANGE(0x06e000, 0x06e7ff) AM_RAM_WRITE(paletteram16_xxxxBBBBGGGGRRRR_word_w) AM_BASE_GENERIC(paletteram)
113
AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE(&toki_background1_videoram16)
114
AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE(&toki_background2_videoram16)
115
AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE_MEMBER(toki_state, videoram)
113
AM_RANGE(0x06e800, 0x06efff) AM_RAM_WRITE(toki_background1_videoram16_w) AM_BASE_MEMBER(toki_state, m_background1_videoram16)
114
AM_RANGE(0x06f000, 0x06f7ff) AM_RAM_WRITE(toki_background2_videoram16_w) AM_BASE_MEMBER(toki_state, m_background2_videoram16)
115
AM_RANGE(0x06f800, 0x06ffff) AM_RAM_WRITE(toki_foreground_videoram16_w) AM_BASE_MEMBER(toki_state, m_videoram)
116
116
AM_RANGE(0x071000, 0x071001) AM_WRITENOP /* sprite related? seems another scroll register */
117
117
/* gets written the same value as 75000a (bg2 scrollx) */
118
118
AM_RANGE(0x071804, 0x071807) AM_WRITENOP /* sprite related, always 01be0100 */
119
119
AM_RANGE(0x07180e, 0x071e45) AM_WRITEONLY AM_BASE_SIZE_GENERIC(spriteram)
120
120
AM_RANGE(0x072000, 0x072001) AM_READ(watchdog_reset16_r) /* probably */
121
121
AM_RANGE(0x075000, 0x075001) AM_WRITE(tokib_soundcommand16_w)
122
AM_RANGE(0x075004, 0x07500b) AM_WRITEONLY AM_BASE(&toki_scrollram16)
122
AM_RANGE(0x075004, 0x07500b) AM_WRITEONLY AM_BASE_MEMBER(toki_state, m_scrollram16)
123
123
AM_RANGE(0x0c0000, 0x0c0001) AM_READ_PORT("DSW")
124
124
AM_RANGE(0x0c0002, 0x0c0003) AM_READ_PORT("INPUTS")
125
125
AM_RANGE(0x0c0004, 0x0c0005) AM_READ_PORT("SYSTEM")