individual bit's operation don't recognizes var type

Beta Testing discussion on mikroBasic.
Post Reply
Author
Message
MAN
Posts: 437
Joined: 11 Jan 2006 18:32
Location: Brasil

individual bit's operation don't recognizes var type

#1 Post by MAN » 13 Jul 2008 21:55

I've used an no usual type of declaration but I find what problem exists.
The compiler ignore the var type and write more final code, that necessary.
The last bit of on LongInt or LongWord is treated different of the rest.
The compiler don't issue a warning or error for bit out of range.
below go a small code segment that shows it.

mB

Code: Select all

'First case the 31 bit is not treated as a bit
Symbol  SetBitj_0  = J.0  = 1
Symbol  SetBitj_7  = J.7  = 1
Symbol  SetBitj_8  = J.8  = 1
Symbol  SetBitj_15 = J.15 = 1
Symbol  SetBitj_16 = J.16 = 1
Symbol  SetBitj_23 = J.23 = 1
Symbol  SetBitj_24 = J.24 = 1
Symbol  SetBitj_30 = J.30 = 1
Symbol  SetBitj_31 = J.31 = 1

'Second case the the compiler ignore the out of range bit's.
Symbol  SetBitk_0  = k.0  = 1
Symbol  SetBitk_7  = k.7  = 1
Symbol  SetBitk_8  = k.8  = 1
Symbol  SetBitk_15 = k.15 = 1
Symbol  SetBitk_16 = k.16 = 1
Symbol  SetBitk_23 = k.23 = 1
Symbol  SetBitk_24 = k.24 = 1
Symbol  SetBitk_31 = k.31 = 1


const   Three as Byte[3] = (0,1,2)


Dim I as word
Dim J as longint
Dim K as word


main:
  'I = @Three
  SetBitj_0
  SetBitj_7
  SetBitj_8
  SetBitj_15
  SetBitj_16
  SetBitj_23
  SetBitj_24
  SetBitj_30
  SetBitj_31

  SetBitk_0
  SetBitk_7
  SetBitk_8
  SetBitk_15
  SetBitk_16
  SetBitk_23
  SetBitk_24
  SetBitk_31

  K.31 = 0
  nop
end.
ASM

Code: Select all

;  Assembly code generated by mikroVirtualMachine - V. 5.0.0.3
;  Date/Time: 13/7/2008 17:40:18
;  Info: http://www.mikroe.com


