I recently wrote a short function that returns four 8-bit values. But of course a function can only return one value. Easy enough to return as a single 32-bit number with shift and add instructions. Then main program just extracts the values in the opposite way they were packed:
Simple, right? Until I went to print them out with this routine:
PRINT RIGHT$("0"+HEX$(a[v--]),2);" | ";
Which only printed the second and fourth values. This drove me nuts until I read the manual on pre and postfix operators, which referred me to "User Defined Functions", which largely clarified everything. I simply took out the postfix and put a v-=1 before the until. My suggestion is, instead of referring the reader to "User Defined Functions", shouldn't it just tell you in the pre- and postfix section, that they don't work within any
function, not just the user defined? Just a thought.