MOVLB bank switch, compiler error

General discussion on mikroBasic PRO for PIC.
Post Reply
Author
Message
yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

MOVLB bank switch, compiler error

#1 Post by yo2lio » 27 Jan 2017 20:05

Hi,

After several days of hard debugging, I discovered a big problem, for P18 mcu.

Code: Select all

program test_MOVLB

dim i as byte absolute $200
dim j as byte absolute $300

main:
  i = ((j and $10) >> 4) + 48
end.


This code generate the following asm:

Code: Select all

;test.mbas,7 :: 		i = ((j and $10) >> 4) + 48
0x001C	0x0102      	MOVLB       2
0x001E	0x6B00      	CLRF        _i, 1
0x0020	0x0103      	MOVLB       3
0x0022	0xB900      	BTFSC       _j, 4, 1
0x0024	0x0102      	MOVLB       2
0x0026	0x2B00      	INCF        _i, 1, 1
0x0028	0x0E30      	MOVLW       48
0x002A	0x2700      	ADDWF       _i, 1, 1
This combination is very very wrong:

0x0020 0x0103 MOVLB 3
0x0022 0xB900 BTFSC _j, 4, 1
0x0024 0x0102 MOVLB 2


I use version 6.6.2 and will be very nice to have an update for this version with this bug corrected.

Thank you.
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

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

Re: MOVLB bank switch, compiler error

#2 Post by janni » 28 Jan 2017 00:22

Hi Florin,

This old bug is finally fixed (among some others) :) . Here's how v 7.00 handles your code example

Code: Select all

  		i = ((j and $10) >> 4) + 48
0x001C	0x0E00      	MOVLW       0
0x001E	0x0103      	MOVLB       3
0x0020	0xB900      	BTFSC       _j, 4, 1
0x0022	0x0E01      	MOVLW       1
0x0024	0x0102      	MOVLB       2
0x0026	0x6F00      	MOVWF       _i, 1
0x0028	0x0E30      	MOVLW       48
0x002A	0x2700      	ADDWF       _i, 1, 1

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

Re: MOVLB bank switch, compiler error

#3 Post by yo2lio » 28 Jan 2017 09:07

Hi Janni,

Thank you.

I will go to 7.0

Normally, I don't like to do this (to change the compiler version in the middle of the project).

Thank you again.
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

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

Re: MOVLB bank switch, compiler error

#4 Post by janni » 28 Jan 2017 13:21

Yeah, that's risky without detailed check of new version. At the moment, due to some irritating quirks of new IDE, I use the new command-line compiler with older IDE (v 6.61).

Post Reply

Return to “mikroBasic PRO for PIC General”