News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Display Used Disk Space

Started by byte1918, December 04, 2010, 03:57:45 PM

Previous topic - Next topic

byte1918

Hello,

This is my first post here, so please bear with me.

I have this homework assignment that requires me to display the used disk space on the screen.

I know I can get all the info I need by using the 36h function of 21h interruption.
Quote       Returns:     
                      AX         Sectors per cluster
                                   FFFFh if invalid drive specified
                      BX         Number of available clusters
                      CX         Bytes per sector
                      DX         Total number of clusters per drive

Ok so AX*BX*CX should be the free space. and AX*CX*DX should be the total disk space.
I have written a simple procedure to multiply a double word with a word, the result being a double word. (assuming the result doesn't overflow)
Ok, so after I get the total disk space and the free space, I should subtract free space from total disk space, but the problem is I'm not really sure how to do that, since both numbers are on two double words, and as far as I can see subtracting word by word won't work.

Any tips are appreciated. Also if you know a better way to get the used disk space, feel free to tell me.

thanks

PS. I'm using TASM

clive

You can use SUB, followed by SBB, to extend the math beyond 16-bit, this uses the "borrow" flag. This is similar to ADD, followed by ADC, using the carry.
It could be a random act of randomness. Those happen a lot as well.

byte1918

Can't believe this, I tried it on paper but failed somehow (damn this cold and headache), anyway it works. thanks