Diff for /np2/io/serial.c between versions 1.4 and 1.7

version 1.4, 2003/10/23 18:33:13 version 1.7, 2003/12/08 00:55:32
Line 4 Line 4
 #include        "iocore.h"  #include        "iocore.h"
   
   
 static const BYTE joykeytable[12] = {  static const UINT8 joykeytable[12] = {
                                 0x2a,   0x34,                                  0x2a,   0x34,
                                 0x29,   0x1c,                                  0x29,   0x1c,
                                 0x3c,   0x48,                                  0x3c,   0x48,
Line 12  static const BYTE joykeytable[12] = { Line 12  static const BYTE joykeytable[12] = {
                                 0x3d,   0x4b,                                  0x3d,   0x4b,
                                 0x3a,   0x43};                                  0x3a,   0x43};
   
 static const BYTE kbexflag[0x80] = {  static const UINT8 kbexflag[0x80] = {
                 //       ESC,  1,  2,  3,  4,  5,  6,  7         ; 00h                  //       ESC,  1,  2,  3,  4,  5,  6,  7         ; 00h
                            0,   0,   0,   0,   0,   0,   0,   0,                             0,   0,   0,   0,   0,   0,   0,   0,
                 //        8,  9,  0,  −,  ^,  ¥,  BS, TAB         ; 08h                  //        8,  9,  0,  −,  ^,  ¥,  BS, TAB         ; 08h
Line 72  void keyb_callback(NEVENTITEM item) { Line 72  void keyb_callback(NEVENTITEM item) {
         }          }
 }  }
   
 static void keyb_out(BYTE data) {  static void keyb_out(REG8 data) {
   
         if (keyb.buffers < KB_BUF) {          if (keyb.buffers < KB_BUF) {
                 keyb.buf[(keyb.pos + keyb.buffers) & KB_BUFMASK] = data;                  keyb.buf[(keyb.pos + keyb.buffers) & KB_BUFMASK] = data;
Line 89  static void keyb_out(BYTE data) { Line 89  static void keyb_out(BYTE data) {
   
 // ----  // ----
   
         BYTE    keystat[0x80];          UINT8   keystat[0x80];
   
 void keystat_reset(void) {  void keystat_reset(void) {
   
         ZeroMemory(keystat, sizeof(keystat));          ZeroMemory(keystat, sizeof(keystat));
 }  }
   
 void keystat_senddata(BYTE data) {  
   
         BYTE    key = data & 0x7f;  void keystat_senddata(REG8 data) {
         BOOL    keynochange = FALSE;  
   
           REG8    key;
           BOOL    keynochange;
   
           key = data & 0x7f;
           keynochange = FALSE;
   
           // CTRL:カナ 0x71,0x72 bit7==0でトグル処理 (標準処理)
         if ((key == 0x71) || (key == 0x72)) {          if ((key == 0x71) || (key == 0x72)) {
                 if (data & 0x80) {                  if (data & 0x80) {
                         return;                          return;
Line 120  void keystat_senddata(BYTE data) { Line 125  void keystat_senddata(BYTE data) {
                         keystat[key] ^= 0x80;                          keystat[key] ^= 0x80;
                 }                  }
                 else {                  else {
                           // CTRL:カナ 0x79,0x7a bit7をそのまま通知
                           // (ハードウェアでメカニカル処理してる場合)
                           if ((key == 0x79) || (key == 0x7a)) {
                                   key -= 0x08;
                                   data -= 0x08;
                           }
                         if (!((keystat[key] ^ data) & 0x80)) {                          if (!((keystat[key] ^ data) & 0x80)) {
                                 keystat[key] ^= 0x80;                                  keystat[key] ^= 0x80;
                         }                          }
Line 136  void keystat_senddata(BYTE data) { Line 147  void keystat_senddata(BYTE data) {
                         if (data & 0x80) {                                              // ver0.30                          if (data & 0x80) {                                              // ver0.30
                                 return;                                  return;
                         }                          }
                         keyb_out((BYTE)(data ^ 0x80));                          keyb_out((REG8)(data ^ 0x80));
                 }                  }
                 keyb_out(data);                  keyb_out(data);
         }          }
Line 144  void keystat_senddata(BYTE data) { Line 155  void keystat_senddata(BYTE data) {
   
 void keystat_resetcopyhelp(void) {  void keystat_resetcopyhelp(void) {
   
         BYTE    i;          REG8    i;
   
         for (i=0x60; i<0x62; i++) {          for (i=0x60; i<0x62; i++) {
                 if (keystat[i] & 0x80) {                  if (keystat[i] & 0x80) {
                         keystat[i] &= 0x7f;                          keystat[i] &= 0x7f;
                         keyb_out((BYTE)(i | 0x80));                          keyb_out((REG8)(i | 0x80));
                 }                  }
         }          }
 }  }
   
 void keystat_allrelease(void) {  void keystat_allrelease(void) {
   
         UINT    i;          REG8    i;
   
         for (i=0; i<0x80; i++) {          for (i=0; i<0x80; i++) {
                 if (keystat[i] & 0x80) {                  if (keystat[i] & 0x80) {
                         keystat[i] &= ~0x80;                          keystat[i] &= ~0x80;
                         keyb_out((BYTE)(i + 0x80));                          keyb_out((REG8)(i | 0x80));
                 }                  }
         }          }
 }  }
   
 void keystat_forcerelease(BYTE value) {  void keystat_forcerelease(REG8 value) {
   
         if (keystat[value & 0x7f] & 0x80) {          if (keystat[value & 0x7f] & 0x80) {
                 keystat[value & 0x7f] &= ~0x80;                  keystat[value & 0x7f] &= ~0x80;
                 keyb_out((BYTE)(value | 0x80));                  keyb_out((REG8)(value | 0x80));
         }          }
 }  }
   
 void keystat_resetjoykey(void) {  void keystat_resetjoykey(void) {
   
         int             i;          int             i;
         BYTE    key;          REG8    key;
   
         for (i=0; i<12; i++) {          for (i=0; i<12; i++) {
                 key = joykeytable[i];                  key = joykeytable[i];
                 if (keystat[key] & 0x80) {                  if (keystat[key] & 0x80) {
                         keystat[key] &= 0x7f;                          keystat[key] &= 0x7f;
                         keyb_out((BYTE)(key | 0x80));                          keyb_out((REG8)(key | 0x80));
                 }                  }
         }          }
 }  }
Line 192  void keystat_resetjoykey(void) { Line 203  void keystat_resetjoykey(void) {
 // ----  // ----
   
 typedef struct {  typedef struct {
         BYTE    joysync;          UINT8   joysync;
         BYTE    joylast;          UINT8   joylast;
         BYTE    mouselast;          UINT8   mouselast;
         BYTE    padding;          UINT8   padding;
         BYTE    d_up;          UINT8   d_up;
         BYTE    d_dn;          UINT8   d_dn;
         BYTE    d_lt;          UINT8   d_lt;
         BYTE    d_rt;          UINT8   d_rt;
 } KEYEXT;  } KEYEXT;
   
 static  KEYEXT  keyext;  static  KEYEXT  keyext;
 static const BYTE mousedelta[] = {1, 1, 1, 1,  static const UINT8 mousedelta[] = {1, 1, 1, 1,
                                                                         2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4};                                                                          2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 4};
 #define MOUSESTEPMAX ((sizeof(mousedelta) / sizeof(BYTE)) - 1)  #define MOUSESTEPMAX ((sizeof(mousedelta) / sizeof(UINT8)) - 1)
   
 void keyext_flash(void) {  void keyext_flash(void) {
   
Line 302  BYTE keyext_getmouse(SINT16 *x, SINT16 * Line 313  BYTE keyext_getmouse(SINT16 *x, SINT16 *
   
 // ----  // ----
   
 static void IOOUTCALL keyb_o41(UINT port, BYTE dat) {  static void IOOUTCALL keyb_o41(UINT port, REG8 dat) {
   
         keyb.mode = dat;          keyb.mode = dat;
         (void)port;          (void)port;
 }  }
   
 static void IOOUTCALL keyb_o43(UINT port, BYTE dat) {  static void IOOUTCALL keyb_o43(UINT port, REG8 dat) {
   
         if ((!(dat & 0x08)) && (keyb.cmd & 0x08)) {          if ((!(dat & 0x08)) && (keyb.cmd & 0x08)) {
                 keyboard_resetsignal();                  keyboard_resetsignal();
Line 320  static void IOOUTCALL keyb_o43(UINT port Line 331  static void IOOUTCALL keyb_o43(UINT port
         (void)port;          (void)port;
 }  }
   
 static BYTE IOINPCALL keyb_i41(UINT port) {  static REG8 IOINPCALL keyb_i41(UINT port) {
   
         (void)port;          (void)port;
         return(keyb.data);          return(keyb.data);
 }  }
   
 static BYTE IOINPCALL keyb_i43(UINT port) {  static REG8 IOINPCALL keyb_i43(UINT port) {
   
         (void)port;          (void)port;
         return(keyb.status);          return(keyb.status);
Line 362  void keyboard_resetsignal(void) {        Line 373  void keyboard_resetsignal(void) {       
         keyboard_reset();          keyboard_reset();
         for (i=0; i<0x80; i++) {          for (i=0; i<0x80; i++) {
                 if (keystat[i]) {                  if (keystat[i]) {
                         keyb_out((BYTE)i);                          keyb_out((REG8)i);
                 }                  }
         }          }
 }  }
Line 434  void rs232c_midipanic(void) { Line 445  void rs232c_midipanic(void) {
   
 // ----  // ----
   
 static void IOOUTCALL rs232c_o30(UINT port, BYTE dat) {  static void IOOUTCALL rs232c_o30(UINT port, REG8 dat) {
   
         if (cm_rs232c) {          if (cm_rs232c) {
                 cm_rs232c->write(cm_rs232c, dat);                  cm_rs232c->write(cm_rs232c, (UINT8)dat);
         }          }
         if (sysport.c & 4) {          if (sysport.c & 4) {
                 rs232c.send = 0;                  rs232c.send = 0;
Line 449  static void IOOUTCALL rs232c_o30(UINT po Line 460  static void IOOUTCALL rs232c_o30(UINT po
         (void)port;          (void)port;
 }  }
   
 static void IOOUTCALL rs232c_o32(UINT port, BYTE dat) {  static void IOOUTCALL rs232c_o32(UINT port, REG8 dat) {
   
         if (!(dat & 0xfd)) {          if (!(dat & 0xfd)) {
                 rs232c.dummyinst++;                  rs232c.dummyinst++;
Line 507  static void IOOUTCALL rs232c_o32(UINT po Line 518  static void IOOUTCALL rs232c_o32(UINT po
         (void)port;          (void)port;
 }  }
   
 static BYTE IOINPCALL rs232c_i30(UINT port) {  static REG8 IOINPCALL rs232c_i30(UINT port) {
   
         (void)port;          (void)port;
         return(rs232c.data);          return(rs232c.data);
 }  }
   
 static BYTE IOINPCALL rs232c_i32(UINT port) {  static REG8 IOINPCALL rs232c_i32(UINT port) {
   
         if (!(rs232c_stat() & 0x20)) {          if (!(rs232c_stat() & 0x20)) {
                 return(rs232c.result | 0x80);                  return(rs232c.result | 0x80);

Removed from v.1.4  
changed lines
  Added in v.1.7


RetroPC.NET-CVS <cvs@retropc.net>