; ADDRESS	OPCODE	ASM
; ----------------------------------------------
$0000	$EF04	F000			GOTO	_main
$0008	$	_main:
;teste.pbas,34 :: 			main:
$0008	$	_main_main:
;teste.pbas,36 :: 			Y = DD
$0008	$0EFF	    			MOVLW	255
$000A	$6E15	    			MOVWF	_y, 0
;teste.pbas,37 :: 			SetBitj_0
$000C	$	teste_L_1:
$000C	$8016	    			BSF	_j, 0, 0
$000E	$	teste_L_2:
;teste.pbas,38 :: 			SetBitj_7
$000E	$	teste_L_3:
$000E	$8E16	    			BSF	_j, 7, 0
$0010	$	teste_L_4:
;teste.pbas,39 :: 			SetBitj_8
$0010	$	teste_L_5:
$0010	$8017	    			BSF	_j+1, 0, 0
$0012	$	teste_L_6:
;teste.pbas,40 :: 			SetBitj_15
$0012	$	teste_L_7:
$0012	$8E17	    			BSF	_j+1, 7, 0
$0014	$	teste_L_8:
;teste.pbas,41 :: 			SetBitj_16
$0014	$	teste_L_9:
$0014	$8018	    			BSF	_j+2, 0, 0
$0016	$	teste_L_10:
;teste.pbas,42 :: 			SetBitj_23
$0016	$	teste_L_11:
$0016	$8E18	    			BSF	_j+2, 7, 0
$0018	$	teste_L_12:
;teste.pbas,43 :: 			SetBitj_24
$0018	$	teste_L_13:
$0018	$8019	    			BSF	_j+3, 0, 0
$001A	$	teste_L_14:
;teste.pbas,44 :: 			SetBitj_30
$001A	$	teste_L_15:
$001A	$8C19	    			BSF	_j+3, 6, 0
$001C	$	teste_L_16:
;teste.pbas,45 :: 			SetBitj_31
$001C	$	teste_L_17:
$001C	$0E00	    			MOVLW	0
$001E	$1216	    			IORWF	_j, 1, 0
$0020	$0E00	    			MOVLW	0
$0022	$1217	    			IORWF	_j+1, 1, 0
$0024	$0E00	    			MOVLW	0
$0026	$1218	    			IORWF	_j+2, 1, 0
$0028	$0E80	    			MOVLW	128
$002A	$1219	    			IORWF	_j+3, 1, 0
$002C	$	teste_L_18:
;teste.pbas,47 :: 			SetBitk_0
$002C	$	teste_L_19:
$002C	$801A	    			BSF	_k, 0, 0
$002E	$	teste_L_20:
;teste.pbas,48 :: 			SetBitk_7
$002E	$	teste_L_21:
$002E	$8E1A	    			BSF	_k, 7, 0
$0030	$	teste_L_22:
;teste.pbas,49 :: 			SetBitk_8
$0030	$	teste_L_23:
$0030	$801B	    			BSF	_k+1, 0, 0
$0032	$	teste_L_24:
;teste.pbas,50 :: 			SetBitk_15
$0032	$	teste_L_25:
$0032	$8E1B	    			BSF	_k+1, 7, 0
$0034	$	teste_L_26:
;teste.pbas,51 :: 			SetBitk_16
$0034	$	teste_L_27:
$0034	$0E00	    			MOVLW	0
$0036	$121A	    			IORWF	_k, 1, 0
$0038	$0E00	    			MOVLW	0
$003A	$121B	    			IORWF	_k+1, 1, 0
$003C	$	teste_L_28:
;teste.pbas,52 :: 			SetBitk_23
$003C	$	teste_L_29:
$003C	$0E00	    			MOVLW	0
$003E	$121A	    			IORWF	_k, 1, 0
$0040	$0E00	    			MOVLW	0
$0042	$121B	    			IORWF	_k+1, 1, 0
$0044	$	teste_L_30:
;teste.pbas,53 :: 			SetBitk_24
$0044	$	teste_L_31:
$0044	$0E00	    			MOVLW	0
$0046	$121A	    			IORWF	_k, 1, 0
$0048	$0E00	    			MOVLW	0
$004A	$121B	    			IORWF	_k+1, 1, 0
$004C	$	teste_L_32:
;teste.pbas,54 :: 			SetBitk_31
$004C	$	teste_L_33:
$004C	$0E00	    			MOVLW	0
$004E	$121A	    			IORWF	_k, 1, 0
$0050	$0E00	    			MOVLW	0
$0052	$121B	    			IORWF	_k+1, 1, 0
$0054	$	teste_L_34:
;teste.pbas,56 :: 			K.31 = 0
$0054	$0EFF	    			MOVLW	255
$0056	$161A	    			ANDWF	_k, 1, 0
$0058	$0EFF	    			MOVLW	255
$005A	$161B	    			ANDWF	_k+1, 1, 0
$005C	$	teste_L_36:
;teste.pbas,57 :: 			nop
$005C	$0000	    			NOP
$005E	$	teste_L_0:
$005E	$D7FF	    			BRA	$
Working with you, for you!
MAN

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

Re: individual bit's operation don't recognizes var type

#2 Post by zristic » 14 Jul 2008 08:32

Thanks MAN, this will be fixed quickly.

Post Reply

Return to “mikroBasic Beta Testing”