New Bytevector oddity

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
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

New Bytevector oddity

Post by GTBecker »

Code: Select all

Sub Main()
End Sub

Public OLED_RighTimeSplash as new bytevectordata({
 &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h40, &h00,
&h20, &h20, &h00, &h00, &h10, &h10, &h10, &h08, &h08, &h08, &h08, &h0C, &h04, &h04, &h04, &h04,
&h04, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h0E, &h0E, &h0E, &h0E, &h1E,
&h1E, &h1E, &h3E, &h7E, &h7E, &h7C, &h7C, &h7C, &h78, &h78, &h70, &h60, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &hE0, &hFE, &hFE, &hFE, &hFE, &hFE, &h8E, &h8E, &h8E, &h8E, &hDE, &hFE, &hFE, &hFC,
&h7C, &h3C, &h18, &h80, &hE4, &hEE, &h6E, &h6E, &h6E, &h06, &h00, &h80, &hC0, &hE0, &hE0, &hE0,
&hE0, &h60, &h60, &h60, &h60, &hE0, &hC0, &hE0, &hE0, &hE0, &hE0, &h20, &h00, &h00, &hF0, &hFE,
})
results in "VarSetTest.bas:16: Error: expected Program Memory item, file "H:\Desktop\I2C\VarSetTest.bas", line 5, column 1022
VarSetTest.bas:16: Error: file "H:\Desktop\I2C\VarSetTest.bas", line 6, column 1: use of undefined constant "E0""

but

Code: Select all

Sub Main()
End Sub

Public OLED_RighTimeSplash as new bytevectordata({
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h40, &h00,
&h20, &h20, &h00, &h00, &h10, &h10, &h10, &h08, &h08, &h08, &h08, &h0C, &h04, &h04, &h04, &h04,
&h04, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h0E, &h0E, &h0E, &h0E, &h1E,
&h1E, &h1E, &h3E, &h7E, &h7E, &h7C, &h7C, &h7C, &h78, &h78, &h70, &h60, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &hE0, &hFE, &hFE, &hFE, &hFE, &hFE, &h8E, &h8E, &h8E, &h8E, &hDE, &hFE, &hFE, &hFC,
&h7C, &h3C, &h18, &h80, &hE4, &hEE, &h6E, &h6E, &h6E, &h06, &h00, &h80, &hC0, &hE0, &hE0, &hE0,
&hE0, &h60, &h60, &h60, &h60, &hE0, &hC0, &hE0, &hE0, &hE0, &hE0, &h20, &h00, &h00, &hF0, &hFE,
})
does not. Only difference is the space before the first byte definition.
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Further:

Code: Select all

Option TargetDevice ZX24x

Sub Main()
	dim i as integer, sum as long = 0
	for i= 1 to ubound(OLED_RighTimeSplash)
		sum = sum + clng(OLED_RighTimeSplash(i))
	next
	debug.print cstr(ubound(OLED_RighTimeSplash)) &" "& cstr(sum)
End Sub

