36 of 318
ZBasic System Library 26 ZX Microcontroller Family BitCopy Type Subroutine Invocation BitCopy(destAddr, destBitOfst, srcAddr, srcBitOfst, bitCount) Parameter Method Type Description dstAddr ByVal integral The address to which to begin copying. dstBitOfst ByVal integral The bit offset to which to begin copying. srcAddr ByVal integral The address from which to begin copying. srcBitOfst ByVal integral The bit offset from which to begin copying. bitCount ByVal integral The number of bits to copy. Discussion This subroutine can be used to copy an arbitrary number of bits from one location in RAM to another. The copy operation may begin and/or end in the middle of a byte if desired. An overlapping copy (when the destination is in the midst of the data being copied) is handled correctly so that the data to be copied is not overwritten. For the purposes of this subroutine, RAM considered a sequence of bits with the least significant bits of each byte preceding the more significant bits. This is the same model of RAM that is utilized by GetBit() and PutBit(). The least significant bit of a byte is at offset zero and the most significant bit is at offset 7. Note that the bit offsets specified for the second and fourth parameters may have values greater than 7. If a bit offset greater than 7 is given, the corresponding address component is adjusted internally to give the same effect. For example, if an address of 200 and a bit offset of 19 are specified, these are converted internally to 202 and 3, respectively. All six parameters are converted internally to UnsignedInteger. Caution This subroutine should be used with care because it is possible to overwrite important data on the stack or other areas of memory which may cause your program to malfunction. Compatibility This subroutine is not available on ZX models that are based on the ATmega32 processor (e.g. the ZX- 24). Moreover, it is not available in BasicX compatibility mode. See Also MemCopy, MemSet