Previous 15994 Revisions Next

r7666 Monday 29th March, 2010 at 23:27:18 UTC by Phill Harvey-Smith
Added preliminary mouse emulation
[src/mess/drivers]rmnimbus.c
[src/mess/includes]rmnimbus.h
[src/mess/machine]rmnimbus.c
[src/mess/video]rmnimbus.c

src/mess/video/rmnimbus.c
r7665r7666
7979UINT16  pixel_mask;
8080UINT8   hs_count;
8181
82static int debug_on;
82static UINT32 debug_flags;
8383
8484static UINT8 get_pixel(UINT16 x, UINT16 y);
8585static UINT16 read_pixel_line(UINT16 x, UINT16 y, UINT8 width);
r7665r7666
9191static void write_pixel_data(UINT16 x, UINT16 y, UINT16    data);
9292static void move_pixel_line(UINT16 x, UINT16 y, UINT16    data, UINT8 width);
9393static void write_reg_004(void);
94static void write_reg_006(void);
9495static void write_reg_010(void);
9596static void write_reg_012(void);
9697static void write_reg_014(void);
r7665r7666
285286        case    reg000  : vidregs[reg000]=data; break;
286287        case    reg002  : vidregs[reg002]=data; break;
287288        case    reg004  : vidregs[reg004]=data; write_reg_004(); break;
288        case    reg006  : vidregs[reg006]=data; break;
289        case    reg006  : vidregs[reg006]=data; write_reg_006(); break;
289290        case    reg008  : vidregs[reg008]=data; break;
290291        case    reg00A  : vidregs[reg00A]=data; break;
291292        case    reg00C  : vidregs[reg00C]=data; break;
r7665r7666
495496    vidregs[reg00C]++;
496497}
497498
499static void write_reg_006(void)
500{
501    vidregs[reg00C]++;
502    vidregs[reg002]=vidregs[reg006];
503}
504
498505static void write_reg_010(void)
499506{
500507    write_pixel_data(vidregs[reg002],vidregs[reg00C],vidregs[reg010]);
r7665r7666
580587{
581588    if(params>0)
582589    {
583        sscanf(param[0],"%d",&debug_on);
590        sscanf(param[0],"%d",&debug_flags);
584591    }
585592    else
586593    {
587594        debug_console_printf(machine,"Error usage : nimbus_vid_debug <debuglevel>\n");
588        debug_console_printf(machine,"Current debuglevel=%02X\n",debug_on);
595        debug_console_printf(machine,"Current debuglevel=%02X\n",debug_flags);
589596    }
590597}
591598
r7665r7666
609616
610617VIDEO_START( nimbus )
611618{
612    debug_on=0;
619    debug_flags=0;
613620
614621    logerror("VIDEO_START\n");
615622
src/mess/includes/rmnimbus.h
r7665r7666
1313#define DEBUG_DB    0x02
1414#define DEBUG_PIXEL 0x04
1515
16#define DEBUG_SET(flags)    ((debug_on & (flags))==(flags))
16#define DEBUG_SET(flags)    ((debug_flags & (flags))==(flags))
1717
1818#define MAINCPU_TAG "maincpu"
1919#define IOCPU_TAG   "iocpu"
r7665r7666
6363
6464/* External int vectors for chained interupts */
6565#define EXTERNAL_INT_DISK       0x80
66#define EXTERNAL_INT_MSM5205    0x84
67#define EXTERNAL_INT_MOUSE_YU   0x88
68#define EXTERNAL_INT_MOUSE_YD   0x89
69#define EXTERNAL_INT_MOUSE_XL   0x8A
70#define EXTERNAL_INT_MOUSE_XR   0x8B   
6671#define EXTERNAL_INT_PC8031_8C  0x8c
6772#define EXTERNAL_INT_PC8031_8E  0x8E
6873#define EXTERNAL_INT_PC8031_8F  0x8F
6974#define EXTERNAL_INT_Z80SIO     0x9C
70#define EXTERNAL_INT_MSM5205    0x84
7175
76
7277/* Memory controler */
7378#define RAM_BANK00_TAG  "bank0"
7479#define RAM_BANK01_TAG  "bank1"
r7665r7666
190195
191196#define DISK_INT_ENABLE         0x01
192197#define MSM5205_INT_ENABLE      0x04
198#define MOUSE_INT_ENABLE        0x08
193199#define PC8031_INT_ENABLE       0x10
194200
195201READ8_HANDLER( iou_r );
r7665r7666
231237
232238void nimbus_msm5205_vck(running_device *device);
233239
240/* Mouse / Joystick */
241
242#define JOYSTICK0_TAG           "joystick0"
243#define MOUSE_BUTTON_TAG        "mousebtn"
244#define MOUSEX_TAG              "mousex"
245#define MOUSEY_TAG              "mousey"
246
247enum
248{
249   MOUSE_PHASE_STATIC = 0,
250   MOUSE_PHASE_POSITIVE,
251   MOUSE_PHASE_NEGATIVE
252};
253
254READ8_HANDLER( mouse_js_r );
255WRITE8_HANDLER( mouse_js_w );
256
257#define MOUSE_INT_ENABLED()     ((iou_reg092 & MOUSE_INT_ENABLE) ? 1 : 0)
258
234259#define LINEAR_ADDR(seg,ofs)    ((seg<<4)+ofs)
235260
236261/* Nimbus sub-bios structures for debugging */
src/mess/machine/rmnimbus.c
r7665r7666
3939#define LATCH_INTS          1
4040#define LOG_PORTS           0
4141#define LOG_INTERRUPTS      0
42#define LOG_INTERRUPTS_EXT 
42#define LOG_INTERRUPTS_EXT  1
4343#define LOG_TIMER           0
4444#define LOG_OPTIMIZATION    0
4545#define LOG_DMA             0
4646#define CPU_RESUME_TRIGGER   7123
4747#define LOG_KEYBOARD        0
4848#define LOG_SIO             0
49#define LOG_DISK_FDD       
49#define LOG_DISK_FDD        1
5050#define LOG_DISK_HDD        0
51#define LOG_DISK           
51#define LOG_DISK            1
5252#define LOG_PC8031          0
5353#define LOG_PC8031_186      0
5454#define LOG_PC8031_PORT     0
r7665r7666
5858
5959/* Debugging */
6060
61UINT32  debug_flags;
61static UINT32  debug_flags;
6262
6363#define DMA_BREAK           0x0000001
64#define DECODE_BIOS         0x0000002
6465
6566/* 80186 internal stuff */
6667struct mem_state
r7665r7666
139140   UINT8       tail;
140141} keyboard;
141142
142
143
144143/* Floppy drives WD2793 */
145144
146145static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_intrq_w );
r7665r7666
158157// Static data related to Floppy and SCSI hard disks
159158static struct _nimbus_drives
160159{
161    UINT8           reg400;
162    UINT8           reg410_in;
163    UINT8           reg410_out;
164    UINT8           reg418;
160    UINT8   reg400;
161    UINT8   reg410_in;
162    UINT8   reg410_out;
163    UINT8   reg418;
165164
166    UINT8           drq_ff;
165    UINT8   drq_ff;
166    UINT8   int_ff;           
167167} nimbus_drives;
168168
169169
170static const SCSIConfigTable SCSI_dev_table =
171{
172   1,                                      /* 1 SCSI device */
173   {
174      { SCSI_ID_0, HARDDISK0_TAG, SCSI_DEVICE_HARDDISK },
175   }
176};
177
178170/* 8031 Peripheral controler */
179171static struct _ipc_interface
180172{
r7665r7666
204196/* Sound */
205197UINT8 last_playmode;
206198
199/* Mouse/Joystick */
200 
201typedef struct
202{
203    UINT8   mouse_px;
204    UINT8   mouse_py;
205   
206    UINT8   mouse_x;
207    UINT8   mouse_y;
208    UINT8   mouse_pc;
209    UINT8   mouse_pcx;
210    UINT8   mouse_pcy;
211   
212    UINT8   intstate_x;
213    UINT8   intstate_y;
214   
215    UINT8   reg0a4;
216   
217    emu_timer   *mouse_timer;
218} _mouse_joy_state;
219
220static _mouse_joy_state nimbus_mouse;
221UINT8 ay8910_a;
222
207223static void drq_callback(running_machine *machine, int which);
224static void nimbus_recalculate_ints(running_machine *machine);
208225
209226static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[]);
210227static void execute_debug_intmasks(running_machine *machine, int ref, int params, const char *param[]);
r7665r7666
221238static void nimbus_bank_memory(running_machine *machine);
222239static void memory_reset(running_machine *machine);
223240static void fdc_reset(void);
224static void generate_disk_int(running_machine *machine);
241static void set_disk_int(running_machine *machine, int state);
225242static void hdc_reset(running_machine *machine);
226243static void hdc_ctrl_write(running_machine *machine, UINT8 data);
227244static void hdc_post_rw(running_machine *machine);
r7665r7666
234251static void iou_reset(void);
235252static void sound_reset(running_machine *machine);
236253
254static void mouse_js_reset(running_machine *machine);
255static TIMER_CALLBACK(mouse_callback);
256
237257#define num_ioports 0x80
238258static UINT16   IOPorts[num_ioports];
239259
r7665r7666
324344   for (Priority = 0; Priority <= i186.intr.priority_mask; Priority++)
325345   {
326346      /* note: by checking 4 bits, we also verify that the mask is off */
327      if ((i186.intr.timer & 15) == Priority)
347      if ((i186.intr.timer & 0x0F) == Priority)
328348      {
329349         /* if we're already servicing something at this level, don't generate anything new */
330350         if (i186.intr.in_service & 0x01)
r7665r7666
408428{
409429    int Priority;
410430    int IntNo;
431    int handled=0;
411432
412433   /* specific case */
413434   if (!(data & 0x8000))
r7665r7666
433454   else
434455   {
435456      /* loop over priorities */
436      for (Priority = 0; Priority <= 7; Priority++)
457      for (Priority = 0; ((Priority <= 7) && !handled); Priority++)
437458      {
438459         /* check for in-service timers */
439460         if ((i186.intr.timer & 0x07) == Priority && (i186.intr.in_service & 0x01))
440461         {
441462            i186.intr.in_service &= ~0x01;
442463            if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for timer\n", attotime_to_double(timer_get_time(machine)));
443            return;
464            handled=1;
444465         }
445466
446467         /* check for in-service DMA interrupts */
447         for (IntNo = 0; IntNo < 2; IntNo++)
468         for (IntNo = 0; ((IntNo < 2) && !handled) ; IntNo++)
448469            if ((i186.intr.dma[IntNo] & 0x07) == Priority && (i186.intr.in_service & (0x04 << IntNo)))
449470            {
450471               i186.intr.in_service &= ~(0x04 << IntNo);
451472               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for DMA%d\n", attotime_to_double(timer_get_time(machine)), IntNo);
452               return;
473               handled=1;
453474            }
454475
455476         /* check external interrupts */
456         for (IntNo = 0; IntNo < 4; IntNo++)
477         for (IntNo = 0; ((IntNo < 4) && !handled) ; IntNo++)
457478            if ((i186.intr.ext[IntNo] & 0x07) == Priority && (i186.intr.in_service & (0x10 << IntNo)))
458479            {
459480               i186.intr.in_service &= ~(0x10 << IntNo);
460481               if (LOG_INTERRUPTS) logerror("(%f) **** Got EOI for INT%d\n", attotime_to_double(timer_get_time(machine)), IntNo);
461               return;
482               handled=1;
462483            }
463484      }
464485   }
486    nimbus_recalculate_ints(machine);
465487}
466488
467489/* Trigger an external interupt, optionally supplying the vector to take */
r7665r7666
469491{
470492   if (LOG_INTERRUPTS_EXT) logerror("generating external int %02X, vector %02X\n",intno,vector);
471493
472   // Only 4 external ints
494    // Only 4 external ints
473495    if(intno>3)
474496    {
475497        logerror("external_int() invalid external interupt no : 0x%02X (can only be 0..3)\n",intno);
r7665r7666
483505        if(i186.intr.ext[intno] & EXTINT_CTRL_CASCADE)
484506            i186.intr.ext_vector[intno]=vector;
485507    }
486
508   
487509    // Turn on the requested request bit and handle interrupt
488510    i186.intr.request |= (0x010 << intno);
489511    update_interrupt_state(machine);
490512}
491513
514static void nimbus_recalculate_ints(running_machine *machine)
515{
516    if((iou_reg092 & DISK_INT_ENABLE) && nimbus_drives.int_ff)
517    {
518        nimbus_drives.int_ff=0;
519        external_int(machine,0,EXTERNAL_INT_DISK);
520    }
521}
492522
493523/*************************************
494524 *
r7665r7666
750780   }
751781
752782    if (LOG_DMA) logerror("Initiated DMA %d - count = %04X, source = %04X, dest = %04X\n", which, d->count, d->source, d->dest);
753    if (debug_flags & DMA_BREAK)
783    if (DEBUG_SET(DMA_BREAK))
754784        debugger_break(machine);
755785
756786   /* set the new control register */
r7665r7666
12901320    pc8031_reset(machine);
12911321    sound_reset(machine);
12921322    memory_reset(machine);
1323    mouse_js_reset(machine);
12931324}
12941325
12951326DRIVER_INIT(nimbus)
r7665r7666
13021333    nimbus_cpu_init(machine);
13031334
13041335    keyboard.keyscan_timer=timer_alloc(machine, keyscan_callback, NULL);
1305
1336    nimbus_mouse.mouse_timer=timer_alloc(machine, mouse_callback, NULL);
1337   
13061338   /* setup debug commands */
13071339   if (machine->debug_flags & DEBUG_FLAG_ENABLED)
13081340   {
r7665r7666
13151347
13161348    }
13171349
1318    debug_flags=0;
1350    debug_flags=DECODE_BIOS;
13191351}
13201352
13211353static void execute_debug_irq(running_machine *machine, int ref, int params, const char *param[])
r7665r7666
13441376{
13451377    int IntNo;
13461378
1347
13481379    debug_console_printf(machine,"i186.intr.priority_mask=%4X\n",i186.intr.priority_mask);
13491380    for(IntNo=0; IntNo<4; IntNo++)
13501381    {
r7665r7666
13801411
13811412    addr_ptr = (UINT8*)memory_get_read_ptr(space,curpc);
13821413
1383    if ((addr_ptr !=NULL) && (addr_ptr[0]==0xCD) && (addr_ptr[1]==0xF0))
1384        decode_subbios(device,curpc);
1414    if(DEBUG_SET(DECODE_BIOS))
1415        if ((addr_ptr !=NULL) && (addr_ptr[0]==0xCD) && (addr_ptr[1]==0xF0))
1416            decode_subbios(device,curpc);
13851417
13861418    return 0;
13871419}
r7665r7666
20342066
20352067    // Setup timer to scan keyboard.
20362068    timer_adjust_periodic(keyboard.keyscan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(50));
2037
20382069}
20392070
20402071static void queue_scancode(UINT8 scancode)
r7665r7666
20602091   return data;
20612092}
20622093
2063static TIMER_CALLBACK(keyscan_callback)
2094static void scan_keyboard(running_machine *machine)
2095
20642096{
20652097    UINT8   keyrow;
20662098    UINT8   row;
r7665r7666
20952127    }
20962128}
20972129
2130static TIMER_CALLBACK(keyscan_callback)
2131{
2132    scan_keyboard(machine);
2133}
20982134
20992135/*
21002136
r7665r7666
21472183    nimbus_drives.reg400=0;
21482184    nimbus_drives.reg410_in=0;
21492185    nimbus_drives.reg410_out=0;
2186    nimbus_drives.int_ff=0;
21502187}
21512188
2152static void generate_disk_int(running_machine *machine)
2189static void set_disk_int(running_machine *machine, int state)
21532190{
21542191    if(LOG_DISK)
2155        logerror("nimbus_drives_intrq\n");
2192        logerror("nimbus_drives_intrq = %d\n",state);
21562193
21572194    if(iou_reg092 & DISK_INT_ENABLE)
21582195    {
2159        external_int(machine,0,EXTERNAL_INT_DISK);
2196        nimbus_drives.int_ff=state;
2197       
2198        if(state)
2199            external_int(machine,0,EXTERNAL_INT_DISK);
21602200    }
21612201}
21622202
21632203static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_intrq_w )
21642204{
2165    if (state)
2166        generate_disk_int(device->machine);
2205    set_disk_int(device->machine,state);
21672206}
21682207
21692208static WRITE_LINE_DEVICE_HANDLER( nimbus_fdc_drq_w )
r7665r7666
23332372    // If we enable the HDC interupt, and an interrupt is pending, go deal with it.
23342373    if(((data & HDC_IRQ_MASK) && (~nimbus_drives.reg410_out & HDC_IRQ_MASK)) &&
23352374       ((~nimbus_drives.reg410_in & HDC_INT_TRIGGER)==HDC_INT_TRIGGER))
2336        generate_disk_int(machine);
2375        set_disk_int(machine,1);
23372376
23382377    nimbus_drives.reg410_out=data;
23392378
r7665r7666
23812420        nimbus_drives.reg410_in&=~mask;
23822421
23832422
2423    if(HDC_IRQ_ENABLED() && ((~nimbus_drives.reg410_in & HDC_INT_TRIGGER)==HDC_INT_TRIGGER))
2424        set_disk_int(device->machine,1);
2425    else
2426        set_disk_int(device->machine,0);
2427
23842428    if(line==SCSI_LINE_REQ)
23852429    {
23862430        if (state==0)
23872431        {
2388            if(HDC_IRQ_ENABLED() && ((~nimbus_drives.reg410_in & HDC_INT_TRIGGER)==HDC_INT_TRIGGER))
2389                generate_disk_int(device->machine);
2390
23912432            if(((nimbus_drives.reg410_in & HDC_CD_MASK)==HDC_CD_MASK) && (last!=0))
23922433            {
23932434                nimbus_drives.drq_ff=1;
r7665r7666
26322673
26332674    last_playmode=MSM5205_S48_4B;
26342675    msm5205_playmode_w(msm5205,last_playmode);
2676   
2677    ay8910_a=0;
26352678}
26362679
26372680READ8_HANDLER( sound_ay8910_r )
r7665r7666
26662709    running_device *msm5205 = devtag_get_device(space->machine, MSM5205_TAG);
26672710
26682711    msm5205_data_w(msm5205, data);
2712   
2713    // Mouse code needs a copy of this.
2714    ay8910_a=data;
26692715}
26702716
26712717WRITE8_HANDLER( sound_ay8910_portb_w )
r7665r7666
26852731        external_int(device->machine,0,EXTERNAL_INT_MSM5205);
26862732}
26872733
2734static const int MOUSE_XYA[3][4] = { { 0, 0, 0, 0 }, { 1, 1, 0, 0 }, { 0, 1, 1, 0 } };
2735static const int MOUSE_XYB[3][4] = { { 0, 0, 0, 0 }, { 0, 1, 1, 0 }, { 1, 1, 0, 0 } };
2736//static const int MOUSE_XYA[4] = { 1, 1, 0, 0 };
2737//static const int MOUSE_XYB[4] = { 0, 1, 1, 0 };
26882738
2739static void mouse_js_reset(running_machine *machine)
2740{
2741    _mouse_joy_state *state = &nimbus_mouse;
2742
2743    state->mouse_px=0;
2744    state->mouse_py=0;
2745    state->mouse_x=128;
2746    state->mouse_y=128;
2747    state->mouse_pc=0;
2748    state->mouse_pcx=0;
2749    state->mouse_pcy=0;
2750    state->intstate_x=0;
2751    state->intstate_y=0;
2752    state->reg0a4=0xC0;
2753
2754    // Setup timer to poll the mouse
2755    timer_adjust_periodic(nimbus_mouse.mouse_timer, attotime_zero, 0, ATTOTIME_IN_HZ(1000));
2756}
2757
2758static TIMER_CALLBACK(mouse_callback)
2759{
2760    UINT8   x = 0;
2761    UINT8   y = 0;
2762//   int     pc=cpu_get_pc(devtag_get_device(machine,MAINCPU_TAG));
2763   
2764    UINT8   intstate_x;
2765    UINT8   intstate_y;
2766    int     xint;
2767    int     yint;
2768   
2769    _mouse_joy_state *state = &nimbus_mouse;
2770
2771   
2772   state->reg0a4 = input_port_read(machine, MOUSE_BUTTON_TAG) | 0xC0;
2773   x = input_port_read(machine, MOUSEX_TAG);
2774    y = input_port_read(machine, MOUSEY_TAG);
2775
2776    UINT8   mxa;
2777    UINT8   mxb;
2778    UINT8   mya;
2779    UINT8   myb;
2780
2781    //logerror("poll_mouse()\n");
2782 
2783   if (x == state->mouse_x)
2784   {
2785      state->mouse_px = MOUSE_PHASE_STATIC;
2786   }
2787   else if (x > state->mouse_x)
2788   {
2789      state->mouse_px = MOUSE_PHASE_POSITIVE;
2790   }
2791   else if (x < state->mouse_x)
2792   {
2793      state->mouse_px = MOUSE_PHASE_NEGATIVE;
2794   }
2795
2796   if (y == state->mouse_y)
2797    {
2798      state->mouse_py = MOUSE_PHASE_STATIC;
2799   }
2800   else if (y > state->mouse_y)
2801   {
2802      state->mouse_py = MOUSE_PHASE_POSITIVE;
2803   }
2804   else if (y < state->mouse_y)
2805   {
2806      state->mouse_py = MOUSE_PHASE_NEGATIVE;
2807   }
2808
2809    switch (state->mouse_px)
2810    {
2811        case MOUSE_PHASE_STATIC     : break;
2812        case MOUSE_PHASE_POSITIVE   : state->mouse_pcx++; break;
2813        case MOUSE_PHASE_NEGATIVE   : state->mouse_pcx--; break;
2814    }
2815    state->mouse_pcx &= 0x03;
2816 
2817    switch (state->mouse_py)
2818    {
2819        case MOUSE_PHASE_STATIC     : break;
2820        case MOUSE_PHASE_POSITIVE   : state->mouse_pcy++; break;
2821        case MOUSE_PHASE_NEGATIVE   : state->mouse_pcy--; break;
2822    }
2823    state->mouse_pcy &= 0x03;
2824
2825//   mxb = MOUSE_XYB[state->mouse_px][state->mouse_pcx]; // XB
2826//    mxa = MOUSE_XYA[state->mouse_px][state->mouse_pcx]; // XA
2827//   mya = MOUSE_XYA[state->mouse_py][state->mouse_pcy]; // YA
2828//   myb = MOUSE_XYB[state->mouse_py][state->mouse_pcy]; // YB
2829   
2830   mxb = MOUSE_XYB[1][state->mouse_pcx]; // XB
2831   mxa = MOUSE_XYA[1][state->mouse_pcx]; // XA
2832   mya = MOUSE_XYA[1][state->mouse_pcy]; // YA
2833   myb = MOUSE_XYB[1][state->mouse_pcy]; // YB
2834 
2835    if ((state->mouse_py!=MOUSE_PHASE_STATIC) || (state->mouse_px!=MOUSE_PHASE_STATIC))
2836    {
2837//        logerror("state->mouse_px=%02X, state->mouse_py=%02X, state->mouse_pcx=%02X, state->mouse_pcy=%02X\n",
2838//              state->mouse_px,state->mouse_py,state->mouse_pcx,state->mouse_pcy);
2839   
2840//        logerror("mxb=%02x, mxa=%02X (mxb ^ mxa)=%02X, (ay8910_a & 0xC0)=%02X, (mxb ^ mxa) ^ ((ay8910_a & 0x80) >> 7)=%02X\n",
2841//              mxb,mxa, (mxb ^ mxa) , (ay8910_a & 0xC0), (mxb ^ mxa) ^ ((ay8910_a & 0x40) >> 6));
2842    }
2843   
2844    intstate_x = (mxb ^ mxa) ^ ((ay8910_a & 0x40) >> 6);
2845    intstate_y = (myb ^ mya) ^ ((ay8910_a & 0x80) >> 7);
2846   
2847    if (MOUSE_INT_ENABLED())
2848    {
2849        if ((intstate_x==1) && (state->intstate_x==0))
2850//        if (intstate_x!=state->intstate_x)
2851        {
2852           
2853            xint=mxa ? EXTERNAL_INT_MOUSE_XR : EXTERNAL_INT_MOUSE_XL;
2854                   
2855            external_int(machine,0,xint);
2856               
2857//            logerror("Xint:%02X, mxb=%02X\n",xint,mxb);
2858        }
2859
2860        if ((intstate_y==1) && (state->intstate_y==0))
2861//        if (intstate_y!=state->intstate_y)
2862        {
2863            yint=myb ? EXTERNAL_INT_MOUSE_YU : EXTERNAL_INT_MOUSE_YD;
2864                   
2865            external_int(machine,0,yint);
2866//            logerror("Yint:%02X, myb=%02X\n",yint,myb);
2867        }       
2868    }
2869    else
2870    {   
2871        state->reg0a4 &= 0xF0;
2872        state->reg0a4 |= ( mxb & 0x01) << 3; // XB
2873        state->reg0a4 |= (!mxb & 0x01) << 2; // XA
2874        state->reg0a4 |= (!myb & 0x01) << 1; // YA
2875        state->reg0a4 |= ( myb & 0x01) << 0; // YB
2876    }
2877     
2878    state->mouse_x = x;
2879    state->mouse_y = y;
2880       
2881    if ((state->mouse_py!=MOUSE_PHASE_STATIC) || (state->mouse_px!=MOUSE_PHASE_STATIC))
2882    {
2883//        logerror("pc=%05X, reg0a4=%02X, reg092=%02X, ay_a=%02X, x=%02X, y=%02X, px=%02X, py=%02X, intstate_x=%02X, intstate_y=%02X\n",
2884//                 pc,state->reg0a4,iou_reg092,ay8910_a,state->mouse_x,state->mouse_y,state->mouse_px,state->mouse_py,intstate_x,intstate_y);
2885    }
2886   
2887    state->intstate_x=intstate_x;
2888    state->intstate_y=intstate_y;
2889}
2890
2891READ8_HANDLER( mouse_js_r )
2892{
2893   /*
2894
2895        bit     description
2896
2897        0       JOY 0-Up    or mouse XB
2898        1       JOY 0-Down  or mouse XA
2899        2       JOY 0-Left  or mouse YA
2900        3       JOY 0-Right or mouse YB
2901        4       JOY 0-b0    or mouse rbutton
2902        5       JOY 0-b1    or mouse lbutton
2903        6       ?? always reads 1
2904        7       ?? always reads 1
2905
2906    */
2907    UINT8   result;
2908//   int     pc=cpu_get_pc(devtag_get_device(space->machine,MAINCPU_TAG));
2909 
2910    _mouse_joy_state *state = &nimbus_mouse;
2911
2912   if (input_port_read(space->machine, "config") & 0x01)
2913   {
2914        result=state->reg0a4;
2915        //logerror("mouse_js_r: pc=%05X, result=%02X\n",pc,result);
2916    }
2917   else
2918   {
2919      result=input_port_read_safe(space->machine, JOYSTICK0_TAG, 0xff);
2920   }
2921
2922    return result;
2923}
2924
2925WRITE8_HANDLER( mouse_js_w )
2926{
2927}
2928
src/mess/drivers/rmnimbus.c
r7665r7666
109109ADDRESS_MAP_END
110110
111111static ADDRESS_MAP_START(nimbus_io, ADDRESS_SPACE_IO, 16)
112    AM_RANGE( 0x0000, 0x002f) AM_READWRITE( nimbus_video_io_r, nimbus_video_io_w)
113    AM_RANGE( 0x0030, 0x007f) AM_READWRITE( nimbus_io_r, nimbus_io_w)
112    AM_RANGE( 0x0000, 0x0031) AM_READWRITE( nimbus_video_io_r, nimbus_video_io_w)
113    AM_RANGE( 0x0032, 0x007f) AM_READWRITE( nimbus_io_r, nimbus_io_w)
114114    AM_RANGE( 0x0080, 0x0081) AM_READWRITE8( mcu_r, mcu_w, 0x00FF)
115115    AM_RANGE( 0x0092, 0x0093) AM_READWRITE8( iou_r, iou_w, 0x00FF)
116    AM_RANGE( 0x00A4, 0x00A5) AM_READWRITE8( mouse_js_r, mouse_js_w, 0x00FF)
116117    AM_RANGE( 0X00c0, 0X00cf) AM_READWRITE8( pc8031_r, pc8031_w, 0x00FF)
117118    AM_RANGE( 0X00e0, 0X00ef) AM_READWRITE8( sound_ay8910_r, sound_ay8910_w, 0x00FF)
118119    AM_RANGE( 0x00f0, 0x00f7) AM_DEVREADWRITE8(Z80SIO_TAG, z80sio_cd_ba_r, z80sio_cd_ba_w, 0x00ff)
r7665r7666
121122ADDRESS_MAP_END
122123
123124static INPUT_PORTS_START( nimbus )
125   PORT_START("config")
126   PORT_CONFNAME( 0x01, 0x00, "Input Port 0 Device")
127   PORT_CONFSETTING( 0x00, "Mouse" )
128   PORT_CONFSETTING( 0x01, DEF_STR( Joystick ) )
129
124130   PORT_START("KEY0") /* Key row 0 scancodes 00..07 */
125131   //PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("1") PORT_CODE(KEYCODE_1) PORT_CHAR('1')
126132    PORT_BIT(0x01, IP_ACTIVE_LOW, IPT_UNUSED)
r7665r7666
237243   //PORT_BIT(0x20, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP6")    PORT_CODE(KEYCODE_6_PAD)        PORT_CHAR('6')
238244   //PORT_BIT(0x40, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP+")    PORT_CODE(KEYCODE_PLUS_PAD)     PORT_CHAR('+')
239245    //PORT_BIT(0x80, IP_ACTIVE_LOW, IPT_KEYBOARD) PORT_NAME("KP1")    PORT_CODE(KEYCODE_1_PAD)        PORT_CHAR('1')
246   
247   PORT_START(JOYSTICK0_TAG)
248   PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_UP )    PORT_PLAYER(1) PORT_8WAY // XB
249   PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN )  PORT_PLAYER(1) PORT_8WAY // XA
250   PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT )  PORT_PLAYER(1) PORT_8WAY // YA
251   PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT ) PORT_PLAYER(1) PORT_8WAY // YB
252   PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1)
253   PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1)
254
255    PORT_START(MOUSE_BUTTON_TAG)  /* Mouse buttons */
256      PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_BUTTON2) PORT_NAME("Mouse Button 2") PORT_CODE(MOUSECODE_BUTTON2)
257      PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_BUTTON1) PORT_NAME("Mouse Button 1") PORT_CODE(MOUSECODE_BUTTON1)
258
259   PORT_START(MOUSEX_TAG) /* Mouse - X AXIS */
260   PORT_BIT( 0xff, 0x00, IPT_MOUSE_X) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
261
262   PORT_START(MOUSEY_TAG) /* Mouse - Y AXIS */
263   PORT_BIT( 0xff, 0x00, IPT_MOUSE_Y) PORT_SENSITIVITY(100) PORT_KEYDELTA(0) PORT_PLAYER(1)
264
240265INPUT_PORTS_END
241266
242267static ADDRESS_MAP_START(nimbus_iocpu_mem, ADDRESS_SPACE_PROGRAM, 8)
r7665r7666
325350   MDRV_SOUND_CONFIG(msm5205_config)
326351
327352   MDRV_SOUND_ROUTE(ALL_OUTPUTS, MONO_TAG, 0.75)
353   
354   
328355MACHINE_DRIVER_END
329356
330357

Previous 15994 Revisions Next


© 1998-2018 The MESS Team