⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dishand.c

📁 minix软件源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
}/* * * * * * * * * * * END OF cihand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for  "mov"  opcodes with  immediate *  * data.                                                   *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidmihand(j)   register int j;            /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF mihand()  * * * * * * * * * */   register int k;   int m, n;   char b[64];   objini(j);   printf("%s",optab[j].text);   if (j & 8)      {      FETCH(m);      FETCH(n);      k = ((n << 8) | m);      if (lookext((long)(k),(PC - 1),b))         printf("#%s\n",b);      else         printf("#%d\n",k);      }   else      {      FETCH(m);      printf("*%d\n",m);      }   objout();}/* * * * * * * * * * * END OF mihand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for a family of quick-move opcodes. *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidmqhand(j)   int j;                     /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF mqhand()  * * * * * * * * * */   unsigned long pc;   register int m, n;   objini(j);   pc = PC + 1;   FETCH(m);   FETCH(n);   m = (n << 8) | m;   printf("%s\t",optab[j].text);   if (j & 2)      printf("%s,%s\n",       lookup((long)(m),N_DATA,LOOK_ABS,pc),       REGS[(j & 1) << 3]);   else      printf("%s,%s\n",       REGS[(j & 1) << 3],       lookup((long)(m),N_DATA,LOOK_ABS,pc));   objout();}/* * * * * * * * * * * END OF mqhand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for a family of quick-test opcodes. *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidtqhand(j)   int j;                     /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF tqhand()  * * * * * * * * * */   register int m, n;   int k;   char b[64];   objini(j);   printf("%s\t%s,",optab[j].text,REGS[(j & 1) << 3]);   FETCH(m);   if (j & 1)      {      FETCH(n);      k = ((n << 8) | m);      if (lookext((long)(k),(PC - 1),b))         printf("#%s\n",b);      else         printf("#%d\n",k);      }   else      {      if (m & 80)         m |= 0xff00;      printf("*%d\n",m);      }   objout();}/* * * * * * * * * * * END OF tqhand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for multiple-byte "return" opcodes. *  * The 8088 allows returns to take an optional  16-bit ar- *  * gument,  which  reflects  the  amount to be added to SP *  * after  the pop of the  return  address.  The idea is to *  * facilitate  the use of local  parameters  on the stack. *  * After some  rumination,  it was decided to  disassemble *  * any such arguments as absolute quantities,  rather than *  * rummaging  through the symbol table for possible corre- *  * sponding constants.                                     *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidrehand(j)   int j;                     /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF rehand()  * * * * * * * * * */   register int m, n;   objini(j);   FETCH(m);   FETCH(n);   m = (n << 8) | m;   printf("%s\t#0x%04.4x\n",optab[j].text,m);   objout();}/* * * * * * * * * * * END OF rehand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for "mov"  opcodes involving memory *  * and immediate data.                                     *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidmmhand(j)   register int j;            /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF mmhand()  * * * * * * * * * */   char *a;   register int k;   char b[64];   objini(j);   FETCH(k);   if (k & 0x38)      {      badseq(j,k);      return;      }   printf("%s",optab[j].text);   if ( ! (j & 1) )      putchar('b');   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);   mtrunc(a);   printf("\t%s,",a);   if (j & 1)      {      FETCH(j);      FETCH(k);      k = (k << 8) | j;      if (lookext((long)(k),(PC - 1),b))         printf("#%s\n",b);      else         printf("#%d\n",k);      }   else      {      FETCH(k);      printf("*%d\n",k);      }   objout();}/* * * * * * * * * * * END OF mmhand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the  handler  for the 8088  family of shift and *  * rotate instructions.                                    *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidsrhand(j)   register int j;            /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF srhand()  * * * * * * * * * */   char *a;   register int k;   objini(j);   FETCH(k);   if ((k & 0x38) == 0x30)      {      badseq(j,k);      return;      }   printf("%s",OPFAM[((k & 0x38) >> 3) + 16]);   if ( ! (j & 1) )      putchar('b');   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);   mtrunc(a);   printf("\t%s",a);   if (j & 2)      printf(",cl\n");   else      printf(",*1\n");   objout();}/* * * * * * * * * * * END OF srhand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for the ASCII-adjust opcodes.       *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidaahand(j)   register int j;            /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF aahand()  * * * * * * * * * */   register int k;   objini(j);   FETCH(k);   if (k != 0x0a)      {      badseq(j,k);      return;      }   printf("%s\n",optab[j].text);   objout();}/* * * * * * * * * * * END OF aahand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for port I/O opcodes  which specify *  * the port address as an immediate operand.               *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidiohand(j)   register int j;            /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF iohand()  * * * * * * * * * */   register int k;   objini(j);   FETCH(k);   printf("%s\t0x%02.2x\n",optab[j].text,k);   objout();}/* * * * * * * * * * * END OF iohand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the  handler  for opcodes  which  perform  long *  * (sixteen-bit) relative jumps and calls.                 *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidljhand(j)   register int j;            /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF ljhand()  * * * * * * * * * */   register int k;   int m, n;   objini(j);   FETCH(m);   FETCH(n);   k = (n << 8) | m;   printf("%s\t%s\t\t| loc %05.5lx\n",optab[j].text,    lookup((PC + k + 1L),N_TEXT,LOOK_LNG,(PC - 1L)),    (PC + k + 1L));   objout();}/* * * * * * * * * * * END OF ljhand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for a pair of oddball opcodes (0xf6 *  * and 0xf7) which perform miscellaneous arithmetic opera- *  * tions not dealt with elsewhere.                         *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidmahand(j)   register int j;            /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF mahand()  * * * * * * * * * */   char *a;   register int k;   char b[64];   objini(j);   FETCH(k);   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);   mtrunc(a);   switch (((k = objbuf[1]) & 0x38) >> 3)      {      case 0 :         printf("\ttest");         break;      case 1 :         badseq(j,k);         return;      case 2 :         printf("\tnot");         break;      case 3 :         printf("\tneg");         break;      case 4 :         printf("\tmul");         break;      case 5 :         printf("\timul");         break;      case 6 :         printf("\tdiv");         break;      case 7 :         printf("\tidiv");         break;      }   if ( ! (j & 1) )      putchar('b');   printf("\t%s",a);   if (k & 0x38)      putchar('\n');   else      if (j & 1)         {         FETCH(j);         FETCH(k);         k = (k << 8) | j;         if (lookext((long)(k),(PC - 1),b))            printf(",#%s\n",b);         else            printf(",#%d\n",k);         }      else         {         FETCH(k);         printf(",*%d\n",k);         }   objout();}/* * * * * * * * * * * END OF mahand() * * * * * * * * * * */ /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *  *                                                         *  * This is the handler for miscellaneous jump, call, push, *  * and increment/decrement opcodes  (0xfe and 0xff)  which *  * are not dealt with elsewhere.                           *  *                                                         *  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */voidmjhand(j)   register int j;            /* Pointer to optab[] entry   */{/* * * * * * * * * *  START OF mjhand()  * * * * * * * * * */   char *a;   register int k;   objini(j);   FETCH(k);   a = mtrans((j & 0xfd),(k & 0xc7),TR_STD);   mtrunc(a);   switch (((k = objbuf[1]) & 0x38) >> 3)      {      case 0 :         printf("\tinc");         if ( ! (j & 1) )            putchar('b');         putchar('\t');         break;      case 1 :         printf("\tdec");         if ( ! (j & 1) )            putchar('b');         putchar('\t');         break;      case 2 :         if (j & 1)            printf("\tcall\t@");         else            goto BAD;         break;      case 3 :         if (j & 1)            printf("\tcalli\t@");         else            goto BAD;         break;      case 4 :         if (j & 1)            printf("\tjmp\t@");         else            goto BAD;         break;      case 5 :         if (j & 1)            printf("\tjmpi\t@");         else            goto BAD;         break;      case 6 :         if (j & 1)            printf("\tpush\t");         else            goto BAD;         break;      case 7 : BAD :         badseq(j,k);         return;      }   printf("%s\n",a);   objout();}/* * * * * * * * * * * END OF mjhand() * * * * * * * * * * */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -