home *** CD-ROM | disk | FTP | other *** search
-
- /*
- * m_cop.c
- * Copyright © 1992 Niklas Röjemo
- */
-
- #include "mnemonics.h"
- #include "error.h"
- #include "option.h"
- #include "input.h"
- #include "expr.h"
- #include "reloc.h"
- #include "put.h"
- #include "area.h"
- #include "get.h"
- #include "help_cop.h"
-
- extern int pedantic;
-
- static void coprocessor(BOOL CopOnly,int ir,int maxop) /* cp#,cpop,cpdst,cplhs,cprhs {,info} */
- {
- int cop = CP_NUMBER(help_copInt(15,"coprocessor number"));
- if(pedantic && cop == 1)
- error(ErrorInfo,TRUE,"Coprocessor 1 is the floating point unit. Use a floating point mnemonic if possible.");
- ir |= cop;
- skipblanks();
- if(inputLook() == ',') {inputSkip(); skipblanks();}
- else error(ErrorError,TRUE,"Inserting a comma after coprocessor number.");
- if(maxop>7)
- ir |= CP_DCODE(help_copInt(maxop,"coprocessor opcode"));
- else
- ir |= CP_RTRAN(help_copInt(maxop,"coprocessor opcode"));
- skipblanks();
- if(inputLook() == ',') {inputSkip(); skipblanks();}
- else error(ErrorError,TRUE,"Inserting a comma after data operand.");
- ir |= CopOnly?CPDST_OP(getCopReg()):CPDST_OP(getCpuReg());
- skipblanks();
- if(inputLook() == ',') {inputSkip(); skipblanks();}
- else error(ErrorError,TRUE,"Inserting a comma after dst.");
- ir |= CPLHS_OP(getCopReg());
- skipblanks();
- if(inputLook() == ',') {inputSkip(); skipblanks();}
- else error(ErrorError,TRUE,"Inserting a comma after lhs.");
- ir |= CPRHS_OP(getCopReg());
- skipblanks();
- if(inputLook() == ',') {
- inputSkip();
- skipblanks();
- ir |= CP_INFO(help_copInt(7,"coprocessor info"));
- }
- putIns(ir);
- }
-
- void m_cdp(unsigned int cc) /* cdp CC cp#,cpop,cpdst,cplhs,cprhs {,info} */
- {
- coprocessor(TRUE,cc | 0x0e000000,15);
- }
-
- /** REGISTER TRANSFER **/
-
- void m_mcr(unsigned int cc)
- {
- coprocessor(FALSE,cc | 0x0e000010,7);
- }
-
- void m_mrc(unsigned int cc)
- {
- coprocessor(FALSE,cc | 0x0e100010,7);
- }
-