From 2d194ca30a8b1b15749098a1a1aa7f6a47fe6299 Mon Sep 17 00:00:00 2001 From: tcsadmin Date: Fri, 20 Aug 2010 22:05:58 +0000 Subject: opcode changes/fixes git-svn-id: https://mindboards.svn.sourceforge.net/svnroot/mindboards/lms_nbcnxc_128/trunk@15 c9361245-7fe8-9947-84e8-057757c4e366 --- AT91SAM7S256/Source/c_cmd.c | 30 +++++++++++++++++------------- AT91SAM7S256/Source/c_cmd_bytecodes.h | 2 +- 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 -- cgit v1.2.3