Answer the question
In order to leave comments, you need to log in
Assembler, free hard disk space?
The program should display the free space on the selected hard drive, but does not want to do this. In the program I used interrupt int 21h, function 36h.
Displays 976 MB, it is not clear what it is ?. Although the free space is around 8GB. All this was done in virtual box, windows xp.
.MODEL SMALL
.386
STACK 256h
DATASEG
CODESEG
start:
mov eax,@data
mov ds,eax ; Data Segment
xor eax,eax
mov ah, 36h
mov dl, 0
int 21h
mul ebx
mov ebx,edx
shl ebx, 16
add eax,ebx
mul ecx
cnvrt:
xor ecx,ecx ;счетчик десятичных цифр
mov ebx,10 ;основание сист. счисления
ckl:
xor edx,edx ;расширим делимое
div ebx
push edx ;получаемые цифры кладем в стек
inc cx
test eax,eax ;делитель - ноль ?
jnz ckl ;еще нет, продолжим
outpt: ;вывод числа на экран
pop eax
add al,'0' ;десятичную цифру -> в ASCII
int 29h ;вывод цифры
loop outpt
mov ah,10h
int 16h
end start
Answer the question
In order to leave comments, you need to log in
0) there is no guarantee that for your real disk all response parameters AX, BX, CX fit in 16 bits (perhaps, of course, DOS cheats something for compatibility, but again there is no guarantee);
Now ASM itself:
1) are you sure that the upper word ebx is pure on the first multiplication?
2) the meaning of manipulations is absolutely incomprehensible
mov ebx,edx
shl ebx, 16
add eax,ebx
xor edx,edx ;расширим делимое
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question