src/mess/drivers/tsispch.c
| r10868 | r10869 | |
| 17 | 17 | * Correctly load UPD7720 roms as UPD7725 data - done, this is utterly disgusting code. |
| 18 | 18 | * Attached i8251a uart at u15 |
| 19 | 19 | * Added dipswitch array S4 |
| 20 | * Attached 8259 PIC - done, but int sources are not hooked up yet, also not sure if callback is done properly |
| 20 | 21 | * |
| 21 | 22 | * TODO: |
| 22 | 23 | * Hook the terminal to the i8251a uart at u15 |
| r10868 | r10869 | |
| 24 | 25 | * Attach the other i8251a uart (assuming it is hooked to the hardware at all!) |
| 25 | 26 | * Correctly implement UPD7720 cpu core to avoid needing revolting conversion code |
| 26 | 27 | * Correct memory maps and io maps - partly done |
| 27 | | * Attach 8259 PIC and figure out where all the ints come from |
| 28 | * 8259 PIC: figure out where all the ints come from |
| 28 | 29 | * Add other dipswitches and jumpers (these may actually just control clock dividers for the two 8251s) |
| 29 | 30 | * Everything else |
| 30 | 31 | * |
| r10868 | r10869 | |
| 41 | 42 | #include "cpu/upd7725/upd7725.h" |
| 42 | 43 | #include "cpu/i86/i86.h" |
| 43 | 44 | #include "machine/msm8251.h" |
| 45 | #include "machine/pic8259.h" |
| 44 | 46 | #include "machine/terminal.h" |
| 45 | 47 | |
| 46 | 48 | /* |
| r10868 | r10869 | |
| 58 | 60 | return 0x00ea; // does exactly what it says on the tin |
| 59 | 61 | }*/ |
| 60 | 62 | |
| 61 | | /* led/dipswitch stuff */ |
| 63 | /***************************************************************************** |
| 64 | PIC 8259 stuff |
| 65 | *****************************************************************************/ |
| 66 | static WRITE_LINE_DEVICE_HANDLER( pic8259_set_int_line ) |
| 67 | { |
| 68 | cputag_set_input_line(device->machine, "maincpu", 0, state ? HOLD_LINE : CLEAR_LINE); |
| 69 | } |
| 70 | |
| 71 | static const struct pic8259_interface pic8259_config = |
| 72 | { |
| 73 | DEVCB_LINE(pic8259_set_int_line) |
| 74 | }; |
| 75 | |
| 76 | static IRQ_CALLBACK(irq_callback) |
| 77 | { |
| 78 | int r = 0; |
| 79 | r = pic8259_acknowledge(device->machine->device("pic8259")); |
| 80 | return r; |
| 81 | } |
| 82 | |
| 83 | /***************************************************************************** |
| 84 | LED/dipswitch stuff |
| 85 | *****************************************************************************/ |
| 62 | 86 | READ8_MEMBER( tsispch_state::dsw_r ) |
| 63 | 87 | { |
| 64 | 88 | UINT8 data; |
| r10868 | r10869 | |
| 94 | 118 | popmessage("LED status: (%x) %x %x %x %x (%x %x %x)\n", BIT(data,7), BIT(data,6), BIT(data,5), BIT(data,4), BIT(data,3), BIT(data,2), BIT(data,1), BIT(data,0)); |
| 95 | 119 | } |
| 96 | 120 | |
| 97 | | |
| 98 | | /* upd7720 stuff */ |
| 99 | | |
| 121 | /***************************************************************************** |
| 122 | UPD77P20 stuff |
| 123 | *****************************************************************************/ |
| 100 | 124 | READ16_MEMBER( tsispch_state::dsp_data_r ) |
| 101 | 125 | { |
| 102 | 126 | upd7725_device *upd7725 = machine->device<upd7725_device>("dsp"); |
| r10868 | r10869 | |
| 136 | 160 | upd7725->snesdsp_write(false, data); |
| 137 | 161 | } |
| 138 | 162 | |
| 139 | | /* Reset */ |
| 163 | /***************************************************************************** |
| 164 | Reset and Driver Init |
| 165 | *****************************************************************************/ |
| 140 | 166 | void tsispch_state::machine_reset() |
| 141 | 167 | { |
| 142 | 168 | // clear fifos (TODO: memset would work better here...) |
| 143 | 169 | int i; |
| 144 | 170 | for (i=0; i<32; i++) infifo[i] = 0; |
| 145 | 171 | infifo_tail_ptr = infifo_head_ptr = 0; |
| 172 | cpu_set_irq_callback(machine->device("maincpu"), irq_callback); |
| 146 | 173 | // below seem to be unnecessary? |
| 147 | 174 | //cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, ASSERT_LINE); |
| 148 | 175 | //cputag_set_input_line(machine, "dsp", INPUT_LINE_RESET, CLEAR_LINE); |
| r10868 | r10869 | |
| 219 | 246 | AM_RANGE(0x00000, 0x02FFF) AM_MIRROR(0x34000) AM_RAM // verified; 6264*2 sram, only first 3/4 used |
| 220 | 247 | AM_RANGE(0x03000, 0x03001) AM_MIRROR(0x341FC) AM_DEVREADWRITE8_LEGACY("i8251a_u15", msm8251_data_r, msm8251_data_w, 0x00FF) |
| 221 | 248 | AM_RANGE(0x03002, 0x03003) AM_MIRROR(0x341FC) AM_DEVREADWRITE8_LEGACY("i8251a_u15", msm8251_status_r, msm8251_control_w, 0x00FF) |
| 222 | | //AM_RANGE(0x03200, 0x03203) AM_MIRROR(0x341FC) // AMD P8259 PIC @ U5 (reads as 04 and 7c, upper byte is open bus) |
| 249 | AM_RANGE(0x03200, 0x03203) AM_MIRROR(0x341FC) AM_DEVREADWRITE8_LEGACY("pic8259", pic8259_r, pic8259_w, 0x00FF) // AMD P8259 PIC @ U5 (reads as 04 and 7c, upper byte is open bus) |
| 223 | 250 | AM_RANGE(0x03400, 0x03401) AM_MIRROR(0x341FE) AM_READ8(dsw_r, 0x00FF) // verified, read from dipswitch s4 |
| 224 | 251 | AM_RANGE(0x03400, 0x03401) AM_MIRROR(0x341FE) AM_WRITE8(led_w, 0xFF00) // verified, write to the 4 leds, plus 4 other mystery bits |
| 225 | 252 | AM_RANGE(0x03600, 0x03601) AM_MIRROR(0x341FC) AM_READWRITE(dsp_data_r, dsp_data_w) // verified; UPD77P20 data reg r/w |
| r10868 | r10869 | |
| 287 | 314 | MCFG_CPU_PROGRAM_MAP(dsp_prg_map) |
| 288 | 315 | MCFG_CPU_DATA_MAP(dsp_data_map) |
| 289 | 316 | |
| 317 | /* PIC 8259 */ |
| 318 | MCFG_PIC8259_ADD("pic8259", pic8259_config) |
| 319 | |
| 290 | 320 | /* uarts */ |
| 291 | 321 | MCFG_MSM8251_ADD("i8251a_u15", default_msm8251_interface) |
| 292 | 322 | |