+ if (cnt < r)
+ return error("register list order");
+
+ cnt -= r;
+ }
+ else
+ cnt = 0;
+
+ while (cnt-- >= 0)
+ rmask |= msktab_minus[r++];
+
+ if (*tok != '/')
+ break;
+
+ tok++;
+ }
+
+ *a_rmask = rmask;
+
+ return OK;
+}
+int fpu_reglist_right(WORD * a_rmask)
+{
+ static WORD msktab_plus[] = {
+ 0x0001, 0x0002, 0x0004, 0x0008,
+ 0x0010, 0x0020, 0x0040, 0x0080
+ };
+
+ WORD rmask = 0;
+ int r, cnt;
+
+ for(;;)
+ {
+ if (*tok >= KW_FP0 && *tok <= KW_FP7)
+ r = *tok++ & 7;
+ else
+ break;
+
+ if (*tok == '-')
+ {
+ tok++;
+
+ if (*tok >= KW_FP0 && *tok <= KW_FP7)
+ cnt = *tok++ & 7;
+ else
+ return error("register list syntax");
+
+ if (cnt < r)
+ return error("register list order");
+
+ cnt -= r;
+ }
+ else
+ cnt = 0;
+
+ while (cnt-- >= 0)
+ rmask |= msktab_plus[r++];
+
+ if (*tok != '/')
+ break;
+
+ tok++;
+ }
+
+ *a_rmask = rmask;
+
+ return OK;
+}
+
+//
+// Check for bitfield instructions extra params
+// These are 020+ instructions and have the following syntax:
+// bfxxx <ea>{param1,param2}
+// param1/2 are either data registers or immediate values
+//
+
+int check030bf(void)
+{
+ WARNING (Add more strict checks as well as checks for non defined (yet) labels)
+
+ if ((activecpu & (CPU_68020 | CPU_68030 | CPU_68040)) == 0)
+ return error(unsupport);
+
+ tok++;
+ if (*tok == CONST)
+ {
+ tok++;
+ bfparam1 = *(int *)tok;
+ if (bfparam1 > 31 || bfparam1 < 0)
+ return error("bfxxx offset: immediate value must be between 0 and 31");
+ bfparam1 = (bfparam1 << 6) | (0 << 11); //Do=0, offset=immediate - shift it to place
+ tok++;
+ }
+ else if (*tok == SYMBOL)
+ {
+ if (expr(bf0expr, &bf0exval, &bf0exattr, &bf0esym) != OK)
+ return ERROR;
+ bfparam1 = bf0exval;
+ if (bfparam1 > 31 || bfparam1 < 0)
+ return error("bfxxx offset: immediate value must be between 0 and 31");
+ bfparam1 = (bfparam1 << 6) | (0 << 11); //Do=0, offset=immediate - shift it to place
+ }
+ else if (*tok >= KW_D0 && *tok <= KW_D7)
+ {
+ bfparam1 = ((*(int *)tok - 128) << 6) | (1 << 11); //Do=1, offset=data register - shift it to place
+ tok++;
+ }
+ else
+ return ERROR;
+
+ if (*tok==':')
+ tok++; //eat the ':'
+
+ if (*tok == '}' && tok[1] == EOL)
+ {
+ tok++;
+ return OK; //It is ok to have }, EOL here - it might be "fmove fpn,<ea> {dx}"
+ }
+
+
+ if (*tok == CONST)
+ {
+ tok++;
+ bfparam2 = *(int *)tok;
+ if (bfparam2 > 31 || bfparam2 < 0)
+ return error("bfxxx width: immediate value must be between 0 and 31");
+ bfparam2 = (bfparam2 << 0) | (0 << 5); //Do=0, offset=immediate - shift it to place
+ tok++;
+ }
+ else if (*tok == SYMBOL)
+ {
+ if (expr(bf0expr, &bf0exval, &bf0exattr, &bf0esym) != OK)
+ return ERROR;
+ bfparam2 = bf0exval;
+ if (bfparam2 > 31 || bfparam2 < 0)
+ return error("bfxxx width: immediate value must be between 0 and 31");
+ bfparam2 = (bfparam2 << 0) | (0 << 5); //Do=0, offset=immediate - shift it to place
+ }
+ else if (*tok >= KW_D0 && *tok <= KW_D7)
+ {
+ bfparam2 = ((*(int *)tok - 128) << 0) | (1 << 5); //Do=1, offset=data register - shift it to place
+ tok++;
+ }
+ else
+ return ERROR;
+
+ tok++; //eat the '}'
+
+ return OK;
+}