Bug in the instruction "sac" (inline asm)

General discussion on mikroC PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
freewheel
Posts: 17
Joined: 01 Oct 2008 10:36

Bug in the instruction "sac" (inline asm)

#1 Post by freewheel » 03 Feb 2010 08:39

Hi,

Today I have found a error again in your compiler! Namely, the instruction SAC or SAC.R in assembly block don't work trully.

For example:

Code: Select all

ACCAU = 0x00;
ACCAH = 0x120F;
ACCAL = 0xFF00;
CORCON = 0x0010;     // SATDW = 1
asm {
     mov #0xB900, W5   ; W5 = 0xB900
     sac  A,#4, W5          ; Result in W5 (=0x0484) is wrong 
     nop                         ; the true result is 0x0120
     nop                         ; But, the following operations
     sftac A,#4                ; return the true result 
     sac  A,W5                ; W5 = 0x120 --> OK
}
So I doubt whether your compiler can be wrong???
Please reply to me!
Thank.

User avatar
anikolic
mikroElektronika team
Posts: 1775
Joined: 17 Aug 2009 16:51
Location: Belgrade
Contact:

#2 Post by anikolic » 03 Feb 2010 16:16

Hi,
This could possibly be a simulator issue, and this needs to be thoroughly examined by our developers. Thank you very much for reporting this, I'll inform you of the results as soon as I receive further feedback on this.

Best regards,
Aleksandar
Web Department Manager

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#3 Post by milan » 05 Feb 2010 11:14

Hi,

Code: Select all

sac  A,#4, W5          ; Result in W5 (=0x0484) is wrong 
Opcode is OK.
Tested on mikroICD, result is 0x120 (OK).

In simulator, there is the problem.
We will investigate it and inform you.
SmartADAPT2 rules !

User avatar
milan
mikroElektronika team
Posts: 1013
Joined: 04 May 2006 16:36
Contact:

#4 Post by milan » 05 Feb 2010 11:34

Hi,

It was an error in the simulator, it's corrected now.
Fix will be included on the next release.

Thank you for your report.
SmartADAPT2 rules !

Post Reply

Return to “mikroC PRO for dsPIC30/33 and PIC24 General”