This was used with the mspgcc in Ubuntu 12.04 LTS, the libc function
__divmodhi4 was unnecessarily called twice. The updated mspgcc in
Ubuntu 14.04 LTS:
"msp430-gcc (GCC) 4.6.3
20120301 (mspgcc LTS
20120406 unpatched)"
used from now has a (better?) libc and compilation of the libc. Also,
__divmodhi4 is not present anyway in the new libc and therefore throws an
error.
break;
case 5: // /% ( a b -- a/b a%b )
-#if defined(MSP430)
- /* directly call divmodhi4, gcc calls it twice even though the fn returns
- * both values in one call */
- asm("mov 2(%[ms]), r12\n"
- "mov 0(%[ms]), r10\n"
- "call #__divmodhi4\n"
- "mov r12, 2(%[mso])\n"
- "mov r14, 0(%[mso])\n"
- : [mso] "+r" (mathStackPtr) /* outputs */
- : [ms] "r" (mathStackPtr) /* inputs */
- : /* clobbers */ "r10","r11","r12","r13","r14"
- );
-#else
i = NOS;
j = TOS;
NOS = i / j;
TOS = i % j;
-#endif
break;
case 6: // . ( a -- )