PhilHornby
Senior Member
I routinely use the
However, I've recently noticed a slight bug:
If you give a specific TABLE location for the data, it will allow you to overwrite the previous data - if it contains a 0x00h (null) byte.
(If the last byte is anything other than a 0x00h, the 'compiler' protests that the location is already in use).
So for example:-
and stores
This code
stores this:-
This can be demonstrated in the simulator :-
TABLE
area to store data strings intended for display on an LCD. Each string is marked with a trailing zero byte, so that the Display Routine can find each individual message (a habit I picked up in 1979, on the PDP-11 ) .However, I've recently noticed a slight bug:
If you give a specific TABLE location for the data, it will allow you to overwrite the previous data - if it contains a 0x00h (null) byte.
(If the last byte is anything other than a 0x00h, the 'compiler' protests that the location is already in use).
So for example:-
Rich (BB code):
table 0,("ABC",0)
table 3,(2) ;incorrectly says location 3 is free
Code:
[0] 41,42,43,02,00,00,00,00
[8] 00,00,00,00,00,00,00,00
[16] 00,00,00,00,00,00,00,00
Rich (BB code):
table 0,("ABC",0)
table (2) ;this works properly (regardless of null)
Code:
[0] 41,42,43,00,02,00,00,00
[8] 00,00,00,00,00,00,00,00
[16] 00,00,00,00,00,00,00,00
This can be demonstrated in the simulator :-
Rich (BB code):
; Program to print Table data.
;
symbol TableLocation = W2
symbol Rows = b2
symbol Columns = b3
symbol Width = 8
symbol Height = 3
TableLocation = 0
sertxd (cr,lf,"Table Data:-")
for Rows = 1 to Height
sertxd (cr,lf,"[",#TableLocation,"]",tab)
for Columns = 1 to Width
readtable TableLocation,b0
inc TableLocation
gosub B0_to_HEX
if Columns <> Width then
sertxd (",")
endif
next Columns
next Rows
stop
B0_TO_HEX:
b1 = b0 / 16 + "0"
gosub Nybble
b1 = b0 & 15 + "0"
Nybble:
if b1 > "9" then : b1 = b1 + 7 endif
sertxd(b1)
return