MULLW k - Multiply literal with WREG , ERROR

Discuss about beta versions of mikroPascal compiler.
Post Reply
Author
Message
yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

MULLW k - Multiply literal with WREG , ERROR

#1 Post by yo2lio » 03 Oct 2007 11:09

MULLW k - Multiply literal with WREG , ERROR in Software Simulator.

Please run this short program in simulator . MCU P18F452

Code: Select all

program test_MULLW;

var data : word;

begin
  FSR2Ptr := @data;
  WREG := $FF;
  asm
    mullw $FF
  end;
  POSTINC2 := PRODL;
  INDF2 := PRODH;
// data must be $FFFF, but is $00F3
end.
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: MULLW k - Multiply literal with WREG , ERROR

#2 Post by zristic » 03 Oct 2007 11:41

yo2lio wrote:Please run this short program in simulator .
What should happen and what really happens? Please specify. Again, the reprot is incomplete.
Thanks for understanding.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#3 Post by yo2lio » 03 Oct 2007 12:15

data must be $FFFF, but is $00F3

Wreg = 255
After instruction MULLW 255, PRODH and PRODL must be 255 and is not !! :shock:
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#4 Post by zristic » 03 Oct 2007 12:18

yo2lio wrote:data must be $FFFF, but is $00F3

Wreg = 255
After instruction MULLW 255, PRODH and PRODL must be 255 and is not !! :shock:
Thank you, now it is easier to find the problem.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

#5 Post by yo2lio » 06 Oct 2007 12:43

I found the BUG :!: :cry: :cry: :cry:

MULLW 10 ASM instruction must generate HEX instruction $0D0A but i found $0008.
MULLW 100 ASM instruction must generate HEX instruction $0D64 but i found $0004.

I can't handle this situation . :cry:
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#6 Post by zristic » 08 Oct 2007 08:48

We will fix it. Thanks.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#7 Post by janni » 22 Oct 2007 18:14

Could you also fix the problem with retfie? It' always being translated to $0011, whatever the user's intentions:

Code: Select all

             is    should be

retfie     $0011   $0010  (default)
retfie 0   $0011   $0010
retfie 1   $0011   $0011

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#8 Post by zristic » 23 Oct 2007 09:00

janni wrote:Could you also fix the problem with retfie?
Yep, of course.

janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#9 Post by janni » 23 Oct 2007 15:16

Another one - CALL xx,FAST doesn't work (as well as RETURN FAST). Call is always coded as $EC.. while it should be $ED... for CALL xx,FAST.

That's quite dangerous as the only workaround for some PIC18s problem with storing/restoring registers on interrupt with RETFIE,FAST (default in mP) involves CALL xx,FAST.

Unfortunatelly, I've sold many controllers based on PIC18F4620 where this problem shows up. I wonder how much the compiler error will cost me this time...

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#10 Post by zristic » 30 Oct 2007 11:20


janni
Posts: 5373
Joined: 18 Feb 2006 13:17
Contact:

#11 Post by janni » 30 Oct 2007 13:10

The trick doesn't work with CALL :(

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#12 Post by zristic » 26 Mar 2008 13:18

janni wrote:The trick doesn't work with CAL
Fixed for CALL too.
Finally...

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

#13 Post by zristic » 26 Mar 2008 13:34

yo2lio wrote: MULLW 10 ASM instruction must generate HEX instruction $0D0A but i found $0008.
MULLW 100 ASM instruction must generate HEX instruction $0D64 but i found $0004.
Fixed.

User avatar
zristic
mikroElektronika team
Posts: 6608
Joined: 03 Aug 2004 12:59
Contact:

Re: MULLW k - Multiply literal with WREG , ERROR

#14 Post by zristic » 26 Mar 2008 13:35

yo2lio wrote:

Code: Select all

program test_MULLW;

var data : word;

begin
  FSR2Ptr := @data;
  WREG := $FF;
  asm
    mullw $FF
  end;
  POSTINC2 := PRODL;
  INDF2 := PRODH;
// data must be $FFFF, but is $00F3
end.
The correct result is not $FFFF, neither it is $00F3 but it is $FE01.

yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

Re: MULLW k - Multiply literal with WREG , ERROR

#15 Post by yo2lio » 26 Mar 2008 13:43

zristic wrote:
yo2lio wrote:

Code: Select all

program test_MULLW;

var data : word;

begin
  FSR2Ptr := @data;
  WREG := $FF;
  asm
    mullw $FF
  end;
  POSTINC2 := PRODL;
  INDF2 := PRODH;
// data must be $FFFF, but is $00F3
end.
The correct result is not $FFFF, neither it is $00F3 but it is $FE01.
Yes, thanks !

I think, the new compiler is very nearly ! :D
Best regards, Florin Andrei Medrea.

http://www.microelemente.ro/
http://www.microelemente.ro/produse-si-servicii/
http://www.microelemente.ro/custom-software/

mail : florin@microelemente.ro

Post Reply

Return to “mikroPascal Beta testing”