BASIC Fester and Batter 
Author Message
 BASIC Fester and Batter


AL> I would appreciate some help with some BIT toggling...

<munch>

CG> You don't say which version of BASIC you're using so I've tried to
  > make this code compatible with them all. If you're using QuickBASIC
  > or another of the modern dialects you'll probably want to write 'em
  > as proper functions.

AL> I am using PDS... if you have more specific code for PDS, I would
  > appreciate that as well...

Okay. These work with PDS, QB4.5, VBDos and, of course, QBasic...

FUNCTION BitClear% (Number%, Bit%)
    BitClear% = Number% AND (32767 - 2 ^ Bit%)
END FUNCTION

FUNCTION BitSet% (Number%, Bit%)
    BitSet% = Number% OR 2 ^ Bit%
END FUNCTION

FUNCTION BitTest% (Number%, Bit%)
    BitTest% = -SGN(Number% AND 2 ^ Bit%)
END FUNCTION

I should own up and say that these (and lots of other tricks in my
armoury) are derived from a 1981 book called 'BASIC Faster and Better'
by Lewis Rosenfelder. This was actually written for Tandy's TRS-80
BASIC and is long out of print but was (and still is) a goldmine of
useful techniques for BASIC programmers. I still treasure my copy.

+------------------------+-----------------------------------------------+
|     _/_/_/_/  _/_/_/_/ | Christy Gemmell, Singular Software            |
|    _/        _/        | 11 Abingdon Road, Leicester LE2 1HA, England. |


| _/_/_/_/  _/_/_/_/     | Phone: +44-0116-254-7681                      |
+------------------------+-----------------------------------------------+

 * 1st 2.00o #323 * Meet me by Stonehenge at midnight, I'll bring the goat.



Mon, 01 Dec 1997 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. BASIC Fester and Batter

2. Very basic Visual Basic

3. Very basic Visual Basic help required

4. change from access basic into visual basic

5. Basic Basic

6. do Visual Basic 6.0 and Visual Basic .NET version beta Working Both

7. Basic (No Pun Intended) Visual Basic.Net Questions

8. A basic BASIC question -- ListBox

9. Question about Visual Basic/Virtual Basic

10. Question about Visual Basic/Virtual Basic

11. GW Basic to Visual Basic 4.0

12. Looking for Basic Xref program for IBM Basic V3.00A

 

 
Powered by phpBB® Forum Software