home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Power-Programmierung
/
CD1.mdf
/
magazine
/
qbnewsl
/
qbnws202
/
rodent
/
makbitnm.bit
< prev
next >
Wrap
Text File
|
1991-04-14
|
2KB
|
52 lines
' ===========================================================================
' FILE: MAKBITNM.BIT
'
' Support routines for QuickBASIC 4.5.
'
' Copyright (c) 1991
' Daniel R. Berry (Traveller Software)
' All Rights Reserved
'
' This code is released to the Public Domain for distribution with the
' QBNews.
'
' Daniel R. Berry
' 3110-C S. Gen McMullen
' San Antonio, TX 78226
'
'
' ===========================================================================
' SUBPROGRAM: MakeBitNum
' Version 1.1 By: Dan Berry (c) Traveller Software 1988 - 1991
' ========================= MakeBitNum SubProgram ===========================
SUB MakeBitNum (BitString$, Number%)
DEFINT A-Z
'
' First - Ensure number is set to 0 and BitString has all 16 positions
'
Number = 0
Bits$ = RIGHT$(STRING$(16, "0") + BitString$, 16)
'
' Then - Convert each bit as necessary
'
IF MID$(Bits$, 16, 1) = "1" THEN Number = Number + &H1
IF MID$(Bits$, 15, 1) = "1" THEN Number = Number + &H2
IF MID$(Bits$, 14, 1) = "1" THEN Number = Number + &H4
IF MID$(Bits$, 13, 1) = "1" THEN Number = Number + &H8
IF MID$(Bits$, 12, 1) = "1" THEN Number = Number + &H10
IF MID$(Bits$, 11, 1) = "1" THEN Number = Number + &H20
IF MID$(Bits$, 10, 1) = "1" THEN Number = Number + &H40
IF MID$(Bits$, 9, 1) = "1" THEN Number = Number + &H80
IF MID$(Bits$, 8, 1) = "1" THEN Number = Number + &H100
IF MID$(Bits$, 7, 1) = "1" THEN Number = Number + &H200
IF MID$(Bits$, 6, 1) = "1" THEN Number = Number + &H400
IF MID$(Bits$, 5, 1) = "1" THEN Number = Number + &H800
IF MID$(Bits$, 4, 1) = "1" THEN Number = Number + &H1000
IF MID$(Bits$, 3, 1) = "1" THEN Number = Number + &H2000
IF MID$(Bits$, 2, 1) = "1" THEN Number = Number + &H4000
IF MID$(Bits$, 1, 1) = "1" THEN Number = Number + &H8000
' ====================== End of MakeBitNum SubProgram =======================
END SUB