Public OLED_RighTimeSplash as new bytevectordata({
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h80, &h00, &h40, &h40, &h00,
&h20, &h20, &h20, &h00, &h10, &h10, &h10, &h08, &h08, &h08, &h08, &h0C, &h04, &h04, &h04, &h04,
&h04, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h0E, &h0E, &h0E, &h0E, &h1E,
&h1E, &h1E, &h3E, &h7E, &h7E, &h7C, &h7C, &h7C, &h78, &h78, &h70, &h60, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &hE0, &hFE, &hFE, &hFE, &hFE, &hFE, &h8E, &h8E, &h8E, &h8E, &hDE, &hFE, &hFE, &hFC,
&h7C, &h3C, &h18, &h80, &hE0, &hEE, &hEE, &hEE, &h6E, &h06, &h00, &h80, &hC0, &hE0, &hE0, &hE0,
&hE0, &h60, &h60, &h60, &h60, &hE0, &hC0, &hE0, &hE0, &hE0, &hE0, &h20, &h00, &h00, &hF0, &hFE,
&hFE, &hFE, &hFE, &hCE, &h40, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hE0, &hE0, &h0E, &h0E, &h0E,
&h8E, &hFE, &hFE, &hFE, &hFE, &hFE, &h3E, &h0E, &h0E, &h0E, &h0E, &h8E, &hE0, &hEE, &hEE, &hEE,
&hEE, &h06, &h00, &hC0, &hE0, &hE0, &hE0, &hE0, &hE0, &h40, &h60, &h60, &h60, &hE0, &hE0, &hE0,
&hE0, &hC0, &hC0, &h60, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hE0, &hC0, &h00, &h00, &h80, &hC0,
&hC0, &hE0, &hE0, &h60, &h60, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hC0, &h80, &h00, &h00, &h00,
&h00, &h1E, &h1F, &h1F, &h1F, &h1F, &h8F, &h81, &h83, &h87, &h9F, &h9F, &h1F, &h1E, &h1C, &h18,
&h10, &h00, &h18, &h1F, &h1F, &h1F, &h1F, &h0F, &h00, &h00, &hCF, &hDF, &hDF, &hDF, &hDF, &h9F,
&h99, &h98, &h98, &h98, &hC8, &hFE, &hFF, &hFF, &h7F, &h3F, &h01, &h00, &h10, &h1E, &h1F, &h1F,
&h1F, &h0F, &h01, &h00, &h00, &h00, &h00, &h1C, &h1F, &h1F, &h9F, &h1F, &h07, &h00, &h00, &h10,
&h1F, &h1F, &h1F, &h1F, &h1F, &h03, &h00, &h00, &h00, &h00, &h1C, &h1F, &h1F, &h1F, &h1F, &h0F,
&h00, &h00, &h1C, &h1F, &h1F, &h1F, &h1F, &h03, &h00, &h00, &h00, &h00, &h1E, &h1F, &h1F, &h1F,
&h1F, &h01, &h00, &h00, &h00, &h10, &h1F, &h1F, &h1F, &h1F, &h1F, &h01, &h00, &h0F, &h1F, &h1F,
&h1F, &h1F, &h3B, &h33, &h33, &h33, &h1B, &h1B, &h1B, &h1B, &h0B, &h03, &h03, &h70, &h10, &h00,
&h00, &h00, &h00, &h00, &h00, &h03, &h0F, &h1F, &h3F, &h3F, &h7F, &h7F, &h7F, &hFE, &hFC, &hF8,
&hF0, &hF0, &hF0, &hE0, &hE0, &hE0, &hE0, &hC0, &hC0, &hC0, &hC0, &hC0, &hC1, &hC1, &hC1, &hC1,
&hC1, &hC1, &h41, &h41, &h41, &h60, &h60, &h20, &h20, &h20, &h20, &h10, &h10, &h10, &h00, &h08,
&h08, &h08, &h00, &h04, &h04, &h00, &h02, &h00, &h01, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00
})
Result:
514 33485

Code: Select all

Option TargetDevice ZX24x

Sub Main()
	dim i as integer, sum as long = 0
	for i= 1 to ubound(OLED_RighTimeSplash)
		sum = sum + clng(OLED_RighTimeSplash(i))
	next
	debug.print cstr(ubound(OLED_RighTimeSplash)) &" "& cstr(sum)
End Sub

Public OLED_RighTimeSplash as new bytevectordata({

&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h80, &h00, &h40, &h40, &h00,
&h20, &h20, &h20, &h00, &h10, &h10, &h10, &h08, &h08, &h08, &h08, &h0C, &h04, &h04, &h04, &h04,
&h04, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h0E, &h0E, &h0E, &h0E, &h1E,
&h1E, &h1E, &h3E, &h7E, &h7E, &h7C, &h7C, &h7C, &h78, &h78, &h70, &h60, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &hE0, &hFE, &hFE, &hFE, &hFE, &hFE, &h8E, &h8E, &h8E, &h8E, &hDE, &hFE, &hFE, &hFC,
&h7C, &h3C, &h18, &h80, &hE0, &hEE, &hEE, &hEE, &h6E, &h06, &h00, &h80, &hC0, &hE0, &hE0, &hE0,
&hE0, &h60, &h60, &h60, &h60, &hE0, &hC0, &hE0, &hE0, &hE0, &hE0, &h20, &h00, &h00, &hF0, &hFE,
&hFE, &hFE, &hFE, &hCE, &h40, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hE0, &hE0, &h0E, &h0E, &h0E,
&h8E, &hFE, &hFE, &hFE, &hFE, &hFE, &h3E, &h0E, &h0E, &h0E, &h0E, &h8E, &hE0, &hEE, &hEE, &hEE,
&hEE, &h06, &h00, &hC0, &hE0, &hE0, &hE0, &hE0, &hE0, &h40, &h60, &h60, &h60, &hE0, &hE0, &hE0,
&hE0, &hC0, &hC0, &h60, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hE0, &hC0, &h00, &h00, &h80, &hC0,
&hC0, &hE0, &hE0, &h60, &h60, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hC0, &h80, &h00, &h00, &h00,
&h00, &h1E, &h1F, &h1F, &h1F, &h1F, &h8F, &h81, &h83, &h87, &h9F, &h9F, &h1F, &h1E, &h1C, &h18,
&h10, &h00, &h18, &h1F, &h1F, &h1F, &h1F, &h0F, &h00, &h00, &hCF, &hDF, &hDF, &hDF, &hDF, &h9F,
&h99, &h98, &h98, &h98, &hC8, &hFE, &hFF, &hFF, &h7F, &h3F, &h01, &h00, &h10, &h1E, &h1F, &h1F,
&h1F, &h0F, &h01, &h00, &h00, &h00, &h00, &h1C, &h1F, &h1F, &h9F, &h1F, &h07, &h00, &h00, &h10,
&h1F, &h1F, &h1F, &h1F, &h1F, &h03, &h00, &h00, &h00, &h00, &h1C, &h1F, &h1F, &h1F, &h1F, &h0F,
&h00, &h00, &h1C, &h1F, &h1F, &h1F, &h1F, &h03, &h00, &h00, &h00, &h00, &h1E, &h1F, &h1F, &h1F,
&h1F, &h01, &h00, &h00, &h00, &h10, &h1F, &h1F, &h1F, &h1F, &h1F, &h01, &h00, &h0F, &h1F, &h1F,
&h1F, &h1F, &h3B, &h33, &h33, &h33, &h1B, &h1B, &h1B, &h1B, &h0B, &h03, &h03, &h70, &h10, &h00,
&h00, &h00, &h00, &h00, &h00, &h03, &h0F, &h1F, &h3F, &h3F, &h7F, &h7F, &h7F, &hFE, &hFC, &hF8,
&hF0, &hF0, &hF0, &hE0, &hE0, &hE0, &hE0, &hC0, &hC0, &hC0, &hC0, &hC0, &hC1, &hC1, &hC1, &hC1,
&hC1, &hC1, &h41, &h41, &h41, &h60, &h60, &h20, &h20, &h20, &h20, &h10, &h10, &h10, &h00, &h08,
&h08, &h08, &h00, &h04, &h04, &h00, &h02, &h00, &h01, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00
})
Result:
512 33695

