•  Back 
  •  Main 
  •  Index 
  •  Tree View 
  •  Cross references 
  •  Help 
  •  Show info about hypertext 
  •  View a new file 
Topic       : The GFA-Basic Compendium
Author      : GFA Systemtechnik GmbH
Version     : GFABasic.HYP v2.98 (12/31/2023)
Subject     : Documentation/Programming
Nodes       : 899
Index Size  : 28056
HCP-Version : 3
Compiled on : Atari
@charset    : atarist
@lang       : 
@default    : Document not found
@help       : Help
@options    : +g -i -s +z
@width      : 75
@hostname   : STRNGSRV
@hostname   : CAB     
@hostname   : HIGHWIRE
@hostname   : THING   
View Ref-FileBCLR(), BSET(), BTST(), BCHG()
SHL|(), SHL&(), SHL()
SHR|(), SHR&(), SHR()
ROL|(), ROL&(), ROL()
ROR|(), ROR&(), ROR()
AND(), OR(), XOR(), IMP(), EQV()
SWAP()
BYTE(), CARD(), WORD()

These Bit Operations affect numerical expressions at the bit level. The
commands BCLR(), BSET(), BTST(), and BCHG() are direct implementations of the
68000 instructions. Note, however, that they are used as functions, not
commands.

They reset, set, test, and negate individual bits. SHLx(), SHRx(), ROLx(), and
RORx() shift or rotate. AND(), OR(), XOR(), IMP(), and EQV() are logical
functions. In the following explanations the convention is used that bit 0 is
the least significant bit. With 4-byte integers bit 31 is the most significant
bit and is also the sign bit (if the sign bit is set, i.e. =1, then a negative
number is represented in two's complement form, otherwise it is a positive
number).

SWAP() exchanges the high- and low-order words of a 4-byte value. BYTE() reads
the lower 8 bits and CARD() the lower 16 bits of an expression. WORD() extends
a word to form a long word, i.e. bit 15 is copied into positions 16 to 31.

Memo: BSET (BCLR) internally uses and returns a signed 32-bit value. If you
      bit change e.g. a word variable BSET(m&,15), the return value is a long
      integer with all bits 15-31 set, i.e. <0. For this reason b&=BSET(m&,15)
      generates an error, since the result is not a word. The result must be
      masked to 16 bits first, using e.g. AND &FFFF or WORD().