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

📄 asm.c

📁 gdb for adsp develop
💻 C
📖 第 1 页 / 共 4 页
字号:
   {   if (parm_count != 2)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space) &&       ISMEM(parm[1].memory_space)) {      instr->c = (BYTE) ((parm[1].address >> 24) & 0xff);      instr->a = (BYTE) (parm[0].address & 0xff);      instr->b = (BYTE) ((parm[1].address >> 16) & 0xff);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_consth() *//*** Formats:   <nmemonic> RC, RA, UI, RND, FD, FS** Examples:  CONVERT**** Note:  This function is used only with the CONVERT**        operation.**** Note:  Some assembler examples show this operation with**        only five parameters.  It should have six.*/intasm_convert(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   BYTE  ui;   BYTE  rnd;   BYTE  fd;   BYTE  fs;   if (parm_count != 6)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space) &&       ISGENERAL(parm[1].memory_space) &&       ISMEM(parm[2].memory_space) &&       ISMEM(parm[3].memory_space) &&       ISMEM(parm[4].memory_space) &&       ISMEM(parm[5].memory_space)) {      if (parm[2].address > 1)         return (EMSYNTAX);      if (parm[3].address > 0x07)         return (EMSYNTAX);      if (parm[4].address > 0x03)         return (EMSYNTAX);      if (parm[5].address > 0x03)         return (EMSYNTAX);      ui =  (BYTE) ((parm[2].address << 7) & 0x80);      rnd = (BYTE) ((parm[3].address << 4) & 0x70);      fd =  (BYTE) ((parm[4].address << 2) & 0x0c);      fs =  (BYTE) (parm[5].address & 0x03);      instr->c = (BYTE) (parm[0].address & 0xff);      instr->a = (BYTE) (parm[1].address & 0xff);      instr->b = (ui | rnd | fd | fs);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_convert() *//*** Formats:   <nmemonic> RC, RA** Examples:  DIV0**** Note:  This function is used only with the DIV0**        operation.*/intasm_div0(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 2)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space) &&       ISGENERAL(parm[1].memory_space)) {      /* Make sure M flag is cleared */      instr->op = (BYTE) (instr->op & 0xfe);      instr->c = (BYTE) (parm[0].address & 0xff);      instr->a = 0;      instr->b = (BYTE) (parm[1].address & 0xff);      }   else   if (ISGENERAL(parm[0].memory_space) &&       ISMEM(parm[1].memory_space)) {      /* Check immediate value */      if (parm[1].address > 0xff)         return (EMSYNTAX);      /* Make sure M flag is set */      instr->op = (BYTE) (instr->op | 0x01);      instr->c = (BYTE) (parm[0].address & 0xff);      instr->a = 0;      instr->b = (BYTE) (parm[1].address & 0xff);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_div0() *//*** Formats:   <nmemonic> RC, RA** Examples:  EXHWS**** Note:  This function is used only with the EXHWS**        operation.*/intasm_exhws(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 2)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space) &&       ISGENERAL(parm[1].memory_space)){      instr->c = (BYTE) (parm[0].address & 0xff);      instr->a = (BYTE) (parm[1].address & 0xff);      instr->b = 0;      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_exhws() *//*** Formats:   <nmemonic>  <target>** Examples:  JMP**** Note:  This function is used only with the JMP**        operation.**** Note:  This function will only do absolute jumps.*/intasm_jmp(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 1)      return (EMSYNTAX);   if (ISMEM(parm[0].memory_space)) {      /* Make sure M flag is set */      if (parm[0].memory_space != PC_RELATIVE)        instr->op = (BYTE) (instr->op | 0x01);      else        instr->op = (BYTE) instr->op ;      instr->c = (BYTE) ((parm[0].address >> 10) & 0xff);      instr->a = 0;      instr->b = (BYTE) ((parm[0].address >> 2) & 0xff);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_jmp() *//*** Formats:   <nmemonic> RB** Examples:  JMPI**** Note:  This function is used only with the JMPI**        operation.*/intasm_jmpi(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 1)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space)) {      instr->c = 0;      instr->a = 0;      instr->b = (BYTE) (parm[0].address & 0xff);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_jmpi() *//*** Formats:   <nmemonic> RC, SA** Examples:  MFSR**** Note:  This function is used only with the MFSR**        operation.*/intasm_mfsr(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 2)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space) &&       ISSPECIAL(parm[1].memory_space)) {      instr->c = (BYTE) (parm[0].address & 0xff);      instr->a = (BYTE) (parm[1].address & 0xff);      instr->b = 0;      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_mfsr() *//*** Formats:   <nmemonic> SA, RB** Examples:  MTSR**** Note:  This function is used only with the MTSR**        operation.*/intasm_mtsr(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 2)      return (EMSYNTAX);   if (ISSPECIAL(parm[0].memory_space) &&       ISGENERAL(parm[1].memory_space)) {      instr->c = 0;      instr->a = (BYTE) (parm[0].address & 0xff);      instr->b = (BYTE) (parm[1].address & 0xff);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_mtsr() *//*** Formats:   <nmemonic> SA, <const16>** Examples:  MTSRIM**** Note:  This function is used only with the MTSRIM**        operation.*/intasm_mtsrim(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 2)      return (EMSYNTAX);   if (ISSPECIAL(parm[0].memory_space) &&       ISMEM(parm[1].memory_space)) {      instr->c = (BYTE) ((parm[1].address >> 8) & 0xff);      instr->a = (BYTE) (parm[0].address & 0xff);      instr->b = (BYTE) (parm[1].address & 0xff);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_mtsrim() *//*** Formats:   <nmemonic> RC, RA** Examples:  MFTLB**** Note:  This function is used only with the MFTLB**        operation.*/intasm_mftlb(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 2)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space) &&       ISGENERAL(parm[1].memory_space)) {      instr->c = (BYTE) (parm[0].address & 0xff);      instr->a = (BYTE) (parm[1].address & 0xff);      instr->b = 0;      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_mftlb() *//*** Formats:   <nmemonic> RA, RB** Examples:  MTTLB**** Note:  This function is used only with the MTTLB**        operation.*/intasm_mttlb(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 2)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space) &&       ISGENERAL(parm[1].memory_space)) {      instr->c = 0;      instr->a = (BYTE) (parm[0].address & 0xff);      instr->b = (BYTE) (parm[1].address & 0xff);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_mttlb() *//*** Formats:   <nmemonic> RC, RA, FS** Examples:  SQRT**** Note:  This function is used only with the SQRT**        operation.*/intasm_sqrt(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 3)      return (EMSYNTAX);   if (ISGENERAL(parm[0].memory_space) &&       ISGENERAL(parm[1].memory_space) &&       ISMEM(parm[2].memory_space)) {      instr->c = (BYTE) (parm[0].address & 0xff);      instr->a = (BYTE) (parm[1].address & 0xff);      instr->b = (BYTE) (parm[2].address & 0x03);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_sqrt() *//*** Formats:   <nmemonic>, VN, RA, RB** Examples:  EMULATE**** Note:  This function is used only with the EMULATE**        operation.***/intasm_emulate(instr, parm, parm_count)   struct   instr_t    *instr;   struct   addr_29k_t *parm;   int      parm_count;   {   if (parm_count != 3)      return (EMSYNTAX);   if (ISMEM(parm[0].memory_space) &&       ISGENERAL(parm[1].memory_space) &&       ISGENERAL(parm[2].memory_space)) {      instr->c = (BYTE) (parm[0].address & 0xff);      instr->a = (BYTE) (parm[1].address & 0xff);      instr->b = (BYTE) (parm[2].address & 0xff);      }   else      return(EMSYNTAX);   return (0);   }  /* end asm_emulate() */

⌨️ 快捷键说明

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