/[gxemul]/trunk/src/devices/dev_dreamcast_maple.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /trunk/src/devices/dev_dreamcast_maple.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 35 by dpavlin, Mon Oct 8 16:21:17 2007 UTC revision 36 by dpavlin, Mon Oct 8 16:21:34 2007 UTC
# Line 25  Line 25 
25   *  SUCH DAMAGE.   *  SUCH DAMAGE.
26   *     *  
27   *   *
28   *  $Id: dev_dreamcast_maple.c,v 1.11 2007/02/03 20:14:23 debug Exp $   *  $Id: dev_dreamcast_maple.c,v 1.14 2007/03/08 19:04:09 debug Exp $
29   *     *  
30   *  Dreamcast "Maple" bus controller.   *  Dreamcast "Maple" bus controller.
31   *   *
# Line 41  Line 41 
41   *   *
42   *  TODO:   *  TODO:
43   *      Unit numbers / IDs for real Maple devices.   *      Unit numbers / IDs for real Maple devices.
44     *      The Controller (up/down/left/right, buttons, etc).
45   */   */
46    
47  #include <stdio.h>  #include <stdio.h>
# Line 95  struct dreamcast_maple_data { Line 96  struct dreamcast_maple_data {
96   *   *
97   *  TODO: Figure out strings and numbers of _real_ Maple devices.   *  TODO: Figure out strings and numbers of _real_ Maple devices.
98   */   */
99    #if 0
100  static struct maple_device maple_device_controller = {  static struct maple_device maple_device_controller = {
101          {          {
102                  BE32_TO_HOST(MAPLE_FUNC(MAPLE_FN_CONTROLLER)),  /*  di_func  */                  BE32_TO_HOST(MAPLE_FUNC(MAPLE_FN_CONTROLLER)),  /*  di_func  */
# Line 107  static struct maple_device maple_device_ Line 109  static struct maple_device maple_device_
109                  LE16_TO_HOST(100)               /*  di_max_power  */                  LE16_TO_HOST(100)               /*  di_max_power  */
110          }          }
111  };  };
112    #endif
113  static struct maple_device maple_device_keyboard = {  static struct maple_device maple_device_keyboard = {
114          {          {
115                  BE32_TO_HOST(MAPLE_FUNC(MAPLE_FN_KEYBOARD)),/*  di_func  */                  BE32_TO_HOST(MAPLE_FUNC(MAPLE_FN_KEYBOARD)),/*  di_func  */
# Line 138  static struct maple_device maple_device_ Line 141  static struct maple_device maple_device_
141  DEVICE_TICK(maple)  DEVICE_TICK(maple)
142  {  {
143          struct dreamcast_maple_data *d = (struct dreamcast_maple_data *) extra;          struct dreamcast_maple_data *d = (struct dreamcast_maple_data *) extra;
144          int control_bits, key = console_readchar(d->console_handle);          int key;
145    
146          if (key < 0)          while ((key = console_readchar(d->console_handle)) >= 0) {
147                  return;                  /*  Add to the keyboard queue:  */
148                    d->char_queue[d->char_queue_head] = key;
149                    d->char_queue_head = (d->char_queue_head + 1) % MAX_CHARS;
150                    if (d->char_queue_head == d->char_queue_tail)
151                            fatal("[ dreamcast_maple: KEYBOARD QUEUE OVERRUN! ]\n");
152            }
153    
154          /*  Add to the keyboard queue:  */  #if 0
155          d->char_queue[d->char_queue_head] = key;          /*
156          d->char_queue_head = (d->char_queue_head + 1) % MAX_CHARS;           *  NOTE/TODO:
157          if (d->char_queue_head == d->char_queue_tail)           *
158                  fatal("[ dreamcast_maple: KEYBOARD QUEUE OVERRUN! ]\n");           *  Implement the controller in a reasonable way!
159             */
160    
161          control_bits = 0;          control_bits = 0;
162          switch (key) {          switch (key) {
# Line 205  DEVICE_TICK(maple) Line 214  DEVICE_TICK(maple)
214                          fatal("[ dreamcast_maple: CONTROLLER QUEUE "                          fatal("[ dreamcast_maple: CONTROLLER QUEUE "
215                              "OVERRUN! ]\n");                              "OVERRUN! ]\n");
216          }          }
217    #endif
218  }  }
219    
220    
# Line 310  static void maple_getcond_keyboard_respo Line 320  static void maple_getcond_keyboard_respo
320          key = get_key(d);          key = get_key(d);
321    
322          /*          /*
323           *  buf[0] = shift keys (1 = ctrl, 2 = shift)           *  buf[0] = shift keys (1 = left ctrl, 2 = shift, 0x10 = right ctrl)
324           *  buf[1] = led state           *  buf[1] = led state
325           *  buf[2] = key           *  buf[2] = key
326           */           */
# Line 627  DEVINIT(dreamcast_maple) Line 637  DEVINIT(dreamcast_maple)
637              0x5f6c00, 0x100, dev_dreamcast_maple_access, d, DM_DEFAULT, NULL);              0x5f6c00, 0x100, dev_dreamcast_maple_access, d, DM_DEFAULT, NULL);
638    
639          /*  Devices connected to port A..D:  */          /*  Devices connected to port A..D:  */
640          d->device[0] = &maple_device_controller;          d->device[0] = NULL;    /*  &maple_device_controller;  */
641          d->device[1] = NULL;          d->device[1] = NULL;
642          d->device[2] = &maple_device_keyboard;          d->device[2] = &maple_device_keyboard;
643          d->device[3] = NULL;    /*  TODO:  &maple_device_mouse;  */          d->device[3] = NULL;    /*  TODO:  &maple_device_mouse;  */

Legend:
Removed from v.35  
changed lines
  Added in v.36

  ViewVC Help
Powered by ViewVC 1.1.26