trunk/src/emu/machine/tmp68301.c
| r26423 | r26424 | |
| 15 | 15 | |
| 16 | 16 | static ADDRESS_MAP_START( tmp68301_regs, AS_0, 16, tmp68301_device ) |
| 17 | 17 | // AM_RANGE(0x000,0x3ff) AM_RAM |
| 18 | AM_RANGE(0x094,0x095) AM_READWRITE(imr_r,imr_w) |
| 19 | AM_RANGE(0x098,0x099) AM_READWRITE(iisr_r,iisr_w) |
| 18 | 20 | |
| 21 | /* Serial */ |
| 22 | AM_RANGE(0x18e,0x18f) AM_READWRITE(scr_r,scr_w) |
| 19 | 23 | ADDRESS_MAP_END |
| 20 | 24 | |
| 25 | // IRQ Mask register, 0x94 |
| 26 | READ16_MEMBER(tmp68301_device::imr_r) |
| 27 | { |
| 28 | return m_imr; |
| 29 | } |
| 30 | |
| 31 | WRITE16_MEMBER(tmp68301_device::imr_w) |
| 32 | { |
| 33 | COMBINE_DATA(&m_imr); |
| 34 | } |
| 35 | |
| 36 | // IRQ In-Service Register |
| 37 | READ16_MEMBER(tmp68301_device::iisr_r) |
| 38 | { |
| 39 | return m_iisr; |
| 40 | } |
| 41 | |
| 42 | WRITE16_MEMBER(tmp68301_device::iisr_w) |
| 43 | { |
| 44 | COMBINE_DATA(&m_iisr); |
| 45 | } |
| 46 | |
| 47 | // Serial Control Register (TODO: 8-bit wide) |
| 48 | READ16_MEMBER(tmp68301_device::scr_r) |
| 49 | { |
| 50 | return m_scr; |
| 51 | } |
| 52 | |
| 53 | WRITE16_MEMBER(tmp68301_device::scr_w) |
| 54 | { |
| 55 | /* |
| 56 | *--- ---- CKSE |
| 57 | --*- ---- RES |
| 58 | ---- ---* INTM |
| 59 | */ |
| 60 | |
| 61 | COMBINE_DATA(&m_scr); |
| 62 | m_scr &= 0xa1; |
| 63 | } |
| 64 | |
| 65 | |
| 21 | 66 | tmp68301_device::tmp68301_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 22 | 67 | : device_t(mconfig, TMP68301, "TMP68301", tag, owner, clock, "tmp68301", __FILE__), |
| 23 | 68 | device_memory_interface(mconfig, *this), |
| r26423 | r26424 | |
| 58 | 103 | m_IE[i] = 0; |
| 59 | 104 | |
| 60 | 105 | machine().firstcpu->set_irq_acknowledge_callback(device_irq_acknowledge_delegate(FUNC(tmp68301_device::irq_callback),this)); |
| 106 | |
| 107 | m_imr = 0x7f7; // mask all irqs |
| 61 | 108 | } |
| 62 | 109 | |
| 63 | 110 | //------------------------------------------------- |
| r26423 | r26424 | |
| 103 | 150 | { |
| 104 | 151 | int i = param; |
| 105 | 152 | UINT16 TCR = m_regs[(0x200 + i * 0x20)/2]; |
| 106 | | UINT16 IMR = m_regs[0x94/2]; // Interrupt Mask Register (IMR) |
| 107 | 153 | UINT16 ICR = m_regs[0x8e/2+i]; // Interrupt Controller Register (ICR7..9) |
| 108 | 154 | UINT16 IVNR = m_regs[0x9a/2]; // Interrupt Vector Number Register (IVNR) |
| 109 | 155 | |
| 110 | 156 | // logerror("s: callback timer %04X, j = %d\n",machine.describe_context(),i,tcount); |
| 111 | 157 | |
| 112 | 158 | if ( (TCR & 0x0004) && // INT |
| 113 | | !(IMR & (0x100<<i)) |
| 159 | !(m_imr & (0x100<<i)) |
| 114 | 160 | ) |
| 115 | 161 | { |
| 116 | 162 | int level = ICR & 0x0007; |
| r26423 | r26424 | |
| 185 | 231 | |
| 186 | 232 | /* Take care of external interrupts */ |
| 187 | 233 | |
| 188 | | UINT16 IMR = m_regs[0x94/2]; // Interrupt Mask Register (IMR) |
| 189 | 234 | UINT16 IVNR = m_regs[0x9a/2]; // Interrupt Vector Number Register (IVNR) |
| 190 | 235 | |
| 191 | 236 | for (i = 0; i < 3; i++) |
| 192 | 237 | { |
| 193 | 238 | if ( (m_IE[i]) && |
| 194 | | !(IMR & (1<<i)) |
| 239 | !(m_imr & (1<<i)) |
| 195 | 240 | ) |
| 196 | 241 | { |
| 197 | 242 | UINT16 ICR = m_regs[0x80/2+i]; // Interrupt Controller Register (ICR0..2) |
| r26423 | r26424 | |
| 212 | 257 | |
| 213 | 258 | READ16_MEMBER( tmp68301_device::regs_r ) |
| 214 | 259 | { |
| 215 | | return m_regs[offset]; |
| 260 | return read_word(offset); |
| 216 | 261 | } |
| 217 | 262 | |
| 218 | 263 | WRITE16_MEMBER( tmp68301_device::regs_w ) |
trunk/src/emu/machine/tmp68301.h
| r26423 | r26424 | |
| 17 | 17 | void external_interrupt_1(); |
| 18 | 18 | void external_interrupt_2(); |
| 19 | 19 | |
| 20 | DECLARE_READ16_MEMBER(imr_r); |
| 21 | DECLARE_WRITE16_MEMBER(imr_w); |
| 22 | DECLARE_READ16_MEMBER(iisr_r); |
| 23 | DECLARE_WRITE16_MEMBER(iisr_w); |
| 24 | DECLARE_READ16_MEMBER(scr_r); |
| 25 | DECLARE_WRITE16_MEMBER(scr_w); |
| 26 | |
| 20 | 27 | protected: |
| 21 | 28 | // device-level overrides |
| 22 | 29 | virtual void device_config_complete(); |
| r26423 | r26424 | |
| 38 | 45 | IRQ_CALLBACK_MEMBER(irq_callback); |
| 39 | 46 | void update_irq_state(); |
| 40 | 47 | |
| 48 | UINT16 m_imr; |
| 49 | UINT16 m_iisr; |
| 50 | UINT16 m_scr; |
| 51 | |
| 41 | 52 | inline UINT16 read_word(offs_t address); |
| 42 | 53 | inline void write_word(offs_t address, UINT16 data); |
| 43 | 54 | const address_space_config m_space_config; |
trunk/src/mame/drivers/realbrk.c
| r26423 | r26424 | |
| 167 | 167 | |
| 168 | 168 | /*realbrk specific memory map*/ |
| 169 | 169 | static ADDRESS_MAP_START( realbrk_mem, AS_PROGRAM, 16, realbrk_state ) |
| 170 | | AM_IMPORT_FROM(base_mem) |
| 171 | 170 | AM_RANGE(0x800008, 0x80000b) AM_DEVWRITE8("ymsnd", ym2413_device, write, 0x00ff) // |
| 172 | 171 | AM_RANGE(0xc00000, 0xc00001) AM_READ_PORT("IN0") // P1 & P2 (Inputs) |
| 173 | 172 | AM_RANGE(0xc00002, 0xc00003) AM_READ_PORT("IN1") // Coins |
| 174 | 173 | AM_RANGE(0xc00004, 0xc00005) AM_RAM_READ(realbrk_dsw_r) AM_SHARE("dsw_select") // DSW select |
| 175 | 174 | AM_RANGE(0xff0000, 0xfffbff) AM_RAM // RAM |
| 176 | 175 | AM_RANGE(0xfffd0a, 0xfffd0b) AM_WRITE(realbrk_flipscreen_w ) // Hack! Parallel port data register |
| 176 | AM_IMPORT_FROM(base_mem) |
| 177 | 177 | ADDRESS_MAP_END |
| 178 | 178 | |
| 179 | 179 | /*pkgnsh specific memory map*/ |