Announcement

Collapse
No announcement yet.

DOS interrupt (read only) with NT

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Amos Vryhof
    Guest replied
    Hmm...interesting....looks like I need to look up more information
    on registers....maybe that will help. Unfortunately, in school,
    I never learned x86 Assembly....I learned MIPS

    ------------------
    Amos
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Tom Hanlin
    replied
    AX is a 16-bit register, which can be addressed as two 8-bit registers,
    AH and AL. Setting AX = &H3600 is the same as setting AH = &H36 and AL = 0.

    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Amos Vryhof
    Guest replied
    Well, in Ralph Brown's interrupt list, the sub function is
    AH=36h, and it seems to work fine with how you stuffed 3600h into
    AX....so I'm guessing, there is some kind of coincidence here...

    Hope I'm right.

    ------------------
    Amos
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Lance Edmonds
    replied
    Would that be casting to unsigned?

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Amos Vryhof
    Guest replied
    Ok, nevermind, I just looked at Lance's example, and figured out
    what I am messing up....

    ------------------
    Amos
    mailto:[email protected][email protected]</A>

    [This message has been edited by Amos Vryhof (edited December 16, 2001).]

    Leave a comment:


  • Amos Vryhof
    Guest replied
    While we're on this topic, Is there any way to access AH
    from PowerBASIC?

    I am playing around with some of the stuff on Ralf Brown's
    interrupt list, using REG, and CALL INTERRUPT, but I want
    to go further.



    ------------------
    Amos
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Mark Hunter
    replied
    michael mattias wrote in http://www.powerbasic.com/support/pb...read.php?t=516

    "you cannot access the winapi from a dos program,
    but you can access the winapi from a windows program
    which is shelled from your pb/dos program."

    so the program could get the free disk space by shelling
    to a pbcc executable that writes the number to a file,
    and then reading the file.

    but it's a bit complicated if it's to work for all
    versions of windows. from the pbcc help-file for
    pbcc's function diskfree (slightly paraphrased):

    "in 32-bit windows, a maximum of two gigabytes is
    returned, even if more free space is available. in
    some early versions of windows 95, diskfree may
    return a negative value for drives or partitions
    larger than two gigabytes.

    "the getdiskfreespaceex api retrieves the free space
    on a disk. however this api is not available in
    early versions of windows 95 (pre-osr2). it is
    available on all versions of windows that support
    fat32 or ntfs file systems."

    Leave a comment:


  • Lance Edmonds
    replied
    No, definitely not at all in my experience.

    For example, the following code reports around 970Mb free on most of drives under Win2K (aka, NT5) when there is, for example, 3.86Gb free.

    Ditto for network drives, and can give VERY unusual results for CDROM drives if the DOS CDROM drivers are not enabled in CONFIG.NT and AUTOEXEC.NT. On my systen here, it reports the CDROM drive as having 484Gb free when there is no disc in the drive!
    Code:
    function FreeSpace&&(Drive%) local public
            reg 4, Drive%
            reg 1, &H3600
            call interrupt &H21
            function = cqud(bits??(reg(2)) * bits??(reg(3)) * bits??(reg(1)))
    end function
    I filled one one NTFS drive so that there was 1.76Gb free and it still reported 970Mb.

    The moral: don't read all you believe from that interrupt.

    ------------------
    Lance
    PowerBASIC Support
    mailto:[email protected][email protected]</A>

    Leave a comment:


  • Mark Hunter
    replied
    "Reading the result with drives > 2 Gb is unreliable."

    One limitation is that since DOS gives the answer
    as a double word, the largest number of gigabytes
    it can measure is

    2^32 / 1024^3 = 4

    So if you have more than 4 gigabytes free, it
    can't measure it (maybe it wraps through 0).

    Otherwise is it reliable with 95/98 and
    with NT/2000/XP ?

    [This message has been edited by Mark Hunter (edited December 15, 2001).]

    Leave a comment:


  • Peter Lameijn
    replied
    Theoretically: It still works.
    Practically : No support for modern large drives. Reading the result with
    drives > 2 Gb is unreliable....
    (Using the Win API functions is really the best solution)

    ------------------
    Peter.
    mailto[email protected][email protected]</A>

    Leave a comment:


  • Mark Hunter
    started a topic DOS interrupt (read only) with NT

    DOS interrupt (read only) with NT

    I don't have Windows NT. Will the following
    work in a PBDOS program running under NT without
    the user having "special priveleges"?
    Code:
    '' DISKFREE
    ! mov  AX,&H3600      ; function 36h, get drive info
    ! mov  DX,DriveNum    ; requested drive
    ! int  &H21           ; call DOS
Working...
X
😀
🥰
🤢
😎
😡
👍
👎