+
+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.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
+ r = *tok.u32++ & 0x07;
+ else
+ break;
+
+ if (*tok.u32 == '-')
+ {
+ tok.u32++;
+
+ if ((*tok.u32 >= KW_FP0) && (*tok.u32 <= KW_FP7))
+ cnt = *tok.u32++ & 0x07;
+ 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.u32 != '/')
+ break;
+
+ tok.u32++;
+ }
+
+ *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)
+{
+ CHECK00;
+ tok.u32++;
+
+ if (*tok.u32 == CONST)
+ {
+ tok.u32++;
+// bfval1 = (int)*(uint64_t *)tok.u32;
+ bfval1 = (int)*tok.u64;
+
+ // Do=0, offset=immediate - shift it to place
+ bfparam1 = (0 << 11);
+// tok.u32++;
+// tok.u32++;
+ tok.u64++;
+ }
+ else if (*tok.u32 == SYMBOL)
+ {
+ if (expr((TOKENPTR)bf0expr, &bf0exval, &bf0exattr, &bf0esym) != OK)
+ return ERROR;
+
+ if (!(bf0exattr & DEFINED))
+ return error("bfxxx offset: immediate value must evaluate");
+
+ bfval1 = (int)bf0exval;
+
+ // Do=0, offset=immediate - shift it to place
+ bfparam1 = (0 << 11);
+ }
+ else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+ {
+ // Do=1, offset=data register - shift it to place
+ bfparam1 = (1 << 11);
+ bfval1 = (*(int *)tok.u32 - 128);
+ tok.u32++;
+ }
+ else
+ return ERROR;
+
+ // Eat the ':', if any
+ if (*tok.u32 == ':')
+ tok.u32++;
+
+ if (*tok.u32 == '}' && tok.u32[1] == EOL)
+ {
+ // It is ok to have }, EOL here - it might be "fmove fpn,<ea> {dx}"
+ tok.u32++;
+ return OK;
+ }
+
+ if (*tok.u32 == CONST)
+ {
+ tok.u32++;
+// bfval2 = (int)*(uint64_t *)tok.u32;
+ bfval2 = (int)*tok.u64;
+
+ // Do=0, offset=immediate - shift it to place
+ bfparam2 = (0 << 5);
+// tok.u32++;
+// tok.u32++;
+ tok.u64++;
+ }
+ else if (*tok.u32 == SYMBOL)
+ {
+ if (expr((TOKENPTR)bf0expr, &bf0exval, &bf0exattr, &bf0esym) != OK)
+ return ERROR;
+
+ bfval2 = (int)bf0exval;
+
+ if (!(bf0exattr & DEFINED))
+ return error("bfxxx width: immediate value must evaluate");
+
+ // Do=0, offset=immediate - shift it to place
+ bfparam2 = (0 << 5);
+ }
+ else if ((*tok.u32 >= KW_D0) && (*tok.u32 <= KW_D7))
+ {
+ // Do=1, offset=data register - shift it to place
+ bfval2 = ((*(int *)tok.u32 - 128));
+ bfparam2 = (1 << 5);
+ tok.u32++;
+ }
+ else
+ return ERROR;
+
+ tok.u32++; // Eat the '}'
+
+ return OK;
+}
+