aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--AT91SAM7S256/Source/c_cmd.c30
-rw-r--r--AT91SAM7S256/Source/c_cmd_bytecodes.h2
2 files changed, 18 insertions, 14 deletions
diff --git a/AT91SAM7S256/Source/c_cmd.c b/AT91SAM7S256/Source/c_cmd.c
index 9a81076..f4b1a31 100644
--- a/AT91SAM7S256/Source/c_cmd.c
+++ b/AT91SAM7S256/Source/c_cmd.c
@@ -5153,18 +5153,6 @@ NXT_STATUS cCmdInterpUnop2(CODE_WORD * const pCode)
}
break;
- case OP_ADDROF:
- {
- pArg1 = cCmdResolveDataArg(Arg1, 0, &TypeCode1);
- if (TypeCode1 == TC_ULONG) {
- pArg2 = cCmdResolveDataArg(Arg2, 0, NULL);
- *(ULONG*)pArg1 = (ULONG)pArg2;
- }
- else
- Status = ERR_INSTR; // output argument MUST be an unsigned long type
- }
- break;
-
default:
{
//Fatal error: Unrecognized instruction
@@ -5579,6 +5567,7 @@ NXT_STATUS cCmdInterpBinop(CODE_WORD * const pCode)
UWORD i;
void *pArg1 = NULL, *pArg2 = NULL;
UWORD Count;
+ TYPE_CODE TypeCode1;
polyBinopDispatch ++;
gPCDelta= 4;
@@ -5744,6 +5733,21 @@ NXT_STATUS cCmdInterpBinop(CODE_WORD * const pCode)
}
break;
+ case OP_ADDROF:
+ {
+ pArg1 = cCmdResolveDataArg(Arg1, 0, &TypeCode1);
+ if (TypeCode1 == TC_ULONG) {
+ pArg2 = cCmdResolveDataArg(Arg2, 0, NULL);
+ if ((UBYTE)Arg3) // relative address requested
+ *(ULONG*)pArg1 = (ULONG)pArg2 - (ULONG)(IOMapCmd.MemoryPool);
+ else
+ *(ULONG*)pArg1 = (ULONG)pArg2;
+ }
+ else
+ Status = ERR_INSTR; // output argument MUST be an unsigned long type
+ }
+ break;
+
default:
{
//Fatal error: Unrecognized instruction
@@ -6130,7 +6134,7 @@ float cCmdBinopFlt(CODE_WORD const Code, float LeftOp, float RightOp, TYPE_CODE
case OP_POW:
{
float intpart, fracpart;
- fracpart = modff(LeftOp, &intpart);
+ fracpart = modff(RightOp, &intpart);
if (LeftOp < 0 && fracpart != 0)
return 0; // make the result zero if you try to raise a negative number to a fractional exponent
else
diff --git a/AT91SAM7S256/Source/c_cmd_bytecodes.h b/AT91SAM7S256/Source/c_cmd_bytecodes.h
index 434aeff..5c24472 100644
--- a/AT91SAM7S256/Source/c_cmd_bytecodes.h
+++ b/AT91SAM7S256/Source/c_cmd_bytecodes.h
@@ -135,7 +135,7 @@
#define OP_SINHD 0x87 // dest, src
// misc other JCH additions
-#define OP_ADDROF 0x89 // dest, src
+#define OP_ADDROF 0x89 // dest, src, rel
// additional string opcodes