Page 1 of 1

Is there an equivelant to BS2 Reverse statement

Posted: 14 April 2010, 8:07 AM
by FFMan
I'm converting an old Basic Stamp 2 program to ZX24 and it uses a Reverse statement to change the state of a pin without querying it first.

Is there a ZX equivelant ? I can think of a few one line ways of doing it but what is the most efficient method ?

Re: Is there an equivelant to BS2 Reverse statement

Posted: 14 April 2010, 8:43 AM
by dkinzer
FFMan wrote:Is there a ZX equivelant ?
There is no direct equivalent. The method suggested in the PBasic Conversion document is this:

Code: Select all

Sub Reverse(ByVal pin as Byte)
  Call SetBits(Register.DDR(pin), PortMask(pin), Not Register.DDR(pin))
End Sub