ver 8.3 Not(Data.Bit) - problem still persist

Beta Testing discussion on mikroPascal.
Post Reply
Author
Message
yo2lio
Posts: 1878
Joined: 19 Sep 2006 12:57
Location: Romania, Arad City
Contact:

ver 8.3 Not(Data.Bit) - problem still persist

#1 Post by yo2lio » 09 Aug 2008 20:47

Hello,

This code, still don't work:

Code: Select all

  i.7 := not(i.7);
Same for :

Code: Select all

  i.j := not(i.j);
Instead of this :

Code: Select all

;test_mp8_3.ppas,9 :: 			i.7 := not(i.7);
$0010	$0E01	    			MOVLW	128
$0012	$1415	    			ANDWF	_i, 0, 0
$0014	$6E01	    			MOVWF	STACK_1, 0
$0016	$1E01	    			COMF	STACK_1, 1, 0
$0018	$5001	    			MOVF	STACK_1, 0, 0
$001A	$0A00	    			XORLW	0
$001C	$E103	    			BNZ	test_mp8_3_L_1
$001E	$9015	    			BCF	_i, 7, 0
$0020	$EF13	F000			GOTO	test_mp8_3_L_2
$0024	$	test_mp8_3_L_1:
$0024	$8015	    			BSF	_i, 7, 0
$0026	$	test_mp8_3_L_2:
Is recommended this :

Code: Select all

  MOVLW 128
  ANDWF	_i, 0, 0
  XORLW 255
  ADDLW 1
  BZ	test_mp8_3_L_1 
  BCF	_i, 7, 0
  GOTO	test_mp8_3_L_2 
test_mp8_3_L_1 :
  BSF	_i, 7, 0
test_mp8_3_L_2 :
But also the following code can be accepted ....

Code: Select all

  MOVLW 128
  ANDWF	_i, 0, 0
  MOVWF	STACK_1, 0
  MOVF	STACK_1, 0, 0
  XORLW 255
  ADDLW 1
  BZ	test_mp8_3_L_1 
  BCF	_i, 7, 0
  GOTO	test_mp8_3_L_2 
test_mp8_3_L_1 :
  BSF	_i, 7, 0
test_mp8_3_L_2 :
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:

#2 Post by janni » 10 Aug 2008 01:39

Optimal (for PIC18) would be

Code: Select all

;          i.7 := not(i.7); 
  MOVFF     _i,STACK_0 
  COMF      STACK_0,F 
; bank switching for i, if necessary
  BTFSS     STACK_0,7
  BCF       _i, 7 
  BTFSC     STACK_0,7 
  BSF       _i, 7
Naturally, implementing bit logic requires more effort than this :D .

Post Reply

Return to “mikroPascal Beta Testing”