Results 1 to 8 of 8

Thread: Usage of OS_IsFeaturePresent Keyword

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

    Usage of OS_IsFeaturePresent Keyword

    I was thinking of using the array i created and loop through the OS_IsFeaturePresent to make the code smaller.

    [code=thinbasic]
    uses "OS"

    dim N(14) AS dword
    DIM i AS Byte
    DIM sMsg as STRING
    DIM lType AS STRING

    Dim ArrayName() As String
    Dim Delimiter As String VALUE "," ' Character used to seperate
    Dim nTokens As DWORD
    Dim Counter As DWORD

    if OS_WinGetVersionTimeline < %OS_Windows_nt then
    MSGBOX 0, "SORRY FUNCTION NOT AVAILABLE"
    STOP
    ELSE
    lType = "%PF_FLOATING_POINT_PRECISION_ERRATA,"
    lType += "%PF_FLOATING_POINT_EMULATED,%PF_COMPARE_EXCHANGE_DOUBLE,"
    lType += "%PF_MMX_INSTRUCTIONS_AVAILABLE,%PF_XMMI_INSTRUCTIONS_AVAILABLE,"
    lType += "%PF_RDTSC_INSTRUCTION_AVAILABLE,%PF_3DNOW_INSTRUCTIONS_AVAILABLE,"
    lType += "%PF_PAE_ENABLED,%PF_XMMI64_INSTRUCTIONS_AVAILABLE,%PF_NX_ENABLED,"
    lType += "%PF_SSE3_INSTRUCTIONS_AVAILABLE,%PF_COMPARE_EXCHANGE128,"
    lType += "%PF_COMPARE64_EXCHANGE128,%PF_CHANNELS_ENABLED"

    N(1) = OS_IsFeaturePresent(%PF_FLOATING_POINT_PRECISION_ERRATA)
    N(2) = OS_IsFeaturePresent(%PF_FLOATING_POINT_EMULATED)
    N(3) = OS_IsFeaturePresent(%PF_COMPARE_EXCHANGE_DOUBLE)
    N(4) = OS_IsFeaturePresent(%PF_MMX_INSTRUCTIONS_AVAILABLE)
    N(5) = OS_IsFeaturePresent(%PF_XMMI_INSTRUCTIONS_AVAILABLE)
    N(6) = OS_IsFeaturePresent(%PF_RDTSC_INSTRUCTION_AVAILABLE)
    N(7) = OS_IsFeaturePresent(%PF_3DNOW_INSTRUCTIONS_AVAILABLE)
    N( = OS_IsFeaturePresent(%PF_PAE_ENABLED)
    N(9) = OS_IsFeaturePresent(%PF_XMMI64_INSTRUCTIONS_AVAILABLE)
    N(10) = OS_IsFeaturePresent(%PF_NX_ENABLED)
    N(11) = OS_IsFeaturePresent(%PF_SSE3_INSTRUCTIONS_AVAILABLE)
    N(12) = OS_IsFeaturePresent(%PF_COMPARE_EXCHANGE12
    N(13) = OS_IsFeaturePresent(%PF_COMPARE64_EXCHANGE12
    N(14) = OS_IsFeaturePresent(%PF_CHANNELS_ENABLED)

    nTokens = SPLIT(lType, Delimiter, ArrayName)
    sMsg = "Your Processor supports" & $CRLF & $CRLF

    For i = 1 to 14
    if n(i) = 1 Then sMsg += ArrayName(i) & $CRLF
    ENDIF
    Next
    ENDIF

    MSGBOX 0, sMsg[/code]


    My CPU

    Processor 1 (ID = 0)
    Number of cores 2
    Number of threads 2 (max 2)
    Name Intel Pentium D 930
    Codename Presler
    Specification Intel(R) Pentium(R) D CPU 3.00GHz
    Package Socket 775 LGA (platform ID = 2h)
    CPUID F.6.2
    Extended CPUID F.6
    Core Stepping B1
    Technology 65 nm
    Core Speed 3010.7 MHz (15.0 x 200.7 MHz)
    Rated Bus speed 802.8 MHz
    Stock frequency 3000 MHz
    Instructions sets MMX, SSE, SSE2, SSE3, EM64T
    L1 Data cache 2 x 16 KBytes, 8-way set associative, 64-byte line size
    Trace cache 2 x 12 Kuops, 8-way set associative
    L2 cache 2 x 2048 KBytes, 8-way set associative, 64-byte line size
    FID/VID Control no
    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
    57
    Posts
    8,817
    Rep Power
    10

    Re: Usage of OS_IsFeaturePresent Keyword

    It is perfect!
    Thanks
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  3. #3
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    160

    Re: Usage of OS_IsFeaturePresent Keyword

    Rather than all the program I wrote could is it possible to add or change the keyword to return an array already filled with the values.

    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

  4. #4
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: Usage of OS_IsFeaturePresent Keyword

    Quote Originally Posted by Abraxas
    Rather than all the program I wrote could is it possible to add or change the keyword to return an array already filled with the values.
    Yes, maybe an idea. I will post this into feature request forum.

    Regarding your example, it seems the string names do not have the same sequence of the values in the array (if I'm not wrong) giving strange results.
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  5. #5
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    160

    Re: Usage of OS_IsFeaturePresent Keyword

    I missed a line. see edited version.
    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

  6. #6
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,817
    Rep Power
    10

    Re: Usage of OS_IsFeaturePresent Keyword

    mmmh, I think also some other param is not in the same sequence.
    Better to use same sequence:
    [code=thinbasic]lType += "%PF_FLOATING_POINT_PRECISION_ERRATA,"
    lType += "%PF_FLOATING_POINT_EMULATED,"
    lType += "%PF_COMPARE_EXCHANGE_DOUBLE,"
    lType += "%PF_MMX_INSTRUCTIONS_AVAILABLE,"
    lType += "%PF_RDTSC_INSTRUCTION_AVAILABLE,"
    lType += "%PF_3DNOW_INSTRUCTIONS_AVAILABLE,"
    lType += "%PF_PAE_ENABLED,"
    lType += "%PF_XMMI64_INSTRUCTIONS_AVAILABLE,"
    lType += "%PF_NX_ENABLED,"
    lType += "%PF_SSE3_INSTRUCTIONS_AVAILABLE,"
    lType += "%PF_XMMI_INSTRUCTIONS_AVAILABLE,"
    lType += "%PF_COMPARE_EXCHANGE128,"
    lType += "%PF_COMPARE64_EXCHANGE128,"
    lType += "%PF_CHANNELS_ENABLED"[/code]

    With this problem, you gave me an idea about values assignment ...
    ... I need some time to think about a possible future implementation of easy assignment of multiple values.

    Thanks
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  7. #7
    thinBasic MVPs
    Join Date
    May 2007
    Location
    UK
    Posts
    1,427
    Rep Power
    160

    Re: Usage of OS_IsFeaturePresent Keyword

    I should stop cutting and pasting. should be ok now but cpuz report sse3 for my cpu and the program doesnt.
    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

  8. #8
    Super Moderator Petr Schreiber's Avatar
    Join Date
    Aug 2005
    Location
    Brno - Czech Republic
    Posts
    7,153
    Rep Power
    736

    Re: Usage of OS_IsFeaturePresent Keyword

    Thanks for this script!,

    at least I can see why programs are complaining I have no SSE... as I really don't have it.
    But at least 3DNow! is here


    Bye,
    Petr
    Learn 3D graphics with ThinBASIC, learn TBGL!
    Windows 10 64bit - Intel Core i5-3350P @ 3.1GHz - 16 GB RAM - NVIDIA GeForce GTX 1050 Ti 4GB

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 ASC Keyword
    By Michael Clease in forum Samples for help file
    Replies: 1
    Last Post: 27-05-2007, 01:22

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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