Bitwise And - Internal error: exception: access violation

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
ndudman
Posts: 79
Joined: 25 December 2008, 14:00 PM

Bitwise And - Internal error: exception: access violation

Post by ndudman »

Hi

With the follow text code i get a
  • >"C:\Program Files\ZBasic\zbasic.exe" --target-device=ZX24p --directory="Z:\home\ndudman\source\swapper/" "test.bas"
    Internal error: exception: access violation
    >Exit code: 1
if the last line is commented out all is ok... what am I doing wrong with the Bitwise AND ?

Code: Select all

sub main()
	Dim resp(1 to 5) as Byte
	resp(1) = 0
	resp(2) = 0
	resp(3) = 0
	Dim MSB as UnsignedInteger = Shl(CUInt(resp(2)), 8)	
	Dim b as Byte = resp(3) 
	Dim LSB as UnsignedInteger = CUInt(b AND 0HFF )
end sub
Thanks for any pointers
Neil
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Bitwise And - Internal error: exception: access violatio

Post by dkinzer »

ndudman wrote:what am I doing wrong with the Bitwise AND ?
The error is with the second operand to the And, an improperly formed hexadecimal constant. It will compile without error if you change it as shown below.

Code: Select all

Dim LSB as UnsignedInteger = CUInt(b AND &HFF)
The internal error occurs because the improperly formed initializer isn't being handled correctly. We will need to research this further to find out how to correct it.
- Don Kinzer
ndudman
Posts: 79
Joined: 25 December 2008, 14:00 PM

Post by ndudman »

Thanks very much... looking again at the correction... I can't believe I didn't notice the missing & :)... but thanks as I was stumped.

Glad to have helped a little, and thanks for your help

Neil
Post Reply