Only difference is spacing. Compiler v4.1.7.
Tom
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

I just noticed that the preceding code spacing didn't post exactly as intended - and now I cannot duplicate the error. Odd.

I found, in any case, that grouping new bytevectordata in no more than ~170 byte definitions avoids the problem, whatever is it or was, e.g.

Code: Select all

Public OLED_RighTimeSplash as new bytevectordata({
	&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
	&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h80, &h00, &h40, &h40, &h00,
	&h20, &h20, &h20, &h00, &h10, &h10, &h10, &h08, &h08, &h08, &h08, &h0C, &h04, &h04, &h04, &h04,
	&h04, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h06, &h0E, &h0E, &h0E, &h0E, &h1E,
	&h1E, &h1E, &h3E, &h7E, &h7E, &h7C, &h7C, &h7C, &h78, &h78, &h70, &h60, &h00, &h00, &h00, &h00,
	&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
	&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
	&h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00, &h00,
	
	&h00, &h00, &hE0, &hFE, &hFE, &hFE, &hFE, &hFE, &h8E, &h8E, &h8E, &h8E, &hDE, &hFE, &hFE, &hFC,
	&h7C, &h3C, &h18, &h80, &hE0, &hEE, &hEE, &hEE, &h6E, &h06, &h00, &h80, &hC0, &hE0, &hE0, &hE0,
	&hE0, &h60, &h60, &h60, &h60, &hE0, &hC0, &hE0, &hE0, &hE0, &hE0, &h20, &h00, &h00, &hF0, &hFE,
	&hFE, &hFE, &hFE, &hCE, &h40, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hE0, &hE0, &h0E, &h0E, &h0E,
	&h8E, &hFE, &hFE, &hFE, &hFE, &hFE, &h3E, &h0E, &h0E, &h0E, &h0E, &h8E, &hE0, &hEE, &hEE, &hEE,
	&hEE, &h06, &h00, &hC0, &hE0, &hE0, &hE0, &hE0, &hE0, &h40, &h60, &h60, &h60, &hE0, &hE0, &hE0,
	&hE0, &hC0, &hC0, &h60, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hE0, &hC0, &h00, &h00, &h80, &hC0,
	&hC0, &hE0, &hE0, &h60, &h60, &h60, &h60, &h60, &hE0, &hE0, &hE0, &hC0, &h80, &h00, &h00, &h00,
... etc.	
Weird.
Tom
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Post by dkinzer »

GTBecker wrote:I just noticed that the preceding code spacing didn't post exactly as intended - and now I cannot duplicate the error.
Interesting. I couldn't reproduce the error you first posted by using copy/paste. Perhaps you could send me an email with a .txt attachment containing the program that exhibits the issue.
GTBecker wrote:I found, in any case, that grouping new bytevectordata in no more than ~170 byte definitions avoids the problem
That is interesting. Perhaps it is a buffering issue.

I'm traveling at the moment but I should have a chance to look into it in the next few days.
- Don Kinzer
GTBecker
Posts: 616
Joined: 17 January 2006, 19:59 PM
Location: Cape Coral

Post by GTBecker »

Well, it's an intermittent.

I have, so far, been unable to build a reliable failure case - but I've at least determined that it occurs in both native XP and LMDE/Wine environments - and that the resulting .c const remains 512 bytes long while ubound reports it as either 512, 513 or 514 depending on source spacing and circumstance.

I'll work on it some more as opportunity arises. The workaround, for now, is breaking the definition source into smaller groups.
Tom
Post Reply