MachineCode wrote:Thanks for that. The manual needs updating, then. Because for the "Read" keyword, it currently shows [ and ] brackets, which means specifying a type is optional, and it says the default type (integer) is used if not specified. See:
Code: Select all
Read[.<type>] <variable>
The type of data to read is determined by the type suffix. The default type will be used if it is not specified.
Without the type specifier it reads an integer from memory, converts the integer to your byte variable and then increments by the number of bytes in an integer. Increasing by 4 or 8 bytes each time eventually runs off the end of your data section.
So as far as the syntax of the command is concerned the type is optional and the manual is currently syntactically correct, which is maybe misleading or unclear especially when the behaviour used to be different. If a change it required it would be required to the command, not just the manual.
Think about it in terms of peeking. The size of memory being read from depends on the command, not where the result is stored. You wouldn't do this and expect only a byte to be accessed in memory:
value.b = PeekI(?label)
So consider the Read command in the same way, you need to tell it what size to read using the suffix or it will default to integer. Perhaps the best option would be to make the type specifier mandatory (for example, you do not get a Peek command with an optional type).
If you paint your butt blue and glue the hole shut you just themed your ass but lost the functionality.
(WinXPhSP3 PB5.20b14)