Is there an equivelant to BS2 Reverse statement

Discussion about the ZBasic language including the System Library. If you're not sure where to post your message, do it here. However, do not make test posts here; that's the purpose of the Sandbox.
Post Reply
FFMan
Posts: 502
Joined: 09 January 2010, 12:52 PM

Is there an equivelant to BS2 Reverse statement

Post 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 ?
dkinzer
Site Admin
Posts: 3120
Joined: 03 September 2005, 13:53 PM
Location: Portland, OR

Re: Is there an equivelant to BS2 Reverse statement

Post 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
- Don Kinzer
Post Reply