byref and byval

Questions about the BASICtools and MakeItC
Post Reply
YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

byref and byval

Post by YahooArchive »

This is the same as Visual BASIC

When calling BYREF a pointer to the variable is passed to the
function. While a BYVAL call uses a copy of the variable.

For single integers it doesn't make too much difference performance
wise. But when a byte array or string is passed the overhead of the
copy and the extra storage required is saved, which can be substantial.



YahooArchive
Posts: 1462
Joined: Fri Oct 19, 2012 5:11 am

Re: byref and byval

Post by YahooArchive »

Thanks for your quick response, especially over the holdiays.

I have been testing the SPI.bas file, and have found the following:

My INcnt and OUTcnt are equal to 2 (two bytes or characters)
I am using MSB first mode.

I put print statements in SPI.bas to see the results of the SHIFTOUT
functions.
They work as expected, Sending CHR($40)+CHR($80) through the SPIOUT
function, the data sent is converted to 64 and 128 (base 10)
and shifted out as such.

I was also trying to use SPIIN with little luck until I parsed the
INlist as two bytes: INlist(1), and INlist(0). BTW, are DIM's, etc...
normally indexed starting with 0 or 1?


Also the INlist is returned as strings representing values. They seem
to be BASE 10.


Thanks again for your help, I will post my results back for those like
me just starting out...

Chris Gosnell

Post Reply