src/mess/machine/rmnimbus.c
| r0 | r6793 | |
| 1 | /* |
| 2 | machine/rmnimbus.c
|
| 3 | |
| 4 | Machine driver for the Research Machines Nimbus.
|
| 5 | |
| 6 | Phill Harvey-Smith
|
| 7 | 2009-11-29.
|
| 8 | |
| 9 | 80186 internal DMA/Timer/PIC code borrowed from Compis driver.
|
| 10 | Perhaps this needs merging into the 80186 core.....
|
| 11 | */
|
| 12 | |
| 13 | |
| 14 | #include "driver.h"
|
| 15 | #include "memory.h"
|
| 16 | #include "cpu/i86/i86.h"
|
| 17 | #include "debug/debugcpu.h"
|
| 18 | #include "debug/debugcon.h"
|
| 19 | #include "devices/flopdrv.h"
|
| 20 | #include "machine/pic8259.h"
|
| 21 | #include "machine/pit8253.h"
|
| 22 | #include "machine/msm8251.h"
|
| 23 | #include "machine/z80sio.h"
|
| 24 | |
| 25 | #include "includes/rmnimbus.h"
|
| 26 | |
| 27 | /*-------------------------------------------------------------------------*/
|
| 28 | /* Defines, constants, and global variables */
|
| 29 | /*-------------------------------------------------------------------------*/
|
| 30 | |
| 31 | /* CPU 80186 */
|
| 32 | #define LATCH_INTS 1
|
| 33 | #define LOG_PORTS 0
|
| 34 | #define LOG_INTERRUPTS 0
|
| 35 | #define LOG_INTERRUPTS_EXT 0
|
| 36 | #define LOG_TIMER 0
|
| 37 | #define LOG_OPTIMIZATION 0
|
| 38 | #define LOG_DMA 1
|
| 39 | #define CPU_RESUME_TRIGGER 7123
|
| 40 | |
| 41 | /* 80186 internal stuff */
|
| 42 | struct mem_state
|
| 43 | {
|
| 44 | UINT16 lower;
|
| 45 | UINT16 upper;
|
| 46 | UINT16 middle;
|
| 47 | UINT16 middle_size;
|
| 48 | UINT16 peripheral;
|
| 49 | };
|
| 50 | |
| 51 | struct timer_state
|
| 52 | {
|
| 53 | UINT16 control;
|
| 54 | UINT16 maxA;
|
| 55 | UINT16 maxB;
|
| 56 | UINT16 count;
|
| 57 | emu_timer *int_timer;
|
| 58 | emu_timer *time_timer;
|
| 59 | UINT8 time_timer_active;
|
| 60 | attotime last_time;
|
| 61 | };
|
| 62 | |
| 63 | struct dma_state
|
| 64 | {
|
| 65 | UINT32 source;
|
| 66 | UINT32 dest;
|
| 67 | UINT16 count;
|
| 68 | UINT16 control;
|
| 69 | UINT8 finished;
|
| 70 | emu_timer *finish_timer;
|
| 71 | };
|
| 72 | |
| 73 | struct intr_state
|
| 74 | {
|
| 75 | UINT8 pending;
|
| 76 | UINT16 ack_mask;
|
| 77 | UINT16 priority_mask;
|
| 78 | UINT16 in_service;
|
| 79 | UINT16 request;
|
| 80 | UINT16 status;
|
| 81 | UINT16 poll_status;
|
| 82 | UINT16 timer;
|
| 83 | UINT16 dma[2];
|
| 84 | UINT16 ext[4];
|
| 85 | UINT16 ext_vector[2]; // external vectors, when in cascade mode
|
| 86 | };
|
| 87 | |
| 88 | static struct i186_state
|
| 89 | {
|
| 90 | struct timer_state timer[3];
|
| 91 | struct dma_state dma[2];
|
| 92 | struct intr_state intr;
|
| 93 | struct mem_state mem;
|
| 94 | } i186;
|
| 95 | |
| 96 | |
| 97 | /* Z80 SIO */
|
| 98 | |
| 99 | const z80sio_interface sio_intf =
|
| 100 | {
|
| 101 | sio_interrupt, /* interrupt handler */
|
| 102 | 0, //sio_dtr_w, /* DTR changed handler */
|
| 103 | 0, /* RTS changed handler */
|
| 104 | 0, /* BREAK changed handler */
|
| 105 | sio_serial_transmit, /* transmit handler */
|
| 106 | sio_serial_receive /* receive handler */
|
| 107 | };
|
| 108 | |
| 109 | static UINT8 keyrows[NIMBUS_KEYROWS];
|
| 110 | |
| 111 | /* Floppy drives WD2793 */
|
| 112 | |
| 113 | static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_intrq_w );
|
| 114 | static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_drq_w );
|
| 115 | |
| 116 | const wd17xx_interface nimbus_wd17xx_interface =
|
| 117 | {
|
| 118 | DEVCB_LINE(nimbus_fdc_intrq_w),
|
| 119 | DEVCB_LINE(nimbus_fdc_drq_w),
|
| 120 | {FLOPPY_0, FLOPPY_1, FLOPPY_2, FLOPPY_3}
|
| 121 | };
|
| 122 | |
| 123 | static struct _nimbus_fdc
|
| 124 | {
|
| 125 | UINT8 drq_enabled;
|
| 126 | UINT8 irq_enabled;
|
| 127 | UINT8 diskno;
|
| 128 | UINT8 motor_on;
|
| 129 | } nimbus_fdc;
|
| 130 | |
| 131 | |
| 132 | static void drq_callback(running_machine *machine, int which);
|
| 133 | |
| 134 | static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[]);
|
| 135 | static void execute_debug_intmasks(running_machine *machine, int ref, int params, const char *param[]);
|
| 136 | static void execute_debug_key(running_machine *machine, int ref, int params, const char *param[]);
|
| 137 | |
| 138 | static int instruction_hook(const device_config *device, offs_t curpc);
|
| 139 | static void decode_subbios(const device_config *device,offs_t pc);
|
| 140 | static void decode_dssi_f_fill_area(const device_config *device,UINT16 ds, UINT16 si);
|
| 141 | static void decode_dssi_f_plot_character_string(const device_config *device,UINT16 ds, UINT16 si);
|
| 142 | static void decode_dssi_f_set_new_clt(const device_config *device,UINT16 ds, UINT16 si);
|
| 143 | static void fdc_reset(void);
|
| 144 | |
| 145 | |
| 146 | #define num_ioports 0x80
|
| 147 | static UINT16 IOPorts[num_ioports];
|
| 148 | |
| 149 | UINT8 nextkey;
|
| 150 | UINT8 sio_int_state;
|
| 151 | |
| 152 | /*************************************
|
| 153 | *
|
| 154 | * 80186 interrupt controller
|
| 155 | *
|
| 156 | *************************************/
|
| 157 | static IRQ_CALLBACK(int_callback)
|
| 158 | {
|
| 159 | UINT8 vector;
|
| 160 | UINT16 old;
|
| 161 | UINT16 oldreq;
|
| 162 | |
| 163 | if (LOG_INTERRUPTS)
|
| 164 | logerror("(%f) **** Acknowledged interrupt vector %02X\n", attotime_to_double(timer_get_time(device->machine)), i186.intr.poll_status & 0x1f);
|
| 165 | |
| 166 | /* clear the interrupt */
|
| 167 | cpu_set_input_line(device, 0, CLEAR_LINE);
|
| 168 | i186.intr.pending = 0;
|
| 169 | |
| 170 | oldreq=i186.intr.request;
|
| 171 | |
| 172 | /* clear the request and set the in-service bit */
|
| 173 | #if LATCH_INTS
|
| 174 | i186.intr.request &= ~i186.intr.ack_mask;
|
| 175 | #else
|
| 176 | i186.intr.request &= ~(i186.intr.ack_mask & 0x0f);
|
| 177 | #endif
|
| 178 | |
| 179 | if(i186.intr.request!=oldreq)
|
| 180 | logerror("i186.intr.request changed from %02X to %02X\n",oldreq,i186.intr.request);
|
| 181 | |
| 182 | old=i186.intr.in_service;
|
| 183 | |
| 184 | i186.intr.in_service |= i186.intr.ack_mask;
|
| 185 |
|
| 186 | if (LOG_INTERRUPTS)
|
| 187 | if(i186.intr.in_service!=old)
|
| 188 | logerror("i186.intr.in_service changed from %02X to %02X\n",old,i186.intr.in_service);
|
| 189 | |
| 190 | if (i186.intr.ack_mask == 0x0001)
|
| 191 | {
|
| 192 | switch (i186.intr.poll_status & 0x1f)
|
| 193 | {
|
| 194 | case 0x08: i186.intr.status &= ~0x01; break;
|
| 195 | case 0x12: i186.intr.status &= ~0x02; break;
|
| 196 | case 0x13: i186.intr.status &= ~0x04; break;
|
| 197 | }
|
| 198 | }
|
| 199 | i186.intr.ack_mask = 0;
|
| 200 | |
| 201 | /* a request no longer pending */
|
| 202 | i186.intr.poll_status &= ~0x8000;
|
| 203 | |
| 204 | /* return the vector */
|
| 205 | switch(i186.intr.poll_status & 0x1F)
|
| 206 | {
|
| 207 | case 0x0C : vector=(i186.intr.ext[0] & EXTINT_CTRL_CASCADE) ? i186.intr.ext_vector[0] : (i186.intr.poll_status & 0x1f); logerror("int 0x0c vector=%02X\n",vector); break;
|
| 208 | case 0x0D : vector=(i186.intr.ext[1] & EXTINT_CTRL_CASCADE) ? i186.intr.ext_vector[1] : (i186.intr.poll_status & 0x1f); logerror("int 0x0D vector=%02X\n",vector); break;
|
| 209 | default :
|
| 210 | vector=i186.intr.poll_status & 0x1f; break;
|
| 211 | }
|
| 212 | |
| 213 | if (LOG_INTERRUPTS_EXT)
|
| 214 | {
|
| 215 | logerror("i186.intr.ext[0]=%04X i186.intr.ext[1]=%04X\n",i186.intr.ext[0],i186.intr.ext[1]);
|
| 216 | logerror("Ext vectors : %02X %02X\n",i186.intr.ext_vector[0],i186.intr.ext_vector[1]);
|
| 217 | logerror("Calling vector %02X\n",vector);
|
| 218 | }
|
| 219 | |
| 220 | return vector;
|
| 221 | }
|
| 222 | |
| 223 | |
| 224 | static void update_interrupt_state(running_machine *machine)
|
| 225 | {
|
| 226 | int new_vector = 0;
|
| 227 | int Priority;
|
| 228 | int IntNo;
|
| 229 | |
| 230 | if (LOG_INTERRUPTS) |
| 231 | logerror("update_interrupt_status: req=%04X stat=%04X serv=%04X priority_mask=%4X\n", i186.intr.request, i186.intr.status, i186.intr.in_service, i186.intr.priority_mask);
|
| 232 | |
| 233 | /* loop over priorities */
|
| 234 | for (Priority = 0; Priority <= i186.intr.priority_mask; Priority++)
|
| 235 | {
|
| 236 | /* note: by checking 4 bits, we also verify that the mask is off */
|
| 237 | if ((i186.intr.timer & 15) == Priority)
|
| 238 | {
|
| 239 | /* if we're already servicing something at this level, don't generate anything new */
|
| 240 | if (i186.intr.in_service & 0x01)
|
| 241 | return;
|
| 242 | |
| 243 | /* if there's something pending, generate an interrupt */
|
| 244 | if (i186.intr.status & 0x07)
|
| 245 | {
|
| 246 | if (i186.intr.status & 1)
|
| 247 | new_vector = 0x08;
|
| 248 | else if (i186.intr.status & 2)
|
| 249 | new_vector = 0x12;
|
| 250 | else if (i186.intr.status & 4)
|
| 251 | new_vector = 0x13;
|
| 252 | else
|
| 253 | popmessage("Invalid timer interrupt!");
|
| 254 | |
| 255 | /* set the clear mask and generate the int */
|
| 256 | i186.intr.ack_mask = 0x0001;
|
| 257 | goto generate_int;
|
| 258 | }
|
| 259 | }
|
| 260 | |
| 261 | /* check DMA interrupts */
|
| 262 | for (IntNo = 0; IntNo < 2; IntNo++)
|
| 263 | if ((i186.intr.dma[IntNo] & 0x0F) == Priority)
|
| 264 | {
|
| 265 | /* if we're already servicing something at this level, don't generate anything new */
|
| 266 | if (i186.intr.in_service & (0x04 << IntNo))
|
| 267 | return;
|
| 268 | |
| 269 | /* if there's something pending, generate an interrupt */
|
| 270 | if (i186.intr.request & (0x04 << IntNo))
|
| 271 | {
|
| 272 | new_vector = 0x0a + IntNo;
|
| 273 | |
| 274 | /* set the clear mask and generate the int */
|
| 275 | i186.intr.ack_mask = 0x0004 << IntNo;
|
| 276 | goto generate_int;
|
| 277 | }
|
| 278 | }
|
| 279 | |
| 280 | //logerror("Checking external ints\n");
|
| 281 | /* check external interrupts */
|
| 282 | for (IntNo = 0; IntNo < 4; IntNo++)
|
| 283 | if ((i186.intr.ext[IntNo] & 0x0F) == Priority)
|
| 284 | {
|
| 285 | if (LOG_INTERRUPTS)
|
| 286 | logerror("Int%d priority=%d\n",IntNo,Priority);
|
| 287 | |
| 288 | /* if we're already servicing something at this level, don't generate anything new */
|
| 289 | if (i186.intr.in_service & (0x10 << IntNo))
|
| 290 | return;
|
| 291 | |
| 292 | /* if there's something pending, generate an interrupt */
|
| 293 | if (i186.intr.request & (0x10 << IntNo))
|
| 294 | {
|
| 295 | /* otherwise, generate an interrupt for this request */
|
| 296 | new_vector = 0x0c + IntNo;
|
| 297 | |
| 298 | /* set the clear mask and generate the int */
|
| 299 | i186.intr.ack_mask = 0x0010 << IntNo;
|
| 300 | logerror("External int !\n");
|
| 301 | goto generate_int;
|
| 302 | }
|
| 303 | }
|
| 304 | }
|
| 305 | return;
|
| 306 | |
| 307 | generate_int:
|
| 308 | /* generate the appropriate interrupt */
|
| 309 | i186.intr.poll_status = 0x8000 | new_vector;
|
| 310 | if (!i186.intr.pending)
|
| 311 | cputag_set_input_line(machine, MAINCPU_TAG, 0, ASSERT_LINE);
|
| 312 | i186.intr.pending = 1;
|
| 313 | cpuexec_trigger(machine, CPU_RESUME_TRIGGER);
|
| 314 | if (LOG_OPTIMIZATION) logerror(" - trigger due to interrupt pending\n");
|
| 315 | if (LOG_INTERRUPTS) logerror("(%f) **** Requesting interrupt vector %02X\n", attotime_to_double(timer_get_time(machine)), new_vector);
|
| 316 | }
|
| 317 | |
| 318 | |
| 319 | static void handle_eoi(running_machine *machine,int data)
|
| 320 | {
|
| 321 | int Priority;
|
| 322 | int IntNo;
|
| 323 | |
| 324 | /* specific case */
|
| 325 | if (!(data & 0x8000))
|
| 326 | {
|
| 327 | /* turn off the appropriate in-service bit */
|
| 328 | switch (data & 0x1f)
|
| 329 | {
|
| 330 | case 0x08: i186.intr.in_service &= ~0x01; break;
|
| 331 | case 0x12: i186.intr.in_service &= ~0x01; break;
|
| 332 | case 0x13: i186.intr.in_service &= ~0x01; break;
|
| 333 | case 0x0a: i186.intr.in_service &= ~0x04; break;
|
| 334 | case 0x0b: i186.intr.in_service &= ~0x08; break;
|
| 335 | case 0x0c: i186.intr.in_service &= ~0x10; break;
|
| 336 | case 0x0d: i186.intr.in_service &= ~0x20; break;
|
| 337 | case 0x0e: i186.intr.in_service &= ~0x40; break;
|
| 338 | case 0x0f: i186.intr.in_service &= ~0x80; break;
|
| 339 | default: logerror("%05X:ERROR - 80186 EOI with unknown vector %02X\n", cpu_get_pc(cputag_get_cpu(machine, MAINCPU_TAG)), data & 0x1f);
|
| 340 | }
|
| 341 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for vector %02X\n", attotime_to_double(timer_get_time(machine)), data & 0x1f);
|
| 342 | }
|
| 343 | |
| 344 | /* non-specific case */
|
| 345 | else
|
| 346 | {
|
| 347 | /* loop over priorities */
|
| 348 | for (Priority = 0; Priority <= 7; Priority++)
|
| 349 | {
|
| 350 | /* check for in-service timers */
|
| 351 | if ((i186.intr.timer & 0x07) == Priority && (i186.intr.in_service & 0x01))
|
| 352 | {
|
| 353 | i186.intr.in_service &= ~0x01;
|
| 354 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", attotime_to_double(timer_get_time(machine)));
|
| 355 | return;
|
| 356 | }
|
| 357 | |
| 358 | /* check for in-service DMA interrupts */
|
| 359 | for (IntNo = 0; IntNo < 2; IntNo++)
|
| 360 | if ((i186.intr.dma[IntNo] & 0x07) == Priority && (i186.intr.in_service & (0x04 << IntNo)))
|
| 361 | {
|
| 362 | i186.intr.in_service &= ~(0x04 << IntNo);
|
| 363 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", attotime_to_double(timer_get_time(machine)), IntNo);
|
| 364 | return;
|
| 365 | }
|
| 366 | |
| 367 | /* check external interrupts */
|
| 368 | for (IntNo = 0; IntNo < 4; IntNo++)
|
| 369 | if ((i186.intr.ext[IntNo] & 0x07) == Priority && (i186.intr.in_service & (0x10 << IntNo)))
|
| 370 | {
|
| 371 | i186.intr.in_service &= ~(0x10 << IntNo);
|
| 372 | if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", attotime_to_double(timer_get_time(machine)), IntNo);
|
| 373 | return;
|
| 374 | }
|
| 375 | }
|
| 376 | }
|
| 377 | }
|
| 378 | |
| 379 | /* Trigger an external interupt, optionally supplying the vector to take */
|
| 380 | static void external_int(running_machine *machine, UINT16 intno, UINT8 vector)
|
| 381 | {
|
| 382 | if (LOG_INTERRUPTS_EXT) logerror("generating external int %02X, vector %02X\n",intno,vector);
|
| 383 |
|
| 384 | // Only 4 external ints
|
| 385 | if(intno>3)
|
| 386 | {
|
| 387 | logerror("external_int() invalid external interupt no : 0x%02X (can only be 0..3)\n",intno);
|
| 388 | return;
|
| 389 | }
|
| 390 | |
| 391 | // Only set external vector if cascade mode enabled, only valid for
|
| 392 | // int 0 & int 1
|
| 393 | if (intno<2)
|
| 394 | {
|
| 395 | if(i186.intr.ext[intno] & EXTINT_CTRL_CASCADE)
|
| 396 | i186.intr.ext_vector[intno]=vector;
|
| 397 | }
|
| 398 | |
| 399 | // Turn on the requested request bit and handle interrupt
|
| 400 | i186.intr.request |= (0x010 << intno);
|
| 401 | update_interrupt_state(machine);
|
| 402 | }
|
| 403 | |
| 404 | |
| 405 | /*************************************
|
| 406 | *
|
| 407 | * 80186 internal timers
|
| 408 | *
|
| 409 | *************************************/
|
| 410 | |
| 411 | static TIMER_CALLBACK(internal_timer_int)
|
| 412 | {
|
| 413 | int which = param;
|
| 414 | struct timer_state *t = &i186.timer[which];
|
| 415 | |
| 416 | if (LOG_TIMER) logerror("Hit interrupt callback for timer %d\n", which);
|
| 417 | |
| 418 | /* set the max count bit */
|
| 419 | t->control |= 0x0020;
|
| 420 | |
| 421 | /* request an interrupt */
|
| 422 | if (t->control & 0x2000)
|
| 423 | {
|
| 424 | i186.intr.status |= 0x01 << which;
|
| 425 | update_interrupt_state(machine);
|
| 426 | if (LOG_TIMER) logerror(" Generating timer interrupt\n");
|
| 427 | }
|
| 428 | |
| 429 | /* if we're continuous, reset */
|
| 430 | if (t->control & 0x0001)
|
| 431 | {
|
| 432 | int count = t->maxA ? t->maxA : 0x10000;
|
| 433 | timer_adjust_oneshot(t->int_timer, attotime_mul(ATTOTIME_IN_HZ(2000000), count), which);
|
| 434 | if (LOG_TIMER) logerror(" Repriming interrupt\n");
|
| 435 | }
|
| 436 | else
|
| 437 | timer_adjust_oneshot(t->int_timer, attotime_never, which);
|
| 438 | }
|
| 439 | |
| 440 | |
| 441 | static void internal_timer_sync(int which)
|
| 442 | {
|
| 443 | struct timer_state *t = &i186.timer[which];
|
| 444 | |
| 445 | /* if we have a timing timer running, adjust the count */
|
| 446 | if (t->time_timer_active)
|
| 447 | {
|
| 448 | attotime current_time = timer_timeelapsed(t->time_timer);
|
| 449 | int net_clocks = attotime_mul(attotime_sub(current_time, t->last_time), 2000000).seconds;
|
| 450 | t->last_time = current_time;
|
| 451 | |
| 452 | /* set the max count bit if we passed the max */
|
| 453 | if ((int)t->count + net_clocks >= t->maxA)
|
| 454 | t->control |= 0x0020;
|
| 455 | |
| 456 | /* set the new count */
|
| 457 | if (t->maxA != 0)
|
| 458 | t->count = (t->count + net_clocks) % t->maxA;
|
| 459 | else
|
| 460 | t->count = t->count + net_clocks;
|
| 461 | }
|
| 462 | }
|
| 463 | |
| 464 | |
| 465 | static void internal_timer_update(running_machine *machine,
|
| 466 | int which,
|
| 467 | int new_count,
|
| 468 | int new_maxA,
|
| 469 | int new_maxB,
|
| 470 | int new_control)
|
| 471 | {
|
| 472 | struct timer_state *t = &i186.timer[which];
|
| 473 | int update_int_timer = 0;
|
| 474 | |
| 475 | logerror("internal_timer_update: %d, new_count=%d, new_maxA=%d, new_maxB=%d,new_control=%d",which,new_count,new_maxA,new_maxB,new_control);
|
| 476 | |
| 477 | /* if we have a new count and we're on, update things */
|
| 478 | if (new_count != -1)
|
| 479 | {
|
| 480 | if (t->control & 0x8000)
|
| 481 | {
|
| 482 | internal_timer_sync(which);
|
| 483 | update_int_timer = 1;
|
| 484 | }
|
| 485 | t->count = new_count;
|
| 486 | }
|
| 487 | |
| 488 | /* if we have a new max and we're on, update things */
|
| 489 | if (new_maxA != -1 && new_maxA != t->maxA)
|
| 490 | {
|
| 491 | if (t->control & 0x8000)
|
| 492 | {
|
| 493 | internal_timer_sync(which);
|
| 494 | update_int_timer = 1;
|
| 495 | }
|
| 496 | t->maxA = new_maxA;
|
| 497 | if (new_maxA == 0)
|
| 498 | {
|
| 499 | new_maxA = 0x10000;
|
| 500 | }
|
| 501 | }
|
| 502 | |
| 503 | /* if we have a new max and we're on, update things */
|
| 504 | if (new_maxB != -1 && new_maxB != t->maxB)
|
| 505 | {
|
| 506 | if (t->control & 0x8000)
|
| 507 | {
|
| 508 | internal_timer_sync(which);
|
| 509 | update_int_timer = 1;
|
| 510 | }
|
| 511 | |
| 512 | t->maxB = new_maxB;
|
| 513 | |
| 514 | if (new_maxB == 0)
|
| 515 | {
|
| 516 | new_maxB = 0x10000;
|
| 517 | }
|
| 518 | }
|
| 519 | |
| 520 | |
| 521 | /* handle control changes */
|
| 522 | if (new_control != -1)
|
| 523 | {
|
| 524 | int diff;
|
| 525 | |
| 526 | /* merge back in the bits we don't modify */
|
| 527 | new_control = (new_control & ~0x1fc0) | (t->control & 0x1fc0);
|
| 528 | |
| 529 | /* handle the /INH bit */
|
| 530 | if (!(new_control & 0x4000))
|
| 531 | new_control = (new_control & ~0x8000) | (t->control & 0x8000);
|
| 532 | new_control &= ~0x4000;
|
| 533 | |
| 534 | /* check for control bits we don't handle */
|
| 535 | diff = new_control ^ t->control;
|
| 536 | if (diff & 0x001c)
|
| 537 | logerror("%05X:ERROR! -unsupported timer mode %04X\n",
|
| 538 | cpu_get_pc(cputag_get_cpu(machine, MAINCPU_TAG)), new_control);
|
| 539 | |
| 540 | /* if we have real changes, update things */
|
| 541 | if (diff != 0)
|
| 542 | {
|
| 543 | |
| 544 | /* if we're going off, make sure our timers are gone */
|
| 545 | if ((diff & 0x8000) && !(new_control & 0x8000))
|
| 546 | {
|
| 547 | /* compute the final count */
|
| 548 | internal_timer_sync(which);
|
| 549 | |
| 550 | /* nuke the timer and force the interrupt timer to be recomputed */
|
| 551 | timer_adjust_oneshot(t->time_timer, attotime_never, which);
|
| 552 | t->time_timer_active = 0;
|
| 553 | update_int_timer = 1;
|
| 554 | }
|
| 555 | |
| 556 | /* if we're going on, start the timers running */
|
| 557 | else if ((diff & 0x8000) && (new_control & 0x8000))
|
| 558 | {
|
| 559 | /* start the timing */
|
| 560 | timer_adjust_oneshot(t->time_timer, attotime_never, which);
|
| 561 | t->time_timer_active = 1;
|
| 562 | update_int_timer = 1;
|
| 563 | }
|
| 564 | |
| 565 | /* if something about the interrupt timer changed, force an update */
|
| 566 | if (!(diff & 0x8000) && (diff & 0x2000))
|
| 567 | {
|
| 568 | internal_timer_sync(which);
|
| 569 | update_int_timer = 1;
|
| 570 | }
|
| 571 | }
|
| 572 | |
| 573 | /* set the new control register */
|
| 574 | t->control = new_control;
|
| 575 | }
|
| 576 | |
| 577 | /* update the interrupt timer */
|
| 578 | if (update_int_timer)
|
| 579 | {
|
| 580 | if ((t->control & 0x8000) && (t->control & 0x2000))
|
| 581 | {
|
| 582 | int diff = t->maxA - t->count;
|
| 583 | if (diff <= 0)
|
| 584 | diff += 0x10000;
|
| 585 | timer_adjust_oneshot(t->int_timer, attotime_mul(ATTOTIME_IN_HZ(2000000), diff), which);
|
| 586 | if (LOG_TIMER) logerror("Set interrupt timer for %d\n", which);
|
| 587 | }
|
| 588 | else
|
| 589 | {
|
| 590 | timer_adjust_oneshot(t->int_timer, attotime_never, which);
|
| 591 | }
|
| 592 | }
|
| 593 | }
|
| 594 | |
| 595 | |
| 596 | |
| 597 | /*************************************
|
| 598 | *
|
| 599 | * 80186 internal DMA
|
| 600 | *
|
| 601 | *************************************/
|
| 602 | |
| 603 | static TIMER_CALLBACK(dma_timer_callback)
|
| 604 | {
|
| 605 | int which = param;
|
| 606 | struct dma_state *d = &i186.dma[which];
|
| 607 | |
| 608 | /* force an update and see if we're really done */
|
| 609 | //stream_update(dma_stream, 0);
|
| 610 | |
| 611 | /* complete the status update */
|
| 612 | d->control &= ~0x0002;
|
| 613 | d->source += d->count;
|
| 614 | d->count = 0;
|
| 615 | |
| 616 | /* check for interrupt generation */
|
| 617 | if (d->control & 0x0100)
|
| 618 | {
|
| 619 | if (LOG_DMA) logerror("DMA%d timer callback - requesting interrupt: count = %04X, source = %04X\n", which, d->count, d->source);
|
| 620 | i186.intr.request |= 0x04 << which;
|
| 621 | update_interrupt_state(machine);
|
| 622 | }
|
| 623 | }
|
| 624 | |
| 625 | |
| 626 | static void update_dma_control(running_machine *machine, int which, int new_control)
|
| 627 | {
|
| 628 | struct dma_state *d = &i186.dma[which];
|
| 629 | int diff;
|
| 630 | |
| 631 | /* handle the CHG bit */
|
| 632 | if (!(new_control & CHG_NOCHG))
|
| 633 | new_control = (new_control & ~ST_STOP) | (d->control & ST_STOP);
|
| 634 | new_control &= ~CHG_NOCHG;
|
| 635 | |
| 636 | /* check for control bits we don't handle */
|
| 637 | diff = new_control ^ d->control;
|
| 638 | if (diff & 0x6811)
|
| 639 | logerror("%05X:ERROR! - unsupported DMA mode %04X\n",
|
| 640 | cpu_get_pc(cputag_get_cpu(machine, MAINCPU_TAG)), new_control);
|
| 641 | |
| 642 | /* if we're going live, set a timer */
|
| 643 | if ((diff & 0x0002) && (new_control & 0x0002))
|
| 644 | {
|
| 645 | /* make sure the parameters meet our expectations */
|
| 646 | if ((new_control & 0xfe00) != 0x1600)
|
| 647 | {
|
| 648 | logerror("Unexpected DMA control %02X\n", new_control);
|
| 649 | }
|
| 650 | else if (/*!is_redline &&*/ ((d->dest & 1) || (d->dest & 0x3f) > 0x0b))
|
| 651 | {
|
| 652 | logerror("Unexpected DMA destination %02X\n", d->dest);
|
| 653 | }
|
| 654 | else if (/*is_redline && */ (d->dest & 0xf000) != 0x4000 && (d->dest & 0xf000) != 0x5000)
|
| 655 | {
|
| 656 | logerror("Unexpected DMA destination %02X\n", d->dest);
|
| 657 | }
|
| 658 | |
| 659 | /* otherwise, set a timer */
|
| 660 | else
|
| 661 | {
|
| 662 | // int count = d->count;
|
| 663 | |
| 664 | /* adjust for redline racer */
|
| 665 | // int dacnum = (d->dest & 0x3f) / 2;
|
| 666 | |
| 667 | if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
|
| 668 | |
| 669 | d->finished = 0;
|
| 670 | /* timer_adjust_oneshot(d->finish_timer,
|
| 671 | ATTOTIME_IN_HZ(dac[dacnum].frequency) * (double)count, which);*/
|
| 672 | }
|
| 673 | }
|
| 674 | |
| 675 | /* set the new control register */
|
| 676 | d->control = new_control;
|
| 677 | }
|
| 678 | |
| 679 | static void drq_callback(running_machine *machine, int which)
|
| 680 | {
|
| 681 | struct dma_state *dma = &i186.dma[which];
|
| 682 | const address_space *memory_space = cpu_get_address_space(cputag_get_cpu(machine, MAINCPU_TAG), ADDRESS_SPACE_PROGRAM);
|
| 683 | const address_space *io_space = cpu_get_address_space(cputag_get_cpu(machine, MAINCPU_TAG), ADDRESS_SPACE_IO);
|
| 684 | |
| 685 | const address_space *src_space;
|
| 686 | const address_space *dest_space;
|
| 687 | |
| 688 | UINT16 dma_word;
|
| 689 | UINT8 dma_byte;
|
| 690 | UINT8 incdec_size;
|
| 691 | |
| 692 | if (LOG_DMA)
|
| 693 | logerror("Control=%04X, src=%05X, dest=%05X, count=%04X\n",dma->control,dma->source,dma->dest,dma->count);
|
| 694 | |
| 695 | if(!(dma->control & ST_STOP))
|
| 696 | {
|
| 697 | logerror("%05X:ERROR! - drq%d with dma channel stopped\n",
|
| 698 | cpu_get_pc(cputag_get_cpu(machine, MAINCPU_TAG)), which);
|
| 699 |
|
| 700 | return;
|
| 701 | }
|
| 702 | |
| 703 |
|
| 704 | if(dma->control & DEST_MIO)
|
| 705 | {
|
| 706 | dest_space=memory_space;
|
| 707 | logerror("dest=memory\n");
|
| 708 | }
|
| 709 | else
|
| 710 | {
|
| 711 | dest_space=io_space;
|
| 712 | logerror("dest=I/O\n");
|
| 713 | }
|
| 714 | |
| 715 | if(dma->control & SRC_MIO)
|
| 716 | {
|
| 717 | src_space=memory_space;
|
| 718 | logerror("src=memory\n");
|
| 719 | }
|
| 720 | else
|
| 721 | {
|
| 722 | src_space=io_space;
|
| 723 | logerror("src=I/O\n");
|
| 724 | }
|
| 725 | |
| 726 | // Do the transfer
|
| 727 | if(dma->control & BYTE_WORD)
|
| 728 | {
|
| 729 | //logerror("moving word\n");
|
| 730 | dma_word=memory_read_word(src_space,dma->source);
|
| 731 | memory_write_word(dest_space,dma->dest,dma_word);
|
| 732 | incdec_size=2;
|
| 733 | }
|
| 734 | else
|
| 735 | {
|
| 736 | //logerror("moving byte\n");
|
| 737 | dma_byte=memory_read_byte(src_space,dma->source);
|
| 738 | memory_write_byte(dest_space,dma->dest,dma_byte);
|
| 739 | incdec_size=1;
|
| 740 | }
|
| 741 | |
| 742 | // Increment or Decrement destination ans source pointers as needed
|
| 743 | //logerror("incrementing destination\n");
|
| 744 | switch (dma->control & DEST_INCDEC_MASK)
|
| 745 | {
|
| 746 | case DEST_DECREMENT : dma->dest -= incdec_size;
|
| 747 | case DEST_INCREMENT : dma->dest += incdec_size;
|
| 748 | }
|
| 749 | |
| 750 | //logerror("incrementing source\n");
|
| 751 | switch (dma->control & SRC_INCDEC_MASK)
|
| 752 | {
|
| 753 | case SRC_DECREMENT : dma->source -= incdec_size;
|
| 754 | case SRC_INCREMENT : dma->source += incdec_size;
|
| 755 | }
|
| 756 | |
| 757 | // decrement count
|
| 758 | dma->count -= 1;
|
| 759 | |
| 760 | //logerror("Check term on zero\n");
|
| 761 | // Terminate if count is zero, and terminate flag set
|
| 762 | if((dma->control & TERMINATE_ON_ZERO) && (dma->count==0))
|
| 763 | {
|
| 764 | dma->control &= ~ST_STOP;
|
| 765 | logerror("DMA terminated\n");
|
| 766 | }
|
| 767 | |
| 768 | //logerror("Check int on zero\n");
|
| 769 | // Interrupt if count is zero, and interrupt flag set
|
| 770 | if((dma->control & INTERRUPT_ON_ZERO) && (dma->count==0))
|
| 771 | {
|
| 772 | if (LOG_DMA) logerror("DMA%d - requesting interrupt: count = %04X, source = %04X\n", which, dma->count, dma->source);
|
| 773 | i186.intr.request |= 0x04 << which;
|
| 774 | update_interrupt_state(machine); |
| 775 | }
|
| 776 | logerror("DMA callback done\n");
|
| 777 | }
|
| 778 | |
| 779 | /*-------------------------------------------------------------------------*/
|
| 780 | /* Name: rmnimbus */
|
| 781 | /* Desc: CPU - Initialize the 80186 CPU */
|
| 782 | /*-------------------------------------------------------------------------*/
|
| 783 | static void nimbus_cpu_init(running_machine *machine)
|
| 784 | {
|
| 785 | |
| 786 | logerror("Machine reset\n");
|
| 787 | |
| 788 | /* create timers here so they stick around */
|
| 789 | i186.timer[0].int_timer = timer_alloc(machine, internal_timer_int, NULL);
|
| 790 | i186.timer[1].int_timer = timer_alloc(machine, internal_timer_int, NULL);
|
| 791 | i186.timer[2].int_timer = timer_alloc(machine, internal_timer_int, NULL);
|
| 792 | i186.timer[0].time_timer = timer_alloc(machine, NULL, NULL);
|
| 793 | i186.timer[1].time_timer = timer_alloc(machine, NULL, NULL);
|
| 794 | i186.timer[2].time_timer = timer_alloc(machine, NULL, NULL);
|
| 795 | i186.dma[0].finish_timer = timer_alloc(machine, dma_timer_callback, NULL);
|
| 796 | i186.dma[1].finish_timer = timer_alloc(machine, dma_timer_callback, NULL);
|
| 797 | }
|
| 798 | |
| 799 | static void nimbus_cpu_reset(running_machine *machine)
|
| 800 | {
|
| 801 | /* reset the interrupt state */
|
| 802 | i186.intr.priority_mask = 0x0007;
|
| 803 | i186.intr.timer = 0x000f;
|
| 804 | i186.intr.dma[0] = 0x000f;
|
| 805 | i186.intr.dma[1] = 0x000f;
|
| 806 | i186.intr.ext[0] = 0x000f;
|
| 807 | i186.intr.ext[1] = 0x000f;
|
| 808 | i186.intr.ext[2] = 0x000f;
|
| 809 | i186.intr.ext[3] = 0x000f;
|
| 810 | i186.intr.in_service = 0x0000;
|
| 811 | |
| 812 | /* External vectors by default to internal int 0/1 vectors */
|
| 813 | i186.intr.ext_vector[0] = 0x000C;
|
| 814 | i186.intr.ext_vector[1] = 0x000D;
|
| 815 |
|
| 816 | i186.intr.pending = 0x0000;
|
| 817 | i186.intr.ack_mask = 0x0000;
|
| 818 | i186.intr.request = 0x0000;
|
| 819 | i186.intr.status = 0x0000;
|
| 820 | i186.intr.poll_status = 0x0000;
|
| 821 |
|
| 822 | logerror("CPU reset done\n");
|
| 823 | }
|
| 824 | |
| 825 | READ16_HANDLER( i186_internal_port_r )
|
| 826 | {
|
| 827 | int temp, which;
|
| 828 | |
| 829 | switch (offset)
|
| 830 | {
|
| 831 | case 0x11:
|
| 832 | logerror("%05X:ERROR - read from 80186 EOI\n", cpu_get_pc(space->cpu));
|
| 833 | break;
|
| 834 | |
| 835 | case 0x12:
|
| 836 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll\n", cpu_get_pc(space->cpu));
|
| 837 | if (i186.intr.poll_status & 0x8000)
|
| 838 | int_callback(cputag_get_cpu(space->machine, MAINCPU_TAG), 0);
|
| 839 | return i186.intr.poll_status;
|
| 840 | |
| 841 | case 0x13:
|
| 842 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt poll status\n", cpu_get_pc(space->cpu));
|
| 843 | return i186.intr.poll_status;
|
| 844 | |
| 845 | case 0x14:
|
| 846 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt mask\n", cpu_get_pc(space->cpu));
|
| 847 | temp = (i186.intr.timer >> 3) & 0x01;
|
| 848 | temp |= (i186.intr.dma[0] >> 1) & 0x04;
|
| 849 | temp |= (i186.intr.dma[1] >> 0) & 0x08;
|
| 850 | temp |= (i186.intr.ext[0] << 1) & 0x10;
|
| 851 | temp |= (i186.intr.ext[1] << 2) & 0x20;
|
| 852 | temp |= (i186.intr.ext[2] << 3) & 0x40;
|
| 853 | temp |= (i186.intr.ext[3] << 4) & 0x80;
|
| 854 | return temp;
|
| 855 | |
| 856 | case 0x15:
|
| 857 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt priority mask\n", cpu_get_pc(space->cpu));
|
| 858 | return i186.intr.priority_mask;
|
| 859 | |
| 860 | case 0x16:
|
| 861 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt in-service\n", cpu_get_pc(space->cpu));
|
| 862 | return i186.intr.in_service;
|
| 863 | |
| 864 | case 0x17:
|
| 865 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt request\n", cpu_get_pc(space->cpu));
|
| 866 | temp = i186.intr.request & ~0x0001;
|
| 867 | if (i186.intr.status & 0x0007)
|
| 868 | temp |= 1;
|
| 869 | return temp;
|
| 870 | |
| 871 | case 0x18:
|
| 872 | if (LOG_PORTS) logerror("%05X:read 80186 interrupt status\n", cpu_get_pc(space->cpu));
|
| 873 | return i186.intr.status;
|
| 874 | |
| 875 | case 0x19:
|
| 876 | if (LOG_PORTS) logerror("%05X:read 80186 timer interrupt control\n", cpu_get_pc(space->cpu));
|
| 877 | return i186.intr.timer;
|
| 878 | |
| 879 | case 0x1a:
|
| 880 | if (LOG_PORTS) logerror("%05X:read 80186 DMA 0 interrupt control\n", cpu_get_pc(space->cpu));
|
| 881 | return i186.intr.dma[0];
|
| 882 | |
| 883 | case 0x1b:
|
| 884 | if (LOG_PORTS) logerror("%05X:read 80186 DMA 1 interrupt control\n", cpu_get_pc(space->cpu));
|
| 885 | return i186.intr.dma[1];
|
| 886 | |
| 887 | case 0x1c:
|
| 888 | if (LOG_PORTS) logerror("%05X:read 80186 INT 0 interrupt control\n", cpu_get_pc(space->cpu));
|
| 889 | return i186.intr.ext[0];
|
| 890 | |
| 891 | case 0x1d:
|
| 892 | if (LOG_PORTS) logerror("%05X:read 80186 INT 1 interrupt control\n", cpu_get_pc(space->cpu));
|
| 893 | return i186.intr.ext[1];
|
| 894 | |
| 895 | case 0x1e:
|
| 896 | if (LOG_PORTS) logerror("%05X:read 80186 INT 2 interrupt control\n", cpu_get_pc(space->cpu));
|
| 897 | return i186.intr.ext[2];
|
| 898 | |
| 899 | case 0x1f:
|
| 900 | if (LOG_PORTS) logerror("%05X:read 80186 INT 3 interrupt control\n", cpu_get_pc(space->cpu));
|
| 901 | return i186.intr.ext[3];
|
| 902 | |
| 903 | case 0x28:
|
| 904 | case 0x2c:
|
| 905 | case 0x30:
|
| 906 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d count\n", cpu_get_pc(space->cpu), (offset - 0x28) / 4);
|
| 907 | which = (offset - 0x28) / 4;
|
| 908 | if (!(offset & 1))
|
| 909 | internal_timer_sync(which);
|
| 910 | return i186.timer[which].count;
|
| 911 | |
| 912 | case 0x29:
|
| 913 | case 0x2d:
|
| 914 | case 0x31:
|
| 915 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d max A\n", cpu_get_pc(space->cpu), (offset - 0x29) / 4);
|
| 916 | which = (offset - 0x29) / 4;
|
| 917 | return i186.timer[which].maxA;
|
| 918 | |
| 919 | case 0x2a:
|
| 920 | case 0x2e:
|
| 921 | logerror("%05X:read 80186 Timer %d max B\n", cpu_get_pc(space->cpu), (offset - 0x2a) / 4);
|
| 922 | which = (offset - 0x2a) / 4;
|
| 923 | return i186.timer[which].maxB;
|
| 924 | |
| 925 | case 0x2b:
|
| 926 | case 0x2f:
|
| 927 | case 0x33:
|
| 928 | if (LOG_PORTS) logerror("%05X:read 80186 Timer %d control\n", cpu_get_pc(space->cpu), (offset - 0x2b) / 4);
|
| 929 | which = (offset - 0x2b) / 4;
|
| 930 | return i186.timer[which].control;
|
| 931 | |
| 932 | case 0x50:
|
| 933 | if (LOG_PORTS) logerror("%05X:read 80186 upper chip select\n", cpu_get_pc(space->cpu));
|
| 934 | return i186.mem.upper;
|
| 935 | |
| 936 | case 0x51:
|
| 937 | if (LOG_PORTS) logerror("%05X:read 80186 lower chip select\n", cpu_get_pc(space->cpu));
|
| 938 | return i186.mem.lower;
|
| 939 | |
| 940 | case 0x52:
|
| 941 | if (LOG_PORTS) logerror("%05X:read 80186 peripheral chip select\n", cpu_get_pc(space->cpu));
|
| 942 | return i186.mem.peripheral;
|
| 943 | |
| 944 | case 0x53:
|
| 945 | if (LOG_PORTS) logerror("%05X:read 80186 middle chip select\n", cpu_get_pc(space->cpu));
|
| 946 | return i186.mem.middle;
|
| 947 | |
| 948 | case 0x54:
|
| 949 | if (LOG_PORTS) logerror("%05X:read 80186 middle P chip select\n", cpu_get_pc(space->cpu));
|
| 950 | return i186.mem.middle_size;
|
| 951 | |
| 952 | case 0x60:
|
| 953 | case 0x68:
|
| 954 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower source address\n", cpu_get_pc(space->cpu), (offset - 0x60) / 8);
|
| 955 | which = (offset - 0x60) / 8;
|
| 956 | // stream_update(dma_stream, 0);
|
| 957 | return i186.dma[which].source;
|
| 958 | |
| 959 | case 0x61:
|
| 960 | case 0x69:
|
| 961 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper source address\n", cpu_get_pc(space->cpu), (offset - 0x61) / 8);
|
| 962 | which = (offset - 0x61) / 8;
|
| 963 | // stream_update(dma_stream, 0);
|
| 964 | return i186.dma[which].source >> 16;
|
| 965 | |
| 966 | case 0x62:
|
| 967 | case 0x6a:
|
| 968 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d lower dest address\n", cpu_get_pc(space->cpu), (offset - 0x62) / 8);
|
| 969 | which = (offset - 0x62) / 8;
|
| 970 | // stream_update(dma_stream, 0);
|
| 971 | return i186.dma[which].dest;
|
| 972 | |
| 973 | case 0x63:
|
| 974 | case 0x6b:
|
| 975 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d upper dest address\n", cpu_get_pc(space->cpu), (offset - 0x63) / 8);
|
| 976 | which = (offset - 0x63) / 8;
|
| 977 | // stream_update(dma_stream, 0);
|
| 978 | return i186.dma[which].dest >> 16;
|
| 979 | |
| 980 | case 0x64:
|
| 981 | case 0x6c:
|
| 982 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d transfer count\n", cpu_get_pc(space->cpu), (offset - 0x64) / 8);
|
| 983 | which = (offset - 0x64) / 8;
|
| 984 | // stream_update(dma_stream, 0);
|
| 985 | return i186.dma[which].count;
|
| 986 | |
| 987 | case 0x65:
|
| 988 | case 0x6d:
|
| 989 | if (LOG_PORTS) logerror("%05X:read 80186 DMA%d control\n", cpu_get_pc(space->cpu), (offset - 0x65) / 8);
|
| 990 | which = (offset - 0x65) / 8;
|
| 991 | // stream_update(dma_stream, 0);
|
| 992 | return i186.dma[which].control;
|
| 993 | |
| 994 | default:
|
| 995 | logerror("%05X:read 80186 port %02X\n", cpu_get_pc(space->cpu), offset);
|
| 996 | break;
|
| 997 | }
|
| 998 | return 0x00;
|
| 999 | }
|
| 1000 | |
| 1001 | /*************************************
|
| 1002 | *
|
| 1003 | * 80186 internal I/O writes
|
| 1004 | *
|
| 1005 | *************************************/
|
| 1006 | |
| 1007 | WRITE16_HANDLER( i186_internal_port_w )
|
| 1008 | {
|
| 1009 | int temp, which, data16 = data;
|
| 1010 | |
| 1011 | switch (offset)
|
| 1012 | {
|
| 1013 | case 0x11:
|
| 1014 | if (LOG_PORTS) logerror("%05X:80186 EOI = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1015 | handle_eoi(space->machine,0x8000);
|
| 1016 | update_interrupt_state(space->machine);
|
| 1017 | break;
|
| 1018 | |
| 1019 | case 0x12:
|
| 1020 | logerror("%05X:ERROR - write to 80186 interrupt poll = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1021 | break;
|
| 1022 | |
| 1023 | case 0x13:
|
| 1024 | logerror("%05X:ERROR - write to 80186 interrupt poll status = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1025 | break;
|
| 1026 | |
| 1027 | case 0x14:
|
| 1028 | if (LOG_PORTS) logerror("%05X:80186 interrupt mask = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1029 | i186.intr.timer = (i186.intr.timer & ~0x08) | ((data16 << 3) & 0x08);
|
| 1030 | i186.intr.dma[0] = (i186.intr.dma[0] & ~0x08) | ((data16 << 1) & 0x08);
|
| 1031 | i186.intr.dma[1] = (i186.intr.dma[1] & ~0x08) | ((data16 << 0) & 0x08);
|
| 1032 | i186.intr.ext[0] = (i186.intr.ext[0] & ~0x08) | ((data16 >> 1) & 0x08);
|
| 1033 | i186.intr.ext[1] = (i186.intr.ext[1] & ~0x08) | ((data16 >> 2) & 0x08);
|
| 1034 | i186.intr.ext[2] = (i186.intr.ext[2] & ~0x08) | ((data16 >> 3) & 0x08);
|
| 1035 | i186.intr.ext[3] = (i186.intr.ext[3] & ~0x08) | ((data16 >> 4) & 0x08);
|
| 1036 | update_interrupt_state(space->machine);
|
| 1037 | break;
|
| 1038 | |
| 1039 | case 0x15:
|
| 1040 | if (LOG_PORTS) logerror("%05X:80186 interrupt priority mask = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1041 | i186.intr.priority_mask = data16 & 0x0007;
|
| 1042 | update_interrupt_state(space->machine);
|
| 1043 | break;
|
| 1044 | |
| 1045 | case 0x16:
|
| 1046 | if (LOG_PORTS) logerror("%05X:80186 interrupt in-service = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1047 | i186.intr.in_service = data16 & 0x00ff;
|
| 1048 | update_interrupt_state(space->machine);
|
| 1049 | break;
|
| 1050 | |
| 1051 | case 0x17:
|
| 1052 | if (LOG_PORTS) logerror("%05X:80186 interrupt request = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1053 | i186.intr.request = (i186.intr.request & ~0x00c0) | (data16 & 0x00c0);
|
| 1054 | update_interrupt_state(space->machine);
|
| 1055 | break;
|
| 1056 | |
| 1057 | case 0x18:
|
| 1058 | if (LOG_PORTS) logerror("%05X:WARNING - wrote to 80186 interrupt status = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1059 | i186.intr.status = (i186.intr.status & ~0x8007) | (data16 & 0x8007);
|
| 1060 | update_interrupt_state(space->machine);
|
| 1061 | break;
|
| 1062 | |
| 1063 | case 0x19:
|
| 1064 | if (LOG_PORTS) logerror("%05X:80186 timer interrupt contol = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1065 | i186.intr.timer = data16 & 0x000f;
|
| 1066 | break;
|
| 1067 | |
| 1068 | case 0x1a:
|
| 1069 | if (LOG_PORTS) logerror("%05X:80186 DMA 0 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1070 | i186.intr.dma[0] = data16 & 0x000f;
|
| 1071 | break;
|
| 1072 | |
| 1073 | case 0x1b:
|
| 1074 | if (LOG_PORTS) logerror("%05X:80186 DMA 1 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1075 | i186.intr.dma[1] = data16 & 0x000f;
|
| 1076 | break;
|
| 1077 | |
| 1078 | case 0x1c:
|
| 1079 | if (LOG_PORTS) logerror("%05X:80186 INT 0 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1080 | i186.intr.ext[0] = data16 & 0x007f;
|
| 1081 | break;
|
| 1082 | |
| 1083 | case 0x1d:
|
| 1084 | if (LOG_PORTS) logerror("%05X:80186 INT 1 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1085 | i186.intr.ext[1] = data16 & 0x007f;
|
| 1086 | break;
|
| 1087 | |
| 1088 | case 0x1e:
|
| 1089 | if (LOG_PORTS) logerror("%05X:80186 INT 2 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1090 | i186.intr.ext[2] = data16 & 0x001f;
|
| 1091 | break;
|
| 1092 | |
| 1093 | case 0x1f:
|
| 1094 | if (LOG_PORTS) logerror("%05X:80186 INT 3 interrupt control = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1095 | i186.intr.ext[3] = data16 & 0x001f;
|
| 1096 | break;
|
| 1097 | |
| 1098 | case 0x28:
|
| 1099 | case 0x2c:
|
| 1100 | case 0x30:
|
| 1101 | if (LOG_PORTS) logerror("%05X:80186 Timer %d count = %04X\n", cpu_get_pc(space->cpu), (offset - 0x28) / 4, data16);
|
| 1102 | which = (offset - 0x28) / 4;
|
| 1103 | internal_timer_update(space->machine,which, data16, -1, -1, -1);
|
| 1104 | break;
|
| 1105 | |
| 1106 | case 0x29:
|
| 1107 | case 0x2d:
|
| 1108 | case 0x31:
|
| 1109 | if (LOG_PORTS) logerror("%05X:80186 Timer %d max A = %04X\n", cpu_get_pc(space->cpu), (offset - 0x29) / 4, data16);
|
| 1110 | which = (offset - 0x29) / 4;
|
| 1111 | internal_timer_update(space->machine,which, -1, data16, -1, -1);
|
| 1112 | break;
|
| 1113 | |
| 1114 | case 0x2a:
|
| 1115 | case 0x2e:
|
| 1116 | if (LOG_PORTS) logerror("%05X:80186 Timer %d max B = %04X\n", cpu_get_pc(space->cpu), (offset - 0x2a) / 4, data16);
|
| 1117 | which = (offset - 0x2a) / 4;
|
| 1118 | internal_timer_update(space->machine,which, -1, -1, data16, -1);
|
| 1119 | break;
|
| 1120 | |
| 1121 | case 0x2b:
|
| 1122 | case 0x2f:
|
| 1123 | case 0x33:
|
| 1124 | if (LOG_PORTS) logerror("%05X:80186 Timer %d control = %04X\n", cpu_get_pc(space->cpu), (offset - 0x2b) / 4, data16);
|
| 1125 | which = (offset - 0x2b) / 4;
|
| 1126 | internal_timer_update(space->machine,which, -1, -1, -1, data16);
|
| 1127 | break;
|
| 1128 | |
| 1129 | case 0x50:
|
| 1130 | if (LOG_PORTS) logerror("%05X:80186 upper chip select = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1131 | i186.mem.upper = data16 | 0xc038;
|
| 1132 | break;
|
| 1133 | |
| 1134 | case 0x51:
|
| 1135 | if (LOG_PORTS) logerror("%05X:80186 lower chip select = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1136 | i186.mem.lower = (data16 & 0x3fff) | 0x0038; printf("%X",i186.mem.lower);
|
| 1137 | break;
|
| 1138 | |
| 1139 | case 0x52:
|
| 1140 | if (LOG_PORTS) logerror("%05X:80186 peripheral chip select = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1141 | i186.mem.peripheral = data16 | 0x0038;
|
| 1142 | break;
|
| 1143 | |
| 1144 | case 0x53:
|
| 1145 | if (LOG_PORTS) logerror("%05X:80186 middle chip select = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1146 | i186.mem.middle = data16 | 0x01f8;
|
| 1147 | break;
|
| 1148 | |
| 1149 | case 0x54:
|
| 1150 | if (LOG_PORTS) logerror("%05X:80186 middle P chip select = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1151 | i186.mem.middle_size = data16 | 0x8038;
|
| 1152 | |
| 1153 | temp = (i186.mem.peripheral & 0xffc0) << 4;
|
| 1154 | if (i186.mem.middle_size & 0x0040)
|
| 1155 | {
|
| 1156 | // install_mem_read_handler(2, temp, temp + 0x2ff, peripheral_r);
|
| 1157 | // install_mem_write_handler(2, temp, temp + 0x2ff, peripheral_w);
|
| 1158 | }
|
| 1159 | else
|
| 1160 | {
|
| 1161 | temp &= 0xffff;
|
| 1162 | // install_port_read_handler(2, temp, temp + 0x2ff, peripheral_r);
|
| 1163 | // install_port_write_handler(2, temp, temp + 0x2ff, peripheral_w);
|
| 1164 | }
|
| 1165 | |
| 1166 | /* we need to do this at a time when the I86 context is swapped in */
|
| 1167 | /* this register is generally set once at startup and never again, so it's a good */
|
| 1168 | /* time to set it up */
|
| 1169 | cpu_set_irq_callback(space->cpu, int_callback);
|
| 1170 | break;
|
| 1171 | |
| 1172 | case 0x60:
|
| 1173 | case 0x68:
|
| 1174 | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower source address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x60) / 8, data16);
|
| 1175 | which = (offset - 0x60) / 8;
|
| 1176 | // stream_update(dma_stream, 0);
|
| 1177 | i186.dma[which].source = (i186.dma[which].source & ~0x0ffff) | (data16 & 0x0ffff);
|
| 1178 | break;
|
| 1179 | |
| 1180 | case 0x61:
|
| 1181 | case 0x69:
|
| 1182 | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper source address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x61) / 8, data16);
|
| 1183 | which = (offset - 0x61) / 8;
|
| 1184 | // stream_update(dma_stream, 0);
|
| 1185 | i186.dma[which].source = (i186.dma[which].source & ~0xf0000) | ((data16 << 16) & 0xf0000);
|
| 1186 | break;
|
| 1187 | |
| 1188 | case 0x62:
|
| 1189 | case 0x6a:
|
| 1190 | if (LOG_PORTS) logerror("%05X:80186 DMA%d lower dest address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x62) / 8, data16);
|
| 1191 | which = (offset - 0x62) / 8;
|
| 1192 | // stream_update(dma_stream, 0);
|
| 1193 | i186.dma[which].dest = (i186.dma[which].dest & ~0x0ffff) | (data16 & 0x0ffff);
|
| 1194 | break;
|
| 1195 | |
| 1196 | case 0x63:
|
| 1197 | case 0x6b:
|
| 1198 | if (LOG_PORTS) logerror("%05X:80186 DMA%d upper dest address = %04X\n", cpu_get_pc(space->cpu), (offset - 0x63) / 8, data16);
|
| 1199 | which = (offset - 0x63) / 8;
|
| 1200 | // stream_update(dma_stream, 0);
|
| 1201 | i186.dma[which].dest = (i186.dma[which].dest & ~0xf0000) | ((data16 << 16) & 0xf0000);
|
| 1202 | break;
|
| 1203 | |
| 1204 | case 0x64:
|
| 1205 | case 0x6c:
|
| 1206 | if (LOG_PORTS) logerror("%05X:80186 DMA%d transfer count = %04X\n", cpu_get_pc(space->cpu), (offset - 0x64) / 8, data16);
|
| 1207 | which = (offset - 0x64) / 8;
|
| 1208 | // stream_update(dma_stream, 0);
|
| 1209 | i186.dma[which].count = data16;
|
| 1210 | break;
|
| 1211 | |
| 1212 | case 0x65:
|
| 1213 | case 0x6d:
|
| 1214 | if (LOG_PORTS) logerror("%05X:80186 DMA%d control = %04X\n", cpu_get_pc(space->cpu), (offset - 0x65) / 8, data16);
|
| 1215 | which = (offset - 0x65) / 8;
|
| 1216 | // stream_update(dma_stream, 0);
|
| 1217 | update_dma_control(space->machine, which, data16);
|
| 1218 | break;
|
| 1219 | |
| 1220 | case 0x7f:
|
| 1221 | if (LOG_PORTS) logerror("%05X:80186 relocation register = %04X\n", cpu_get_pc(space->cpu), data16);
|
| 1222 | |
| 1223 | /* we assume here there that this doesn't happen too often */
|
| 1224 | /* plus, we can't really remove the old memory range, so we also assume that it's */
|
| 1225 | /* okay to leave us mapped where we were */
|
| 1226 | temp = (data16 & 0x0fff) << 8;
|
| 1227 | if (data16 & 0x1000)
|
| 1228 | {
|
| 1229 | memory_install_read16_handler(cputag_get_address_space(space->machine, MAINCPU_TAG, ADDRESS_SPACE_PROGRAM), temp, temp + 0xff, 0, 0, i186_internal_port_r);
|
| 1230 | memory_install_write16_handler(cputag_get_address_space(space->machine, MAINCPU_TAG, ADDRESS_SPACE_PROGRAM), temp, temp + 0xff, 0, 0, i186_internal_port_w);
|
| 1231 | }
|
| 1232 | else
|
| 1233 | {
|
| 1234 | temp &= 0xffff;
|
| 1235 | memory_install_read16_handler(cputag_get_address_space(space->machine, MAINCPU_TAG, ADDRESS_SPACE_IO), temp, temp + 0xff, 0, 0, i186_internal_port_r);
|
| 1236 | memory_install_write16_handler(cputag_get_address_space(space->machine, MAINCPU_TAG, ADDRESS_SPACE_IO), temp, temp + 0xff, 0, 0, i186_internal_port_w);
|
| 1237 | }
|
| 1238 | /* popmessage("Sound CPU reset");*/
|
| 1239 | break;
|
| 1240 | |
| 1241 | default:
|
| 1242 | logerror("%05X:80186 port %02X = %04X\n", cpu_get_pc(space->cpu), offset, data16);
|
| 1243 | break;
|
| 1244 | }
|
| 1245 | }
|
| 1246 | |
| 1247 | MACHINE_RESET(nimbus)
|
| 1248 | {
|
| 1249 | /* CPU */
|
| 1250 | nimbus_cpu_reset(machine); |
| 1251 | fdc_reset();
|
| 1252 | }
|
| 1253 | |
| 1254 | DRIVER_INIT(nimbus)
|
| 1255 | {
|
| 1256 | }
|
| 1257 | |
| 1258 | MACHINE_START( nimbus )
|
| 1259 | {
|
| 1260 | /* init cpu */
|
| 1261 | nimbus_cpu_init(machine);
|
| 1262 | |
| 1263 | /* setup debug commands */
|
| 1264 | if (machine->debug_flags & DEBUG_FLAG_ENABLED)
|
| 1265 | {
|
| 1266 | debug_console_register_command(machine, "nimbus_irq", CMDFLAG_NONE, 0, 0, 1, execute_debug_irq);
|
| 1267 | debug_console_register_command(machine, "nimbus_intmasks", CMDFLAG_NONE, 0, 0, 0, execute_debug_intmasks);
|
| 1268 | debug_console_register_command(machine, "nimbus_key", CMDFLAG_NONE, 0, 0, 1, execute_debug_key);
|
| 1269 | |
| 1270 | |
| 1271 | /* set up the instruction hook */
|
| 1272 | debug_cpu_set_instruction_hook(cputag_get_cpu(machine, MAINCPU_TAG), instruction_hook);
|
| 1273 |
|
| 1274 | }
|
| 1275 | }
|
| 1276 | |
| 1277 | static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[])
|
| 1278 | {
|
| 1279 | int IntNo;
|
| 1280 | int IntMask;
|
| 1281 | |
| 1282 | if(params>0)
|
| 1283 | {
|
| 1284 | sscanf(param[0],"%d",&IntNo);
|
| 1285 | |
| 1286 | IntMask=0x0000;
|
| 1287 | |
| 1288 | switch (IntNo)
|
| 1289 | {
|
| 1290 | case 0 : IntMask=0x010; break;
|
| 1291 | case 1 : IntMask=0x020; break;
|
| 1292 | case 2 : IntMask=0x040; break;
|
| 1293 | case 3 : IntMask=0x080; break;
|
| 1294 | }
|
| 1295 | |
| 1296 | i186.intr.request |= IntMask;
|
| 1297 | update_interrupt_state(machine);
|
| 1298 | |
| 1299 | debug_console_printf(machine,"triggering IRQ%d, IntMask=%4.4X, i186.intr.request=%4.4X\n",IntNo,IntMask,i186.intr.request);
|
| 1300 | |
| 1301 | // cputag_set_input_line(machine, MAINCPU_TAG, IntNo, HOLD_LINE );
|
| 1302 | // cputag_set_input_line(machine, MAINCPU_TAG, IntNo, CLEAR_LINE );
|
| 1303 | |
| 1304 | }
|
| 1305 | else
|
| 1306 | {
|
| 1307 | debug_console_printf(machine,"Error, you must supply an intno to trigger\n");
|
| 1308 | }
|
| 1309 |
|
| 1310 | |
| 1311 | }
|
| 1312 | |
| 1313 | |
| 1314 | static void execute_debug_intmasks(running_machine *machine, int ref, int params, const char *param[])
|
| 1315 | {
|
| 1316 | int IntNo;
|
| 1317 | |
| 1318 | |
| 1319 | debug_console_printf(machine,"i186.intr.priority_mask=%4X\n",i186.intr.priority_mask);
|
| 1320 | for(IntNo=0; IntNo<4; IntNo++)
|
| 1321 | {
|
| 1322 | debug_console_printf(machine,"extInt%d mask=%4X\n",IntNo,i186.intr.ext[IntNo]);
|
| 1323 | }
|
| 1324 | |
| 1325 | debug_console_printf(machine,"i186.intr.request = %04X\n",i186.intr.request);
|
| 1326 | debug_console_printf(machine,"i186.intr.ack_mask = %04X\n",i186.intr.ack_mask);
|
| 1327 | debug_console_printf(machine,"i186.intr.in_service= %04X\n",i186.intr.in_service);
|
| 1328 | }
|
| 1329 | |
| 1330 | static void execute_debug_key(running_machine *machine, int ref, int params, const char *param[])
|
| 1331 | {
|
| 1332 | int Key;
|
| 1333 | |
| 1334 | if(params>0)
|
| 1335 | {
|
| 1336 | sscanf(param[0],"%d",&Key);
|
| 1337 | |
| 1338 | nextkey=Key;
|
| 1339 | }
|
| 1340 | else
|
| 1341 | {
|
| 1342 | debug_console_printf(machine,"Error, you must supply a keycode\n");
|
| 1343 | }
|
| 1344 |
|
| 1345 | |
| 1346 | }
|
| 1347 | |
| 1348 | |
| 1349 | /*-----------------------------------------------
|
| 1350 | instruction_hook - per-instruction hook
|
| 1351 | -----------------------------------------------*/
|
| 1352 | |
| 1353 | static int instruction_hook(const device_config *device, offs_t curpc)
|
| 1354 | {
|
| 1355 | const address_space *space = cpu_get_address_space(device, ADDRESS_SPACE_PROGRAM);
|
| 1356 | UINT8 *addr_ptr;
|
| 1357 | |
| 1358 | addr_ptr = memory_get_read_ptr(space,curpc);
|
| 1359 | |
| 1360 | if ((addr_ptr !=NULL) && (addr_ptr[0]==0xCD) && (addr_ptr[1]==0xF0))
|
| 1361 | decode_subbios(device,curpc);
|
| 1362 | |
| 1363 | return 0;
|
| 1364 | }
|
| 1365 | |
| 1366 | #define set_type(type_name) sprintf(type_str,type_name)
|
| 1367 | #define set_drv(drv_name) sprintf(drv_str,drv_name)
|
| 1368 | #define set_func(func_name) sprintf(func_str,func_name)
|
| 1369 | |
| 1370 | static void decode_subbios(const device_config *device,offs_t pc)
|
| 1371 | {
|
| 1372 | char type_str[80];
|
| 1373 | char drv_str[80];
|
| 1374 | char func_str[80];
|
| 1375 | |
| 1376 | void (*dump_dssi)(const device_config *,UINT16, UINT16) = NULL;
|
| 1377 | |
| 1378 | const device_config *cpu = cputag_get_cpu(device->machine,MAINCPU_TAG);
|
| 1379 | |
| 1380 | UINT16 ax = cpu_get_reg(cpu,I8086_AX);
|
| 1381 | UINT16 bx = cpu_get_reg(cpu,I8086_BX);
|
| 1382 | UINT16 cx = cpu_get_reg(cpu,I8086_CX);
|
| 1383 | UINT16 ds = cpu_get_reg(cpu,I8086_DS);
|
| 1384 | UINT16 si = cpu_get_reg(cpu,I8086_SI);
|
| 1385 | |
| 1386 | logerror("=======================================================================\n");
|
| 1387 | logerror("Sub-bios call at %08X, AX=%04X, BX=%04X, CX=%04X, DS:SI=%04X:%04X\n",pc,ax,bx,cx,ds,si);
|
| 1388 | |
| 1389 | set_type("invalid");
|
| 1390 | set_drv("invalid");
|
| 1391 | set_func("invalid");
|
| 1392 | |
| 1393 | |
| 1394 | switch (cx)
|
| 1395 | {
|
| 1396 | case 0 : |
| 1397 | {
|
| 1398 | set_type("t_mummu");
|
| 1399 | set_drv("d_mummu");
|
| 1400 | |
| 1401 | switch (ax)
|
| 1402 | {
|
| 1403 | case 0 : set_func("f_get_version_number"); break;
|
| 1404 | case 1 : set_func("f_add_type_code"); break;
|
| 1405 | case 2 : set_func("f_del_typc_code"); break;
|
| 1406 | case 3 : set_func("f_get_TCB"); break;
|
| 1407 | case 4 : set_func("f_add_driver_cdoe"); break;
|
| 1408 | case 5 : set_func("f_del_driver_code"); break;
|
| 1409 | case 6 : set_func("f_get_DCB"); break;
|
| 1410 | case 7 : set_func("f_get_copyright"); break;
|
| 1411 | }
|
| 1412 | }; break;
|
| 1413 | |
| 1414 | case 1 : |
| 1415 | {
|
| 1416 | set_type("t_character");
|
| 1417 | set_drv("d_printer");
|
| 1418 | |
| 1419 | switch(ax)
|
| 1420 | {
|
| 1421 | case 0 : set_func("f_get_version_number"); break;
|
| 1422 | case 1 : set_func("f_get_output_status"); break;
|
| 1423 | case 2 : set_func("f_output_character"); break;
|
| 1424 | case 3 : set_func("f_get_input_status"); break;
|
| 1425 | case 4 : set_func("f_get_and_remove"); break;
|
| 1426 | case 5 : set_func("f_get_no_remove"); break;
|
| 1427 | case 6 : set_func("f_get_last_and_remove"); break;
|
| 1428 | case 7 : set_func("f_get_last_no_remove"); break;
|
| 1429 | case 8 : set_func("f_set_IO_parameters"); break;
|
| 1430 | }
|
| 1431 | }; break;
|
| 1432 | |
| 1433 | case 2 : |
| 1434 | {
|
| 1435 | set_type("t_disk");
|
| 1436 | |
| 1437 | switch(bx)
|
| 1438 | {
|
| 1439 | case 0 : set_drv("d_floppy"); break;
|
| 1440 | case 1 : set_drv("d_winchester"); break;
|
| 1441 | case 2 : set_drv("d_tape"); break;
|
| 1442 | case 3 : set_drv("d_rompack"); break;
|
| 1443 | case 4 : set_drv("d_eeprom"); break;
|
| 1444 | }
|
| 1445 | |
| 1446 | switch(ax)
|
| 1447 | {
|
| 1448 | case 0 : set_func("f_get_version_number"); break; |
| 1449 | case 1 : set_func("f_initialise_unit"); break;
|
| 1450 | case 2 : set_func("f_pseudo_init_unit"); break;
|
| 1451 | case 3 : set_func("f_get_device_status"); break;
|
| 1452 | case 4 : set_func("f_read_n_sectors"); break;
|
| 1453 | case 5 : set_func("f_write_n_sectors"); break;
|
| 1454 | case 6 : set_func("f_verify_n_sectors"); break;
|
| 1455 | case 7 : set_func("f_media_check"); break;
|
| 1456 | case 8 : set_func("f_recalibrate"); break;
|
| 1457 | case 9 : set_func("f_motors_off"); break;
|
| 1458 | }
|
| 1459 | |
| 1460 | }; break;
|
| 1461 | |
| 1462 | case 3 : |
| 1463 | {
|
| 1464 | set_type("t_piconet");
|
| 1465 | switch(ax)
|
| 1466 | {
|
| 1467 | case 0 : set_func("f_get_version_number"); break; |
| 1468 | }
|
| 1469 | }; break;
|
| 1470 | |
| 1471 | case 4 : |
| 1472 | {
|
| 1473 | set_type("t_tick");
|
| 1474 | set_drv("d_tick");
|
| 1475 | |
| 1476 | switch(ax)
|
| 1477 | {
|
| 1478 | case 0 : set_func("f_get_version_number"); break; |
| 1479 | case 1 : set_func("f_ticks_per_second"); break; |
| 1480 | case 2 : set_func("f_link_tick_routine"); break; |
| 1481 | case 3 : set_func("f_unlink_tick_routine"); break; |
| 1482 | }
|
| 1483 | }; break;
|
| 1484 | |
| 1485 | case 5 : |
| 1486 | {
|
| 1487 | set_type("t_graphics_input");
|
| 1488 | switch(ax)
|
| 1489 | {
|
| 1490 | case 0 : set_func("f_get_version_number"); break; |
| 1491 | }
|
| 1492 | }; break;
|
| 1493 | |
| 1494 | case 6 : |
| 1495 | {
|
| 1496 | set_type("t_graphics_output");
|
| 1497 | set_drv("d_ngc_screen");
|
| 1498 | |
| 1499 | switch(ax)
|
| 1500 | {
|
| 1501 | case 0 : set_func("f_get_version_number"); break; |
| 1502 | case 1 : set_func("f_graphics_output_cold_start"); break; |
| 1503 | case 2 : set_func("f_graphics_output_warm_start"); break; |
| 1504 | case 3 : set_func("f_graphics_output_off"); break; |
| 1505 | case 4 : set_func("f_reinit_graphics_output"); break; |
| 1506 | case 5 : set_func("f_polymarker"); break; |
| 1507 | case 6 : set_func("f_polyline"); break; |
| 1508 | case 7 : set_func("f_fill_area"); dump_dssi=&decode_dssi_f_fill_area; break; |
| 1509 | case 8 : set_func("f_flood_fill_area"); break; |
| 1510 | case 9 : set_func("f_plot_character_string"); dump_dssi=&decode_dssi_f_plot_character_string; break; |
| 1511 | case 10 : set_func("f_define_graphics_clipping_area"); break; |
| 1512 | case 11 : set_func("f_enquire_clipping_area_limits"); break; |
| 1513 | case 12 : set_func("f_select_graphics_clipping_area"); break; |
| 1514 | case 13 : set_func("f_enq_selctd_graphics_clip_area"); break; |
| 1515 | case 14 : set_func("f_set_clt_element"); break; |
| 1516 | case 15 : set_func("f_enquire_clt_element"); break; |
| 1517 | case 16 : set_func("f_set_new_clt"); dump_dssi=&decode_dssi_f_set_new_clt; break; |
| 1518 | case 17 : set_func("f_enquire_clt_contents"); break; |
| 1519 | case 18 : set_func("f_define_dithering_pattern"); break; |
| 1520 | case 19 : set_func("f_enquire_dithering_pattern"); break; |
| 1521 | case 20 : set_func("f_draw_sprite"); break; |
| 1522 | case 21 : set_func("f_move_sprite"); break; |
| 1523 | case 22 : set_func("f_erase_sprite"); break; |
| 1524 | case 23 : set_func("f_read_pixel"); break; |
| 1525 | case 24 : set_func("f_read_to_limit"); break; |
| 1526 | case 25 : set_func("f_read_area_pixel"); break; |
| 1527 | case 26 : set_func("f_write_area_pixel"); break; |
| 1528 | case 27 : set_func("f_copy_area_pixel"); break; |
| 1529 | |
| 1530 | case 29 : set_func("f_read_area_word"); break; |
| 1531 | case 30 : set_func("f_write_area_word"); break; |
| 1532 | case 31 : set_func("f_copy_area_word"); break; |
| 1533 | case 32 : set_func("f_swap_area_word"); break; |
| 1534 | case 33 : set_func("f_set_border_colour"); break; |
| 1535 | case 34 : set_func("f_enquire_border_colour"); break; |
| 1536 | case 35 : set_func("f_enquire_miscellaneous_data"); break; |
| 1537 | case 36 : set_func("f_circle"); break; |
| 1538 | |
| 1539 | case 38 : set_func("f_arc_of_ellipse"); break; |
| 1540 | case 39 : set_func("f_isin"); break; |
| 1541 | case 40 : set_func("f_icos"); break; |
| 1542 | case 41 : set_func("f_define_hatching_pattern"); break; |
| 1543 | case 42 : set_func("f_enquire_hatching_pattern"); break; |
| 1544 | case 43 : set_func("f_enquire_display_line"); break; |
| 1545 | case 44 : set_func("f_plonk_logo"); break; |
| 1546 | }
|
| 1547 | }; break;
|
| 1548 | |
| 1549 | case 7 : |
| 1550 | {
|
| 1551 | set_type("t_zend");
|
| 1552 | switch(ax)
|
| 1553 | {
|
| 1554 | case 0 : set_func("f_get_version_number"); break; |
| 1555 | }
|
| 1556 | }; break;
|
| 1557 | |
| 1558 | case 8 : |
| 1559 | {
|
| 1560 | set_type("t_zep");
|
| 1561 | switch(ax)
|
| 1562 | {
|
| 1563 | case 0 : set_func("f_get_version_number"); break; |
| 1564 | }
|
| 1565 | }; break;
|
| 1566 | |
| 1567 | case 9 : |
| 1568 | {
|
| 1569 | set_type("t_raw_console");
|
| 1570 | |
| 1571 | switch(bx)
|
| 1572 | {
|
| 1573 | case 0 : |
| 1574 | {
|
| 1575 | set_drv("d_screen");
|
| 1576 | |
| 1577 | switch(ax)
|
| 1578 | {
|
| 1579 | case 0 : set_func("f_get_version_number"); break; |
| 1580 | case 1 : set_func("f_plonk_char"); break;
|
| 1581 | case 2 : set_func("f_plonk_cursor"); break;
|
| 1582 | case 3 : set_func("f_kill_cursor"); break;
|
| 1583 | case 4 : set_func("f_scroll"); break;
|
| 1584 | case 5 : set_func("f_width"); break;
|
| 1585 | case 6 : set_func("f_get_char_set"); break;
|
| 1586 | case 7 : set_func("f_set_char_set"); break;
|
| 1587 | case 8 : set_func("f_reset_char_set"); break;
|
| 1588 | case 9 : set_func("f_set_plonk_parameters"); break;
|
| 1589 | case 10 : set_func("f_set_cursor_flash_rate"); break;
|
| 1590 | }
|
| 1591 | }; break;
|
| 1592 | |
| 1593 | case 1 :
|
| 1594 | {
|
| 1595 | set_drv("d_keyboard");
|
| 1596 | |
| 1597 | switch(ax)
|
| 1598 | {
|
| 1599 | case 0 : set_func("f_get_version_number"); break; |
| 1600 | case 1 : set_func("f_init_keyboard"); break;
|
| 1601 | case 2 : set_func("f_get_last_key_code"); break;
|
| 1602 | case 3 : set_func("f_get_bitmap"); break;
|
| 1603 | }
|
| 1604 | }; break;
|
| 1605 | }
|
| 1606 | }; break;
|
| 1607 | |
| 1608 | case 10 : |
| 1609 | {
|
| 1610 | set_type("t_acoustics");
|
| 1611 | switch(ax)
|
| 1612 | {
|
| 1613 | case 0 : set_func("f_get_version_number"); break; |
| 1614 | }
|
| 1615 | }; break;
|
| 1616 | |
| 1617 | case 11 : |
| 1618 | {
|
| 1619 | set_type("t_hard_sums");
|
| 1620 | switch(ax)
|
| 1621 | {
|
| 1622 | case 0 : set_func("f_get_version_number"); break; |
| 1623 | }
|
| 1624 | }; break; |
| 1625 | }
|
| 1626 | |
| 1627 | logerror("Type=%s, Driver=%s, Function=%s\n",type_str,drv_str,func_str);
|
| 1628 | |
| 1629 | if(dump_dssi!=NULL)
|
| 1630 | dump_dssi(device,ds,si);
|
| 1631 | logerror("=======================================================================\n");
|
| 1632 | }
|
| 1633 | |
| 1634 | void *get_dssi_ptr(const address_space *space, UINT16 ds, UINT16 si)
|
| 1635 | {
|
| 1636 | int addr;
|
| 1637 | |
| 1638 | addr=((ds<<4)+si);
|
| 1639 | OUTPUT_SEGOFS("DS:SI",ds,si);
|
| 1640 | |
| 1641 | return memory_get_read_ptr(space, addr);
|
| 1642 | }
|
| 1643 | |
| 1644 | static void decode_dssi_f_fill_area(const device_config *device,UINT16 ds, UINT16 si)
|
| 1645 | {
|
| 1646 | const address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM);
|
| 1647 |
|
| 1648 | UINT16 *addr_ptr;
|
| 1649 | t_area_params *area_params;
|
| 1650 | t_nimbus_brush *brush;
|
| 1651 | int cocount;
|
| 1652 | |
| 1653 | area_params = get_dssi_ptr(space,ds,si);
|
| 1654 | |
| 1655 | OUTPUT_SEGOFS("SegBrush:OfsBrush",area_params->seg_brush,area_params->ofs_brush);
|
| 1656 | brush=memory_get_read_ptr(space, LINEAR_ADDR(area_params->seg_brush,area_params->ofs_brush));
|
| 1657 | |
| 1658 | logerror("Brush params\n");
|
| 1659 | logerror("Style=%04X, StyleIndex=%04X\n",brush->style,brush->style_index);
|
| 1660 | logerror("Colour1=%04X, Colour2=%04X\n",brush->colour1,brush->colour2);
|
| 1661 | logerror("transparency=%04X, boundry_spec=%04X\n",brush->transparency,brush->boundary_spec);
|
| 1662 | logerror("boundry colour=%04X, save colour=%04X\n",brush->boundary_colour,brush->save_colour);
|
| 1663 | |
| 1664 | |
| 1665 | OUTPUT_SEGOFS("SegData:OfsData",area_params->seg_data,area_params->ofs_data);
|
| 1666 | |
| 1667 | addr_ptr = memory_get_read_ptr(space, LINEAR_ADDR(area_params->seg_data,area_params->ofs_data));
|
| 1668 | for(cocount=0; cocount < area_params->count; cocount++)
|
| 1669 | {
|
| 1670 | logerror("x=%d y=%d\n",addr_ptr[cocount*2],addr_ptr[(cocount*2)+1]);
|
| 1671 | }
|
| 1672 | }
|
| 1673 | |
| 1674 | static void decode_dssi_f_plot_character_string(const device_config *device,UINT16 ds, UINT16 si)
|
| 1675 | {
|
| 1676 | const address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM);
|
| 1677 |
|
| 1678 | UINT8 *char_ptr;
|
| 1679 | t_plot_string_params *plot_string_params;
|
| 1680 | int charno;
|
| 1681 |
|
| 1682 | plot_string_params=get_dssi_ptr(space,ds,si);
|
| 1683 | |
| 1684 | OUTPUT_SEGOFS("SegFont:OfsFont",plot_string_params->seg_font,plot_string_params->ofs_font);
|
| 1685 | OUTPUT_SEGOFS("SegData:OfsData",plot_string_params->seg_data,plot_string_params->ofs_data);
|
| 1686 | |
| 1687 | logerror("x=%d, y=%d, length=%d\n",plot_string_params->x,plot_string_params->y,plot_string_params->length);
|
| 1688 | |
| 1689 | char_ptr=memory_get_read_ptr(space, LINEAR_ADDR(plot_string_params->seg_data,plot_string_params->ofs_data));
|
| 1690 | |
| 1691 | if (plot_string_params->length==0xFFFF)
|
| 1692 | logerror("%s",char_ptr);
|
| 1693 | else
|
| 1694 | for(charno=0;charno<plot_string_params->length;charno++)
|
| 1695 | logerror("%c",char_ptr[charno]);
|
| 1696 | |
| 1697 | logerror("\n");
|
| 1698 | }
|
| 1699 | |
| 1700 | static void decode_dssi_f_set_new_clt(const device_config *device,UINT16 ds, UINT16 si)
|
| 1701 | {
|
| 1702 | const address_space *space = cputag_get_address_space(device->machine,MAINCPU_TAG, ADDRESS_SPACE_PROGRAM);
|
| 1703 | UINT16 *new_colours;
|
| 1704 | int colour;
|
| 1705 | new_colours=get_dssi_ptr(space,ds,si);
|
| 1706 | |
| 1707 | OUTPUT_SEGOFS("SegColours:OfsColours",ds,si);
|
| 1708 | |
| 1709 | for(colour=0;colour<16;colour++)
|
| 1710 | logerror("colour #%02X=%04X\n",colour,new_colours[colour]);
|
| 1711 | |
| 1712 | }
|
| 1713 | |
| 1714 | READ16_HANDLER( nimbus_io_r )
|
| 1715 | {
|
| 1716 | int pc=cpu_get_pc(space->cpu);
|
| 1717 | |
| 1718 | logerror("Nimbus IOR at pc=%08X from %04X mask=%04X, data=%04X\n",pc,(offset*2)+0x30,mem_mask,IOPorts[offset]);
|
| 1719 | |
| 1720 | switch (offset*2)
|
| 1721 | {
|
| 1722 | default : return IOPorts[offset]; break;
|
| 1723 | }
|
| 1724 | return 0;
|
| 1725 | }
|
| 1726 | |
| 1727 | WRITE16_HANDLER( nimbus_io_w )
|
| 1728 | {
|
| 1729 | int pc=cpu_get_pc(space->cpu);
|
| 1730 | |
| 1731 | logerror("Nimbus IOW at %08X write of %04X to %04X mask=%04X\n",pc,data,(offset*2)+0x30,mem_mask);
|
| 1732 | |
| 1733 | switch (offset*2)
|
| 1734 | {
|
| 1735 | default : COMBINE_DATA(&IOPorts[offset]); break;
|
| 1736 | }
|
| 1737 | }
|
| 1738 | |
| 1739 | /* |
| 1740 | |
| 1741 | Z80SIO, used for the keyboard interface |
| 1742 | |
| 1743 | */
|
| 1744 | |
| 1745 | READ8_DEVICE_HANDLER( sio_r )
|
| 1746 | {
|
| 1747 | int pc=cpu_get_pc(cputag_get_cpu(device->machine,MAINCPU_TAG));
|
| 1748 | UINT8 result = 0;
|
| 1749 | |
| 1750 | switch (offset*2)
|
| 1751 | {
|
| 1752 | case 0 :
|
| 1753 | result=z80sio_d_r(device, 0); |
| 1754 | break;
|
| 1755 | case 2 :
|
| 1756 | result=z80sio_d_r(device, 1); |
| 1757 | break;
|
| 1758 | case 4 :
|
| 1759 | result=z80sio_c_r(device, 0);
|
| 1760 | break;
|
| 1761 | case 6 :
|
| 1762 | result=z80sio_c_r(device, 1);
|
| 1763 | break;
|
| 1764 | }
|
| 1765 | |
| 1766 | logerror("Nimbus SIOR at pc=%08X from %04X data=%02X\n",pc,(offset*2)+0xF0,result);
|
| 1767 | |
| 1768 | return result;
|
| 1769 | }
|
| 1770 | |
| 1771 | WRITE8_DEVICE_HANDLER( sio_w )
|
| 1772 | {
|
| 1773 | int pc=cpu_get_pc(cputag_get_cpu(device->machine,MAINCPU_TAG));
|
| 1774 | |
| 1775 | logerror("Nimbus SIOW at %08X write of %02X to %04X\n",pc,data,(offset*2)+0xF0);
|
| 1776 | |
| 1777 | switch (offset*2)
|
| 1778 | {
|
| 1779 | case 0 :
|
| 1780 | z80sio_d_w(device, 0, data);
|
| 1781 | break;
|
| 1782 | case 2 :
|
| 1783 | z80sio_d_w(device, 1, data);
|
| 1784 | break;
|
| 1785 | case 4 :
|
| 1786 | z80sio_c_w(device, 0, data);
|
| 1787 | break;
|
| 1788 | case 5 :
|
| 1789 | z80sio_c_w(device, 1, data);
|
| 1790 | break;
|
| 1791 | }
|
| 1792 | }
|
| 1793 | |
| 1794 | /* Z80 SIO/2 */
|
| 1795 | |
| 1796 | void sio_interrupt(const device_config *device, int state)
|
| 1797 | {
|
| 1798 | logerror("SIO Interrupt state=%02X\n",state);
|
| 1799 | |
| 1800 | // Don't re-trigger if already active !
|
| 1801 | if(state!=sio_int_state)
|
| 1802 | {
|
| 1803 | sio_int_state=state;
|
| 1804 | |
| 1805 | if(state)
|
| 1806 | external_int(device->machine,0,0x9C);
|
| 1807 | }
|
| 1808 | }
|
| 1809 | |
| 1810 | WRITE8_DEVICE_HANDLER( sio_dtr_w )
|
| 1811 | {
|
| 1812 | if (offset == 1)
|
| 1813 | {
|
| 1814 | }
|
| 1815 | }
|
| 1816 | |
| 1817 | WRITE8_DEVICE_HANDLER( sio_serial_transmit )
|
| 1818 | {
|
| 1819 | }
|
| 1820 | |
| 1821 | int sio_serial_receive( const device_config *device, int channel )
|
| 1822 | {
|
| 1823 | UINT8 keyrow;
|
| 1824 | UINT8 row;
|
| 1825 | static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4",
|
| 1826 | "KEY5", "KEY6", "KEY7", "KEY8", "KEY9" };
|
| 1827 | int key;
|
| 1828 | |
| 1829 | if(channel==0)
|
| 1830 | {
|
| 1831 | key=-1;
|
| 1832 | |
| 1833 | //logerror("Read keyboard\n");
|
| 1834 | for(row=0;row<NIMBUS_KEYROWS;row++)
|
| 1835 | {
|
| 1836 | keyrow=input_port_read(device->machine, keynames[row]);
|
| 1837 | if(keyrows[row]!=keyrow)
|
| 1838 | {
|
| 1839 | keyrows[row]=keyrow;
|
| 1840 | key=~keyrow & 0xff;
|
| 1841 | }
|
| 1842 | }
|
| 1843 | |
| 1844 | if (nextkey!=0)
|
| 1845 | {
|
| 1846 | key=nextkey;
|
| 1847 | nextkey=0;
|
| 1848 | }
|
| 1849 | |
| 1850 | if(key!=-1) |
| 1851 | logerror("Keypressed=%02X\n",key);
|
| 1852 | |
| 1853 | return key;
|
| 1854 | }
|
| 1855 | else
|
| 1856 | return -1;
|
| 1857 | }
|
| 1858 | |
| 1859 | /* Floppy disk */
|
| 1860 | |
| 1861 | static void fdc_reset(void)
|
| 1862 | {
|
| 1863 | nimbus_fdc.irq_enabled=0;
|
| 1864 | nimbus_fdc.drq_enabled=0;
|
| 1865 | nimbus_fdc.diskno=0;
|
| 1866 | nimbus_fdc.motor_on=0;
|
| 1867 | }
|
| 1868 | |
| 1869 | static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_intrq_w )
|
| 1870 | {
|
| 1871 | logerror("nimbus_fdc_intrq_w(%d)\n", state);
|
| 1872 | |
| 1873 | if(state && nimbus_fdc.irq_enabled)
|
| 1874 | {
|
| 1875 | external_int(device->machine,0,0x80);
|
| 1876 | } |
| 1877 | }
|
| 1878 | |
| 1879 | static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_drq_w )
|
| 1880 | {
|
| 1881 | logerror("nimbus_fdc_drq_w(%d)\n", state);
|
| 1882 | |
| 1883 | if(state && nimbus_fdc.drq_enabled)
|
| 1884 | drq_callback(device->machine,1);
|
| 1885 | }
|
| 1886 | |
| 1887 | READ8_HANDLER( nimbus_fdc_r )
|
| 1888 | {
|
| 1889 | int result = 0;
|
| 1890 | const device_config *fdc = devtag_get_device(space->machine, FDC_TAG);
|
| 1891 | int pc=cpu_get_pc(space->cpu);
|
| 1892 | const device_config *drive = devtag_get_device(space->machine, nimbus_wd17xx_interface.floppy_drive_tags[nimbus_fdc.diskno]);
|
| 1893 |
|
| 1894 | switch(offset*2)
|
| 1895 | {
|
| 1896 | case 0x08 :
|
| 1897 | result = wd17xx_status_r(fdc, 0);
|
| 1898 | logerror("Disk status=%2.2X\n",result);
|
| 1899 | break;
|
| 1900 | case 0x0A :
|
| 1901 | result = wd17xx_track_r(fdc, 0);
|
| 1902 | break;
|
| 1903 | case 0x0C :
|
| 1904 | result = wd17xx_sector_r(fdc, 0);
|
| 1905 | break;
|
| 1906 | case 0x0E :
|
| 1907 | result = wd17xx_data_r(fdc, 0);
|
| 1908 | break;
|
| 1909 | case 0x10 :
|
| 1910 | result = (nimbus_fdc.motor_on ? 0x04 : 0x00) |
|
| 1911 | (floppy_drive_get_flag_state(drive, FLOPPY_DRIVE_INDEX) ? 0x00 : 0x02) |
|
| 1912 | (floppy_drive_get_flag_state(drive, FLOPPY_DRIVE_READY) ? 0x01 : 0x00); |
| 1913 | break;
|
| 1914 | default:
|
| 1915 | break;
|
| 1916 | }
|
| 1917 | |
| 1918 | logerror("Nimbus FDCR at pc=%08X from %04X data=%02X\n",pc,(offset*2)+0x400,result);
|
| 1919 | |
| 1920 | return result;
|
| 1921 | }
|
| 1922 | |
| 1923 | WRITE8_HANDLER( nimbus_fdc_w )
|
| 1924 | {
|
| 1925 | const device_config *fdc = devtag_get_device(space->machine, FDC_TAG);
|
| 1926 | int pc=cpu_get_pc(space->cpu);
|
| 1927 | |
| 1928 | logerror("Nimbus FDCW at %08X write of %02X to %04X\n",pc,data,(offset*2)+0x400);
|
| 1929 | |
| 1930 | switch(offset*2)
|
| 1931 | {
|
| 1932 | case 0x00 :
|
| 1933 | switch (data & 0x0F)
|
| 1934 | {
|
| 1935 | case 0x01 : nimbus_fdc.diskno=0; break;
|
| 1936 | case 0x02 : nimbus_fdc.diskno=1; break;
|
| 1937 | case 0x04 : nimbus_fdc.diskno=2; break;
|
| 1938 | case 0x08 : nimbus_fdc.diskno=3; break; |
| 1939 | //default : nimbus_fdc.diskno=NO_DRIVE_SELECTED; break; // no drive selected
|
| 1940 | }
|
| 1941 | if (nimbus_fdc.diskno!=NO_DRIVE_SELECTED)
|
| 1942 | {
|
| 1943 | wd17xx_set_drive(fdc, nimbus_fdc.diskno);
|
| 1944 | wd17xx_set_side(fdc, (data & 0x10) ? 1 : 0);
|
| 1945 | }
|
| 1946 | nimbus_fdc.motor_on=(data & 0x20);
|
| 1947 | nimbus_fdc.drq_enabled=(data & 0x80);
|
| 1948 | nimbus_fdc.irq_enabled=1;
|
| 1949 | |
| 1950 | // Nimbus FDC is hard wired for double density
|
| 1951 | wd17xx_set_density(fdc, DEN_MFM_LO);
|
| 1952 | break;
|
| 1953 | case 0x08 :
|
| 1954 | wd17xx_command_w(fdc, 0, data);
|
| 1955 | break;
|
| 1956 | case 0x0A :
|
| 1957 | wd17xx_track_w(fdc, 0, data);
|
| 1958 | break;
|
| 1959 | case 0x0C :
|
| 1960 | wd17xx_sector_w(fdc, 0, data);
|
| 1961 | break;
|
| 1962 | case 0x0E :
|
| 1963 | wd17xx_data_w(fdc, 0, data);
|
| 1964 | break;
|
| 1965 | }
|
| 1966 | }
|
| 1967 | |