Results 1 to 3 of 3

Thread: Usage of the Bin$ Keyword

  1. #1
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Blog Entries
    1
    Rep Power
    154

    Usage of the Bin$ Keyword

    [code=thinbasic]
    ' Usage of the BIN$ Instruction example
    '
    ' Returns Binary Version of a number
    '
    ' Written by Abraxas

    DIM Base10Num as DWORD value &hAAAA5555
    DIM TempVal As DWORD Value Base10Num
    DIM n as byte value 0
    Dim sMsg as String

    sMsg += "Base10 = " & Base10Num & $CRLF
    sMsg += "Binary = " & Bin$(Base10Num,32) & $CRLF
    sMsg += "Binary Nibbles = "

    ' This Groups 4 bits (a nibble)
    For n = 28 to 0 step -4
    TempVal = Base10Num
    sMsg += " " & Bin$((SHIFT SIGNED RIGHT TempVal,n),4)
    Next
    sMsg += $CRLF
    sMsg += "Hex = &h" & Hex$(Base10Num,
    MsgBox 0, sMsg ' Display The information


    [/code]
    Home Desktop : Windows 7 - Intel Pentium (D) - 3.0 Ghz - 2GB - Geforce 6800GS
    Home Laptop : WinXP Pro SP3 - Intel Centrino Duo - 1.73 Ghz - 2 GB - Intel GMA 950
    Home Laptop : Windows 10 - Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz, 2401 Mhz, 2 Core(s), 4 Logical Processor(s) - 4 GB - Intel HD 4400
    Work Desktop : Windows 10 - Intel I7 - 4 Ghz - 8GB - Quadro Fx 370

  2. #2
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    51
    Posts
    8,338
    Blog Entries
    2
    Rep Power
    10

    Re: Usage of the Bin$ Keyword

    Perfect.
    www.thinbasic.com | www.thinbasic.com/community/ | psch.thinbasic.com
    Win10Pro 64bit - 8GB Ram - Intel i7 M620 2.67GHz - NVIDIA Quadro FX1800M 1GB

  3. #3
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    62
    Posts
    3,869
    Rep Power
    398

    Re: Usage of the Bin$ Keyword

    These are nice because I don't remember ever using such commands before. Seeing a to the point example is a great idea.
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. Usage of the CHR$ Keyword
    By Michael Clease in forum Samples for help file
    Replies: 1
    Last Post: 28-05-2007, 07:40
  2. Usage of the HEX$ Keyword
    By Michael Clease in forum Samples for help file
    Replies: 1
    Last Post: 28-05-2007, 07:39

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •