home *** CD-ROM | disk | FTP | other *** search
/ APDL Public Domain 1 / APDL_PD1A.iso / program / assembler / as / src / c / m_cop < prev    next >
Encoding:
Text File  |  1992-07-21  |  1.8 KB  |  70 lines

  1.  
  2. /*
  3.  * m_cop.c
  4.  * Copyright © 1992 Niklas Röjemo
  5.  */
  6.  
  7. #include "mnemonics.h"
  8. #include "error.h"
  9. #include "option.h"
  10. #include "input.h"
  11. #include "expr.h"
  12. #include "reloc.h"
  13. #include "put.h"
  14. #include "area.h"
  15. #include "get.h"
  16. #include "help_cop.h"
  17.  
  18. extern int pedantic;
  19.  
  20. static void coprocessor(BOOL CopOnly,int ir,int maxop) /* cp#,cpop,cpdst,cplhs,cprhs {,info} */
  21. {
  22.   int cop = CP_NUMBER(help_copInt(15,"coprocessor number"));
  23.   if(pedantic && cop == 1)
  24.     error(ErrorInfo,TRUE,"Coprocessor 1 is the floating point unit. Use a floating point mnemonic if possible.");
  25.   ir |= cop;
  26.   skipblanks();
  27.   if(inputLook() == ',') {inputSkip(); skipblanks();}
  28.   else error(ErrorError,TRUE,"Inserting a comma after coprocessor number.");
  29.   if(maxop>7)
  30.     ir |= CP_DCODE(help_copInt(maxop,"coprocessor opcode"));
  31.   else
  32.     ir |= CP_RTRAN(help_copInt(maxop,"coprocessor opcode"));
  33.   skipblanks();
  34.   if(inputLook() == ',') {inputSkip(); skipblanks();}
  35.   else error(ErrorError,TRUE,"Inserting a comma after data operand.");
  36.   ir |= CopOnly?CPDST_OP(getCopReg()):CPDST_OP(getCpuReg());
  37.   skipblanks();
  38.   if(inputLook() == ',') {inputSkip(); skipblanks();}
  39.   else error(ErrorError,TRUE,"Inserting a comma after dst.");
  40.   ir |= CPLHS_OP(getCopReg());
  41.   skipblanks();
  42.   if(inputLook() == ',') {inputSkip(); skipblanks();}
  43.   else error(ErrorError,TRUE,"Inserting a comma after lhs.");
  44.   ir |= CPRHS_OP(getCopReg());
  45.   skipblanks();
  46.   if(inputLook() == ',') {
  47.     inputSkip();
  48.     skipblanks();
  49.     ir |= CP_INFO(help_copInt(7,"coprocessor info"));
  50.   }
  51.   putIns(ir);
  52. }
  53.  
  54. void m_cdp(unsigned int cc)   /* cdp CC cp#,cpop,cpdst,cplhs,cprhs {,info} */
  55. {
  56.    coprocessor(TRUE,cc | 0x0e000000,15);
  57. }
  58.  
  59. /** REGISTER TRANSFER **/
  60.  
  61. void m_mcr(unsigned int cc)
  62. {
  63.    coprocessor(FALSE,cc | 0x0e000010,7);
  64. }
  65.  
  66. void m_mrc(unsigned int cc)
  67. {
  68.    coprocessor(FALSE,cc | 0x0e100010,7);
  69. }
  70.