trunk/src/emu/bus/a2bus/a2bus.h
| r243306 | r243307 | |
| 106 | 106 | void set_nmi_line(int state, int slot); |
| 107 | 107 | void set_maincpu_halt(int state); |
| 108 | 108 | void recalc_inh(int slot); |
| 109 | UINT8 dma_r(address_space &space, UINT16 offset); |
| 110 | void dma_w(address_space &space, UINT16 offset, UINT8 data); |
| 111 | UINT8 dma_nospace_r(UINT16 offset); |
| 112 | void dma_nospace_w(UINT16 offset, UINT8 data); |
| 109 | 113 | |
| 110 | 114 | DECLARE_WRITE_LINE_MEMBER( irq_w ); |
| 111 | 115 | DECLARE_WRITE_LINE_MEMBER( nmi_w ); |
| r243306 | r243307 | |
| 117 | 121 | |
| 118 | 122 | // internal state |
| 119 | 123 | cpu_device *m_maincpu; |
| 124 | address_space *m_maincpu_space; |
| 120 | 125 | |
| 121 | 126 | devcb_write_line m_out_irq_cb; |
| 122 | 127 | devcb_write_line m_out_nmi_cb; |
| r243306 | r243307 | |
| 144 | 149 | device_a2bus_card_interface(const machine_config &mconfig, device_t &device); |
| 145 | 150 | virtual ~device_a2bus_card_interface(); |
| 146 | 151 | |
| 147 | | virtual UINT8 read_c0nx(address_space &space, UINT8 offset) { printf("a2bus: unhandled read at C0n%x\n", offset); return 0; } // C0nX - /DEVSEL |
| 148 | | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to C0n%x\n", data, offset); } |
| 152 | virtual UINT8 read_c0nx(address_space &space, UINT8 offset) { logerror("a2bus: unhandled read at C0n%x\n", offset); return 0; } // C0nX - /DEVSEL |
| 153 | virtual void write_c0nx(address_space &space, UINT8 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to C0n%x\n", data, offset); } |
| 149 | 154 | virtual UINT8 read_cnxx(address_space &space, UINT8 offset) { return 0; } // CnXX - /IOSEL |
| 150 | | virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) { printf("a2bus: unhandled write %02x to Cn%02x\n", data, offset); } |
| 155 | virtual void write_cnxx(address_space &space, UINT8 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to Cn%02x\n", data, offset); } |
| 151 | 156 | virtual UINT8 read_c800(address_space &space, UINT16 offset) { return 0; } // C800 - /IOSTB |
| 152 | | virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) { printf("a2bus: unhandled write %02x to %04x\n", data, offset + 0xc800); } |
| 157 | virtual void write_c800(address_space &space, UINT16 offset, UINT8 data) { logerror("a2bus: unhandled write %02x to %04x\n", data, offset + 0xc800); } |
| 153 | 158 | virtual bool take_c800() { return true; } // override and return false if your card doesn't take over the c800 space |
| 154 | 159 | virtual UINT8 read_inh_rom(address_space &space, UINT16 offset) { return 0; } |
| 155 | 160 | virtual void write_inh_rom(address_space &space, UINT16 offset, UINT8 data) { } |
| r243306 | r243307 | |
| 171 | 176 | void recalc_slot_inh() { m_a2bus->recalc_inh(m_slot); } |
| 172 | 177 | void set_maincpu_halt(int state) { m_a2bus->set_maincpu_halt(state); } |
| 173 | 178 | |
| 179 | // pass through the original address space if any for debugger protection |
| 180 | // when debugging e.g. coprocessor cards (Z80 SoftCard etc). |
| 181 | UINT8 slot_dma_read(address_space &space, UINT16 offset) { return m_a2bus->dma_r(space, offset); } |
| 182 | void slot_dma_write(address_space &space, UINT16 offset, UINT8 data) { m_a2bus->dma_w(space, offset, data); } |
| 183 | |
| 184 | // these versions forego that protection for when the DMA isn't coming from a debuggable CPU device |
| 185 | UINT8 slot_dma_read_no_space(UINT16 offset) { return m_a2bus->dma_nospace_r(offset); } |
| 186 | void slot_dma_write_no_space(UINT16 offset, UINT8 data) { m_a2bus->dma_nospace_w(offset, data); } |
| 187 | |
| 174 | 188 | // inline configuration |
| 175 | 189 | static void static_set_a2bus_tag(device_t &device, const char *tag, const char *slottag); |
| 176 | 190 | public: |
trunk/src/emu/bus/a2bus/a2softcard.c
| r243306 | r243307 | |
| 52 | 52 | a2bus_softcard_device::a2bus_softcard_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| 53 | 53 | device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 54 | 54 | device_a2bus_card_interface(mconfig, *this), |
| 55 | | m_z80(*this, Z80_TAG), |
| 56 | | m_6502space(NULL) |
| 55 | m_z80(*this, Z80_TAG) |
| 57 | 56 | { |
| 58 | 57 | } |
| 59 | 58 | |
| 60 | 59 | a2bus_softcard_device::a2bus_softcard_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 61 | 60 | device_t(mconfig, A2BUS_SOFTCARD, "Microsoft SoftCard", tag, owner, clock, "a2softcard", __FILE__), |
| 62 | 61 | device_a2bus_card_interface(mconfig, *this), |
| 63 | | m_z80(*this, Z80_TAG), |
| 64 | | m_6502space(NULL) |
| 62 | m_z80(*this, Z80_TAG) |
| 65 | 63 | { |
| 66 | 64 | } |
| 67 | 65 | |
| r243306 | r243307 | |
| 82 | 80 | { |
| 83 | 81 | m_bEnabled = false; |
| 84 | 82 | |
| 85 | | m_6502space = NULL; |
| 86 | 83 | m_FirstZ80Boot = true; |
| 87 | 84 | m_z80->set_input_line(INPUT_LINE_HALT, ASSERT_LINE); |
| 88 | 85 | } |
| r243306 | r243307 | |
| 91 | 88 | { |
| 92 | 89 | if (!m_bEnabled) |
| 93 | 90 | { |
| 94 | | // steal the 6502's address space |
| 95 | | m_6502space = &space; |
| 96 | | |
| 97 | 91 | m_z80->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); |
| 98 | 92 | set_maincpu_halt(ASSERT_LINE); |
| 99 | 93 | |
| r243306 | r243307 | |
| 115 | 109 | |
| 116 | 110 | READ8_MEMBER( a2bus_softcard_device::dma_r ) |
| 117 | 111 | { |
| 118 | | if (m_6502space) |
| 112 | if (m_bEnabled) |
| 119 | 113 | { |
| 120 | 114 | if (offset <= 0xafff) |
| 121 | 115 | { |
| 122 | | return m_6502space->read_byte(offset+0x1000); |
| 116 | return slot_dma_read(space, offset+0x1000); |
| 123 | 117 | } |
| 124 | 118 | else if (offset <= 0xbfff) // LC bank 2 d000-dfff |
| 125 | 119 | { |
| 126 | | return m_6502space->read_byte((offset&0xfff) + 0xd000); |
| 120 | return slot_dma_read(space, (offset&0xfff) + 0xd000); |
| 127 | 121 | } |
| 128 | 122 | else if (offset <= 0xcfff) // LC e000-efff |
| 129 | 123 | { |
| 130 | | return m_6502space->read_byte((offset&0xfff) + 0xe000); |
| 124 | return slot_dma_read(space, (offset&0xfff) + 0xe000); |
| 131 | 125 | } |
| 132 | 126 | else if (offset <= 0xdfff) // LC f000-ffff (or ROM?) |
| 133 | 127 | { |
| 134 | | return m_6502space->read_byte((offset&0xfff) + 0xf000); |
| 128 | return slot_dma_read(space, (offset&0xfff) + 0xf000); |
| 135 | 129 | } |
| 136 | 130 | else if (offset <= 0xefff) // I/O space c000-cfff |
| 137 | 131 | { |
| 138 | | return m_6502space->read_byte((offset&0xfff) + 0xc000); |
| 132 | return slot_dma_read(space, (offset&0xfff) + 0xc000); |
| 139 | 133 | } |
| 140 | 134 | else // zero page |
| 141 | 135 | { |
| 142 | | return m_6502space->read_byte(offset&0xfff); |
| 136 | return slot_dma_read(space, offset&0xfff); |
| 143 | 137 | } |
| 144 | 138 | } |
| 145 | 139 | |
| r243306 | r243307 | |
| 153 | 147 | |
| 154 | 148 | WRITE8_MEMBER( a2bus_softcard_device::dma_w ) |
| 155 | 149 | { |
| 156 | | if (m_6502space) |
| 150 | if (m_bEnabled) |
| 157 | 151 | { |
| 158 | 152 | if (offset <= 0xafff) |
| 159 | 153 | { |
| 160 | | m_6502space->write_byte(offset+0x1000, data); |
| 154 | slot_dma_write(space, offset+0x1000, data); |
| 161 | 155 | } |
| 162 | 156 | else if (offset <= 0xbfff) // LC bank 2 d000-dfff |
| 163 | 157 | { |
| 164 | | m_6502space->write_byte((offset&0xfff) + 0xd000, data); |
| 158 | slot_dma_write(space, (offset&0xfff) + 0xd000, data); |
| 165 | 159 | } |
| 166 | 160 | else if (offset <= 0xcfff) // LC e000-efff |
| 167 | 161 | { |
| 168 | | m_6502space->write_byte((offset&0xfff) + 0xe000, data); |
| 162 | slot_dma_write(space, (offset&0xfff) + 0xe000, data); |
| 169 | 163 | } |
| 170 | 164 | else if (offset <= 0xdfff) // LC f000-ffff (or ROM?) |
| 171 | 165 | { |
| 172 | | m_6502space->write_byte((offset&0xfff) + 0xf000, data); |
| 166 | slot_dma_write(space, (offset&0xfff) + 0xf000, data); |
| 173 | 167 | } |
| 174 | 168 | else if (offset <= 0xefff) // I/O space c000-cfff |
| 175 | 169 | { |
| 176 | | m_6502space->write_byte((offset&0xfff) + 0xc000, data); |
| 170 | slot_dma_write(space, (offset&0xfff) + 0xc000, data); |
| 177 | 171 | } |
| 178 | 172 | else // zero page |
| 179 | 173 | { |
| 180 | | m_6502space->write_byte(offset&0xfff, data); |
| 174 | slot_dma_write(space, offset&0xfff, data); |
| 181 | 175 | } |
| 182 | 176 | } |
| 183 | 177 | } |
trunk/src/emu/bus/a2bus/a2themill.c
| r243306 | r243307 | |
| 71 | 71 | a2bus_themill_device::a2bus_themill_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) : |
| 72 | 72 | device_t(mconfig, type, name, tag, owner, clock, shortname, source), |
| 73 | 73 | device_a2bus_card_interface(mconfig, *this), |
| 74 | | m_6809(*this, M6809_TAG), |
| 75 | | m_6502space(NULL) |
| 74 | m_6809(*this, M6809_TAG) |
| 76 | 75 | { |
| 77 | 76 | } |
| 78 | 77 | |
| 79 | 78 | a2bus_themill_device::a2bus_themill_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 80 | 79 | device_t(mconfig, A2BUS_THEMILL, "Stellation Two The Mill", tag, owner, clock, "a2themill", __FILE__), |
| 81 | 80 | device_a2bus_card_interface(mconfig, *this), |
| 82 | | m_6809(*this, M6809_TAG), |
| 83 | | m_6502space(NULL) |
| 81 | m_6809(*this, M6809_TAG) |
| 84 | 82 | { |
| 85 | 83 | } |
| 86 | 84 | |
| r243306 | r243307 | |
| 102 | 100 | void a2bus_themill_device::device_reset() |
| 103 | 101 | { |
| 104 | 102 | m_bEnabled = false; |
| 105 | | m_6502space = NULL; |
| 106 | 103 | m_flipAddrSpace = false; |
| 107 | 104 | m_6809Mode = false; |
| 108 | 105 | m_status = 0xc0; // OS9 loader relies on this |
| r243306 | r243307 | |
| 135 | 132 | case 2: // 6809 reset |
| 136 | 133 | if (data & 0x80) |
| 137 | 134 | { |
| 138 | | // steal the 6502's address space |
| 139 | | m_6502space = &space; |
| 140 | 135 | m_6809->reset(); |
| 141 | 136 | |
| 142 | 137 | m_6809->set_input_line(INPUT_LINE_HALT, CLEAR_LINE); |
| r243306 | r243307 | |
| 241 | 236 | |
| 242 | 237 | READ8_MEMBER( a2bus_themill_device::dma_r ) |
| 243 | 238 | { |
| 244 | | if (m_6502space) |
| 239 | if (m_6809Mode) |
| 245 | 240 | { |
| 246 | | if (m_6809Mode) |
| 241 | if (offset <= 0xafff) |
| 247 | 242 | { |
| 248 | | if (offset <= 0xafff) |
| 249 | | { |
| 250 | | return m_6502space->read_byte(offset+0x1000); |
| 251 | | } |
| 252 | | else if (offset <= 0xbfff) |
| 253 | | { |
| 254 | | return m_6502space->read_byte((offset&0xfff) + 0xd000); |
| 255 | | } |
| 256 | | else if (offset <= 0xcfff) |
| 257 | | { |
| 258 | | return m_6502space->read_byte((offset&0xfff) + 0xe000); |
| 259 | | } |
| 260 | | else if (offset <= 0xdfff) |
| 261 | | { |
| 262 | | return m_6502space->read_byte((offset&0xfff) + 0xf000); |
| 263 | | } |
| 264 | | else if (offset <= 0xefff) |
| 265 | | { |
| 266 | | return m_6502space->read_byte((offset&0xfff) + 0xc000); |
| 267 | | } |
| 268 | | else // 6809 Fxxx -> 6502 ZP |
| 269 | | { |
| 270 | | return m_6502space->read_byte(offset&0xfff); |
| 271 | | } |
| 243 | return slot_dma_read(space, offset+0x1000); |
| 272 | 244 | } |
| 245 | else if (offset <= 0xbfff) |
| 246 | { |
| 247 | return slot_dma_read(space, (offset&0xfff) + 0xd000); |
| 248 | } |
| 249 | else if (offset <= 0xcfff) |
| 250 | { |
| 251 | return slot_dma_read(space, (offset&0xfff) + 0xe000); |
| 252 | } |
| 253 | else if (offset <= 0xdfff) |
| 254 | { |
| 255 | return slot_dma_read(space, (offset&0xfff) + 0xf000); |
| 256 | } |
| 257 | else if (offset <= 0xefff) |
| 258 | { |
| 259 | return slot_dma_read(space, (offset&0xfff) + 0xc000); |
| 260 | } |
| 261 | else // 6809 Fxxx -> 6502 ZP |
| 262 | { |
| 263 | return slot_dma_read(space, offset&0xfff); |
| 264 | } |
| 265 | } |
| 266 | else |
| 267 | { |
| 268 | if (m_flipAddrSpace) |
| 269 | { |
| 270 | return slot_dma_read(space, offset^0x8000); |
| 271 | } |
| 273 | 272 | else |
| 274 | 273 | { |
| 275 | | if (m_flipAddrSpace) |
| 276 | | { |
| 277 | | return m_6502space->read_byte(offset^0x8000); |
| 278 | | } |
| 279 | | else |
| 280 | | { |
| 281 | | return m_6502space->read_byte(offset); |
| 282 | | } |
| 274 | return slot_dma_read(space, offset); |
| 283 | 275 | } |
| 284 | 276 | } |
| 285 | 277 | |
| r243306 | r243307 | |
| 293 | 285 | |
| 294 | 286 | WRITE8_MEMBER( a2bus_themill_device::dma_w ) |
| 295 | 287 | { |
| 296 | | if (m_6502space) |
| 288 | if (m_6809Mode) |
| 297 | 289 | { |
| 298 | | if (m_6809Mode) |
| 290 | if (offset <= 0xafff) |
| 299 | 291 | { |
| 300 | | if (offset <= 0xafff) |
| 301 | | { |
| 302 | | m_6502space->write_byte(offset+0x1000, data); |
| 303 | | } |
| 304 | | else if (offset <= 0xbfff) |
| 305 | | { |
| 306 | | m_6502space->write_byte((offset&0xfff) + 0xd000, data); |
| 307 | | } |
| 308 | | else if (offset <= 0xcfff) |
| 309 | | { |
| 310 | | m_6502space->write_byte((offset&0xfff) + 0xe000, data); |
| 311 | | } |
| 312 | | else if (offset <= 0xdfff) |
| 313 | | { |
| 314 | | m_6502space->write_byte((offset&0xfff) + 0xf000, data); |
| 315 | | } |
| 316 | | else if (offset <= 0xefff) |
| 317 | | { |
| 318 | | m_6502space->write_byte((offset&0xfff) + 0xc000, data); |
| 319 | | } |
| 320 | | else // 6809 Fxxx -> 6502 ZP |
| 321 | | { |
| 322 | | m_6502space->write_byte(offset&0xfff, data); |
| 323 | | } |
| 292 | slot_dma_write(space, offset+0x1000, data); |
| 324 | 293 | } |
| 294 | else if (offset <= 0xbfff) |
| 295 | { |
| 296 | slot_dma_write(space, (offset&0xfff) + 0xd000, data); |
| 297 | } |
| 298 | else if (offset <= 0xcfff) |
| 299 | { |
| 300 | slot_dma_write(space, (offset&0xfff) + 0xe000, data); |
| 301 | } |
| 302 | else if (offset <= 0xdfff) |
| 303 | { |
| 304 | slot_dma_write(space, (offset&0xfff) + 0xf000, data); |
| 305 | } |
| 306 | else if (offset <= 0xefff) |
| 307 | { |
| 308 | slot_dma_write(space, (offset&0xfff) + 0xc000, data); |
| 309 | } |
| 310 | else // 6809 Fxxx -> 6502 ZP |
| 311 | { |
| 312 | slot_dma_write(space, offset&0xfff, data); |
| 313 | } |
| 314 | } |
| 315 | else |
| 316 | { |
| 317 | if (m_flipAddrSpace) |
| 318 | { |
| 319 | slot_dma_write(space, offset^0x8000, data); |
| 320 | } |
| 325 | 321 | else |
| 326 | 322 | { |
| 327 | | if (m_flipAddrSpace) |
| 328 | | { |
| 329 | | m_6502space->write_byte(offset^0x8000, data); |
| 330 | | } |
| 331 | | else |
| 332 | | { |
| 333 | | m_6502space->write_byte(offset, data); |
| 334 | | } |
| 323 | slot_dma_write(space, offset, data); |
| 335 | 324 | } |
| 336 | 325 | } |
| 337 | 326 | } |
trunk/src/emu/cpu/amis2000/amis2000.c
| r243306 | r243307 | |
| 7 | 7 | TODO: |
| 8 | 8 | - unemulated opcodes (need more testing material) |
| 9 | 9 | - support external program map |
| 10 | - STATUS pin(wildfire.c sound?) |
| 10 | 11 | - add 50/60hz timer |
| 11 | 12 | - add S2200/S2400 |
| 12 | 13 | |
| r243306 | r243307 | |
| 15 | 16 | #include "amis2000.h" |
| 16 | 17 | #include "debugger.h" |
| 17 | 18 | |
| 19 | #include "amis2000op.inc" |
| 18 | 20 | |
| 21 | |
| 19 | 22 | // S2000 is the most basic one, 64 nibbles internal RAM and 1KB internal ROM |
| 20 | 23 | // S2150 increased RAM to 80 nibbles and ROM to 1.5KB |
| 21 | 24 | // high-voltage output versions of these chips (S2000A and S2150A) are identical overall |
| r243306 | r243307 | |
| 25 | 28 | |
| 26 | 29 | // internal memory maps |
| 27 | 30 | static ADDRESS_MAP_START(program_1k, AS_PROGRAM, 8, amis2000_device) |
| 28 | | AM_RANGE(0x0000, 0x03ff) AM_ROM AM_MIRROR(0x1c00) |
| 31 | AM_RANGE(0x0000, 0x03ff) AM_ROM |
| 29 | 32 | ADDRESS_MAP_END |
| 30 | 33 | |
| 31 | 34 | static ADDRESS_MAP_START(program_1_5k, AS_PROGRAM, 8, amis2000_device) |
| 32 | | AM_RANGE(0x0000, 0x03ff) AM_ROM AM_MIRROR(0x1800) |
| 33 | | AM_RANGE(0x0400, 0x05ff) AM_ROM AM_MIRROR(0x1a00) |
| 35 | AM_RANGE(0x0000, 0x03ff) AM_ROM |
| 36 | AM_RANGE(0x0400, 0x05ff) AM_NOP |
| 37 | AM_RANGE(0x0600, 0x07ff) AM_ROM |
| 34 | 38 | ADDRESS_MAP_END |
| 35 | 39 | |
| 36 | 40 | |
| r243306 | r243307 | |
| 116 | 120 | enum |
| 117 | 121 | { |
| 118 | 122 | S2000_PC=1, S2000_BL, S2000_BU, |
| 119 | | S2000_ACC, S2000_E, S2000_CARRY |
| 123 | S2000_ACC, S2000_E, S2000_CY |
| 120 | 124 | }; |
| 121 | 125 | |
| 122 | 126 | void amis2000_device::device_start() |
| r243306 | r243307 | |
| 138 | 142 | m_pc = 0; |
| 139 | 143 | m_ppr = 0; |
| 140 | 144 | m_pbr = 0; |
| 141 | | m_pp_index = 0; |
| 142 | 145 | m_skip = false; |
| 143 | 146 | m_op = 0; |
| 147 | m_prev_op = 0; |
| 144 | 148 | m_f = 0; |
| 145 | 149 | m_carry = 0; |
| 146 | 150 | m_bl = 0; |
| r243306 | r243307 | |
| 150 | 154 | m_i = 0; |
| 151 | 155 | m_k = 0; |
| 152 | 156 | m_d = 0; |
| 157 | m_d_active = false; |
| 158 | m_d_polarity = 0; |
| 153 | 159 | m_a = 0; |
| 154 | 160 | |
| 155 | 161 | // register for savestates |
| r243306 | r243307 | |
| 157 | 163 | save_item(NAME(m_pc)); |
| 158 | 164 | save_item(NAME(m_ppr)); |
| 159 | 165 | save_item(NAME(m_pbr)); |
| 160 | | save_item(NAME(m_pp_index)); |
| 161 | 166 | save_item(NAME(m_skip)); |
| 162 | 167 | save_item(NAME(m_op)); |
| 168 | save_item(NAME(m_prev_op)); |
| 163 | 169 | save_item(NAME(m_f)); |
| 164 | 170 | save_item(NAME(m_carry)); |
| 165 | 171 | save_item(NAME(m_bl)); |
| r243306 | r243307 | |
| 169 | 175 | save_item(NAME(m_i)); |
| 170 | 176 | save_item(NAME(m_k)); |
| 171 | 177 | save_item(NAME(m_d)); |
| 178 | save_item(NAME(m_d_active)); |
| 179 | save_item(NAME(m_d_polarity)); |
| 172 | 180 | save_item(NAME(m_a)); |
| 173 | 181 | |
| 174 | 182 | // register state for debugger |
| r243306 | r243307 | |
| 177 | 185 | state_add(S2000_BU, "BU", m_bu ).formatstr("%01X"); |
| 178 | 186 | state_add(S2000_ACC, "ACC", m_acc ).formatstr("%01X"); |
| 179 | 187 | state_add(S2000_E, "E", m_e ).formatstr("%01X"); |
| 180 | | state_add(S2000_CARRY, "CARRY", m_carry ).formatstr("%01X"); |
| 188 | state_add(S2000_CY, "CY", m_carry ).formatstr("%01X"); |
| 181 | 189 | |
| 182 | 190 | state_add(STATE_GENPC, "curpc", m_pc).formatstr("%04X").noshow(); |
| 183 | 191 | state_add(STATE_GENFLAGS, "GENFLAGS", m_f).formatstr("%6s").noshow(); |
| r243306 | r243307 | |
| 198 | 206 | m_op = 0; |
| 199 | 207 | |
| 200 | 208 | // clear i/o |
| 209 | m_d_polarity = 0; |
| 210 | m_d = 0; d_latch_out(false); |
| 211 | m_a = 0; m_write_a(0, 0, 0xffff); |
| 201 | 212 | m_i = 0; |
| 202 | 213 | m_k = 0; |
| 203 | | m_d = 0; m_write_d(0, 0, 0xff); |
| 204 | | m_a = 0; m_write_a(0, 0, 0xffff); |
| 205 | 214 | } |
| 206 | 215 | |
| 207 | 216 | |
| r243306 | r243307 | |
| 210 | 219 | // execute |
| 211 | 220 | //------------------------------------------------- |
| 212 | 221 | |
| 213 | | #include "amis2000op.inc" |
| 214 | | |
| 215 | 222 | void amis2000_device::execute_run() |
| 216 | 223 | { |
| 217 | 224 | while (m_icount > 0) |
| 218 | 225 | { |
| 219 | 226 | m_icount--; |
| 220 | 227 | |
| 221 | | // increase PP prefix count |
| 222 | | if ((m_op & 0xf0) == 0x60) |
| 223 | | { |
| 224 | | if (m_pp_index < 2) |
| 225 | | m_pp_index++; |
| 226 | | } |
| 227 | | else |
| 228 | | m_pp_index = 0; |
| 228 | // remember previous opcode |
| 229 | m_prev_op = m_op; |
| 229 | 230 | |
| 230 | 231 | debugger_instruction_hook(this, m_pc); |
| 231 | 232 | m_op = m_program->read_byte(m_pc); |
| r243306 | r243307 | |
| 251 | 252 | switch (m_op) |
| 252 | 253 | { |
| 253 | 254 | case 0x00: op_nop(); break; |
| 254 | | case 0x01: op_illegal(); break; // reserved for devkit-use |
| 255 | case 0x01: op_halt(); break; |
| 255 | 256 | case 0x02: op_rt(); break; |
| 256 | 257 | case 0x03: op_rts(); break; |
| 257 | 258 | case 0x04: op_psh(); break; |
trunk/src/emu/cpu/amis2000/amis2000d.c
| r243306 | r243307 | |
| 17 | 17 | mLAM, mXC, mXCI, mXCD, mSTM, mRSM, |
| 18 | 18 | mADD, mADCS, mADIS, mAND, mXOR, mCMA, mSTC, mRSC, mSF1, mRF1, mSF2, mRF2, |
| 19 | 19 | mSAM, mSZM, mSBE, mSZC, mSOS, mSZK, mSZI, mTF1, mTF2, |
| 20 | | mPP, mJMP, mJMS, mRT, mRTS, mNOP, |
| 21 | | mINP, mOUT, mDISB, mDISN, mMVS, mPSH, mPSL, mEUR, |
| 22 | | mILL |
| 20 | mPP, mJMP, mJMS, mRT, mRTS, mNOP, mHALT, |
| 21 | mINP, mOUT, mDISB, mDISN, mMVS, mPSH, mPSL, mEUR |
| 23 | 22 | }; |
| 24 | 23 | |
| 25 | 24 | static const char *const s_mnemonics[] = |
| r243306 | r243307 | |
| 28 | 27 | "LAM", "XC", "XCI", "XCD", "STM", "RSM", |
| 29 | 28 | "ADD", "ADCS", "ADIS", "AND", "XOR", "CMA", "STC", "RSC", "SF1", "RF1", "SF2", "RF2", |
| 30 | 29 | "SAM", "SZM", "SBE", "SZC", "SOS", "SZK", "SZI", "TF1", "TF2", |
| 31 | | "PP", "JMP", "JMS", "RT", "RTS", "NOP", |
| 32 | | "INP", "OUT", "DISB", "DISN", "MVS", "PSH", "PSL", "EUR", |
| 33 | | "?" |
| 30 | "PP", "JMP", "JMS", "RT", "RTS", "NOP", "HALT", |
| 31 | "INP", "OUT", "DISB", "DISN", "MVS", "PSH", "PSL", "EUR" |
| 34 | 32 | }; |
| 35 | 33 | |
| 36 | 34 | |
| r243306 | r243307 | |
| 43 | 41 | 0, 0, 0, 0, 0, 0, |
| 44 | 42 | 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 45 | 43 | 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 46 | | 0, 0, _OVER, _OUT, _OUT, 0, |
| 47 | | 0, 0, 0, 0, 0, 0, 0, 0, |
| 48 | | 0 |
| 44 | 0, 0, _OVER, _OUT, _OUT, 0, 0, |
| 45 | 0, 0, 0, 0, 0, 0, 0, 0 |
| 49 | 46 | }; |
| 50 | 47 | |
| 51 | 48 | |
| r243306 | r243307 | |
| 55 | 52 | -2, -2, -2, -2, 2, 2, |
| 56 | 53 | 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 57 | 54 | 0, 2, 0, 0, 0, 0, 0, 0, 0, |
| 58 | | -4, 6, 6, 0, 0, 0, |
| 59 | | 0, 0, 0, 0, 0, 0, 0, 0, |
| 60 | | 0 |
| 55 | -4, 6, 6, 0, 0, 0, 0, |
| 56 | 0, 0, 0, 0, 0, 0, 0, 0 |
| 61 | 57 | }; |
| 62 | 58 | |
| 63 | 59 | |
| 64 | 60 | static const UINT8 s2000_mnemonic[0x100] = |
| 65 | 61 | { |
| 66 | 62 | /* 0x00 */ |
| 67 | | mNOP, mILL, mRT, mRTS, mPSH, mPSL, mAND, mSOS, |
| 63 | mNOP, mHALT, mRT, mRTS, mPSH, mPSL, mAND, mSOS, |
| 68 | 64 | mSBE, mSZC, mSTC, mRSC, mLAE, mXAE, mINP, mEUR, |
| 69 | 65 | /* 0x10 */ |
| 70 | 66 | mCMA, mXABU, mLAB, mXAB, mADCS, mXOR, mADD, mSAM, |
trunk/src/emu/cpu/amis2000/amis2000op.inc
| r243306 | r243307 | |
| 4 | 4 | |
| 5 | 5 | UINT8 amis2000_device::ram_r() |
| 6 | 6 | { |
| 7 | | UINT16 address = m_bu << m_bu_bits | m_bl; |
| 7 | UINT16 address = m_bu << 4 | m_bl; |
| 8 | 8 | return m_data->read_byte(address) & 0xf; |
| 9 | 9 | } |
| 10 | 10 | |
| 11 | 11 | void amis2000_device::ram_w(UINT8 data) |
| 12 | 12 | { |
| 13 | | UINT16 address = m_bu << m_bu_bits | m_bl; |
| 13 | UINT16 address = m_bu << 4 | m_bl; |
| 14 | 14 | m_data->write_byte(address, data & 0xf); |
| 15 | 15 | } |
| 16 | 16 | |
| r243306 | r243307 | |
| 33 | 33 | m_callstack[0] = m_pc & m_callstack_mask; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | | void amis2000_device::op_illegal() |
| 36 | void amis2000_device::d_latch_out(bool active) |
| 37 | 37 | { |
| 38 | | logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc); |
| 38 | m_write_d(0, active ? (m_d ^ m_d_polarity) : 0, 0xff); |
| 39 | m_d_active = active; |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | |
| r243306 | r243307 | |
| 44 | 45 | void amis2000_device::op_lai() |
| 45 | 46 | { |
| 46 | 47 | // LAI X: load ACC with X, select I and K inputs |
| 47 | | UINT8 param = m_op & 0x0f; |
| 48 | | m_acc = param; |
| 49 | | m_i = m_read_i(0, 0xff) & param; |
| 50 | | m_k = m_read_k(0, 0xff) & param; |
| 48 | // note: only execute the first one in a sequence of LAI |
| 49 | if ((m_prev_op & 0xf0) != (m_op & 0xf0)) |
| 50 | { |
| 51 | UINT8 param = m_op & 0x0f; |
| 52 | m_acc = param; |
| 53 | m_i = m_read_i(0, 0xff) & param; |
| 54 | m_k = m_read_k(0, 0xff) & param; |
| 55 | } |
| 51 | 56 | } |
| 52 | 57 | |
| 53 | 58 | void amis2000_device::op_lab() |
| r243306 | r243307 | |
| 89 | 94 | void amis2000_device::op_lbe() |
| 90 | 95 | { |
| 91 | 96 | // LBE Y: load BU with Y, load BL with E |
| 92 | | UINT8 param = m_op & 0x03; |
| 93 | | m_bu = param & m_bu_mask; |
| 94 | | m_bl = m_e; |
| 97 | // note: only execute the first one in a sequence of LB* |
| 98 | if ((m_prev_op & 0xf0) != (m_op & 0xf0)) |
| 99 | { |
| 100 | UINT8 param = m_op & 0x03; |
| 101 | m_bu = param & m_bu_mask; |
| 102 | m_bl = m_e; |
| 103 | } |
| 95 | 104 | } |
| 96 | 105 | |
| 97 | 106 | void amis2000_device::op_lbep() |
| 98 | 107 | { |
| 99 | 108 | // LBEP Y: load BU with Y, load BL with E+1 |
| 100 | | UINT8 param = m_op & 0x03; |
| 101 | | m_bu = param & m_bu_mask; |
| 102 | | m_bl = m_e + 1; |
| 109 | // note: only execute the first one in a sequence of LB* |
| 110 | if ((m_prev_op & 0xf0) != (m_op & 0xf0)) |
| 111 | { |
| 112 | UINT8 param = m_op & 0x03; |
| 113 | m_bu = param & m_bu_mask; |
| 114 | m_bl = (m_e + 1) & 0xf; |
| 115 | } |
| 103 | 116 | } |
| 104 | 117 | |
| 105 | 118 | void amis2000_device::op_lbz() |
| 106 | 119 | { |
| 107 | 120 | // LBZ Y: load BU with Y, load BL with 0 |
| 108 | | UINT8 param = m_op & 0x03; |
| 109 | | m_bu = param & m_bu_mask; |
| 110 | | m_bl = 0; |
| 121 | // note: only execute the first one in a sequence of LB* |
| 122 | if ((m_prev_op & 0xf0) != (m_op & 0xf0)) |
| 123 | { |
| 124 | UINT8 param = m_op & 0x03; |
| 125 | m_bu = param & m_bu_mask; |
| 126 | m_bl = 0; |
| 127 | } |
| 111 | 128 | } |
| 112 | 129 | |
| 113 | 130 | void amis2000_device::op_lbf() |
| 114 | 131 | { |
| 115 | 132 | // LBF Y: load BU with Y, load BL with 15 |
| 116 | | UINT8 param = m_op & 0x03; |
| 117 | | m_bu = param & m_bu_mask; |
| 118 | | m_bl = 0xf; |
| 133 | // note: only execute the first one in a sequence of LB* |
| 134 | if ((m_prev_op & 0xf0) != (m_op & 0xf0)) |
| 135 | { |
| 136 | UINT8 param = m_op & 0x03; |
| 137 | m_bu = param & m_bu_mask; |
| 138 | m_bl = 0xf; |
| 139 | } |
| 119 | 140 | } |
| 120 | 141 | |
| 121 | 142 | |
| r243306 | r243307 | |
| 126 | 147 | // LAM _Y: load ACC with RAM, xor BU with _Y |
| 127 | 148 | m_acc = ram_r(); |
| 128 | 149 | UINT8 param = ~m_op & 0x03; |
| 129 | | m_bu ^= param & m_bu_mask; |
| 150 | m_bu ^= (param & m_bu_mask); |
| 130 | 151 | } |
| 131 | 152 | |
| 132 | 153 | void amis2000_device::op_xc() |
| r243306 | r243307 | |
| 136 | 157 | m_acc = ram_r(); |
| 137 | 158 | ram_w(old_acc); |
| 138 | 159 | UINT8 param = ~m_op & 0x03; |
| 139 | | m_bu ^= param & m_bu_mask; |
| 160 | m_bu ^= (param & m_bu_mask); |
| 140 | 161 | } |
| 141 | 162 | |
| 142 | 163 | void amis2000_device::op_xci() |
| r243306 | r243307 | |
| 175 | 196 | void amis2000_device::op_inp() |
| 176 | 197 | { |
| 177 | 198 | // INP: input D-pins to ACC and RAM |
| 178 | | op_illegal(); |
| 199 | UINT8 in = m_d_active ? m_d : m_read_d(0, 0xff); |
| 200 | m_acc = in & 0xf; |
| 201 | ram_w(in >> 4 & 0xf); |
| 179 | 202 | } |
| 180 | 203 | |
| 181 | 204 | void amis2000_device::op_out() |
| 182 | 205 | { |
| 183 | 206 | // OUT: pulse output ACC and RAM to D-pins |
| 184 | | op_illegal(); |
| 207 | logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc); |
| 185 | 208 | } |
| 186 | 209 | |
| 187 | 210 | void amis2000_device::op_disb() |
| 188 | 211 | { |
| 189 | 212 | // DISB: set D-latch to ACC and RAM directly |
| 190 | 213 | m_d = m_acc | ram_r() << 4; |
| 191 | | m_write_d(0, m_d, 0xff); |
| 192 | | // TODO: exit from floating mode on D-pins |
| 214 | d_latch_out(true); |
| 193 | 215 | } |
| 194 | 216 | |
| 195 | 217 | void amis2000_device::op_disn() |
| r243306 | r243307 | |
| 201 | 223 | 0x7e, 0x30, 0x6d, 0x79, 0x33, 0x5b, 0x5f, 0x70, 0x7f, 0x7b, 0x77, 0x1f, 0x4e, 0x3d, 0x4f, 0x47 |
| 202 | 224 | }; |
| 203 | 225 | m_d = lut_segment_decoder[m_acc] | (m_carry ? 0x80 : 0x00); |
| 204 | | m_write_d(0, m_d, 0xff); |
| 205 | | // TODO: exit from floating mode on D-pins |
| 226 | d_latch_out(true); |
| 206 | 227 | } |
| 207 | 228 | |
| 208 | 229 | void amis2000_device::op_mvs() |
| 209 | 230 | { |
| 210 | 231 | // MVS: output master strobe latch to A-pins |
| 232 | d_latch_out(false); |
| 211 | 233 | m_write_a(0, m_a, 0xffff); |
| 212 | | // TODO: enter floating mode on D-pins |
| 213 | 234 | } |
| 214 | 235 | |
| 215 | 236 | void amis2000_device::op_psh() |
| r243306 | r243307 | |
| 224 | 245 | |
| 225 | 246 | case 0xe: |
| 226 | 247 | // exit from floating mode on D-pins |
| 227 | | // ? |
| 248 | d_latch_out(true); |
| 228 | 249 | break; |
| 229 | 250 | |
| 230 | 251 | case 0xf: |
| r243306 | r243307 | |
| 251 | 272 | |
| 252 | 273 | case 0xe: |
| 253 | 274 | // enter floating mode on D-pins |
| 254 | | // ? |
| 275 | d_latch_out(false); |
| 255 | 276 | break; |
| 256 | 277 | |
| 257 | 278 | case 0xf: |
| r243306 | r243307 | |
| 268 | 289 | |
| 269 | 290 | void amis2000_device::op_eur() |
| 270 | 291 | { |
| 271 | | // EUR: set timer frequency(European) and D-latch polarity |
| 272 | | op_illegal(); |
| 292 | // EUR: set timer frequency(European) and D-latch polarity, via ACC |
| 293 | m_d_polarity = (m_acc & 1) ? 0x00 : 0xff; |
| 294 | d_latch_out(m_d_active); // refresh |
| 273 | 295 | } |
| 274 | 296 | |
| 275 | 297 | |
| r243306 | r243307 | |
| 279 | 301 | { |
| 280 | 302 | // PP _X: prepare page/bank with _X |
| 281 | 303 | UINT8 param = ~m_op & 0x0f; |
| 282 | | if (m_pp_index == 0) |
| 304 | if ((m_prev_op & 0xf0) != (m_op & 0xf0)) |
| 283 | 305 | m_ppr = param; |
| 284 | 306 | else |
| 285 | 307 | m_pbr = param & 7; |
| r243306 | r243307 | |
| 290 | 312 | // JMP X: jump to X(+PP) |
| 291 | 313 | UINT16 mask = 0x3f; |
| 292 | 314 | UINT16 param = m_op & mask; |
| 293 | | if (m_pp_index > 0) |
| 315 | |
| 316 | // if previous opcode was PP, change PC high bits too |
| 317 | if ((m_prev_op & 0xf0) == 0x60) |
| 294 | 318 | { |
| 295 | | param |= m_ppr << 6; |
| 296 | | mask |= 0x3c0; |
| 319 | param |= (m_ppr << 6) | (m_pbr << 10); |
| 320 | mask = 0x1fff; |
| 297 | 321 | } |
| 298 | | if (m_pp_index > 1) |
| 299 | | { |
| 300 | | param |= m_pbr << 10; |
| 301 | | mask |= 0x1c00; |
| 302 | | } |
| 303 | 322 | m_pc = (m_pc & ~mask) | param; |
| 304 | 323 | } |
| 305 | 324 | |
| r243306 | r243307 | |
| 308 | 327 | // JMS X: call to X(+PP) |
| 309 | 328 | m_icount--; |
| 310 | 329 | push_callstack(); |
| 311 | | if (m_pp_index == 0) |
| 312 | | { |
| 313 | | // subroutines default location is page 15 |
| 314 | | m_ppr = 0xf; |
| 315 | | m_pp_index++; |
| 316 | | } |
| 317 | 330 | op_jmp(); |
| 331 | |
| 332 | // subroutines default location is page 15 |
| 333 | if ((m_prev_op & 0xf0) != 0x60) |
| 334 | m_pc |= 0x3c0; |
| 318 | 335 | } |
| 319 | 336 | |
| 320 | 337 | void amis2000_device::op_rt() |
| r243306 | r243307 | |
| 335 | 352 | // NOP: no operation |
| 336 | 353 | } |
| 337 | 354 | |
| 355 | void amis2000_device::op_halt() |
| 356 | { |
| 357 | // HALT: debugger breakpoint for devkit-use |
| 358 | logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc); |
| 359 | } |
| 338 | 360 | |
| 361 | |
| 339 | 362 | // Skip Instructions |
| 340 | 363 | |
| 341 | 364 | void amis2000_device::op_szc() |
| r243306 | r243307 | |
| 378 | 401 | void amis2000_device::op_sos() |
| 379 | 402 | { |
| 380 | 403 | // SOS: skip next on SF(timer output), clear SF |
| 381 | | op_illegal(); |
| 404 | logerror("%s unknown opcode $%02X at $%04X\n", tag(), m_op, m_pc); |
| 382 | 405 | } |
| 383 | 406 | |
| 384 | 407 | void amis2000_device::op_tf1() |
| 385 | 408 | { |
| 386 | 409 | // TF1: skip next on flag 1 |
| 387 | | m_skip = (m_f & 0x01); |
| 410 | m_skip = (m_f & 0x01) ? true : false; |
| 388 | 411 | } |
| 389 | 412 | |
| 390 | 413 | void amis2000_device::op_tf2() |
| 391 | 414 | { |
| 392 | 415 | // TF2: skip next on flag 2 |
| 393 | | m_skip = (m_f & 0x02); |
| 416 | m_skip = (m_f & 0x02) ? true : false; |
| 394 | 417 | } |
| 395 | 418 | |
| 396 | 419 | |
trunk/src/emu/cpu/uml.h
| r243306 | r243307 | |
| 305 | 305 | parameter(UINT64 val) : m_type(PTYPE_IMMEDIATE), m_value(val) { } |
| 306 | 306 | parameter(operand_size size, memory_scale scale) : m_type(PTYPE_SIZE_SCALE), m_value((scale << 4) | size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); assert(scale >= SCALE_x1 && scale <= SCALE_x8); } |
| 307 | 307 | parameter(operand_size size, memory_space space) : m_type(PTYPE_SIZE_SPACE), m_value((space << 4) | size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); assert(space >= SPACE_PROGRAM && space <= SPACE_IO); } |
| 308 | | parameter(code_handle &handle) : m_type(PTYPE_CODE_HANDLE), m_value(static_cast<parameter_value>(reinterpret_cast<FPTR>(&handle))) { } |
| 308 | parameter(code_handle &handle) : m_type(PTYPE_CODE_HANDLE), m_value(reinterpret_cast<parameter_value>(&handle)) { } |
| 309 | 309 | parameter(code_label &label) : m_type(PTYPE_CODE_LABEL), m_value(label) { } |
| 310 | 310 | |
| 311 | 311 | // creators for types that don't safely default |
| r243306 | r243307 | |
| 313 | 313 | static inline parameter make_freg(int regnum) { assert(regnum >= REG_F0 && regnum < REG_F_END); return parameter(PTYPE_FLOAT_REGISTER, regnum); } |
| 314 | 314 | static inline parameter make_vreg(int regnum) { assert(regnum >= REG_V0 && regnum < REG_V_END); return parameter(PTYPE_VECTOR_REGISTER, regnum); } |
| 315 | 315 | static inline parameter make_mapvar(int mvnum) { assert(mvnum >= MAPVAR_M0 && mvnum < MAPVAR_END); return parameter(PTYPE_MAPVAR, mvnum); } |
| 316 | | static inline parameter make_memory(void *base) { return parameter(PTYPE_MEMORY, static_cast<parameter_value>(reinterpret_cast<FPTR>(base))); } |
| 317 | | static inline parameter make_memory(const void *base) { return parameter(PTYPE_MEMORY, static_cast<parameter_value>(reinterpret_cast<FPTR>(const_cast<void *>(base)))); } |
| 316 | static inline parameter make_memory(void *base) { return parameter(PTYPE_MEMORY, reinterpret_cast<parameter_value>(base)); } |
| 317 | static inline parameter make_memory(const void *base) { return parameter(PTYPE_MEMORY, reinterpret_cast<parameter_value>(const_cast<void *>(base))); } |
| 318 | 318 | static inline parameter make_size(operand_size size) { assert(size >= SIZE_BYTE && size <= SIZE_DQWORD); return parameter(PTYPE_SIZE, size); } |
| 319 | | static inline parameter make_string(const char *string) { return parameter(PTYPE_STRING, static_cast<parameter_value>(reinterpret_cast<FPTR>(const_cast<char *>(string)))); } |
| 320 | | static inline parameter make_cfunc(c_function func) { return parameter(PTYPE_C_FUNCTION, static_cast<parameter_value>(reinterpret_cast<FPTR>(func))); } |
| 319 | static inline parameter make_string(const char *string) { return parameter(PTYPE_STRING, reinterpret_cast<parameter_value>(const_cast<char *>(string))); } |
| 320 | static inline parameter make_cfunc(c_function func) { return parameter(PTYPE_C_FUNCTION, reinterpret_cast<parameter_value>(func)); } |
| 321 | 321 | static inline parameter make_rounding(float_rounding_mode mode) { assert(mode >= ROUND_TRUNC && mode <= ROUND_DEFAULT); return parameter(PTYPE_ROUNDING, mode); } |
| 322 | 322 | |
| 323 | 323 | // operators |
trunk/src/emu/softlist.c
| r243306 | r243307 | |
| 265 | 265 | |
| 266 | 266 | |
| 267 | 267 | //************************************************************************** |
| 268 | | // CONST STRING POOL |
| 269 | | //************************************************************************** |
| 270 | | |
| 271 | | //------------------------------------------------- |
| 272 | | // const_string_pool - constructor |
| 273 | | //------------------------------------------------- |
| 274 | | |
| 275 | | const_string_pool::const_string_pool() |
| 276 | | { |
| 277 | | } |
| 278 | | |
| 279 | | |
| 280 | | //------------------------------------------------- |
| 281 | | // add - add a string to the string pool |
| 282 | | //------------------------------------------------- |
| 283 | | |
| 284 | | const char *const_string_pool::add(const char *string) |
| 285 | | { |
| 286 | | // if NULL or a small number (for some hash strings), just return as-is |
| 287 | | if (FPTR(string) < 0x100) |
| 288 | | return string; |
| 289 | | |
| 290 | | // scan to find space |
| 291 | | for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next()) |
| 292 | | { |
| 293 | | const char *result = chunk->add(string); |
| 294 | | if (result != NULL) |
| 295 | | return result; |
| 296 | | } |
| 297 | | |
| 298 | | // no space anywhere, create a new pool and prepend it (so it gets used first) |
| 299 | | const char *result = m_chunklist.prepend(*global_alloc(pool_chunk)).add(string); |
| 300 | | assert(result != NULL); |
| 301 | | return result; |
| 302 | | } |
| 303 | | |
| 304 | | |
| 305 | | //------------------------------------------------- |
| 306 | | // contains - determine if the given string |
| 307 | | // pointer lives in the pool |
| 308 | | //------------------------------------------------- |
| 309 | | |
| 310 | | bool const_string_pool::contains(const char *string) |
| 311 | | { |
| 312 | | // if NULL or a small number (for some hash strings), then yes, effectively |
| 313 | | if (FPTR(string) < 0x100) |
| 314 | | return true; |
| 315 | | |
| 316 | | // scan to find it |
| 317 | | for (pool_chunk *chunk = m_chunklist.first(); chunk != NULL; chunk = chunk->next()) |
| 318 | | if (chunk->contains(string)) |
| 319 | | return true; |
| 320 | | |
| 321 | | return false; |
| 322 | | } |
| 323 | | |
| 324 | | |
| 325 | | //------------------------------------------------- |
| 326 | | // pool_chunk - constructor |
| 327 | | //------------------------------------------------- |
| 328 | | |
| 329 | | const_string_pool::pool_chunk::pool_chunk() |
| 330 | | : m_next(NULL), |
| 331 | | m_used(0) |
| 332 | | { |
| 333 | | } |
| 334 | | |
| 335 | | |
| 336 | | //------------------------------------------------- |
| 337 | | // add - add a string to this pool |
| 338 | | //------------------------------------------------- |
| 339 | | |
| 340 | | const char *const_string_pool::pool_chunk::add(const char *string) |
| 341 | | { |
| 342 | | // get the length of the string (no string can be longer than a full pool) |
| 343 | | int bytes = strlen(string) + 1; |
| 344 | | assert(bytes < POOL_SIZE); |
| 345 | | |
| 346 | | // if too big, return NULL |
| 347 | | if (m_used + bytes > POOL_SIZE) |
| 348 | | return NULL; |
| 349 | | |
| 350 | | // allocate, copy, and return the memory |
| 351 | | char *dest = &m_buffer[m_used]; |
| 352 | | m_used += bytes; |
| 353 | | memcpy(dest, string, bytes); |
| 354 | | return dest; |
| 355 | | } |
| 356 | | |
| 357 | | |
| 358 | | |
| 359 | | //************************************************************************** |
| 360 | 268 | // SOFTWARE LIST DEVICE |
| 361 | 269 | //************************************************************************** |
| 362 | 270 | |
trunk/src/mame/drivers/fastfred.c
| r243306 | r243307 | |
| 14 | 14 | #include "sound/ay8910.h" |
| 15 | 15 | |
| 16 | 16 | |
| 17 | void fastfred_state::machine_start() |
| 18 | { |
| 19 | save_item(NAME(m_charbank)); |
| 20 | save_item(NAME(m_colorbank)); |
| 21 | save_item(NAME(m_nmi_mask)); |
| 22 | save_item(NAME(m_sound_nmi_mask)); |
| 23 | } |
| 24 | |
| 17 | 25 | // This routine is a big hack, but the only way I can get the game working |
| 18 | 26 | // without knowing anything about the way the protection chip works. |
| 19 | 27 | // These values were derived based on disassembly of the code. Usually, it |
| r243306 | r243307 | |
| 124 | 132 | |
| 125 | 133 | MACHINE_START_MEMBER(fastfred_state,imago) |
| 126 | 134 | { |
| 135 | machine_start(); |
| 127 | 136 | m_gfxdecode->gfx(1)->set_source(m_imago_sprites); |
| 128 | 137 | } |
| 129 | 138 | |
| r243306 | r243307 | |
| 1039 | 1048 | m_hardware_type = 3; |
| 1040 | 1049 | } |
| 1041 | 1050 | |
| 1042 | | GAME( 1982, flyboy, 0, fastfred, flyboy, fastfred_state, flyboy, ROT90, "Kaneko", "Fly-Boy", 0 ) |
| 1043 | | GAME( 1982, flyboyb, flyboy, fastfred, flyboy, fastfred_state, flyboyb, ROT90, "bootleg", "Fly-Boy (bootleg)", 0 ) |
| 1044 | | GAME( 1982, fastfred, flyboy, fastfred, fastfred, fastfred_state, fastfred, ROT90, "Kaneko (Atari license)", "Fast Freddie", 0 ) |
| 1045 | | GAME( 1983, jumpcoas, 0, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko", "Jump Coaster", 0 ) |
| 1046 | | GAME( 1983, jumpcoast,jumpcoas, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko (Taito license)", "Jump Coaster (Taito)", 0 ) |
| 1047 | | GAME( 1983, boggy84, 0, jumpcoas, boggy84, fastfred_state, boggy84, ROT90, "Kaneko", "Boggy '84", 0 ) |
| 1048 | | GAME( 1983, boggy84b, boggy84, jumpcoas, boggy84, fastfred_state, boggy84b, ROT90, "bootleg (Eddie's Games)", "Boggy '84 (bootleg)", 0 ) |
| 1049 | | GAME( 1986, redrobin, 0, fastfred, redrobin, fastfred_state, flyboyb, ROT90, "Elettronolo", "Red Robin", 0 ) |
| 1051 | GAME( 1982, flyboy, 0, fastfred, flyboy, fastfred_state, flyboy, ROT90, "Kaneko", "Fly-Boy", GAME_SUPPORTS_SAVE ) |
| 1052 | GAME( 1982, flyboyb, flyboy, fastfred, flyboy, fastfred_state, flyboyb, ROT90, "bootleg", "Fly-Boy (bootleg)", GAME_SUPPORTS_SAVE ) |
| 1053 | GAME( 1982, fastfred, flyboy, fastfred, fastfred, fastfred_state, fastfred, ROT90, "Kaneko (Atari license)", "Fast Freddie", GAME_SUPPORTS_SAVE ) |
| 1054 | GAME( 1983, jumpcoas, 0, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko", "Jump Coaster", GAME_SUPPORTS_SAVE ) |
| 1055 | GAME( 1983, jumpcoast,jumpcoas, jumpcoas, jumpcoas, fastfred_state, jumpcoas, ROT90, "Kaneko (Taito license)", "Jump Coaster (Taito)", GAME_SUPPORTS_SAVE ) |
| 1056 | GAME( 1983, boggy84, 0, jumpcoas, boggy84, fastfred_state, boggy84, ROT90, "Kaneko", "Boggy '84", GAME_SUPPORTS_SAVE ) |
| 1057 | GAME( 1983, boggy84b, boggy84, jumpcoas, boggy84, fastfred_state, boggy84b, ROT90, "bootleg (Eddie's Games)", "Boggy '84 (bootleg)", GAME_SUPPORTS_SAVE ) |
| 1058 | GAME( 1986, redrobin, 0, fastfred, redrobin, fastfred_state, flyboyb, ROT90, "Elettronolo", "Red Robin", GAME_SUPPORTS_SAVE ) |
| 1050 | 1059 | GAME( 1984, imago, 0, imago, imago, fastfred_state, imago, ROT90, "Acom", "Imago (cocktail set)", 0 ) |
| 1051 | 1060 | GAME( 1983, imagoa, imago, imago, imagoa, fastfred_state, imago, ROT90, "Acom", "Imago (no cocktail set)", 0 ) |
trunk/src/mame/includes/fastfred.h
| r243306 | r243307 | |
| 12 | 12 | public: |
| 13 | 13 | fastfred_state(const machine_config &mconfig, device_type type, const char *tag) |
| 14 | 14 | : galaxold_state(mconfig, type, tag), |
| 15 | m_gfxdecode(*this, "gfxdecode"), |
| 16 | m_palette(*this, "palette"), |
| 15 | 17 | m_videoram(*this, "videoram"), |
| 16 | 18 | m_spriteram(*this, "spriteram"), |
| 17 | 19 | m_attributesram(*this, "attributesram"), |
| 18 | 20 | m_background_color(*this, "bgcolor"), |
| 19 | | m_imago_fg_videoram(*this, "imago_fg_vram"), |
| 20 | | m_gfxdecode(*this, "gfxdecode"), |
| 21 | | m_palette(*this, "palette") { } |
| 21 | m_imago_fg_videoram(*this, "imago_fg_vram") { } |
| 22 | 22 | |
| 23 | | UINT8 m_imago_sprites[0x800*3]; |
| 24 | | UINT16 m_imago_sprites_address; |
| 25 | | UINT8 m_imago_sprites_bank; |
| 26 | | int m_hardware_type; |
| 23 | required_device<gfxdecode_device> m_gfxdecode; |
| 24 | required_device<palette_device> m_palette; |
| 25 | |
| 27 | 26 | required_shared_ptr<UINT8> m_videoram; |
| 28 | 27 | required_shared_ptr<UINT8> m_spriteram; |
| 29 | 28 | required_shared_ptr<UINT8> m_attributesram; |
| 30 | 29 | optional_shared_ptr<UINT8> m_background_color; |
| 31 | 30 | optional_shared_ptr<UINT8> m_imago_fg_videoram; |
| 32 | | required_device<gfxdecode_device> m_gfxdecode; |
| 33 | | required_device<palette_device> m_palette; |
| 34 | 31 | |
| 32 | int m_hardware_type; |
| 35 | 33 | UINT16 m_charbank; |
| 36 | 34 | UINT8 m_colorbank; |
| 35 | UINT8 m_nmi_mask; |
| 36 | UINT8 m_sound_nmi_mask; |
| 37 | UINT8 m_imago_sprites[0x800*3]; |
| 38 | UINT16 m_imago_sprites_address; |
| 39 | UINT8 m_imago_sprites_bank; |
| 40 | |
| 37 | 41 | tilemap_t *m_bg_tilemap; |
| 38 | 42 | tilemap_t *m_fg_tilemap; |
| 39 | 43 | tilemap_t *m_web_tilemap; |
| 40 | 44 | |
| 41 | | UINT8 m_nmi_mask; |
| 42 | | UINT8 m_sound_nmi_mask; |
| 43 | 45 | DECLARE_READ8_MEMBER(fastfred_custom_io_r); |
| 44 | 46 | DECLARE_READ8_MEMBER(flyboy_custom1_io_r); |
| 45 | 47 | DECLARE_READ8_MEMBER(flyboy_custom2_io_r); |
| r243306 | r243307 | |
| 51 | 53 | DECLARE_READ8_MEMBER(imago_sprites_offset_r); |
| 52 | 54 | DECLARE_WRITE8_MEMBER(nmi_mask_w); |
| 53 | 55 | DECLARE_WRITE8_MEMBER(sound_nmi_mask_w); |
| 56 | DECLARE_WRITE8_MEMBER(fastfred_videoram_w); |
| 57 | DECLARE_WRITE8_MEMBER(fastfred_attributes_w); |
| 58 | DECLARE_WRITE8_MEMBER(fastfred_charbank1_w); |
| 59 | DECLARE_WRITE8_MEMBER(fastfred_charbank2_w); |
| 60 | DECLARE_WRITE8_MEMBER(fastfred_colorbank1_w); |
| 61 | DECLARE_WRITE8_MEMBER(fastfred_colorbank2_w); |
| 62 | DECLARE_WRITE8_MEMBER(fastfred_flip_screen_x_w); |
| 63 | DECLARE_WRITE8_MEMBER(fastfred_flip_screen_y_w); |
| 64 | DECLARE_WRITE8_MEMBER(imago_fg_videoram_w); |
| 65 | DECLARE_WRITE8_MEMBER(imago_charbank_w); |
| 66 | |
| 54 | 67 | DECLARE_DRIVER_INIT(fastfred); |
| 55 | 68 | DECLARE_DRIVER_INIT(flyboy); |
| 56 | 69 | DECLARE_DRIVER_INIT(flyboyb); |
| r243306 | r243307 | |
| 58 | 71 | DECLARE_DRIVER_INIT(boggy84); |
| 59 | 72 | DECLARE_DRIVER_INIT(jumpcoas); |
| 60 | 73 | DECLARE_DRIVER_INIT(boggy84b); |
| 74 | |
| 61 | 75 | TILE_GET_INFO_MEMBER(get_tile_info); |
| 62 | 76 | TILE_GET_INFO_MEMBER(imago_get_tile_info_bg); |
| 63 | 77 | TILE_GET_INFO_MEMBER(imago_get_tile_info_fg); |
| 64 | 78 | TILE_GET_INFO_MEMBER(imago_get_tile_info_web); |
| 65 | | DECLARE_VIDEO_START(fastfred); |
| 79 | |
| 80 | INTERRUPT_GEN_MEMBER(vblank_irq); |
| 81 | INTERRUPT_GEN_MEMBER(sound_timer_irq); |
| 82 | |
| 83 | virtual void machine_start(); |
| 66 | 84 | DECLARE_PALETTE_INIT(fastfred); |
| 67 | 85 | DECLARE_MACHINE_START(imago); |
| 86 | DECLARE_VIDEO_START(fastfred); |
| 68 | 87 | DECLARE_VIDEO_START(imago); |
| 88 | |
| 69 | 89 | UINT32 screen_update_fastfred(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 70 | 90 | UINT32 screen_update_imago(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 71 | | INTERRUPT_GEN_MEMBER(vblank_irq); |
| 72 | | INTERRUPT_GEN_MEMBER(sound_timer_irq); |
| 73 | 91 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 74 | | DECLARE_WRITE8_MEMBER(fastfred_videoram_w); |
| 75 | | DECLARE_WRITE8_MEMBER(fastfred_attributes_w); |
| 76 | | DECLARE_WRITE8_MEMBER(fastfred_charbank1_w); |
| 77 | | DECLARE_WRITE8_MEMBER(fastfred_charbank2_w); |
| 78 | | DECLARE_WRITE8_MEMBER(fastfred_colorbank1_w); |
| 79 | | DECLARE_WRITE8_MEMBER(fastfred_colorbank2_w); |
| 80 | | DECLARE_WRITE8_MEMBER(fastfred_flip_screen_x_w); |
| 81 | | DECLARE_WRITE8_MEMBER(fastfred_flip_screen_y_w); |
| 82 | | |
| 83 | | DECLARE_WRITE8_MEMBER(imago_fg_videoram_w); |
| 84 | | DECLARE_WRITE8_MEMBER(imago_charbank_w); |
| 85 | 92 | }; |
trunk/src/mess/drivers/wildfire.c
| r243306 | r243307 | |
| 31 | 31 | required_device<cpu_device> m_maincpu; |
| 32 | 32 | required_device<speaker_sound_device> m_speaker; |
| 33 | 33 | |
| 34 | DECLARE_WRITE8_MEMBER(write_d); |
| 35 | DECLARE_WRITE16_MEMBER(write_a); |
| 36 | |
| 34 | 37 | virtual void machine_start(); |
| 35 | 38 | }; |
| 36 | 39 | |
| r243306 | r243307 | |
| 41 | 44 | |
| 42 | 45 | ***************************************************************************/ |
| 43 | 46 | |
| 44 | | //.. |
| 47 | WRITE8_MEMBER(wildfire_state::write_d) |
| 48 | { |
| 49 | } |
| 45 | 50 | |
| 51 | WRITE16_MEMBER(wildfire_state::write_a) |
| 52 | { |
| 53 | } |
| 46 | 54 | |
| 47 | 55 | |
| 56 | |
| 48 | 57 | /*************************************************************************** |
| 49 | 58 | |
| 50 | 59 | Inputs |
| r243306 | r243307 | |
| 52 | 61 | ***************************************************************************/ |
| 53 | 62 | |
| 54 | 63 | static INPUT_PORTS_START( wildfire ) |
| 64 | PORT_START("IN1") // I |
| 65 | PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_BUTTON3 ) PORT_NAME("Shooter Button") |
| 66 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_BUTTON1 ) PORT_NAME("Left Flipper") |
| 67 | PORT_BIT( 0x04, IP_ACTIVE_HIGH, IPT_BUTTON2 ) PORT_NAME("Right Flipper") |
| 68 | PORT_BIT( 0x08, IP_ACTIVE_HIGH, IPT_UNUSED ) |
| 55 | 69 | INPUT_PORTS_END |
| 56 | 70 | |
| 57 | 71 | |
| r243306 | r243307 | |
| 71 | 85 | |
| 72 | 86 | /* basic machine hardware */ |
| 73 | 87 | MCFG_CPU_ADD("maincpu", AMI_S2150, MASTER_CLOCK) |
| 88 | MCFG_AMI_S2000_READ_I_CB(IOPORT("IN1")) |
| 89 | MCFG_AMI_S2000_WRITE_D_CB(WRITE8(wildfire_state, write_d)) |
| 90 | MCFG_AMI_S2000_WRITE_A_CB(WRITE16(wildfire_state, write_a)) |
| 74 | 91 | |
| 75 | 92 | MCFG_DEFAULT_LAYOUT(layout_wildfire) |
| 76 | 93 | |
| r243306 | r243307 | |
| 91 | 108 | ***************************************************************************/ |
| 92 | 109 | |
| 93 | 110 | ROM_START( wildfire ) |
| 94 | | ROM_REGION( 0x0600, "maincpu", 0 ) |
| 95 | | ROM_LOAD( "us4341385", 0x0000, 0x0600, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums) |
| 111 | ROM_REGION( 0x0800, "maincpu", ROMREGION_ERASE00 ) |
| 112 | ROM_LOAD( "us4341385", 0x0000, 0x0400, CRC(84ac0f1f) SHA1(1e00ddd402acfc2cc267c34eed4b89d863e2144f) ) // from patent US4334679, data should be correct (it included checksums) |
| 113 | ROM_CONTINUE( 0x0600, 0x0200 ) |
| 96 | 114 | ROM_END |
| 97 | 115 | |
| 98 | 116 | |