- int immreg; // Immediate register destination
- LONG D1; // Source and Destinations
- LONG ea1; // ea bitfields
- int force_imm = NUM_NORMAL; // Holds forced immediate value (i.e. '<' or '>')
- if (*tok == '-')
- {
- if (*tok == CONST || tok[1] == FCONST)
- {
- tok++;
- dspImmedEXVAL = *tok++;
- goto l_check_immed;
- }
- // This could be either -(Rn), -aa or -ea. Check for immediate first
- // Maybe we got an expression here, check for it
- if (*tok == SYMBOL || tok[1] == SYMBOL)
- {
- // Evaluate the expression and go to immediate code path
- if (expr(dspImmedEXPR, &dspImmedEXVAL, &dspImmedEXATTR, &dspImmedESYM) == OK)
- {
- // Only check for aa if we have a defined number in our hands or we've
- // been asked to use a short number format. The former case we'll just test
- // it to see if it's small enough. The later - it's the programmer's call
- // so he'd better have a small address or the fixups will bite him/her in the arse!
- if (dspImmedEXATTR&DEFINED || force_imm == NUM_FORCE_SHORT)
- {
- // It's an immediate, so ea is probably an absolute address
- // (unless it's aa if the immediate is small enough)
- // 'L:ea,D' or 'L:aa,D'
- l_check_immed:
- // Check for aa (which is 6 bits zero extended)
- if (*tok == EOL)
- {
- // 'S,L:aa'
- if (dspImmedEXVAL < 0x40 && force_imm != NUM_FORCE_LONG)
- {
- // 'S,L:aa'
- if (S1 == KW_A)
- S1 = 4;
- else if (S1 == KW_B)
- S1 = 5;
- else
- S1 &= 7;
-
- inst = B16(01000000, 00000000);
- inst |= dspImmedEXVAL;
- inst |= ((S1 & 0x4) << (11 - 2)) + ((S1 & 3) << 8);
- return inst;
- }
- else
- {
- // 'S,L:ea'
- if (S1 == KW_A)
- S1 = 4;
- else if (S1 == KW_B)
- S1 = 5;
- else
- S1 &= 7;
-
- if (ea1 == DSP_EA_ABS)
- deposit_extra_ea = DEPOSIT_EXTRA_WORD;
-
- inst |= B16(01000000, 01110000);
- inst |= ((S1 & 0x4) << (11 - 2)) + ((S1 & 3) << 8);
- inst |= ea1;
- return inst;
- }
-
- }
- if (*tok++ != ',')
- return error("unrecognised L: parallel move syntax: expected ',' after 'L:ea/L:aa'");
- // Check for allowed registers for D (a0, b0, x, y, a, b, ab or ba)
- if (!((*tok >= KW_A10 && *(tok + 1) <= KW_BA) || (*tok >= KW_A && *tok <= KW_B)))
- return error("unrecognised L: parallel move syntax: expected a0, b0, x, y, a, b, ab or ba after 'L:ea/L:aa'");
-
- if (dspImmedEXVAL < (1 << 6) && (dspImmedEXATTR&DEFINED))
- {
- // 'L:aa,D'
- l_aa:
- immreg = *tok++;
- if (immreg == KW_A)
- immreg = 4;
- else if (immreg == KW_B)
- immreg = 5;
- else
- immreg &= 7;
-
- if (*tok != EOL)
- return error("unrecognised L: parallel move syntax: expected End-Of-Line after L:aa,D");
-
- inst &= B16(11111111, 10111111);
- inst |= dspImmedEXVAL;
- inst |= ((immreg & 0x4) << (11 - 2)) + ((immreg & 3) << 8);
- return inst;
- }
- }
-
- if (deposit_extra_ea == DEPOSIT_EXTRA_FIXUP)
- {
- // Hang on, we've got a L:<aa here, let's do that instead
- goto l_aa;
- }
-
- // Well, that settles it - we do have a ea in our hands
- // 'L:ea,D'
- D1 = *tok++;
- if (D1 == KW_A)
- D1 = 4;
- else if (D1 == KW_B)
- D1 = 5;
- else
- D1 &= 7;
-
- if (*tok != EOL)
- return error("unrecognised L: parallel move syntax: expected End-Of-Line after L:ea,D");
-
- inst |= B16(00000000, 00110000);
- inst |= ((D1 & 0x4) << (11 - 2)) + ((D1 & 3) << 8);
- return inst;
- }
- }
- else
- {
- //It's not an immediate, check for '-(Rn)'
- ea1 = checkea(',', L_ERRORS);
+ int immreg; // Immediate register destination
+ LONG D1; // Source and Destinations
+ LONG ea1; // ea bitfields
+ int force_imm = NUM_NORMAL; // Holds forced immediate value (i.e. '<' or '>')
+
+ if (*tok == '-')
+ {
+ if (*tok == CONST || tok[1] == FCONST)
+ {
+ tok++;
+ dspImmedEXVAL = *tok++;
+ goto l_check_immed;
+ }
+
+ // This could be either -(Rn), -aa or -ea. Check for immediate first
+ // Maybe we got an expression here, check for it
+ if (*tok == SYMBOL || tok[1] == SYMBOL)
+ {
+ // Evaluate the expression and go to immediate code path
+ if (expr(dspImmedEXPR, &dspImmedEXVAL, &dspImmedEXATTR, &dspImmedESYM) == OK)
+ {
+ // Only check for aa if we have a defined number in our hands
+ // or we've been asked to use a short number format. The
+ // former case we'll just test it to see if it's small enough.
+ // The later - it's the programmer's call so he'd better have
+ // a small address or the fixups will bite him/her in the arse!
+ if (dspImmedEXATTR&DEFINED || force_imm == NUM_FORCE_SHORT)
+ {
+ // It's an immediate, so ea is probably an absolute address
+ // (unless it's aa if the immediate is small enough)
+ // 'L:ea,D' or 'L:aa,D'
+ l_check_immed:
+ // Check for aa (which is 6 bits zero extended)
+ if (*tok == EOL)
+ {
+ // 'S,L:aa'
+ if (dspImmedEXVAL < 0x40 && force_imm != NUM_FORCE_LONG)
+ {
+ // 'S,L:aa'
+ if (S1 == KW_A)
+ S1 = 4;
+ else if (S1 == KW_B)
+ S1 = 5;
+ else
+ S1 &= 7;